diff --git a/lib/services/sqlManagement2/LICENSE.txt b/lib/services/sqlManagement2/LICENSE.txt index 0313a903d7..5431ba98b9 100644 --- a/lib/services/sqlManagement2/LICENSE.txt +++ b/lib/services/sqlManagement2/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2017 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/sqlManagement2/README.md b/lib/services/sqlManagement2/README.md index c0d7e0e514..9083240548 100644 --- a/lib/services/sqlManagement2/README.md +++ b/lib/services/sqlManagement2/README.md @@ -1,37 +1,43 @@ -# Microsoft Azure SDK for Node.js - SQLManagement - -This project provides a Node.js package that makes it easy to manage Microsoft Azure SQL. -## Minimum node.js version >= 6.x.x - -## How to Install - -```bash -npm install azure-arm-sql -``` - -## How to Use - -### Authentication, client creation and listing servers as an example - - ```javascript - const msRestAzure = require('ms-rest-azure'); - const SQLManagement = require("azure-arm-sql"); - - // Interactive Login - // It provides a url and code that needs to be copied and pasted in a browser and authenticated over there. If successful, - // the user will get a DeviceTokenCredentials object. - msRestAzure.interactiveLogin().then((credentials) => { - let client = new SQLManagement(credentials, 'your-subscription-id'); - return client.servers.list(); - }).then((servers) => { - console.log('List of servers:'); - console.dir(servers, {depth: null, colors: true}); -}).catch((err) => { - console.log('An error ocurred'); - console.dir(err, {depth: null, colors: true}); - }); -``` - -## Related projects - -- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) \ No newline at end of file +--- +uid: azure-arm-sql +summary: *content + +--- +# Microsoft Azure SDK for Node.js - SqlManagementClient +This project provides a Node.js package for accessing Azure. Right now it supports: +- **Node.js version 6.x.x or higher** + +## Features + + +## How to Install + +```bash +npm install azure-arm-sql +``` + +## How to use + +### Authentication, client creation and get recoverableDatabases as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const SqlManagementClient = require("azure-arm-sql"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new SqlManagementClient(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + const serverName = "testserverName"; + const databaseName = "testdatabaseName"; + return client.recoverableDatabases.get(resourceGroupName, serverName, databaseName).then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error occurred:'); + console.dir(err, {depth: null, colors: true}); +}); + +## Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/sqlManagement2/lib/models/automaticTuningOptions.js b/lib/services/sqlManagement2/lib/models/automaticTuningOptions.js new file mode 100644 index 0000000000..cc8a4107e0 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/automaticTuningOptions.js @@ -0,0 +1,88 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Automatic tuning properties for individual advisors. + * + */ +class AutomaticTuningOptions { + /** + * Create a AutomaticTuningOptions. + * @member {string} [desiredState] Automatic tuning option desired state. + * Possible values include: 'Off', 'On', 'Default' + * @member {string} [actualState] Automatic tuning option actual state. + * Possible values include: 'Off', 'On' + * @member {number} [reasonCode] Reason code if desired and actual state are + * different. + * @member {string} [reasonDesc] Reason description if desired and actual + * state are different. Possible values include: 'Default', 'Disabled', + * 'AutoConfigured', 'InheritedFromServer', 'QueryStoreOff', + * 'QueryStoreReadOnly', 'NotSupported' + */ + constructor() { + } + + /** + * Defines the metadata of AutomaticTuningOptions + * + * @returns {object} metadata of AutomaticTuningOptions + * + */ + mapper() { + return { + required: false, + serializedName: 'AutomaticTuningOptions', + type: { + name: 'Composite', + className: 'AutomaticTuningOptions', + modelProperties: { + desiredState: { + required: false, + serializedName: 'desiredState', + type: { + name: 'Enum', + allowedValues: [ 'Off', 'On', 'Default' ] + } + }, + actualState: { + required: false, + readOnly: true, + serializedName: 'actualState', + type: { + name: 'Enum', + allowedValues: [ 'Off', 'On' ] + } + }, + reasonCode: { + required: false, + readOnly: true, + serializedName: 'reasonCode', + type: { + name: 'Number' + } + }, + reasonDesc: { + required: false, + readOnly: true, + serializedName: 'reasonDesc', + type: { + name: 'Enum', + allowedValues: [ 'Default', 'Disabled', 'AutoConfigured', 'InheritedFromServer', 'QueryStoreOff', 'QueryStoreReadOnly', 'NotSupported' ] + } + } + } + } + }; + } +} + +module.exports = AutomaticTuningOptions; diff --git a/lib/services/sqlManagement2/lib/models/automaticTuningServerOptions.js b/lib/services/sqlManagement2/lib/models/automaticTuningServerOptions.js new file mode 100644 index 0000000000..139c420e84 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/automaticTuningServerOptions.js @@ -0,0 +1,87 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Automatic tuning properties for individual advisors. + * + */ +class AutomaticTuningServerOptions { + /** + * Create a AutomaticTuningServerOptions. + * @member {string} [desiredState] Automatic tuning option desired state. + * Possible values include: 'Off', 'On', 'Default' + * @member {string} [actualState] Automatic tuning option actual state. + * Possible values include: 'Off', 'On' + * @member {number} [reasonCode] Reason code if desired and actual state are + * different. + * @member {string} [reasonDesc] Reason description if desired and actual + * state are different. Possible values include: 'Default', 'Disabled', + * 'AutoConfigured' + */ + constructor() { + } + + /** + * Defines the metadata of AutomaticTuningServerOptions + * + * @returns {object} metadata of AutomaticTuningServerOptions + * + */ + mapper() { + return { + required: false, + serializedName: 'AutomaticTuningServerOptions', + type: { + name: 'Composite', + className: 'AutomaticTuningServerOptions', + modelProperties: { + desiredState: { + required: false, + serializedName: 'desiredState', + type: { + name: 'Enum', + allowedValues: [ 'Off', 'On', 'Default' ] + } + }, + actualState: { + required: false, + readOnly: true, + serializedName: 'actualState', + type: { + name: 'Enum', + allowedValues: [ 'Off', 'On' ] + } + }, + reasonCode: { + required: false, + readOnly: true, + serializedName: 'reasonCode', + type: { + name: 'Number' + } + }, + reasonDesc: { + required: false, + readOnly: true, + serializedName: 'reasonDesc', + type: { + name: 'Enum', + allowedValues: [ 'Default', 'Disabled', 'AutoConfigured' ] + } + } + } + } + }; + } +} + +module.exports = AutomaticTuningServerOptions; diff --git a/lib/services/sqlManagement2/lib/models/backupLongTermRetentionPolicy.js b/lib/services/sqlManagement2/lib/models/backupLongTermRetentionPolicy.js index 380d2fc45e..59cab275c7 100644 --- a/lib/services/sqlManagement2/lib/models/backupLongTermRetentionPolicy.js +++ b/lib/services/sqlManagement2/lib/models/backupLongTermRetentionPolicy.js @@ -13,18 +13,21 @@ const models = require('./index'); /** - * A backup long term retention policy + * A long term retention policy. * * @extends models['ProxyResource'] */ class BackupLongTermRetentionPolicy extends models['ProxyResource'] { /** * Create a BackupLongTermRetentionPolicy. - * @member {string} [location] The geo-location where the resource lives - * @member {string} state The status of the backup long term retention - * policy. Possible values include: 'Disabled', 'Enabled' - * @member {string} recoveryServicesBackupPolicyResourceId The azure recovery - * services backup protection policy resource id + * @member {string} [weeklyRetention] The weekly retention policy for an LTR + * backup in an ISO 8601 format. + * @member {string} [monthlyRetention] The montly retention policy for an LTR + * backup in an ISO 8601 format. + * @member {string} [yearlyRetention] The yearly retention policy for an LTR + * backup in an ISO 8601 format. + * @member {number} [weekOfYear] The week of year to take the yearly backup + * in an ISO 8601 format. */ constructor() { super(); @@ -68,28 +71,33 @@ class BackupLongTermRetentionPolicy extends models['ProxyResource'] { name: 'String' } }, - location: { + weeklyRetention: { required: false, - readOnly: true, - serializedName: 'location', + serializedName: 'properties.weeklyRetention', type: { name: 'String' } }, - state: { - required: true, - serializedName: 'properties.state', + monthlyRetention: { + required: false, + serializedName: 'properties.monthlyRetention', type: { - name: 'Enum', - allowedValues: [ 'Disabled', 'Enabled' ] + name: 'String' } }, - recoveryServicesBackupPolicyResourceId: { - required: true, - serializedName: 'properties.recoveryServicesBackupPolicyResourceId', + yearlyRetention: { + required: false, + serializedName: 'properties.yearlyRetention', type: { name: 'String' } + }, + weekOfYear: { + required: false, + serializedName: 'properties.weekOfYear', + type: { + name: 'Number' + } } } } diff --git a/lib/services/sqlManagement2/lib/models/completeDatabaseRestoreDefinition.js b/lib/services/sqlManagement2/lib/models/completeDatabaseRestoreDefinition.js new file mode 100644 index 0000000000..65d3fbb01b --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/completeDatabaseRestoreDefinition.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Contains the information necessary to perform a complete database restore + * operation. + * + */ +class CompleteDatabaseRestoreDefinition { + /** + * Create a CompleteDatabaseRestoreDefinition. + * @member {string} lastBackupName The last backup name to apply + */ + constructor() { + } + + /** + * Defines the metadata of CompleteDatabaseRestoreDefinition + * + * @returns {object} metadata of CompleteDatabaseRestoreDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'CompleteDatabaseRestoreDefinition', + type: { + name: 'Composite', + className: 'CompleteDatabaseRestoreDefinition', + modelProperties: { + lastBackupName: { + required: true, + serializedName: 'lastBackupName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CompleteDatabaseRestoreDefinition; diff --git a/lib/services/sqlManagement2/lib/models/createDatabaseRestorePointDefinition.js b/lib/services/sqlManagement2/lib/models/createDatabaseRestorePointDefinition.js new file mode 100644 index 0000000000..da8769ff34 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/createDatabaseRestorePointDefinition.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Contains the information necessary to perform a create database restore + * point operation. + * + */ +class CreateDatabaseRestorePointDefinition { + /** + * Create a CreateDatabaseRestorePointDefinition. + * @member {string} restorePointLabel The restore point label to apply + */ + constructor() { + } + + /** + * Defines the metadata of CreateDatabaseRestorePointDefinition + * + * @returns {object} metadata of CreateDatabaseRestorePointDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'CreateDatabaseRestorePointDefinition', + type: { + name: 'Composite', + className: 'CreateDatabaseRestorePointDefinition', + modelProperties: { + restorePointLabel: { + required: true, + serializedName: 'restorePointLabel', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = CreateDatabaseRestorePointDefinition; diff --git a/lib/services/sqlManagement2/lib/models/database.js b/lib/services/sqlManagement2/lib/models/database.js index f343877aa3..120ae1703a 100644 --- a/lib/services/sqlManagement2/lib/models/database.js +++ b/lib/services/sqlManagement2/lib/models/database.js @@ -13,26 +13,25 @@ const models = require('./index'); /** - * Represents a database. + * A database resource. * * @extends models['TrackedResource'] */ class Database extends models['TrackedResource'] { /** * Create a Database. - * @member {string} [kind] Kind of database. This is metadata used for the + * @member {object} [sku] The name and tier of the SKU. + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {string} [kind] Kind of database. This is metadata used for the * Azure portal experience. - * @member {string} [collation] The collation of the database. If createMode - * is not Default, this value is ignored. - * @member {date} [creationDate] The creation date of the database (ISO8601 - * format). - * @member {number} [containmentState] The containment state of the database. - * @member {uuid} [currentServiceObjectiveId] The current service level - * objective ID of the database. This is the ID of the service level - * objective that is currently active. - * @member {uuid} [databaseId] The ID of the database. - * @member {date} [earliestRestoreDate] This records the earliest start date - * and time that restore is available for this database (ISO8601 format). + * @member {string} [managedBy] Resource that manages the database. * @member {string} [createMode] Specifies the mode of database creation. * * Default: regular database creation. @@ -41,9 +40,9 @@ class Database extends models['TrackedResource'] { * sourceDatabaseId must be specified as the resource ID of the source * database. * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) secondary replica of an existing database. sourceDatabaseId - * must be specified as the resource ID of the existing primary 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 @@ -65,90 +64,76 @@ class Database extends models['TrackedResource'] { * long term retention vault. recoveryServicesRecoveryPointResourceId must be * specified as the recovery point resource ID. * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse - * edition. Possible values include: 'Copy', 'Default', - * 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', - * 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup' - * @member {string} [sourceDatabaseId] Conditional. If createMode is Copy, - * NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or - * Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * @member {date} [sourceDatabaseDeletionDate] Conditional. If createMode is - * Restore and sourceDatabaseId is the deleted database's original resource - * id when it existed (as opposed to its current restorable dropped database - * id), then this value is required. Specifies the time that the database was - * deleted. - * @member {date} [restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * @member {string} [recoveryServicesRecoveryPointResourceId] Conditional. If - * createMode is RestoreLongTermRetentionBackup, then this value is required. - * Specifies the resource ID of the recovery point to restore from. - * @member {string} [edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If - * createMode is NonReadableSecondary or OnlineSecondary, this value is - * ignored. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible - * values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * @member {string} [maxSizeBytes] The max size of the database expressed in - * bytes. If createMode is not Default, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * @member {uuid} [requestedServiceObjectiveId] The configured service level - * objective ID of the database. This is the service level objective that is - * in the process of being applied to the database. Once successfully - * updated, it will match the value of currentServiceObjectiveId property. If - * requestedServiceObjectiveId and requestedServiceObjectiveName are both - * updated, the value of requestedServiceObjectiveId overrides the value of - * requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * @member {string} [requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of - * serviceLevelObjective property. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible - * values include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', - * 'P6', 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * @member {string} [serviceLevelObjective] The current service level - * objective of the database. Possible values include: 'Basic', 'S0', 'S1', - * 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' - * @member {string} [status] The status of the database. - * @member {string} [elasticPoolName] The name of the elastic pool the - * database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for + * DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * @member {string} [collation] The collation of the database. + * @member {number} [maxSizeBytes] The max size of the database expressed in + * bytes. + * @member {string} [sampleName] The name of the sample schema to apply when + * creating this database. Possible values include: 'AdventureWorksLT', + * 'WideWorldImportersStd', 'WideWorldImportersFull' + * @member {string} [elasticPoolId] The resource identifier of the elastic + * pool containing this database. + * @member {string} [sourceDatabaseId] The resource identifier of the source + * database associated with create operation of this database. + * @member {string} [status] The status of the database. Possible values + * include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', + * 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', + * 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', + * 'Pausing', 'Paused', 'Resuming', 'Scaling' + * @member {uuid} [databaseId] The ID of the database. + * @member {date} [creationDate] The creation date of the database (ISO8601 + * format). + * @member {string} [currentServiceObjectiveName] The current service level + * objective name of the database. + * @member {string} [requestedServiceObjectiveName] The requested service + * level objective name of the database. * @member {string} [defaultSecondaryLocation] The default secondary region * for this database. - * @member {array} [serviceTierAdvisors] The list of service tier advisors - * for this database. Expanded property - * @member {array} [transparentDataEncryption] The transparent data - * encryption info for this database. - * @member {array} [recommendedIndex] The recommended indices for this + * @member {string} [failoverGroupId] Failover Group resource identifier that + * this database belongs to. + * @member {date} [restorePointInTime] Specifies the point in time (ISO8601 + * format) of the source database that will be restored to create the new * database. - * @member {string} [failoverGroupId] The resource identifier of the failover - * group containing this database. - * @member {string} [readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are - * allowed to this database or not. Not supported for DataWarehouse edition. - * Possible values include: 'Enabled', 'Disabled' - * @member {string} [sampleName] Indicates the name of the sample schema to - * apply when creating this database. If createMode is not Default, this - * value is ignored. Not supported for DataWarehouse edition. Possible values - * include: 'AdventureWorksLT' + * @member {date} [sourceDatabaseDeletionDate] Specifies the time that the + * database was deleted. + * @member {string} [recoveryServicesRecoveryPointId] The resource identifier + * of the recovery point associated with create operation of this database. + * @member {string} [longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * @member {string} [recoverableDatabaseId] The resource identifier of the + * recoverable database associated with create operation of this database. + * @member {string} [restorableDroppedDatabaseId] The resource identifier of + * the restorable dropped database associated with create operation of this + * database. + * @member {string} [catalogCollation] Collation of the metadata catalog. + * Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * @member {boolean} [zoneRedundant] Whether or not this database is zone + * redundant, which means the replicas of this database will be spread across + * multiple availability zones. + * @member {string} [licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * @member {number} [maxLogSizeBytes] The max log size for this database. + * @member {date} [earliestRestoreDate] This records the earliest start date + * and time that restore is available for this database (ISO8601 format). + * @member {string} [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: 'Enabled', 'Disabled' + * @member {object} [currentSku] The name and tier of the SKU. + * @member {string} [currentSku.name] The name of the SKU, typically, a + * letter + Number code, e.g. P3. + * @member {string} [currentSku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * @member {string} [currentSku.size] Size of the particular SKU + * @member {string} [currentSku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * @member {number} [currentSku.capacity] Capacity of the particular SKU. */ constructor() { super(); @@ -213,6 +198,14 @@ class Database extends models['TrackedResource'] { name: 'String' } }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, kind: { required: false, readOnly: true, @@ -221,216 +214,205 @@ class Database extends models['TrackedResource'] { name: 'String' } }, - collation: { + managedBy: { required: false, - serializedName: 'properties.collation', + readOnly: true, + serializedName: 'managedBy', type: { name: 'String' } }, - creationDate: { + createMode: { required: false, - readOnly: true, - serializedName: 'properties.creationDate', + serializedName: 'properties.createMode', type: { - name: 'DateTime' + name: 'String' } }, - containmentState: { + collation: { required: false, - readOnly: true, - serializedName: 'properties.containmentState', + serializedName: 'properties.collation', + type: { + name: 'String' + } + }, + maxSizeBytes: { + required: false, + serializedName: 'properties.maxSizeBytes', type: { name: 'Number' } }, - currentServiceObjectiveId: { + sampleName: { required: false, - readOnly: true, - serializedName: 'properties.currentServiceObjectiveId', + serializedName: 'properties.sampleName', type: { name: 'String' } }, - databaseId: { + elasticPoolId: { required: false, - readOnly: true, - serializedName: 'properties.databaseId', + serializedName: 'properties.elasticPoolId', type: { name: 'String' } }, - earliestRestoreDate: { + sourceDatabaseId: { required: false, - readOnly: true, - serializedName: 'properties.earliestRestoreDate', + serializedName: 'properties.sourceDatabaseId', type: { - name: 'DateTime' + name: 'String' } }, - createMode: { + status: { required: false, - serializedName: 'properties.createMode', + readOnly: true, + serializedName: 'properties.status', type: { name: 'String' } }, - sourceDatabaseId: { + databaseId: { required: false, - serializedName: 'properties.sourceDatabaseId', + readOnly: true, + serializedName: 'properties.databaseId', type: { name: 'String' } }, - sourceDatabaseDeletionDate: { + creationDate: { required: false, - serializedName: 'properties.sourceDatabaseDeletionDate', + readOnly: true, + serializedName: 'properties.creationDate', type: { name: 'DateTime' } }, - restorePointInTime: { + currentServiceObjectiveName: { required: false, - serializedName: 'properties.restorePointInTime', + readOnly: true, + serializedName: 'properties.currentServiceObjectiveName', type: { - name: 'DateTime' + name: 'String' } }, - recoveryServicesRecoveryPointResourceId: { + requestedServiceObjectiveName: { required: false, - serializedName: 'properties.recoveryServicesRecoveryPointResourceId', + readOnly: true, + serializedName: 'properties.requestedServiceObjectiveName', type: { name: 'String' } }, - edition: { + defaultSecondaryLocation: { required: false, - serializedName: 'properties.edition', + readOnly: true, + serializedName: 'properties.defaultSecondaryLocation', type: { name: 'String' } }, - maxSizeBytes: { + failoverGroupId: { required: false, - serializedName: 'properties.maxSizeBytes', + readOnly: true, + serializedName: 'properties.failoverGroupId', type: { name: 'String' } }, - requestedServiceObjectiveId: { + restorePointInTime: { required: false, - serializedName: 'properties.requestedServiceObjectiveId', + serializedName: 'properties.restorePointInTime', type: { - name: 'String' + name: 'DateTime' } }, - requestedServiceObjectiveName: { + sourceDatabaseDeletionDate: { required: false, - serializedName: 'properties.requestedServiceObjectiveName', + serializedName: 'properties.sourceDatabaseDeletionDate', + type: { + name: 'DateTime' + } + }, + recoveryServicesRecoveryPointId: { + required: false, + serializedName: 'properties.recoveryServicesRecoveryPointId', type: { name: 'String' } }, - serviceLevelObjective: { + longTermRetentionBackupResourceId: { required: false, - readOnly: true, - serializedName: 'properties.serviceLevelObjective', + serializedName: 'properties.longTermRetentionBackupResourceId', type: { name: 'String' } }, - status: { + recoverableDatabaseId: { required: false, - readOnly: true, - serializedName: 'properties.status', + serializedName: 'properties.recoverableDatabaseId', type: { name: 'String' } }, - elasticPoolName: { + restorableDroppedDatabaseId: { required: false, - serializedName: 'properties.elasticPoolName', + serializedName: 'properties.restorableDroppedDatabaseId', type: { name: 'String' } }, - defaultSecondaryLocation: { + catalogCollation: { required: false, - readOnly: true, - serializedName: 'properties.defaultSecondaryLocation', + serializedName: 'properties.catalogCollation', type: { name: 'String' } }, - serviceTierAdvisors: { + zoneRedundant: { required: false, - readOnly: true, - serializedName: 'properties.serviceTierAdvisors', + serializedName: 'properties.zoneRedundant', type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ServiceTierAdvisorElementType', - type: { - name: 'Composite', - className: 'ServiceTierAdvisor' - } - } + name: 'Boolean' } }, - transparentDataEncryption: { + licenseType: { required: false, - readOnly: true, - serializedName: 'properties.transparentDataEncryption', + serializedName: 'properties.licenseType', type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'TransparentDataEncryptionElementType', - type: { - name: 'Composite', - className: 'TransparentDataEncryption' - } - } + name: 'String' } }, - recommendedIndex: { + maxLogSizeBytes: { required: false, readOnly: true, - serializedName: 'properties.recommendedIndex', + serializedName: 'properties.maxLogSizeBytes', type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'RecommendedIndexElementType', - type: { - name: 'Composite', - className: 'RecommendedIndex' - } - } + name: 'Number' } }, - failoverGroupId: { + earliestRestoreDate: { required: false, readOnly: true, - serializedName: 'properties.failoverGroupId', + serializedName: 'properties.earliestRestoreDate', type: { - name: 'String' + name: 'DateTime' } }, readScale: { required: false, serializedName: 'properties.readScale', type: { - name: 'Enum', - allowedValues: [ 'Enabled', 'Disabled' ] + name: 'String' } }, - sampleName: { + currentSku: { required: false, - serializedName: 'properties.sampleName', + readOnly: true, + serializedName: 'properties.currentSku', type: { - name: 'String' + name: 'Composite', + className: 'Sku' } } } diff --git a/lib/services/sqlManagement2/lib/models/databaseAutomaticTuning.js b/lib/services/sqlManagement2/lib/models/databaseAutomaticTuning.js new file mode 100644 index 0000000000..c8e4237526 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/databaseAutomaticTuning.js @@ -0,0 +1,109 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Database-level Automatic Tuning. + * + * @extends models['ProxyResource'] + */ +class DatabaseAutomaticTuning extends models['ProxyResource'] { + /** + * Create a DatabaseAutomaticTuning. + * @member {string} [desiredState] Automatic tuning desired state. Possible + * values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + * @member {string} [actualState] Automatic tuning actual state. Possible + * values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + * @member {object} [options] Automatic tuning options definition. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DatabaseAutomaticTuning + * + * @returns {object} metadata of DatabaseAutomaticTuning + * + */ + mapper() { + return { + required: false, + serializedName: 'DatabaseAutomaticTuning', + type: { + name: 'Composite', + className: 'DatabaseAutomaticTuning', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + desiredState: { + required: false, + serializedName: 'properties.desiredState', + type: { + name: 'Enum', + allowedValues: [ 'Inherit', 'Custom', 'Auto', 'Unspecified' ] + } + }, + actualState: { + required: false, + readOnly: true, + serializedName: 'properties.actualState', + type: { + name: 'Enum', + allowedValues: [ 'Inherit', 'Custom', 'Auto', 'Unspecified' ] + } + }, + options: { + required: false, + serializedName: 'properties.options', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'AutomaticTuningOptionsElementType', + type: { + name: 'Composite', + className: 'AutomaticTuningOptions' + } + } + } + } + } + } + }; + } +} + +module.exports = DatabaseAutomaticTuning; diff --git a/lib/services/sqlManagement2/lib/models/databaseListResult.js b/lib/services/sqlManagement2/lib/models/databaseListResult.js index 8d8f143e1f..7e34d7100c 100644 --- a/lib/services/sqlManagement2/lib/models/databaseListResult.js +++ b/lib/services/sqlManagement2/lib/models/databaseListResult.js @@ -11,11 +11,12 @@ 'use strict'; /** - * Represents the response to a list database request. + * A list of databases. */ class DatabaseListResult extends Array { /** * Create a DatabaseListResult. + * @member {string} [nextLink] Link to retrieve next page of results. */ constructor() { super(); @@ -36,7 +37,8 @@ class DatabaseListResult extends Array { className: 'DatabaseListResult', modelProperties: { value: { - required: true, + required: false, + readOnly: true, serializedName: '', type: { name: 'Sequence', @@ -49,6 +51,14 @@ class DatabaseListResult extends Array { } } } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } } } } diff --git a/lib/services/sqlManagement2/lib/models/databaseOperation.js b/lib/services/sqlManagement2/lib/models/databaseOperation.js index 5adb38425c..f38745c1c9 100644 --- a/lib/services/sqlManagement2/lib/models/databaseOperation.js +++ b/lib/services/sqlManagement2/lib/models/databaseOperation.js @@ -35,6 +35,10 @@ class DatabaseOperation extends models['ProxyResource'] { * @member {string} [errorDescription] The operation error description. * @member {number} [errorSeverity] The operation error severity. * @member {boolean} [isUserError] Whether or not the error is a user error. + * @member {date} [estimatedCompletionTime] The estimated completion time of + * the operation. + * @member {string} [description] The operation description. + * @member {boolean} [isCancellable] Whether the operation can be cancelled. */ constructor() { super(); @@ -165,6 +169,30 @@ class DatabaseOperation extends models['ProxyResource'] { type: { name: 'Boolean' } + }, + estimatedCompletionTime: { + required: false, + readOnly: true, + serializedName: 'properties.estimatedCompletionTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + isCancellable: { + required: false, + readOnly: true, + serializedName: 'properties.isCancellable', + type: { + name: 'Boolean' + } } } } diff --git a/lib/services/sqlManagement2/lib/models/databaseUpdate.js b/lib/services/sqlManagement2/lib/models/databaseUpdate.js index 6fbeb24f88..9cd896d3e6 100644 --- a/lib/services/sqlManagement2/lib/models/databaseUpdate.js +++ b/lib/services/sqlManagement2/lib/models/databaseUpdate.js @@ -13,25 +13,21 @@ const models = require('./index'); /** - * Represents a database update. + * A database resource. * - * @extends models['Resource'] */ -class DatabaseUpdate extends models['Resource'] { +class DatabaseUpdate { /** * Create a DatabaseUpdate. - * @member {object} [tags] Resource tags. - * @member {string} [collation] The collation of the database. If createMode - * is not Default, this value is ignored. - * @member {date} [creationDate] The creation date of the database (ISO8601 - * format). - * @member {number} [containmentState] The containment state of the database. - * @member {uuid} [currentServiceObjectiveId] The current service level - * objective ID of the database. This is the ID of the service level - * objective that is currently active. - * @member {uuid} [databaseId] The ID of the database. - * @member {date} [earliestRestoreDate] This records the earliest start date - * and time that restore is available for this database (ISO8601 format). + * @member {object} [sku] The name and tier of the SKU. + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. * @member {string} [createMode] Specifies the mode of database creation. * * Default: regular database creation. @@ -40,9 +36,9 @@ class DatabaseUpdate extends models['Resource'] { * sourceDatabaseId must be specified as the resource ID of the source * database. * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) secondary replica of an existing database. sourceDatabaseId - * must be specified as the resource ID of the existing primary 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 @@ -64,93 +60,79 @@ class DatabaseUpdate extends models['Resource'] { * long term retention vault. recoveryServicesRecoveryPointResourceId must be * specified as the recovery point resource ID. * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse - * edition. Possible values include: 'Copy', 'Default', - * 'NonReadableSecondary', 'OnlineSecondary', 'PointInTimeRestore', - * 'Recovery', 'Restore', 'RestoreLongTermRetentionBackup' - * @member {string} [sourceDatabaseId] Conditional. If createMode is Copy, - * NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or - * Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * @member {date} [sourceDatabaseDeletionDate] Conditional. If createMode is - * Restore and sourceDatabaseId is the deleted database's original resource - * id when it existed (as opposed to its current restorable dropped database - * id), then this value is required. Specifies the time that the database was - * deleted. - * @member {date} [restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * @member {string} [recoveryServicesRecoveryPointResourceId] Conditional. If - * createMode is RestoreLongTermRetentionBackup, then this value is required. - * Specifies the resource ID of the recovery point to restore from. - * @member {string} [edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If - * createMode is NonReadableSecondary or OnlineSecondary, this value is - * ignored. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible - * values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * @member {string} [maxSizeBytes] The max size of the database expressed in - * bytes. If createMode is not Default, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * @member {uuid} [requestedServiceObjectiveId] The configured service level - * objective ID of the database. This is the service level objective that is - * in the process of being applied to the database. Once successfully - * updated, it will match the value of currentServiceObjectiveId property. If - * requestedServiceObjectiveId and requestedServiceObjectiveName are both - * updated, the value of requestedServiceObjectiveId overrides the value of - * requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * @member {string} [requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of - * serviceLevelObjective property. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible - * values include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', - * 'P6', 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * @member {string} [serviceLevelObjective] The current service level - * objective of the database. Possible values include: 'Basic', 'S0', 'S1', - * 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' - * @member {string} [status] The status of the database. - * @member {string} [elasticPoolName] The name of the elastic pool the - * database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for + * DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * @member {string} [collation] The collation of the database. + * @member {number} [maxSizeBytes] The max size of the database expressed in + * bytes. + * @member {string} [sampleName] The name of the sample schema to apply when + * creating this database. Possible values include: 'AdventureWorksLT', + * 'WideWorldImportersStd', 'WideWorldImportersFull' + * @member {string} [elasticPoolId] The resource identifier of the elastic + * pool containing this database. + * @member {string} [sourceDatabaseId] The resource identifier of the source + * database associated with create operation of this database. + * @member {string} [status] The status of the database. Possible values + * include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', + * 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', + * 'AutoClosed', 'Copying', 'Creating', 'Inaccessible', 'OfflineSecondary', + * 'Pausing', 'Paused', 'Resuming', 'Scaling' + * @member {uuid} [databaseId] The ID of the database. + * @member {date} [creationDate] The creation date of the database (ISO8601 + * format). + * @member {string} [currentServiceObjectiveName] The current service level + * objective name of the database. + * @member {string} [requestedServiceObjectiveName] The requested service + * level objective name of the database. * @member {string} [defaultSecondaryLocation] The default secondary region * for this database. - * @member {array} [serviceTierAdvisors] The list of service tier advisors - * for this database. Expanded property - * @member {array} [transparentDataEncryption] The transparent data - * encryption info for this database. - * @member {array} [recommendedIndex] The recommended indices for this + * @member {string} [failoverGroupId] Failover Group resource identifier that + * this database belongs to. + * @member {date} [restorePointInTime] Specifies the point in time (ISO8601 + * format) of the source database that will be restored to create the new * database. - * @member {string} [failoverGroupId] The resource identifier of the failover - * group containing this database. - * @member {string} [readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are - * allowed to this database or not. Not supported for DataWarehouse edition. - * Possible values include: 'Enabled', 'Disabled' - * @member {string} [sampleName] Indicates the name of the sample schema to - * apply when creating this database. If createMode is not Default, this - * value is ignored. Not supported for DataWarehouse edition. Possible values - * include: 'AdventureWorksLT' + * @member {date} [sourceDatabaseDeletionDate] Specifies the time that the + * database was deleted. + * @member {string} [recoveryServicesRecoveryPointId] The resource identifier + * of the recovery point associated with create operation of this database. + * @member {string} [longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * @member {string} [recoverableDatabaseId] The resource identifier of the + * recoverable database associated with create operation of this database. + * @member {string} [restorableDroppedDatabaseId] The resource identifier of + * the restorable dropped database associated with create operation of this + * database. + * @member {string} [catalogCollation] Collation of the metadata catalog. + * Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * @member {boolean} [zoneRedundant] Whether or not this database is zone + * redundant, which means the replicas of this database will be spread across + * multiple availability zones. + * @member {string} [licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * @member {number} [maxLogSizeBytes] The max log size for this database. + * @member {date} [earliestRestoreDate] This records the earliest start date + * and time that restore is available for this database (ISO8601 format). + * @member {string} [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: 'Enabled', 'Disabled' + * @member {object} [currentSku] The name and tier of the SKU. + * @member {string} [currentSku.name] The name of the SKU, typically, a + * letter + Number code, e.g. P3. + * @member {string} [currentSku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * @member {string} [currentSku.size] Size of the particular SKU + * @member {string} [currentSku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * @member {number} [currentSku.capacity] Capacity of the particular SKU. + * @member {object} [tags] Resource tags. */ constructor() { - super(); } /** @@ -167,71 +149,60 @@ class DatabaseUpdate extends models['Resource'] { name: 'Composite', className: 'DatabaseUpdate', modelProperties: { - id: { + sku: { required: false, - readOnly: true, - serializedName: 'id', + serializedName: 'sku', type: { - name: 'String' + name: 'Composite', + className: 'Sku' } }, - name: { + createMode: { required: false, - readOnly: true, - serializedName: 'name', + serializedName: 'properties.createMode', type: { name: 'String' } }, - type: { + collation: { required: false, - readOnly: true, - serializedName: 'type', + serializedName: 'properties.collation', type: { name: 'String' } }, - tags: { + maxSizeBytes: { required: false, - serializedName: 'tags', + serializedName: 'properties.maxSizeBytes', type: { - name: 'Dictionary', - value: { - required: false, - serializedName: 'StringElementType', - type: { - name: 'String' - } - } + name: 'Number' } }, - collation: { + sampleName: { required: false, - serializedName: 'properties.collation', + serializedName: 'properties.sampleName', type: { name: 'String' } }, - creationDate: { + elasticPoolId: { required: false, - readOnly: true, - serializedName: 'properties.creationDate', + serializedName: 'properties.elasticPoolId', type: { - name: 'DateTime' + name: 'String' } }, - containmentState: { + sourceDatabaseId: { required: false, - readOnly: true, - serializedName: 'properties.containmentState', + serializedName: 'properties.sourceDatabaseId', type: { - name: 'Number' + name: 'String' } }, - currentServiceObjectiveId: { + status: { required: false, readOnly: true, - serializedName: 'properties.currentServiceObjectiveId', + serializedName: 'properties.status', type: { name: 'String' } @@ -244,177 +215,153 @@ class DatabaseUpdate extends models['Resource'] { name: 'String' } }, - earliestRestoreDate: { + creationDate: { required: false, readOnly: true, - serializedName: 'properties.earliestRestoreDate', + serializedName: 'properties.creationDate', type: { name: 'DateTime' } }, - createMode: { + currentServiceObjectiveName: { required: false, - serializedName: 'properties.createMode', + readOnly: true, + serializedName: 'properties.currentServiceObjectiveName', type: { name: 'String' } }, - sourceDatabaseId: { + requestedServiceObjectiveName: { required: false, - serializedName: 'properties.sourceDatabaseId', + readOnly: true, + serializedName: 'properties.requestedServiceObjectiveName', type: { name: 'String' } }, - sourceDatabaseDeletionDate: { - required: false, - serializedName: 'properties.sourceDatabaseDeletionDate', - type: { - name: 'DateTime' - } - }, - restorePointInTime: { + defaultSecondaryLocation: { required: false, - serializedName: 'properties.restorePointInTime', + readOnly: true, + serializedName: 'properties.defaultSecondaryLocation', type: { - name: 'DateTime' + name: 'String' } }, - recoveryServicesRecoveryPointResourceId: { + failoverGroupId: { required: false, - serializedName: 'properties.recoveryServicesRecoveryPointResourceId', + readOnly: true, + serializedName: 'properties.failoverGroupId', type: { name: 'String' } }, - edition: { + restorePointInTime: { required: false, - serializedName: 'properties.edition', + serializedName: 'properties.restorePointInTime', type: { - name: 'String' + name: 'DateTime' } }, - maxSizeBytes: { + sourceDatabaseDeletionDate: { required: false, - serializedName: 'properties.maxSizeBytes', + serializedName: 'properties.sourceDatabaseDeletionDate', type: { - name: 'String' + name: 'DateTime' } }, - requestedServiceObjectiveId: { + recoveryServicesRecoveryPointId: { required: false, - serializedName: 'properties.requestedServiceObjectiveId', + serializedName: 'properties.recoveryServicesRecoveryPointId', type: { name: 'String' } }, - requestedServiceObjectiveName: { + longTermRetentionBackupResourceId: { required: false, - serializedName: 'properties.requestedServiceObjectiveName', + serializedName: 'properties.longTermRetentionBackupResourceId', type: { name: 'String' } }, - serviceLevelObjective: { + recoverableDatabaseId: { required: false, - readOnly: true, - serializedName: 'properties.serviceLevelObjective', + serializedName: 'properties.recoverableDatabaseId', type: { name: 'String' } }, - status: { + restorableDroppedDatabaseId: { required: false, - readOnly: true, - serializedName: 'properties.status', + serializedName: 'properties.restorableDroppedDatabaseId', type: { name: 'String' } }, - elasticPoolName: { + catalogCollation: { required: false, - serializedName: 'properties.elasticPoolName', + serializedName: 'properties.catalogCollation', type: { name: 'String' } }, - defaultSecondaryLocation: { + zoneRedundant: { required: false, - readOnly: true, - serializedName: 'properties.defaultSecondaryLocation', + serializedName: 'properties.zoneRedundant', type: { - name: 'String' + name: 'Boolean' } }, - serviceTierAdvisors: { + licenseType: { required: false, - readOnly: true, - serializedName: 'properties.serviceTierAdvisors', + serializedName: 'properties.licenseType', type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ServiceTierAdvisorElementType', - type: { - name: 'Composite', - className: 'ServiceTierAdvisor' - } - } + name: 'String' } }, - transparentDataEncryption: { + maxLogSizeBytes: { required: false, readOnly: true, - serializedName: 'properties.transparentDataEncryption', + serializedName: 'properties.maxLogSizeBytes', type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'TransparentDataEncryptionElementType', - type: { - name: 'Composite', - className: 'TransparentDataEncryption' - } - } + name: 'Number' } }, - recommendedIndex: { + earliestRestoreDate: { required: false, readOnly: true, - serializedName: 'properties.recommendedIndex', + serializedName: 'properties.earliestRestoreDate', type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'RecommendedIndexElementType', - type: { - name: 'Composite', - className: 'RecommendedIndex' - } - } + name: 'DateTime' } }, - failoverGroupId: { + readScale: { required: false, - readOnly: true, - serializedName: 'properties.failoverGroupId', + serializedName: 'properties.readScale', type: { name: 'String' } }, - readScale: { + currentSku: { required: false, - serializedName: 'properties.readScale', + readOnly: true, + serializedName: 'properties.currentSku', type: { - name: 'Enum', - allowedValues: [ 'Enabled', 'Disabled' ] + name: 'Composite', + className: 'Sku' } }, - sampleName: { + tags: { required: false, - serializedName: 'properties.sampleName', + serializedName: 'tags', type: { - name: 'String' + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } } } } diff --git a/lib/services/sqlManagement2/lib/models/databaseVulnerabilityAssessment.js b/lib/services/sqlManagement2/lib/models/databaseVulnerabilityAssessment.js new file mode 100644 index 0000000000..1d1f3e0836 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/databaseVulnerabilityAssessment.js @@ -0,0 +1,107 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A database vulnerability assessment. + * + * @extends models['ProxyResource'] + */ +class DatabaseVulnerabilityAssessment extends models['ProxyResource'] { + /** + * Create a DatabaseVulnerabilityAssessment. + * @member {string} [storageContainerPath] A blob storage container path to + * hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * @member {string} [storageContainerSasKey] A shared access signature (SAS + * Key) that has write access to the blob container specified in + * 'storageContainerPath' parameter. + * @member {object} [recurringScans] The recurring scans settings + * @member {boolean} [recurringScans.isEnabled] Recurring scans state. + * @member {boolean} [recurringScans.emailSubscriptionAdmins] Specifies that + * the schedule scan notification will be is sent to the subscription + * administrators. + * @member {array} [recurringScans.emails] Specifies an array of e-mail + * addresses to which the scan notification is sent. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DatabaseVulnerabilityAssessment + * + * @returns {object} metadata of DatabaseVulnerabilityAssessment + * + */ + mapper() { + return { + required: false, + serializedName: 'DatabaseVulnerabilityAssessment', + type: { + name: 'Composite', + className: 'DatabaseVulnerabilityAssessment', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + storageContainerPath: { + required: false, + serializedName: 'properties.storageContainerPath', + type: { + name: 'String' + } + }, + storageContainerSasKey: { + required: false, + serializedName: 'properties.storageContainerSasKey', + type: { + name: 'String' + } + }, + recurringScans: { + required: false, + serializedName: 'properties.recurringScans', + type: { + name: 'Composite', + className: 'VulnerabilityAssessmentRecurringScansProperties' + } + } + } + } + }; + } +} + +module.exports = DatabaseVulnerabilityAssessment; diff --git a/lib/services/sqlManagement2/lib/models/databaseVulnerabilityAssessmentScansExport.js b/lib/services/sqlManagement2/lib/models/databaseVulnerabilityAssessmentScansExport.js new file mode 100644 index 0000000000..0a46456038 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/databaseVulnerabilityAssessmentScansExport.js @@ -0,0 +1,83 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A database Vulnerability Assessment scan export resource. + * + * @extends models['ProxyResource'] + */ +class DatabaseVulnerabilityAssessmentScansExport extends models['ProxyResource'] { + /** + * Create a DatabaseVulnerabilityAssessmentScansExport. + * @member {string} [exportedReportLocation] Location of the exported report + * (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DatabaseVulnerabilityAssessmentScansExport + * + * @returns {object} metadata of DatabaseVulnerabilityAssessmentScansExport + * + */ + mapper() { + return { + required: false, + serializedName: 'DatabaseVulnerabilityAssessmentScansExport', + type: { + name: 'Composite', + className: 'DatabaseVulnerabilityAssessmentScansExport', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + exportedReportLocation: { + required: false, + readOnly: true, + serializedName: 'properties.exportedReportLocation', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DatabaseVulnerabilityAssessmentScansExport; diff --git a/lib/services/sqlManagement2/lib/models/editionCapability.js b/lib/services/sqlManagement2/lib/models/editionCapability.js index c7454e9524..91c33a3d6d 100644 --- a/lib/services/sqlManagement2/lib/models/editionCapability.js +++ b/lib/services/sqlManagement2/lib/models/editionCapability.js @@ -13,17 +13,21 @@ const models = require('./index'); /** - * The database edition capabilities. + * The edition capability. * */ class EditionCapability { /** * Create a EditionCapability. - * @member {string} [name] The edition name. - * @member {string} [status] The status of the edition. Possible values - * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [name] The database edition name. * @member {array} [supportedServiceLevelObjectives] The list of supported * service objectives for the edition. + * @member {boolean} [zoneRedundant] Whether or not zone redundancy is + * supported for the edition. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. */ constructor() { } @@ -50,15 +54,6 @@ class EditionCapability { name: 'String' } }, - status: { - required: false, - readOnly: true, - serializedName: 'status', - type: { - name: 'Enum', - allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] - } - }, supportedServiceLevelObjectives: { required: false, readOnly: true, @@ -74,6 +69,30 @@ class EditionCapability { } } } + }, + zoneRedundant: { + required: false, + readOnly: true, + serializedName: 'zoneRedundant', + type: { + name: 'Boolean' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } } } } diff --git a/lib/services/sqlManagement2/lib/models/elasticPool.js b/lib/services/sqlManagement2/lib/models/elasticPool.js index f8179f7308..878e902fbf 100644 --- a/lib/services/sqlManagement2/lib/models/elasticPool.js +++ b/lib/services/sqlManagement2/lib/models/elasticPool.js @@ -13,28 +13,41 @@ const models = require('./index'); /** - * Represents a database elastic pool. + * An elastic pool. * * @extends models['TrackedResource'] */ class ElasticPool extends models['TrackedResource'] { /** * Create a ElasticPool. - * @member {date} [creationDate] The creation date of the elastic pool - * (ISO8601 format). + * @member {object} [sku] + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {string} [kind] Kind of elastic pool. This is metadata used for + * the Azure portal experience. * @member {string} [state] The state of the elastic pool. Possible values * include: 'Creating', 'Ready', 'Disabled' - * @member {string} [edition] The edition of the elastic pool. Possible - * values include: 'Basic', 'Standard', 'Premium' - * @member {number} [dtu] The total shared DTU for the database elastic pool. - * @member {number} [databaseDtuMax] The maximum DTU any one database can - * consume. - * @member {number} [databaseDtuMin] The minimum DTU all databases are - * guaranteed. - * @member {number} [storageMB] Gets storage limit for the database elastic - * pool in MB. - * @member {string} [kind] Kind of elastic pool. This is metadata used for - * the Azure portal experience. + * @member {date} [creationDate] The creation date of the elastic pool + * (ISO8601 format). + * @member {number} [maxSizeBytes] The storage limit for the database elastic + * pool in bytes. + * @member {object} [perDatabaseSettings] The per database settings for the + * elastic pool. + * @member {number} [perDatabaseSettings.minCapacity] The minimum capacity + * all databases are guaranteed. + * @member {number} [perDatabaseSettings.maxCapacity] The maximum capacity + * any one database can consume. + * @member {boolean} [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. + * @member {string} [licenseType] The license type to apply for this elastic + * pool. Possible values include: 'LicenseIncluded', 'BasePrice' */ constructor() { super(); @@ -99,61 +112,63 @@ class ElasticPool extends models['TrackedResource'] { name: 'String' } }, - creationDate: { + sku: { required: false, - readOnly: true, - serializedName: 'properties.creationDate', + serializedName: 'sku', type: { - name: 'DateTime' + name: 'Composite', + className: 'Sku' } }, - state: { + kind: { required: false, readOnly: true, - serializedName: 'properties.state', + serializedName: 'kind', type: { name: 'String' } }, - edition: { + state: { required: false, - serializedName: 'properties.edition', + readOnly: true, + serializedName: 'properties.state', type: { name: 'String' } }, - dtu: { + creationDate: { required: false, - serializedName: 'properties.dtu', + readOnly: true, + serializedName: 'properties.creationDate', type: { - name: 'Number' + name: 'DateTime' } }, - databaseDtuMax: { + maxSizeBytes: { required: false, - serializedName: 'properties.databaseDtuMax', + serializedName: 'properties.maxSizeBytes', type: { name: 'Number' } }, - databaseDtuMin: { + perDatabaseSettings: { required: false, - serializedName: 'properties.databaseDtuMin', + serializedName: 'properties.perDatabaseSettings', type: { - name: 'Number' + name: 'Composite', + className: 'ElasticPoolPerDatabaseSettings' } }, - storageMB: { + zoneRedundant: { required: false, - serializedName: 'properties.storageMB', + serializedName: 'properties.zoneRedundant', type: { - name: 'Number' + name: 'Boolean' } }, - kind: { + licenseType: { required: false, - readOnly: true, - serializedName: 'kind', + serializedName: 'properties.licenseType', type: { name: 'String' } diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolEditionCapability.js b/lib/services/sqlManagement2/lib/models/elasticPoolEditionCapability.js index 7a4577b25b..8363d79a3f 100644 --- a/lib/services/sqlManagement2/lib/models/elasticPoolEditionCapability.js +++ b/lib/services/sqlManagement2/lib/models/elasticPoolEditionCapability.js @@ -13,17 +13,21 @@ const models = require('./index'); /** - * The elastic pool edition capabilities. + * The elastic pool edition capability. * */ class ElasticPoolEditionCapability { /** * Create a ElasticPoolEditionCapability. * @member {string} [name] The elastic pool edition name. - * @member {string} [status] The status of the elastic pool edition. Possible - * values include: 'Visible', 'Available', 'Default', 'Disabled' - * @member {array} [supportedElasticPoolDtus] The list of supported elastic - * pool DTU levels for the edition. + * @member {array} [supportedElasticPoolPerformanceLevels] The list of + * supported elastic pool DTU levels for the edition. + * @member {boolean} [zoneRedundant] Whether or not zone redundancy is + * supported for the edition. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. */ constructor() { } @@ -50,6 +54,30 @@ class ElasticPoolEditionCapability { name: 'String' } }, + supportedElasticPoolPerformanceLevels: { + required: false, + readOnly: true, + serializedName: 'supportedElasticPoolPerformanceLevels', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ElasticPoolPerformanceLevelCapabilityElementType', + type: { + name: 'Composite', + className: 'ElasticPoolPerformanceLevelCapability' + } + } + } + }, + zoneRedundant: { + required: false, + readOnly: true, + serializedName: 'zoneRedundant', + type: { + name: 'Boolean' + } + }, status: { required: false, readOnly: true, @@ -59,20 +87,11 @@ class ElasticPoolEditionCapability { allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] } }, - supportedElasticPoolDtus: { + reason: { required: false, - readOnly: true, - serializedName: 'supportedElasticPoolDtus', + serializedName: 'reason', type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ElasticPoolDtuCapabilityElementType', - type: { - name: 'Composite', - className: 'ElasticPoolDtuCapability' - } - } + name: 'String' } } } diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolListResult.js b/lib/services/sqlManagement2/lib/models/elasticPoolListResult.js index ab6f8122a9..d0c17d09a4 100644 --- a/lib/services/sqlManagement2/lib/models/elasticPoolListResult.js +++ b/lib/services/sqlManagement2/lib/models/elasticPoolListResult.js @@ -11,11 +11,12 @@ 'use strict'; /** - * Represents the response to a list elastic pool request. + * The result of an elastic pool list request. */ class ElasticPoolListResult extends Array { /** * Create a ElasticPoolListResult. + * @member {string} [nextLink] Link to retrieve next page of results. */ constructor() { super(); @@ -36,7 +37,8 @@ class ElasticPoolListResult extends Array { className: 'ElasticPoolListResult', modelProperties: { value: { - required: true, + required: false, + readOnly: true, serializedName: '', type: { name: 'Sequence', @@ -49,6 +51,14 @@ class ElasticPoolListResult extends Array { } } } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } } } } diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolOperation.js b/lib/services/sqlManagement2/lib/models/elasticPoolOperation.js new file mode 100644 index 0000000000..3a9d43357b --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/elasticPoolOperation.js @@ -0,0 +1,201 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A elastic pool operation. + * + * @extends models['ProxyResource'] + */ +class ElasticPoolOperation extends models['ProxyResource'] { + /** + * Create a ElasticPoolOperation. + * @member {string} [elasticPoolName] The name of the elastic pool the + * operation is being performed on. + * @member {string} [operation] The name of operation. + * @member {string} [operationFriendlyName] The friendly name of operation. + * @member {number} [percentComplete] The percentage of the operation + * completed. + * @member {string} [serverName] The name of the server. + * @member {date} [startTime] The operation start time. + * @member {string} [state] The operation state. + * @member {number} [errorCode] The operation error code. + * @member {string} [errorDescription] The operation error description. + * @member {number} [errorSeverity] The operation error severity. + * @member {boolean} [isUserError] Whether or not the error is a user error. + * @member {date} [estimatedCompletionTime] The estimated completion time of + * the operation. + * @member {string} [description] The operation description. + * @member {boolean} [isCancellable] Whether the operation can be cancelled. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ElasticPoolOperation + * + * @returns {object} metadata of ElasticPoolOperation + * + */ + mapper() { + return { + required: false, + serializedName: 'ElasticPoolOperation', + type: { + name: 'Composite', + className: 'ElasticPoolOperation', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + elasticPoolName: { + required: false, + readOnly: true, + serializedName: 'properties.elasticPoolName', + type: { + name: 'String' + } + }, + operation: { + required: false, + readOnly: true, + serializedName: 'properties.operation', + type: { + name: 'String' + } + }, + operationFriendlyName: { + required: false, + readOnly: true, + serializedName: 'properties.operationFriendlyName', + type: { + name: 'String' + } + }, + percentComplete: { + required: false, + readOnly: true, + serializedName: 'properties.percentComplete', + type: { + name: 'Number' + } + }, + serverName: { + required: false, + readOnly: true, + serializedName: 'properties.serverName', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + state: { + required: false, + readOnly: true, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + errorCode: { + required: false, + readOnly: true, + serializedName: 'properties.errorCode', + type: { + name: 'Number' + } + }, + errorDescription: { + required: false, + readOnly: true, + serializedName: 'properties.errorDescription', + type: { + name: 'String' + } + }, + errorSeverity: { + required: false, + readOnly: true, + serializedName: 'properties.errorSeverity', + type: { + name: 'Number' + } + }, + isUserError: { + required: false, + readOnly: true, + serializedName: 'properties.isUserError', + type: { + name: 'Boolean' + } + }, + estimatedCompletionTime: { + required: false, + readOnly: true, + serializedName: 'properties.estimatedCompletionTime', + type: { + name: 'DateTime' + } + }, + description: { + required: false, + readOnly: true, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + isCancellable: { + required: false, + readOnly: true, + serializedName: 'properties.isCancellable', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = ElasticPoolOperation; diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolOperationListResult.js b/lib/services/sqlManagement2/lib/models/elasticPoolOperationListResult.js new file mode 100644 index 0000000000..c389d12c01 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/elasticPoolOperationListResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The response to a list elastic pool operations request + */ +class ElasticPoolOperationListResult extends Array { + /** + * Create a ElasticPoolOperationListResult. + * @member {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ElasticPoolOperationListResult + * + * @returns {object} metadata of ElasticPoolOperationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ElasticPoolOperationListResult', + type: { + name: 'Composite', + className: 'ElasticPoolOperationListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ElasticPoolOperationElementType', + type: { + name: 'Composite', + className: 'ElasticPoolOperation' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ElasticPoolOperationListResult; diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseMaxPerformanceLevelCapability.js b/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseMaxPerformanceLevelCapability.js new file mode 100644 index 0000000000..693b58f5d3 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseMaxPerformanceLevelCapability.js @@ -0,0 +1,103 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The max per-database performance level capability. + * + */ +class ElasticPoolPerDatabaseMaxPerformanceLevelCapability { + /** + * Create a ElasticPoolPerDatabaseMaxPerformanceLevelCapability. + * @member {number} [limit] The maximum performance level per database. + * @member {string} [unit] Unit type used to measure performance level. + * Possible values include: 'DTU', 'VCores' + * @member {array} [supportedPerDatabaseMinPerformanceLevels] The list of + * supported min database performance levels. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. + */ + constructor() { + } + + /** + * Defines the metadata of ElasticPoolPerDatabaseMaxPerformanceLevelCapability + * + * @returns {object} metadata of ElasticPoolPerDatabaseMaxPerformanceLevelCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'ElasticPoolPerDatabaseMaxPerformanceLevelCapability', + type: { + name: 'Composite', + className: 'ElasticPoolPerDatabaseMaxPerformanceLevelCapability', + modelProperties: { + limit: { + required: false, + readOnly: true, + serializedName: 'limit', + type: { + name: 'Number' + } + }, + unit: { + required: false, + readOnly: true, + serializedName: 'unit', + type: { + name: 'String' + } + }, + supportedPerDatabaseMinPerformanceLevels: { + required: false, + readOnly: true, + serializedName: 'supportedPerDatabaseMinPerformanceLevels', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ElasticPoolPerDatabaseMinPerformanceLevelCapabilityElementType', + type: { + name: 'Composite', + className: 'ElasticPoolPerDatabaseMinPerformanceLevelCapability' + } + } + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ElasticPoolPerDatabaseMaxPerformanceLevelCapability; diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseMinPerformanceLevelCapability.js b/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseMinPerformanceLevelCapability.js new file mode 100644 index 0000000000..679c62dc47 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseMinPerformanceLevelCapability.js @@ -0,0 +1,83 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The minimum per-database performance level capability. + * + */ +class ElasticPoolPerDatabaseMinPerformanceLevelCapability { + /** + * Create a ElasticPoolPerDatabaseMinPerformanceLevelCapability. + * @member {number} [limit] The minimum performance level per database. + * @member {string} [unit] Unit type used to measure performance level. + * Possible values include: 'DTU', 'VCores' + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. + */ + constructor() { + } + + /** + * Defines the metadata of ElasticPoolPerDatabaseMinPerformanceLevelCapability + * + * @returns {object} metadata of ElasticPoolPerDatabaseMinPerformanceLevelCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'ElasticPoolPerDatabaseMinPerformanceLevelCapability', + type: { + name: 'Composite', + className: 'ElasticPoolPerDatabaseMinPerformanceLevelCapability', + modelProperties: { + limit: { + required: false, + readOnly: true, + serializedName: 'limit', + type: { + name: 'Number' + } + }, + unit: { + required: false, + readOnly: true, + serializedName: 'unit', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ElasticPoolPerDatabaseMinPerformanceLevelCapability; diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseSettings.js b/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseSettings.js new file mode 100644 index 0000000000..5810f7eca6 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/elasticPoolPerDatabaseSettings.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Per database settings of an elastic pool. + * + */ +class ElasticPoolPerDatabaseSettings { + /** + * Create a ElasticPoolPerDatabaseSettings. + * @member {number} [minCapacity] The minimum capacity all databases are + * guaranteed. + * @member {number} [maxCapacity] The maximum capacity any one database can + * consume. + */ + constructor() { + } + + /** + * Defines the metadata of ElasticPoolPerDatabaseSettings + * + * @returns {object} metadata of ElasticPoolPerDatabaseSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'ElasticPoolPerDatabaseSettings', + type: { + name: 'Composite', + className: 'ElasticPoolPerDatabaseSettings', + modelProperties: { + minCapacity: { + required: false, + serializedName: 'minCapacity', + type: { + name: 'Number' + } + }, + maxCapacity: { + required: false, + serializedName: 'maxCapacity', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ElasticPoolPerDatabaseSettings; diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolPerformanceLevelCapability.js b/lib/services/sqlManagement2/lib/models/elasticPoolPerformanceLevelCapability.js new file mode 100644 index 0000000000..444e9e51aa --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/elasticPoolPerformanceLevelCapability.js @@ -0,0 +1,193 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The Elastic Pool performance level capability. + * + */ +class ElasticPoolPerformanceLevelCapability { + /** + * Create a ElasticPoolPerformanceLevelCapability. + * @member {object} [performanceLevel] The performance level for the pool. + * @member {number} [performanceLevel.value] Performance level value. + * @member {string} [performanceLevel.unit] Unit type used to measure + * performance level. Possible values include: 'DTU', 'VCores' + * @member {object} [sku] The sku. + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {array} [supportedLicenseTypes] List of supported license types. + * @member {number} [maxDatabaseCount] The maximum number of databases + * supported. + * @member {object} [includedMaxSize] The included (free) max size for this + * performance level. + * @member {number} [includedMaxSize.limit] The maximum size limit (see + * 'unit' for the units). + * @member {string} [includedMaxSize.unit] The units that the limit is + * expressed in. Possible values include: 'Megabytes', 'Gigabytes', + * 'Terabytes', 'Petabytes' + * @member {array} [supportedMaxSizes] The list of supported max sizes. + * @member {array} [supportedPerDatabaseMaxSizes] The list of supported per + * database max sizes. + * @member {array} [supportedPerDatabaseMaxPerformanceLevels] The list of + * supported per database max performance levels. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. + */ + constructor() { + } + + /** + * Defines the metadata of ElasticPoolPerformanceLevelCapability + * + * @returns {object} metadata of ElasticPoolPerformanceLevelCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'ElasticPoolPerformanceLevelCapability', + type: { + name: 'Composite', + className: 'ElasticPoolPerformanceLevelCapability', + modelProperties: { + performanceLevel: { + required: false, + readOnly: true, + serializedName: 'performanceLevel', + type: { + name: 'Composite', + className: 'PerformanceLevelCapability' + } + }, + sku: { + required: false, + readOnly: true, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + supportedLicenseTypes: { + required: false, + readOnly: true, + serializedName: 'supportedLicenseTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LicenseTypeCapabilityElementType', + type: { + name: 'Composite', + className: 'LicenseTypeCapability' + } + } + } + }, + maxDatabaseCount: { + required: false, + readOnly: true, + serializedName: 'maxDatabaseCount', + type: { + name: 'Number' + } + }, + includedMaxSize: { + required: false, + readOnly: true, + serializedName: 'includedMaxSize', + type: { + name: 'Composite', + className: 'MaxSizeCapability' + } + }, + supportedMaxSizes: { + required: false, + readOnly: true, + serializedName: 'supportedMaxSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MaxSizeRangeCapabilityElementType', + type: { + name: 'Composite', + className: 'MaxSizeRangeCapability' + } + } + } + }, + supportedPerDatabaseMaxSizes: { + required: false, + readOnly: true, + serializedName: 'supportedPerDatabaseMaxSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MaxSizeRangeCapabilityElementType', + type: { + name: 'Composite', + className: 'MaxSizeRangeCapability' + } + } + } + }, + supportedPerDatabaseMaxPerformanceLevels: { + required: false, + readOnly: true, + serializedName: 'supportedPerDatabaseMaxPerformanceLevels', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ElasticPoolPerDatabaseMaxPerformanceLevelCapabilityElementType', + type: { + name: 'Composite', + className: 'ElasticPoolPerDatabaseMaxPerformanceLevelCapability' + } + } + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ElasticPoolPerformanceLevelCapability; diff --git a/lib/services/sqlManagement2/lib/models/elasticPoolUpdate.js b/lib/services/sqlManagement2/lib/models/elasticPoolUpdate.js index 8b1fbfa17b..5535097575 100644 --- a/lib/services/sqlManagement2/lib/models/elasticPoolUpdate.js +++ b/lib/services/sqlManagement2/lib/models/elasticPoolUpdate.js @@ -13,30 +13,37 @@ const models = require('./index'); /** - * Represents an elastic pool update. + * An elastic pool update. * - * @extends models['Resource'] */ -class ElasticPoolUpdate extends models['Resource'] { +class ElasticPoolUpdate { /** * Create a ElasticPoolUpdate. + * @member {object} [sku] + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {number} [maxSizeBytes] The storage limit for the database elastic + * pool in bytes. + * @member {object} [perDatabaseSettings] The per database settings for the + * elastic pool. + * @member {number} [perDatabaseSettings.minCapacity] The minimum capacity + * all databases are guaranteed. + * @member {number} [perDatabaseSettings.maxCapacity] The maximum capacity + * any one database can consume. + * @member {boolean} [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. + * @member {string} [licenseType] The license type to apply for this elastic + * pool. Possible values include: 'LicenseIncluded', 'BasePrice' * @member {object} [tags] Resource tags. - * @member {date} [creationDate] The creation date of the elastic pool - * (ISO8601 format). - * @member {string} [state] The state of the elastic pool. Possible values - * include: 'Creating', 'Ready', 'Disabled' - * @member {string} [edition] The edition of the elastic pool. Possible - * values include: 'Basic', 'Standard', 'Premium' - * @member {number} [dtu] The total shared DTU for the database elastic pool. - * @member {number} [databaseDtuMax] The maximum DTU any one database can - * consume. - * @member {number} [databaseDtuMin] The minimum DTU all databases are - * guaranteed. - * @member {number} [storageMB] Gets storage limit for the database elastic - * pool in MB. */ constructor() { - super(); } /** @@ -53,26 +60,39 @@ class ElasticPoolUpdate extends models['Resource'] { name: 'Composite', className: 'ElasticPoolUpdate', modelProperties: { - id: { + sku: { required: false, - readOnly: true, - serializedName: 'id', + serializedName: 'sku', type: { - name: 'String' + name: 'Composite', + className: 'Sku' } }, - name: { + maxSizeBytes: { required: false, - readOnly: true, - serializedName: 'name', + serializedName: 'properties.maxSizeBytes', type: { - name: 'String' + name: 'Number' + } + }, + perDatabaseSettings: { + required: false, + serializedName: 'properties.perDatabaseSettings', + type: { + name: 'Composite', + className: 'ElasticPoolPerDatabaseSettings' + } + }, + zoneRedundant: { + required: false, + serializedName: 'properties.zoneRedundant', + type: { + name: 'Boolean' } }, - type: { + licenseType: { required: false, - readOnly: true, - serializedName: 'type', + serializedName: 'properties.licenseType', type: { name: 'String' } @@ -90,57 +110,6 @@ class ElasticPoolUpdate extends models['Resource'] { } } } - }, - creationDate: { - required: false, - readOnly: true, - serializedName: 'properties.creationDate', - type: { - name: 'DateTime' - } - }, - state: { - required: false, - readOnly: true, - serializedName: 'properties.state', - type: { - name: 'String' - } - }, - edition: { - required: false, - serializedName: 'properties.edition', - type: { - name: 'String' - } - }, - dtu: { - required: false, - serializedName: 'properties.dtu', - type: { - name: 'Number' - } - }, - databaseDtuMax: { - required: false, - serializedName: 'properties.databaseDtuMax', - type: { - name: 'Number' - } - }, - databaseDtuMin: { - required: false, - serializedName: 'properties.databaseDtuMin', - type: { - name: 'Number' - } - }, - storageMB: { - required: false, - serializedName: 'properties.storageMB', - type: { - name: 'Number' - } } } } diff --git a/lib/services/sqlManagement2/lib/models/importRequest.js b/lib/services/sqlManagement2/lib/models/importRequest.js index a418f5129e..474fc662c8 100644 --- a/lib/services/sqlManagement2/lib/models/importRequest.js +++ b/lib/services/sqlManagement2/lib/models/importRequest.js @@ -23,11 +23,18 @@ class ImportRequest extends models['ExportRequest'] { * @member {string} databaseName The name of the database to import. * @member {string} edition The edition for the database being created. * Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' * @member {string} serviceObjectiveName The name of the service objective to - * assign to the database. Possible values include: 'Basic', 'S0', 'S1', - * 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' + * assign to the database. Possible values include: 'System', 'System0', + * 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', + * 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', + * 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', + * 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', + * 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', + * 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', + * 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', + * 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool' * @member {string} maxSizeBytes The maximum size for the newly imported * database. */ diff --git a/lib/services/sqlManagement2/lib/models/index.d.ts b/lib/services/sqlManagement2/lib/models/index.d.ts index f39d5dc536..d7d687d2a0 100644 --- a/lib/services/sqlManagement2/lib/models/index.d.ts +++ b/lib/services/sqlManagement2/lib/models/index.d.ts @@ -32,49 +32,6 @@ export interface Resource extends BaseResource { readonly type?: string; } -/** - * @class - * Initializes a new instance of the ProxyResource class. - * @constructor - * ARM proxy resource. - * - */ -export interface ProxyResource extends Resource { -} - -/** - * @class - * Initializes a new instance of the BackupLongTermRetentionPolicy class. - * @constructor - * A backup long term retention policy - * - * @member {string} [location] The geo-location where the resource lives - * @member {string} state The status of the backup long term retention policy. - * Possible values include: 'Disabled', 'Enabled' - * @member {string} recoveryServicesBackupPolicyResourceId The azure recovery - * services backup protection policy resource id - */ -export interface BackupLongTermRetentionPolicy extends ProxyResource { - readonly location?: string; - state: string; - recoveryServicesBackupPolicyResourceId: string; -} - -/** - * @class - * Initializes a new instance of the BackupLongTermRetentionVault class. - * @constructor - * A backup long term retention vault - * - * @member {string} [location] The geo-location where the resource lives - * @member {string} recoveryServicesVaultResourceId The azure recovery services - * vault resource id - */ -export interface BackupLongTermRetentionVault extends ProxyResource { - readonly location?: string; - recoveryServicesVaultResourceId: string; -} - /** * @class * Initializes a new instance of the TrackedResource class. @@ -91,22 +48,12 @@ export interface TrackedResource extends Resource { /** * @class - * Initializes a new instance of the RestorePoint class. + * Initializes a new instance of the ProxyResource class. * @constructor - * A database restore point. + * ARM proxy resource. * - * @member {string} [restorePointType] The restore point type of the database - * restore point. Possible values include: 'DISCRETE', 'CONTINUOUS' - * @member {date} [restorePointCreationDate] Restore point creation time - * (ISO8601 format). Populated when restorePointType = CONTINUOUS. Null - * otherwise. - * @member {date} [earliestRestoreDate] Earliest restore time (ISO8601 format). - * Populated when restorePointType = DISCRETE. Null otherwise. */ -export interface RestorePoint extends ProxyResource { - readonly restorePointType?: string; - readonly restorePointCreationDate?: Date; - readonly earliestRestoreDate?: Date; +export interface ProxyResource extends Resource { } /** @@ -163,202 +110,37 @@ export interface RestorableDroppedDatabase extends ProxyResource { /** * @class - * Initializes a new instance of the MaxSizeCapability class. - * @constructor - * The maximum size limits for a database. - * - * @member {number} [limit] The maximum size of the database (see 'unit' for - * the units). - * @member {string} [unit] The units that the limit is expressed in. Possible - * values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' - * @member {string} [status] The status of the maximum size capability. - * Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - */ -export interface MaxSizeCapability { - readonly limit?: number; - readonly unit?: string; - readonly status?: string; -} - -/** - * @class - * Initializes a new instance of the ServiceObjectiveCapability class. - * @constructor - * The service objectives capability. - * - * @member {string} [name] The service objective name. - * @member {string} [status] The status of the service objective. Possible - * values include: 'Visible', 'Available', 'Default', 'Disabled' - * @member {string} [unit] Unit type used to measure service objective - * performance level. Possible values include: 'DTU' - * @member {number} [value] Performance level value. - * @member {uuid} [id] The unique ID of the service objective. - * @member {array} [supportedMaxSizes] The list of supported maximum database - * sizes for this service objective. - * @member {object} [includedMaxSize] The included (free) max size for this - * service level objective. - * @member {number} [includedMaxSize.limit] The maximum size of the database - * (see 'unit' for the units). - * @member {string} [includedMaxSize.unit] The units that the limit is - * expressed in. Possible values include: 'Megabytes', 'Gigabytes', - * 'Terabytes', 'Petabytes' - * @member {string} [includedMaxSize.status] The status of the maximum size - * capability. Possible values include: 'Visible', 'Available', 'Default', - * 'Disabled' - */ -export interface ServiceObjectiveCapability { - readonly name?: string; - readonly status?: string; - readonly unit?: string; - readonly value?: number; - readonly id?: string; - readonly supportedMaxSizes?: MaxSizeCapability[]; - readonly includedMaxSize?: MaxSizeCapability; -} - -/** - * @class - * Initializes a new instance of the EditionCapability class. - * @constructor - * The database edition capabilities. - * - * @member {string} [name] The edition name. - * @member {string} [status] The status of the edition. Possible values - * include: 'Visible', 'Available', 'Default', 'Disabled' - * @member {array} [supportedServiceLevelObjectives] The list of supported - * service objectives for the edition. - */ -export interface EditionCapability { - readonly name?: string; - readonly status?: string; - readonly supportedServiceLevelObjectives?: ServiceObjectiveCapability[]; -} - -/** - * @class - * Initializes a new instance of the ElasticPoolPerDatabaseMinDtuCapability class. - * @constructor - * The minimum per-database DTU capability. - * - * @member {number} [limit] The maximum DTUs per database. - * @member {string} [status] The status of the capability. Possible values - * include: 'Visible', 'Available', 'Default', 'Disabled' - */ -export interface ElasticPoolPerDatabaseMinDtuCapability { - readonly limit?: number; - readonly status?: string; -} - -/** - * @class - * Initializes a new instance of the ElasticPoolPerDatabaseMaxDtuCapability class. - * @constructor - * The max per-database DTU capability. - * - * @member {number} [limit] The maximum DTUs per database. - * @member {string} [status] The status of the capability. Possible values - * include: 'Visible', 'Available', 'Default', 'Disabled' - * @member {array} [supportedPerDatabaseMinDtus] The list of supported min - * database DTUs. - */ -export interface ElasticPoolPerDatabaseMaxDtuCapability { - readonly limit?: number; - readonly status?: string; - readonly supportedPerDatabaseMinDtus?: ElasticPoolPerDatabaseMinDtuCapability[]; -} - -/** - * @class - * Initializes a new instance of the ElasticPoolDtuCapability class. - * @constructor - * The Elastic Pool DTU capability. - * - * @member {number} [limit] The maximum size of the database (see 'unit' for - * the units). - * @member {number} [maxDatabaseCount] The maximum number of databases - * supported. - * @member {string} [status] The status of the capability. Possible values - * include: 'Visible', 'Available', 'Default', 'Disabled' - * @member {array} [supportedMaxSizes] The list of supported max sizes. - * @member {object} [includedMaxSize] The included (free) max size for this - * service level objective. - * @member {number} [includedMaxSize.limit] The maximum size of the database - * (see 'unit' for the units). - * @member {string} [includedMaxSize.unit] The units that the limit is - * expressed in. Possible values include: 'Megabytes', 'Gigabytes', - * 'Terabytes', 'Petabytes' - * @member {string} [includedMaxSize.status] The status of the maximum size - * capability. Possible values include: 'Visible', 'Available', 'Default', - * 'Disabled' - * @member {array} [supportedPerDatabaseMaxSizes] The list of supported max - * database sizes. - * @member {array} [supportedPerDatabaseMaxDtus] The list of supported max - * database DTUs. - */ -export interface ElasticPoolDtuCapability { - readonly limit?: number; - readonly maxDatabaseCount?: number; - readonly status?: string; - readonly supportedMaxSizes?: MaxSizeCapability[]; - readonly includedMaxSize?: MaxSizeCapability; - readonly supportedPerDatabaseMaxSizes?: MaxSizeCapability[]; - readonly supportedPerDatabaseMaxDtus?: ElasticPoolPerDatabaseMaxDtuCapability[]; -} - -/** - * @class - * Initializes a new instance of the ElasticPoolEditionCapability class. - * @constructor - * The elastic pool edition capabilities. - * - * @member {string} [name] The elastic pool edition name. - * @member {string} [status] The status of the elastic pool edition. Possible - * values include: 'Visible', 'Available', 'Default', 'Disabled' - * @member {array} [supportedElasticPoolDtus] The list of supported elastic - * pool DTU levels for the edition. - */ -export interface ElasticPoolEditionCapability { - readonly name?: string; - readonly status?: string; - readonly supportedElasticPoolDtus?: ElasticPoolDtuCapability[]; -} - -/** - * @class - * Initializes a new instance of the ServerVersionCapability class. + * Initializes a new instance of the CheckNameAvailabilityRequest class. * @constructor - * The server capabilities. + * A request to check whether the specified name for a resource is available. * - * @member {string} [name] The server version name. - * @member {string} [status] The status of the server version. Possible values - * include: 'Visible', 'Available', 'Default', 'Disabled' - * @member {array} [supportedEditions] The list of supported database editions. - * @member {array} [supportedElasticPoolEditions] The list of supported elastic - * pool editions. + * @member {string} name The name whose availability is to be checked. */ -export interface ServerVersionCapability { - readonly name?: string; - readonly status?: string; - readonly supportedEditions?: EditionCapability[]; - readonly supportedElasticPoolEditions?: ElasticPoolEditionCapability[]; +export interface CheckNameAvailabilityRequest { + name: string; } /** * @class - * Initializes a new instance of the LocationCapabilities class. + * Initializes a new instance of the CheckNameAvailabilityResponse class. * @constructor - * The capabilities for a location. + * A response indicating whether the specified name for a resource is + * available. * - * @member {string} [name] The location name. - * @member {string} [status] Azure SQL Database's status for the location. - * Possible values include: 'Visible', 'Available', 'Default', 'Disabled' - * @member {array} [supportedServerVersions] The list of supported server - * versions. + * @member {boolean} [available] True if the name is available, otherwise + * false. + * @member {string} [message] A message explaining why the name is unavailable. + * Will be null if the name is available. + * @member {string} [name] The name whose availability was checked. + * @member {string} [reason] The reason code explaining why the name is + * unavailable. Will be null if the name is available. Possible values include: + * 'Invalid', 'AlreadyExists' */ -export interface LocationCapabilities { +export interface CheckNameAvailabilityResponse { + readonly available?: boolean; + readonly message?: string; readonly name?: string; - readonly status?: string; - readonly supportedServerVersions?: ServerVersionCapability[]; + readonly reason?: string; } /** @@ -647,11 +429,17 @@ export interface ExportRequest { * @member {string} databaseName The name of the database to import. * @member {string} edition The edition for the database being created. * Possible values include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', - * 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' + * 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' * @member {string} serviceObjectiveName The name of the service objective to - * assign to the database. Possible values include: 'Basic', 'S0', 'S1', 'S2', - * 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', 'System2', - * 'ElasticPool' + * assign to the database. Possible values include: 'System', 'System0', + * 'System1', 'System2', 'System3', 'System4', 'System2L', 'System3L', + * 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', + * 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', + * 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', + * 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', + * 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', + * 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', + * 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool' * @member {string} maxSizeBytes The maximum size for the newly imported * database. */ @@ -768,6 +556,63 @@ export interface MetricDefinition { readonly metricAvailabilities?: MetricAvailability[]; } +/** + * @class + * Initializes a new instance of the RecommendedElasticPoolMetric class. + * @constructor + * Represents recommended elastic pool metric. + * + * @member {date} [dateTime] The time of metric (ISO8601 format). + * @member {number} [dtu] Gets or sets the DTUs (Database Transaction Units). + * See + * https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ + * @member {number} [sizeGB] Gets or sets size in gigabytes. + */ +export interface RecommendedElasticPoolMetric { + dateTime?: Date; + dtu?: number; + sizeGB?: number; +} + +/** + * @class + * Initializes a new instance of the RecommendedElasticPool class. + * @constructor + * Represents a recommented elastic pool. + * + * @member {string} [databaseEdition] The edition of the recommended elastic + * pool. The ElasticPoolEdition enumeration contains all the valid editions. + * Possible values include: 'Basic', 'Standard', 'Premium' + * @member {number} [dtu] The DTU for the recommended elastic pool. + * @member {number} [databaseDtuMin] The minimum DTU for the database. + * @member {number} [databaseDtuMax] The maximum DTU for the database. + * @member {number} [storageMB] Gets storage size in megabytes. + * @member {date} [observationPeriodStart] The observation period start + * (ISO8601 format). + * @member {date} [observationPeriodEnd] The observation period start (ISO8601 + * format). + * @member {number} [maxObservedDtu] Gets maximum observed DTU. + * @member {number} [maxObservedStorageMB] Gets maximum observed storage in + * megabytes. + * @member {array} [databases] The list of databases in this pool. Expanded + * property + * @member {array} [metrics] The list of databases housed in the server. + * Expanded property + */ +export interface RecommendedElasticPool extends ProxyResource { + readonly databaseEdition?: string; + dtu?: number; + databaseDtuMin?: number; + databaseDtuMax?: number; + storageMB?: number; + readonly observationPeriodStart?: Date; + readonly observationPeriodEnd?: Date; + readonly maxObservedDtu?: number; + readonly maxObservedStorageMB?: number; + readonly databases?: TrackedResource[]; + readonly metrics?: RecommendedElasticPoolMetric[]; +} + /** * @class * Initializes a new instance of the ReplicationLink class. @@ -872,55 +717,187 @@ export interface ServiceObjective extends ProxyResource { /** * @class - * Initializes a new instance of the CheckNameAvailabilityRequest class. + * Initializes a new instance of the ElasticPoolActivity class. * @constructor - * A request to check whether the specified name for a resource is available. + * Represents the activity on an elastic pool. * - * @member {string} name The name whose availability is to be checked. - */ -export interface CheckNameAvailabilityRequest { - name: string; -} - -/** - * @class - * Initializes a new instance of the CheckNameAvailabilityResponse class. - * @constructor - * A response indicating whether the specified name for a resource is - * available. + * @member {string} [location] The geo-location where the resource lives + * @member {date} [endTime] The time the operation finished (ISO8601 format). + * @member {number} [errorCode] The error code if available. + * @member {string} [errorMessage] The error message if available. + * @member {number} [errorSeverity] The error severity if available. + * @member {string} [operation] The operation name. + * @member {uuid} [operationId] The unique operation ID. + * @member {number} [percentComplete] The percentage complete if available. + * @member {number} [requestedDatabaseDtuMax] The requested max DTU per + * database if available. + * @member {number} [requestedDatabaseDtuMin] The requested min DTU per + * database if available. + * @member {number} [requestedDtu] The requested DTU for the pool if available. + * @member {string} [requestedElasticPoolName] The requested name for the + * elastic pool if available. + * @member {number} [requestedStorageLimitInGB] The requested storage limit for + * the pool in GB if available. + * @member {string} [elasticPoolName] The name of the elastic pool. + * @member {string} [serverName] The name of the server the elastic pool is in. + * @member {date} [startTime] The time the operation started (ISO8601 format). + * @member {string} [state] The current state of the operation. + * @member {number} [requestedStorageLimitInMB] The requested storage limit in + * MB. + * @member {number} [requestedDatabaseDtuGuarantee] The requested per database + * DTU guarantee. + * @member {number} [requestedDatabaseDtuCap] The requested per database DTU + * cap. + * @member {number} [requestedDtuGuarantee] The requested DTU guarantee. + */ +export interface ElasticPoolActivity extends ProxyResource { + location?: string; + readonly endTime?: Date; + readonly errorCode?: number; + readonly errorMessage?: string; + readonly errorSeverity?: number; + readonly operation?: string; + readonly operationId?: string; + readonly percentComplete?: number; + readonly requestedDatabaseDtuMax?: number; + readonly requestedDatabaseDtuMin?: number; + readonly requestedDtu?: number; + readonly requestedElasticPoolName?: string; + readonly requestedStorageLimitInGB?: number; + readonly elasticPoolName?: string; + readonly serverName?: string; + readonly startTime?: Date; + readonly state?: string; + readonly requestedStorageLimitInMB?: number; + readonly requestedDatabaseDtuGuarantee?: number; + readonly requestedDatabaseDtuCap?: number; + readonly requestedDtuGuarantee?: number; +} + +/** + * @class + * Initializes a new instance of the ElasticPoolDatabaseActivity class. + * @constructor + * Represents the activity on an elastic pool. * - * @member {boolean} [available] True if the name is available, otherwise - * false. - * @member {string} [message] A message explaining why the name is unavailable. - * Will be null if the name is available. - * @member {string} [name] The name whose availability was checked. - * @member {string} [reason] The reason code explaining why the name is - * unavailable. Will be null if the name is available. Possible values include: - * 'Invalid', 'AlreadyExists' + * @member {string} [location] The geo-location where the resource lives + * @member {string} [databaseName] The database name. + * @member {date} [endTime] The time the operation finished (ISO8601 format). + * @member {number} [errorCode] The error code if available. + * @member {string} [errorMessage] The error message if available. + * @member {number} [errorSeverity] The error severity if available. + * @member {string} [operation] The operation name. + * @member {uuid} [operationId] The unique operation ID. + * @member {number} [percentComplete] The percentage complete if available. + * @member {string} [requestedElasticPoolName] The name for the elastic pool + * the database is moving into if available. + * @member {string} [currentElasticPoolName] The name of the current elastic + * pool the database is in if available. + * @member {string} [currentServiceObjective] The name of the current service + * objective if available. + * @member {string} [requestedServiceObjective] The name of the requested + * service objective if available. + * @member {string} [serverName] The name of the server the elastic pool is in. + * @member {date} [startTime] The time the operation started (ISO8601 format). + * @member {string} [state] The current state of the operation. */ -export interface CheckNameAvailabilityResponse { - readonly available?: boolean; - readonly message?: string; +export interface ElasticPoolDatabaseActivity extends ProxyResource { + location?: string; + readonly databaseName?: string; + readonly endTime?: Date; + readonly errorCode?: number; + readonly errorMessage?: string; + readonly errorSeverity?: number; + readonly operation?: string; + readonly operationId?: string; + readonly percentComplete?: number; + readonly requestedElasticPoolName?: string; + readonly currentElasticPoolName?: string; + readonly currentServiceObjective?: string; + readonly requestedServiceObjective?: string; + readonly serverName?: string; + readonly startTime?: Date; + readonly state?: string; +} + +/** + * @class + * Initializes a new instance of the OperationImpact class. + * @constructor + * The impact of an operation, both in absolute and relative terms. + * + * @member {string} [name] The name of the impact dimension. + * @member {string} [unit] The unit in which estimated impact to dimension is + * measured. + * @member {number} [changeValueAbsolute] The absolute impact to dimension. + * @member {number} [changeValueRelative] The relative impact to dimension + * (null if not applicable) + */ +export interface OperationImpact { readonly name?: string; - readonly reason?: string; + readonly unit?: string; + readonly changeValueAbsolute?: number; + readonly changeValueRelative?: number; } /** * @class - * Initializes a new instance of the RecommendedElasticPoolMetric class. + * Initializes a new instance of the RecommendedIndex class. * @constructor - * Represents recommended elastic pool metric. + * Represents a database recommended index. * - * @member {date} [dateTime] The time of metric (ISO8601 format). - * @member {number} [dtu] Gets or sets the DTUs (Database Transaction Units). - * See - * https://azure.microsoft.com/documentation/articles/sql-database-what-is-a-dtu/ - * @member {number} [sizeGB] Gets or sets size in gigabytes. + * @member {string} [action] The proposed index action. You can create a + * missing index, drop an unused index, or rebuild an existing index to improve + * its performance. Possible values include: 'Create', 'Drop', 'Rebuild' + * @member {string} [state] The current recommendation state. Possible values + * include: 'Active', 'Pending', 'Executing', 'Verifying', 'Pending Revert', + * 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success' + * @member {date} [created] The UTC datetime showing when this resource was + * created (ISO8601 format). + * @member {date} [lastModified] The UTC datetime of when was this resource + * last changed (ISO8601 format). + * @member {string} [indexType] The type of index (CLUSTERED, NONCLUSTERED, + * COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', + * 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE' + * @member {string} [schema] The schema where table to build index over resides + * @member {string} [table] The table on which to build index. + * @member {array} [columns] Columns over which to build index + * @member {array} [includedColumns] The list of column names to be included in + * the index + * @member {string} [indexScript] The full build index script + * @member {array} [estimatedImpact] The estimated impact of doing recommended + * index action. + * @member {array} [reportedImpact] The values reported after index action is + * complete. */ -export interface RecommendedElasticPoolMetric { - dateTime?: Date; - dtu?: number; - sizeGB?: number; +export interface RecommendedIndex extends ProxyResource { + readonly action?: string; + readonly state?: string; + readonly created?: Date; + readonly lastModified?: Date; + readonly indexType?: string; + readonly schema?: string; + readonly table?: string; + readonly columns?: string[]; + readonly includedColumns?: string[]; + readonly indexScript?: string; + readonly estimatedImpact?: OperationImpact[]; + readonly reportedImpact?: OperationImpact[]; +} + +/** + * @class + * Initializes a new instance of the TransparentDataEncryption class. + * @constructor + * Represents a database transparent data encryption configuration. + * + * @member {string} [location] Resource location. + * @member {string} [status] The status of the database transparent data + * encryption. Possible values include: 'Enabled', 'Disabled' + */ +export interface TransparentDataEncryption extends ProxyResource { + readonly location?: string; + status?: string; } /** @@ -930,9 +907,15 @@ export interface RecommendedElasticPoolMetric { * A Slo Usage Metric. * * @member {string} [serviceLevelObjective] The serviceLevelObjective for SLO - * usage metric. Possible values include: 'Basic', 'S0', 'S1', 'S2', 'S3', - * 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', 'System2', - * 'ElasticPool' + * usage metric. Possible values include: 'System', 'System0', 'System1', + * 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', 'Free', + * 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', 'P1', 'P2', + * 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', 'PRS6', 'DW100', + * 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', 'DW1200', 'DW1000c', + * 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', + * 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', 'DW10000c', 'DW15000c', + * 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', 'DS500', 'DS600', 'DS1000', + * 'DS1200', 'DS1500', 'DS2000', 'ElasticPool' * @member {uuid} [serviceLevelObjectiveId] The serviceLevelObjectiveId for SLO * usage metric. * @member {number} [inRangeTimeRatio] Gets or sets inRangeTimeRatio for SLO @@ -1015,1369 +998,2294 @@ export interface ServiceTierAdvisor extends ProxyResource { /** * @class - * Initializes a new instance of the TransparentDataEncryption class. + * Initializes a new instance of the TransparentDataEncryptionActivity class. * @constructor - * Represents a database transparent data encryption configuration. + * Represents a database transparent data encryption Scan. * * @member {string} [location] Resource location. - * @member {string} [status] The status of the database transparent data - * encryption. Possible values include: 'Enabled', 'Disabled' + * @member {string} [status] The status of the database. Possible values + * include: 'Encrypting', 'Decrypting' + * @member {number} [percentComplete] The percent complete of the transparent + * data encryption scan for a database. */ -export interface TransparentDataEncryption extends ProxyResource { +export interface TransparentDataEncryptionActivity extends ProxyResource { readonly location?: string; - status?: string; + readonly status?: string; + readonly percentComplete?: number; } /** * @class - * Initializes a new instance of the OperationImpact class. + * Initializes a new instance of the ServerUsage class. * @constructor - * The impact of an operation, both in absolute and relative terms. + * Represents server metrics. * - * @member {string} [name] The name of the impact dimension. - * @member {string} [unit] The unit in which estimated impact to dimension is - * measured. - * @member {number} [changeValueAbsolute] The absolute impact to dimension. - * @member {number} [changeValueRelative] The relative impact to dimension - * (null if not applicable) + * @member {string} [name] Name of the server usage metric. + * @member {string} [resourceName] The name of the resource. + * @member {string} [displayName] The metric display name. + * @member {number} [currentValue] The current value of the metric. + * @member {number} [limit] The current limit of the metric. + * @member {string} [unit] The units of the metric. + * @member {date} [nextResetTime] The next reset time for the metric (ISO8601 + * format). */ -export interface OperationImpact { +export interface ServerUsage { readonly name?: string; + readonly resourceName?: string; + readonly displayName?: string; + readonly currentValue?: number; + readonly limit?: number; readonly unit?: string; - readonly changeValueAbsolute?: number; - readonly changeValueRelative?: number; + readonly nextResetTime?: Date; } /** * @class - * Initializes a new instance of the RecommendedIndex class. + * Initializes a new instance of the DatabaseUsage class. * @constructor - * Represents a database recommended index. + * The database usages. * - * @member {string} [action] The proposed index action. You can create a - * missing index, drop an unused index, or rebuild an existing index to improve - * its performance. Possible values include: 'Create', 'Drop', 'Rebuild' - * @member {string} [state] The current recommendation state. Possible values - * include: 'Active', 'Pending', 'Executing', 'Verifying', 'Pending Revert', - * 'Reverting', 'Reverted', 'Ignored', 'Expired', 'Blocked', 'Success' - * @member {date} [created] The UTC datetime showing when this resource was - * created (ISO8601 format). - * @member {date} [lastModified] The UTC datetime of when was this resource - * last changed (ISO8601 format). - * @member {string} [indexType] The type of index (CLUSTERED, NONCLUSTERED, - * COLUMNSTORE, CLUSTERED COLUMNSTORE). Possible values include: 'CLUSTERED', - * 'NONCLUSTERED', 'COLUMNSTORE', 'CLUSTERED COLUMNSTORE' - * @member {string} [schema] The schema where table to build index over resides - * @member {string} [table] The table on which to build index. - * @member {array} [columns] Columns over which to build index - * @member {array} [includedColumns] The list of column names to be included in - * the index - * @member {string} [indexScript] The full build index script - * @member {array} [estimatedImpact] The estimated impact of doing recommended - * index action. - * @member {array} [reportedImpact] The values reported after index action is - * complete. + * @member {string} [name] The name of the usage metric. + * @member {string} [resourceName] The name of the resource. + * @member {string} [displayName] The usage metric display name. + * @member {number} [currentValue] The current value of the usage metric. + * @member {number} [limit] The current limit of the usage metric. + * @member {string} [unit] The units of the usage metric. + * @member {date} [nextResetTime] The next reset time for the usage metric + * (ISO8601 format). + */ +export interface DatabaseUsage { + readonly name?: string; + readonly resourceName?: string; + readonly displayName?: string; + readonly currentValue?: number; + readonly limit?: number; + readonly unit?: string; + readonly nextResetTime?: Date; +} + +/** + * @class + * Initializes a new instance of the DatabaseBlobAuditingPolicy class. + * @constructor + * A database blob auditing policy. + * + * @member {string} [kind] Resource kind. + * @member {string} state Specifies the state of the policy. If state is + * Enabled, storageEndpoint and storageAccountAccessKey are required. Possible + * values include: 'Enabled', 'Disabled' + * @member {string} [storageEndpoint] Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). If state is Enabled, + * storageEndpoint is required. + * @member {string} [storageAccountAccessKey] Specifies the identifier key of + * the auditing storage account. If state is Enabled, storageAccountAccessKey + * is required. + * @member {number} [retentionDays] Specifies the number of days to keep in the + * audit logs. + * @member {array} [auditActionsAndGroups] Specifies the Actions and + * Actions-Groups to audit. + * @member {uuid} [storageAccountSubscriptionId] Specifies the blob storage + * subscription Id. + * @member {boolean} [isStorageSecondaryKeyInUse] Specifies whether + * storageAccountAccessKey value is the storage’s secondary key. + */ +export interface DatabaseBlobAuditingPolicy extends ProxyResource { + readonly kind?: string; + state: string; + storageEndpoint?: string; + storageAccountAccessKey?: string; + retentionDays?: number; + auditActionsAndGroups?: string[]; + storageAccountSubscriptionId?: string; + isStorageSecondaryKeyInUse?: boolean; +} + +/** + * @class + * Initializes a new instance of the AutomaticTuningOptions class. + * @constructor + * Automatic tuning properties for individual advisors. + * + * @member {string} [desiredState] Automatic tuning option desired state. + * Possible values include: 'Off', 'On', 'Default' + * @member {string} [actualState] Automatic tuning option actual state. + * Possible values include: 'Off', 'On' + * @member {number} [reasonCode] Reason code if desired and actual state are + * different. + * @member {string} [reasonDesc] Reason description if desired and actual state + * are different. Possible values include: 'Default', 'Disabled', + * 'AutoConfigured', 'InheritedFromServer', 'QueryStoreOff', + * 'QueryStoreReadOnly', 'NotSupported' + */ +export interface AutomaticTuningOptions { + desiredState?: string; + readonly actualState?: string; + readonly reasonCode?: number; + readonly reasonDesc?: string; +} + +/** + * @class + * Initializes a new instance of the DatabaseAutomaticTuning class. + * @constructor + * Database-level Automatic Tuning. + * + * @member {string} [desiredState] Automatic tuning desired state. Possible + * values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + * @member {string} [actualState] Automatic tuning actual state. Possible + * values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + * @member {object} [options] Automatic tuning options definition. + */ +export interface DatabaseAutomaticTuning extends ProxyResource { + desiredState?: string; + readonly actualState?: string; + options?: { [propertyName: string]: AutomaticTuningOptions }; +} + +/** + * @class + * Initializes a new instance of the EncryptionProtector class. + * @constructor + * The server encryption protector. + * + * @member {string} [kind] Kind of encryption protector. This is metadata used + * for the Azure portal experience. + * @member {string} [location] Resource location. + * @member {string} [subregion] Subregion of the encryption protector. + * @member {string} [serverKeyName] The name of the server key. + * @member {string} serverKeyType The encryption protector type like + * 'ServiceManaged', 'AzureKeyVault'. Possible values include: + * 'ServiceManaged', 'AzureKeyVault' + * @member {string} [uri] The URI of the server key. + * @member {string} [thumbprint] Thumbprint of the server key. + */ +export interface EncryptionProtector extends ProxyResource { + kind?: string; + readonly location?: string; + readonly subregion?: string; + serverKeyName?: string; + serverKeyType: string; + readonly uri?: string; + readonly thumbprint?: string; +} + +/** + * @class + * Initializes a new instance of the FailoverGroupReadWriteEndpoint class. + * @constructor + * Read-write endpoint of the failover group instance. + * + * @member {string} failoverPolicy Failover policy of the read-write endpoint + * for the failover group. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. Possible values include: + * 'Manual', 'Automatic' + * @member {number} [failoverWithDataLossGracePeriodMinutes] Grace period + * before failover with data loss is attempted for the read-write endpoint. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is + * required. + */ +export interface FailoverGroupReadWriteEndpoint { + failoverPolicy: string; + failoverWithDataLossGracePeriodMinutes?: number; +} + +/** + * @class + * Initializes a new instance of the FailoverGroupReadOnlyEndpoint class. + * @constructor + * Read-only endpoint of the failover group instance. + * + * @member {string} [failoverPolicy] Failover policy of the read-only endpoint + * for the failover group. Possible values include: 'Disabled', 'Enabled' + */ +export interface FailoverGroupReadOnlyEndpoint { + failoverPolicy?: string; +} + +/** + * @class + * Initializes a new instance of the PartnerInfo class. + * @constructor + * Partner server information for the failover group. + * + * @member {string} id Resource identifier of the partner server. + * @member {string} [location] Geo location of the partner server. + * @member {string} [replicationRole] Replication role of the partner server. + * Possible values include: 'Primary', 'Secondary' + */ +export interface PartnerInfo { + id: string; + readonly location?: string; + readonly replicationRole?: string; +} + +/** + * @class + * Initializes a new instance of the FailoverGroup class. + * @constructor + * A failover group. + * + * @member {string} [location] Resource location. + * @member {object} [tags] Resource tags. + * @member {object} readWriteEndpoint Read-write endpoint of the failover group + * instance. + * @member {string} [readWriteEndpoint.failoverPolicy] Failover policy of the + * read-write endpoint for the failover group. If failoverPolicy is Automatic + * then failoverWithDataLossGracePeriodMinutes is required. Possible values + * include: 'Manual', 'Automatic' + * @member {number} [readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] + * Grace period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * @member {object} [readOnlyEndpoint] Read-only endpoint of the failover group + * instance. + * @member {string} [readOnlyEndpoint.failoverPolicy] Failover policy of the + * read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * @member {string} [replicationRole] Local replication role of the failover + * group instance. Possible values include: 'Primary', 'Secondary' + * @member {string} [replicationState] Replication state of the failover group + * instance. + * @member {array} partnerServers List of partner server information for the + * failover group. + * @member {array} [databases] List of databases in the failover group. + */ +export interface FailoverGroup extends ProxyResource { + readonly location?: string; + tags?: { [propertyName: string]: string }; + readWriteEndpoint: FailoverGroupReadWriteEndpoint; + readOnlyEndpoint?: FailoverGroupReadOnlyEndpoint; + readonly replicationRole?: string; + readonly replicationState?: string; + partnerServers: PartnerInfo[]; + databases?: string[]; +} + +/** + * @class + * Initializes a new instance of the FailoverGroupUpdate class. + * @constructor + * A failover group update request. + * + * @member {object} [readWriteEndpoint] Read-write endpoint of the failover + * group instance. + * @member {string} [readWriteEndpoint.failoverPolicy] Failover policy of the + * read-write endpoint for the failover group. If failoverPolicy is Automatic + * then failoverWithDataLossGracePeriodMinutes is required. Possible values + * include: 'Manual', 'Automatic' + * @member {number} [readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] + * Grace period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * @member {object} [readOnlyEndpoint] Read-only endpoint of the failover group + * instance. + * @member {string} [readOnlyEndpoint.failoverPolicy] Failover policy of the + * read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * @member {array} [databases] List of databases in the failover group. + * @member {object} [tags] Resource tags. + */ +export interface FailoverGroupUpdate { + readWriteEndpoint?: FailoverGroupReadWriteEndpoint; + readOnlyEndpoint?: FailoverGroupReadOnlyEndpoint; + databases?: string[]; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ResourceIdentity class. + * @constructor + * Azure Active Directory identity configuration for a resource. + * + * @member {uuid} [principalId] The Azure Active Directory principal id. + * @member {string} [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' + * @member {uuid} [tenantId] The Azure Active Directory tenant id. + */ +export interface ResourceIdentity { + readonly principalId?: string; + type?: string; + readonly tenantId?: string; +} + +/** + * @class + * Initializes a new instance of the Sku class. + * @constructor + * An ARM Resource SKU. + * + * @member {string} name The name of the SKU, typically, a letter + Number + * code, e.g. P3. + * @member {string} [tier] The tier of the particular SKU, e.g. Basic, Premium. + * @member {string} [size] Size of the particular SKU + * @member {string} [family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [capacity] Capacity of the particular SKU. + */ +export interface Sku { + name: string; + tier?: string; + size?: string; + family?: string; + capacity?: number; +} + +/** + * @class + * Initializes a new instance of the ManagedInstance class. + * @constructor + * An Azure SQL managed instance. + * + * @member {object} [identity] The Azure Active Directory identity of the + * managed instance. + * @member {uuid} [identity.principalId] The Azure Active Directory principal + * id. + * @member {string} [identity.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' + * @member {uuid} [identity.tenantId] The Azure Active Directory tenant id. + * @member {object} [sku] Managed instance sku + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {string} [fullyQualifiedDomainName] The fully qualified domain name + * of the managed instance. + * @member {string} [administratorLogin] Administrator username for the managed + * instance. Can only be specified when the managed instance is being created + * (and is required for creation). + * @member {string} [administratorLoginPassword] The administrator login + * password (required for managed instance creation). + * @member {string} [subnetId] Subnet resource ID for the managed instance. + * @member {string} [state] The state of the managed instance. + * @member {string} [licenseType] The license type. Possible values are + * 'LicenseIncluded' and 'BasePrice'. + * @member {number} [vCores] The number of VCores. + * @member {number} [storageSizeInGB] The maximum storage size in GB. + */ +export interface ManagedInstance extends TrackedResource { + identity?: ResourceIdentity; + sku?: Sku; + readonly fullyQualifiedDomainName?: string; + administratorLogin?: string; + administratorLoginPassword?: string; + subnetId?: string; + readonly state?: string; + licenseType?: string; + vCores?: number; + storageSizeInGB?: number; +} + +/** + * @class + * Initializes a new instance of the ManagedInstanceUpdate class. + * @constructor + * An update request for an Azure SQL Database managed instance. + * + * @member {object} [sku] Managed instance sku + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {string} [fullyQualifiedDomainName] The fully qualified domain name + * of the managed instance. + * @member {string} [administratorLogin] Administrator username for the managed + * instance. Can only be specified when the managed instance is being created + * (and is required for creation). + * @member {string} [administratorLoginPassword] The administrator login + * password (required for managed instance creation). + * @member {string} [subnetId] Subnet resource ID for the managed instance. + * @member {string} [state] The state of the managed instance. + * @member {string} [licenseType] The license type. Possible values are + * 'LicenseIncluded' and 'BasePrice'. + * @member {number} [vCores] The number of VCores. + * @member {number} [storageSizeInGB] The maximum storage size in GB. + * @member {object} [tags] Resource tags. + */ +export interface ManagedInstanceUpdate { + sku?: Sku; + readonly fullyQualifiedDomainName?: string; + administratorLogin?: string; + administratorLoginPassword?: string; + subnetId?: string; + readonly state?: string; + licenseType?: string; + vCores?: number; + storageSizeInGB?: number; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * Display metadata associated with the operation. + * + * @member {string} [provider] The localized friendly form of the resource + * provider name. + * @member {string} [resource] The localized friendly form of the resource type + * related to this action/operation. + * @member {string} [operation] The localized friendly name for the operation. + * @member {string} [description] The localized friendly description for the + * operation. + */ +export interface OperationDisplay { + readonly provider?: string; + readonly resource?: string; + readonly operation?: string; + readonly description?: string; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * SQL REST API operation definition. + * + * @member {string} [name] The name of the operation being performed on this + * particular object. + * @member {object} [display] The localized display information for this + * particular operation / action. + * @member {string} [display.provider] The localized friendly form of the + * resource provider name. + * @member {string} [display.resource] The localized friendly form of the + * resource type related to this action/operation. + * @member {string} [display.operation] The localized friendly name for the + * operation. + * @member {string} [display.description] The localized friendly description + * for the operation. + * @member {string} [origin] The intended executor of the operation. Possible + * values include: 'user', 'system' + * @member {object} [properties] Additional descriptions for the operation. + */ +export interface Operation { + readonly name?: string; + readonly display?: OperationDisplay; + readonly origin?: string; + readonly properties?: { [propertyName: string]: any }; +} + +/** + * @class + * Initializes a new instance of the ServerKey class. + * @constructor + * A server key. + * + * @member {string} [kind] Kind of encryption protector. This is metadata used + * for the Azure portal experience. + * @member {string} [location] Resource location. + * @member {string} [subregion] Subregion of the server key. + * @member {string} serverKeyType The server key type like 'ServiceManaged', + * 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' + * @member {string} [uri] The URI of the server key. + * @member {string} [thumbprint] Thumbprint of the server key. + * @member {date} [creationDate] The server key creation date. + */ +export interface ServerKey extends ProxyResource { + kind?: string; + readonly location?: string; + readonly subregion?: string; + serverKeyType: string; + uri?: string; + thumbprint?: string; + creationDate?: Date; +} + +/** + * @class + * Initializes a new instance of the Server class. + * @constructor + * An Azure SQL Database server. + * + * @member {object} [identity] The Azure Active Directory identity of the + * server. + * @member {uuid} [identity.principalId] The Azure Active Directory principal + * id. + * @member {string} [identity.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' + * @member {uuid} [identity.tenantId] The Azure Active Directory tenant id. + * @member {string} [kind] Kind of sql server. This is metadata used for the + * Azure portal experience. + * @member {string} [administratorLogin] Administrator username for the server. + * Once created it cannot be changed. + * @member {string} [administratorLoginPassword] The administrator login + * password (required for server creation). + * @member {string} [version] The version of the server. + * @member {string} [state] The state of the server. + * @member {string} [fullyQualifiedDomainName] The fully qualified domain name + * of the server. + */ +export interface Server extends TrackedResource { + identity?: ResourceIdentity; + readonly kind?: string; + administratorLogin?: string; + administratorLoginPassword?: string; + version?: string; + readonly state?: string; + readonly fullyQualifiedDomainName?: string; +} + +/** + * @class + * Initializes a new instance of the ServerUpdate class. + * @constructor + * An update request for an Azure SQL Database server. + * + * @member {string} [administratorLogin] Administrator username for the server. + * Once created it cannot be changed. + * @member {string} [administratorLoginPassword] The administrator login + * password (required for server creation). + * @member {string} [version] The version of the server. + * @member {string} [state] The state of the server. + * @member {string} [fullyQualifiedDomainName] The fully qualified domain name + * of the server. + * @member {object} [tags] Resource tags. + */ +export interface ServerUpdate { + administratorLogin?: string; + administratorLoginPassword?: string; + version?: string; + readonly state?: string; + readonly fullyQualifiedDomainName?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the SyncAgent class. + * @constructor + * An Azure SQL Database sync agent. + * + * @member {string} [syncAgentName] Name of the sync agent. + * @member {string} [syncDatabaseId] ARM resource id of the sync database in + * the sync agent. + * @member {date} [lastAliveTime] Last alive time of the sync agent. + * @member {string} [state] State of the sync agent. Possible values include: + * 'Online', 'Offline', 'NeverConnected' + * @member {boolean} [isUpToDate] If the sync agent version is up to date. + * @member {date} [expiryTime] Expiration time of the sync agent version. + * @member {string} [version] Version of the sync agent. + */ +export interface SyncAgent extends ProxyResource { + readonly syncAgentName?: string; + syncDatabaseId?: string; + readonly lastAliveTime?: Date; + readonly state?: string; + readonly isUpToDate?: boolean; + readonly expiryTime?: Date; + readonly version?: string; +} + +/** + * @class + * Initializes a new instance of the SyncAgentKeyProperties class. + * @constructor + * Properties of an Azure SQL Database sync agent key. + * + * @member {string} [syncAgentKey] Key of sync agent. + */ +export interface SyncAgentKeyProperties { + readonly syncAgentKey?: string; +} + +/** + * @class + * Initializes a new instance of the SyncAgentLinkedDatabase class. + * @constructor + * An Azure SQL Database sync agent linked database. + * + * @member {string} [databaseType] Type of the sync agent linked database. + * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * @member {string} [databaseId] Id of the sync agent linked database. + * @member {string} [description] Description of the sync agent linked + * database. + * @member {string} [serverName] Server name of the sync agent linked database. + * @member {string} [databaseName] Database name of the sync agent linked + * database. + * @member {string} [userName] User name of the sync agent linked database. + */ +export interface SyncAgentLinkedDatabase extends ProxyResource { + readonly databaseType?: string; + readonly databaseId?: string; + readonly description?: string; + readonly serverName?: string; + readonly databaseName?: string; + readonly userName?: string; +} + +/** + * @class + * Initializes a new instance of the SyncDatabaseIdProperties class. + * @constructor + * Properties of the sync database id. + * + * @member {string} [id] ARM resource id of sync database. + */ +export interface SyncDatabaseIdProperties { + readonly id?: string; +} + +/** + * @class + * Initializes a new instance of the SyncFullSchemaTableColumn class. + * @constructor + * Properties of the column in the table of database full schema. + * + * @member {string} [dataSize] Data size of the column. + * @member {string} [dataType] Data type of the column. + * @member {string} [errorId] Error id of the column. + * @member {boolean} [hasError] If there is error in the table. + * @member {boolean} [isPrimaryKey] If it is the primary key of the table. + * @member {string} [name] Name of the column. + * @member {string} [quotedName] Quoted name of the column. + */ +export interface SyncFullSchemaTableColumn { + readonly dataSize?: string; + readonly dataType?: string; + readonly errorId?: string; + readonly hasError?: boolean; + readonly isPrimaryKey?: boolean; + readonly name?: string; + readonly quotedName?: string; +} + +/** + * @class + * Initializes a new instance of the SyncFullSchemaTable class. + * @constructor + * Properties of the table in the database full schema. + * + * @member {array} [columns] List of columns in the table of database full + * schema. + * @member {string} [errorId] Error id of the table. + * @member {boolean} [hasError] If there is error in the table. + * @member {string} [name] Name of the table. + * @member {string} [quotedName] Quoted name of the table. */ -export interface RecommendedIndex extends ProxyResource { - readonly action?: string; - readonly state?: string; - readonly created?: Date; - readonly lastModified?: Date; - readonly indexType?: string; - readonly schema?: string; - readonly table?: string; - readonly columns?: string[]; - readonly includedColumns?: string[]; - readonly indexScript?: string; - readonly estimatedImpact?: OperationImpact[]; - readonly reportedImpact?: OperationImpact[]; +export interface SyncFullSchemaTable { + readonly columns?: SyncFullSchemaTableColumn[]; + readonly errorId?: string; + readonly hasError?: boolean; + readonly name?: string; + readonly quotedName?: string; } /** * @class - * Initializes a new instance of the Database class. + * Initializes a new instance of the SyncFullSchemaProperties class. * @constructor - * Represents a database. + * Properties of the database full schema. * - * @member {string} [kind] Kind of database. This is metadata used for the - * Azure portal experience. - * @member {string} [collation] The collation of the database. If createMode is - * not Default, this value is ignored. - * @member {date} [creationDate] The creation date of the database (ISO8601 - * format). - * @member {number} [containmentState] The containment state of the database. - * @member {uuid} [currentServiceObjectiveId] The current service level - * objective ID of the database. This is the ID of the service level objective - * that is currently active. - * @member {uuid} [databaseId] The ID of the database. - * @member {date} [earliestRestoreDate] This records the earliest start date - * and time that restore is available for this database (ISO8601 format). - * @member {string} [createMode] Specifies the mode of database creation. + * @member {array} [tables] List of tables in the database full schema. + * @member {date} [lastUpdateTime] Last update time of the database schema. + */ +export interface SyncFullSchemaProperties { + readonly tables?: SyncFullSchemaTable[]; + readonly lastUpdateTime?: Date; +} + +/** + * @class + * Initializes a new instance of the SyncGroupLogProperties class. + * @constructor + * Properties of an Azure SQL Database sync group log. * - * Default: regular database creation. + * @member {date} [timestamp] Timestamp of the sync group log. + * @member {string} [type] Type of the sync group log. Possible values include: + * 'All', 'Error', 'Warning', 'Success' + * @member {string} [source] Source of the sync group log. + * @member {string} [details] Details of the sync group log. + * @member {uuid} [tracingId] TracingId of the sync group log. + * @member {string} [operationStatus] OperationStatus of the sync group log. + */ +export interface SyncGroupLogProperties { + readonly timestamp?: Date; + readonly type?: string; + readonly source?: string; + readonly details?: string; + readonly tracingId?: string; + readonly operationStatus?: string; +} + +/** + * @class + * Initializes a new instance of the SyncGroupSchemaTableColumn class. + * @constructor + * Properties of column in sync group table. * - * Copy: creates a database as a copy of an existing database. sourceDatabaseId - * must be specified as the resource ID of the source database. + * @member {string} [quotedName] Quoted name of sync group table column. + * @member {string} [dataSize] Data size of the column. + * @member {string} [dataType] Data type of the column. + */ +export interface SyncGroupSchemaTableColumn { + quotedName?: string; + dataSize?: string; + dataType?: string; +} + +/** + * @class + * Initializes a new instance of the SyncGroupSchemaTable class. + * @constructor + * Properties of table in sync group schema. * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) secondary replica of an existing database. sourceDatabaseId - * must be specified as the resource ID of the existing primary database. + * @member {array} [columns] List of columns in sync group schema. + * @member {string} [quotedName] Quoted name of sync group schema table. + */ +export interface SyncGroupSchemaTable { + columns?: SyncGroupSchemaTableColumn[]; + quotedName?: string; +} + +/** + * @class + * Initializes a new instance of the SyncGroupSchema class. + * @constructor + * Properties of sync group schema. * - * 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. + * @member {array} [tables] List of tables in sync group schema. + * @member {string} [masterSyncMemberName] Name of master sync member where the + * schema is from. + */ +export interface SyncGroupSchema { + tables?: SyncGroupSchemaTable[]; + masterSyncMemberName?: string; +} + +/** + * @class + * Initializes a new instance of the SyncGroup class. + * @constructor + * An Azure SQL Database sync group. * - * Recovery: Creates a database by restoring a geo-replicated backup. - * sourceDatabaseId must be specified as the recoverable database resource ID - * to restore. + * @member {number} [interval] Sync interval of the sync group. + * @member {date} [lastSyncTime] Last sync time of the sync group. + * @member {string} [conflictResolutionPolicy] Conflict resolution policy of + * the sync group. Possible values include: 'HubWin', 'MemberWin' + * @member {string} [syncDatabaseId] ARM resource id of the sync database in + * the sync group. + * @member {string} [hubDatabaseUserName] User name for the sync group hub + * database credential. + * @member {string} [hubDatabasePassword] Password for the sync group hub + * database credential. + * @member {string} [syncState] Sync state of the sync group. Possible values + * include: 'NotReady', 'Error', 'Warning', 'Progressing', 'Good' + * @member {object} [schema] Sync schema of the sync group. + * @member {array} [schema.tables] List of tables in sync group schema. + * @member {string} [schema.masterSyncMemberName] Name of master sync member + * where the schema is from. + */ +export interface SyncGroup extends ProxyResource { + interval?: number; + readonly lastSyncTime?: Date; + conflictResolutionPolicy?: string; + syncDatabaseId?: string; + hubDatabaseUserName?: string; + hubDatabasePassword?: string; + readonly syncState?: string; + schema?: SyncGroupSchema; +} + +/** + * @class + * Initializes a new instance of the SyncMember class. + * @constructor + * An Azure SQL Database sync member. * - * 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. + * @member {string} [databaseType] Database type of the sync member. Possible + * values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * @member {string} [syncAgentId] ARM resource id of the sync agent in the sync + * member. + * @member {uuid} [sqlServerDatabaseId] SQL Server database id of the sync + * member. + * @member {string} [serverName] Server name of the member database in the sync + * member + * @member {string} [databaseName] Database name of the member database in the + * sync member. + * @member {string} [userName] User name of the member database in the sync + * member. + * @member {string} [password] Password of the member database in the sync + * member. + * @member {string} [syncDirection] Sync direction of the sync member. Possible + * values include: 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember' + * @member {string} [syncState] Sync state of the sync member. Possible values + * include: 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', + * 'DisabledTombstoneCleanup', 'DisabledBackupRestore', + * 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', + * 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', + * 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', 'Reprovisioning', + * 'ReprovisionFailed', 'UnReprovisioned' + */ +export interface SyncMember extends ProxyResource { + databaseType?: string; + syncAgentId?: string; + sqlServerDatabaseId?: string; + serverName?: string; + databaseName?: string; + userName?: string; + password?: string; + syncDirection?: string; + readonly syncState?: string; +} + +/** + * @class + * Initializes a new instance of the SubscriptionUsage class. + * @constructor + * Usage Metric of a Subscription in a Location. * - * RestoreLongTermRetentionBackup: Creates a database by restoring from a long - * term retention vault. recoveryServicesRecoveryPointResourceId must be - * specified as the recovery point resource ID. + * @member {string} [displayName] User-readable name of the metric. + * @member {number} [currentValue] Current value of the metric. + * @member {number} [limit] Boundary value of the metric. + * @member {string} [unit] Unit of the metric. + */ +export interface SubscriptionUsage extends ProxyResource { + readonly displayName?: string; + readonly currentValue?: number; + readonly limit?: number; + readonly unit?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkRule class. + * @constructor + * A virtual network rule. + * + * @member {string} virtualNetworkSubnetId The ARM resource id of the virtual + * network subnet. + * @member {boolean} [ignoreMissingVnetServiceEndpoint] Create firewall rule + * before the virtual network has vnet service endpoint enabled. + * @member {string} [state] Virtual Network Rule State. Possible values + * include: 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown' + */ +export interface VirtualNetworkRule extends ProxyResource { + virtualNetworkSubnetId: string; + ignoreMissingVnetServiceEndpoint?: boolean; + readonly state?: string; +} + +/** + * @class + * Initializes a new instance of the LongTermRetentionBackup class. + * @constructor + * A long term retention backup. + * + * @member {string} [serverName] The server name that the backup database + * belong to. + * @member {date} [serverCreateTime] The create time of the server. + * @member {string} [databaseName] The name of the database the backup belong + * to + * @member {date} [databaseDeletionTime] The delete time of the database + * @member {date} [backupTime] The time the backup was taken + * @member {date} [backupExpirationTime] The time the long term retention + * backup will expire. + */ +export interface LongTermRetentionBackup extends ProxyResource { + readonly serverName?: string; + readonly serverCreateTime?: Date; + readonly databaseName?: string; + readonly databaseDeletionTime?: Date; + readonly backupTime?: Date; + readonly backupExpirationTime?: Date; +} + +/** + * @class + * Initializes a new instance of the BackupLongTermRetentionPolicy class. + * @constructor + * A long term retention policy. + * + * @member {string} [weeklyRetention] The weekly retention policy for an LTR + * backup in an ISO 8601 format. + * @member {string} [monthlyRetention] The montly retention policy for an LTR + * backup in an ISO 8601 format. + * @member {string} [yearlyRetention] The yearly retention policy for an LTR + * backup in an ISO 8601 format. + * @member {number} [weekOfYear] The week of year to take the yearly backup in + * an ISO 8601 format. + */ +export interface BackupLongTermRetentionPolicy extends ProxyResource { + weeklyRetention?: string; + monthlyRetention?: string; + yearlyRetention?: string; + weekOfYear?: number; +} + +/** + * @class + * Initializes a new instance of the CompleteDatabaseRestoreDefinition class. + * @constructor + * Contains the information necessary to perform a complete database restore + * operation. + * + * @member {string} lastBackupName The last backup name to apply + */ +export interface CompleteDatabaseRestoreDefinition { + lastBackupName: string; +} + +/** + * @class + * Initializes a new instance of the ManagedDatabase class. + * @constructor + * A managed database resource. + * + * @member {string} [collation] Collation of the managed database. + * @member {string} [status] Status for the database. Possible values include: + * 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible' + * @member {date} [creationDate] Creation date of the database. + * @member {date} [earliestRestorePoint] Earliest restore point in time for + * point in time restore. + * @member {date} [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. + * @member {string} [defaultSecondaryLocation] Geo paired region. + * @member {string} [catalogCollation] Collation of the metadata catalog. + * Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS' + * @member {string} [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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * @member {string} [storageContainerUri] Conditional. If createMode is + * RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * @member {string} [sourceDatabaseId] The resource identifier of the source + * database associated with create operation of this database. + * @member {string} [storageContainerSasToken] Conditional. If createMode is + * RestoreExternalBackup, this value is required. Specifies the storage + * container sas token. + * @member {string} [failoverGroupId] Instance Failover Group resource + * identifier that this managed database belongs to. + */ +export interface ManagedDatabase extends TrackedResource { + collation?: string; + readonly status?: string; + readonly creationDate?: Date; + readonly earliestRestorePoint?: Date; + restorePointInTime?: Date; + readonly defaultSecondaryLocation?: string; + catalogCollation?: string; + createMode?: string; + storageContainerUri?: string; + sourceDatabaseId?: string; + storageContainerSasToken?: string; + readonly failoverGroupId?: string; +} + +/** + * @class + * Initializes a new instance of the ManagedDatabaseUpdate class. + * @constructor + * An managed database update. * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * @member {string} [sourceDatabaseId] Conditional. If createMode is Copy, - * NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or - * Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * @member {date} [sourceDatabaseDeletionDate] Conditional. If createMode is - * Restore and sourceDatabaseId is the deleted database's original resource id - * when it existed (as opposed to its current restorable dropped database id), - * then this value is required. Specifies the time that the database was - * deleted. + * @member {string} [collation] Collation of the managed database. + * @member {string} [status] Status for the database. Possible values include: + * 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible' + * @member {date} [creationDate] Creation date of the database. + * @member {date} [earliestRestorePoint] Earliest restore point in time for + * point in time restore. * @member {date} [restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * @member {string} [recoveryServicesRecoveryPointResourceId] Conditional. If - * createMode is RestoreLongTermRetentionBackup, then this value is required. - * Specifies the resource ID of the recovery point to restore from. - * @member {string} [edition] The edition of the database. The DatabaseEditions - * enumeration contains all the valid editions. If createMode is - * NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * @member {string} [maxSizeBytes] The max size of the database expressed in - * bytes. If createMode is not Default, this value is ignored. To see possible - * values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * @member {uuid} [requestedServiceObjectiveId] The configured service level - * objective ID of the database. This is the service level objective that is in - * the process of being applied to the database. Once successfully updated, it - * will match the value of currentServiceObjectiveId property. If - * requestedServiceObjectiveId and requestedServiceObjectiveName are both - * updated, the value of requestedServiceObjectiveId overrides the value of - * requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * @member {string} [requestedServiceObjectiveName] The name of the configured - * service level objective of the database. This is the service level objective - * that is in the process of being applied to the database. Once successfully - * updated, it will match the value of serviceLevelObjective property. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * @member {string} [serviceLevelObjective] The current service level objective - * of the database. Possible values include: 'Basic', 'S0', 'S1', 'S2', 'S3', - * 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', 'System2', - * 'ElasticPool' - * @member {string} [status] The status of the database. - * @member {string} [elasticPoolName] The name of the elastic pool the database - * is in. If elasticPoolName and requestedServiceObjectiveName are both - * updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * @member {string} [defaultSecondaryLocation] The default secondary region for - * this database. - * @member {array} [serviceTierAdvisors] The list of service tier advisors for - * this database. Expanded property - * @member {array} [transparentDataEncryption] The transparent data encryption - * info for this database. - * @member {array} [recommendedIndex] The recommended indices for this - * database. - * @member {string} [failoverGroupId] The resource identifier of the failover - * group containing this database. - * @member {string} [readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * @member {string} [sampleName] Indicates the name of the sample schema to - * apply when creating this database. If createMode is not Default, this value - * is ignored. Not supported for DataWarehouse edition. Possible values - * include: 'AdventureWorksLT' + * 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. + * @member {string} [defaultSecondaryLocation] Geo paired region. + * @member {string} [catalogCollation] Collation of the metadata catalog. + * Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS' + * @member {string} [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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * @member {string} [storageContainerUri] Conditional. If createMode is + * RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * @member {string} [sourceDatabaseId] The resource identifier of the source + * database associated with create operation of this database. + * @member {string} [storageContainerSasToken] Conditional. If createMode is + * RestoreExternalBackup, this value is required. Specifies the storage + * container sas token. + * @member {string} [failoverGroupId] Instance Failover Group resource + * identifier that this managed database belongs to. + * @member {object} [tags] Resource tags. */ -export interface Database extends TrackedResource { - readonly kind?: string; +export interface ManagedDatabaseUpdate { collation?: string; + readonly status?: string; readonly creationDate?: Date; - readonly containmentState?: number; - readonly currentServiceObjectiveId?: string; - readonly databaseId?: string; - readonly earliestRestoreDate?: Date; - createMode?: string; - sourceDatabaseId?: string; - sourceDatabaseDeletionDate?: Date; + readonly earliestRestorePoint?: Date; restorePointInTime?: Date; - recoveryServicesRecoveryPointResourceId?: string; - edition?: string; - maxSizeBytes?: string; - requestedServiceObjectiveId?: string; - requestedServiceObjectiveName?: string; - readonly serviceLevelObjective?: string; - readonly status?: string; - elasticPoolName?: string; readonly defaultSecondaryLocation?: string; - readonly serviceTierAdvisors?: ServiceTierAdvisor[]; - readonly transparentDataEncryption?: TransparentDataEncryption[]; - readonly recommendedIndex?: RecommendedIndex[]; + catalogCollation?: string; + createMode?: string; + storageContainerUri?: string; + sourceDatabaseId?: string; + storageContainerSasToken?: string; readonly failoverGroupId?: string; - readScale?: string; - sampleName?: string; + tags?: { [propertyName: string]: string }; } /** * @class - * Initializes a new instance of the RecommendedElasticPool class. + * Initializes a new instance of the AutomaticTuningServerOptions class. * @constructor - * Represents a recommented elastic pool. + * Automatic tuning properties for individual advisors. * - * @member {string} [databaseEdition] The edition of the recommended elastic - * pool. The ElasticPoolEdition enumeration contains all the valid editions. - * Possible values include: 'Basic', 'Standard', 'Premium' - * @member {number} [dtu] The DTU for the recommended elastic pool. - * @member {number} [databaseDtuMin] The minimum DTU for the database. - * @member {number} [databaseDtuMax] The maximum DTU for the database. - * @member {number} [storageMB] Gets storage size in megabytes. - * @member {date} [observationPeriodStart] The observation period start - * (ISO8601 format). - * @member {date} [observationPeriodEnd] The observation period start (ISO8601 - * format). - * @member {number} [maxObservedDtu] Gets maximum observed DTU. - * @member {number} [maxObservedStorageMB] Gets maximum observed storage in - * megabytes. - * @member {array} [databases] The list of databases in this pool. Expanded - * property - * @member {array} [metrics] The list of databases housed in the server. - * Expanded property + * @member {string} [desiredState] Automatic tuning option desired state. + * Possible values include: 'Off', 'On', 'Default' + * @member {string} [actualState] Automatic tuning option actual state. + * Possible values include: 'Off', 'On' + * @member {number} [reasonCode] Reason code if desired and actual state are + * different. + * @member {string} [reasonDesc] Reason description if desired and actual state + * are different. Possible values include: 'Default', 'Disabled', + * 'AutoConfigured' */ -export interface RecommendedElasticPool extends ProxyResource { - readonly databaseEdition?: string; - dtu?: number; - databaseDtuMin?: number; - databaseDtuMax?: number; - storageMB?: number; - readonly observationPeriodStart?: Date; - readonly observationPeriodEnd?: Date; - readonly maxObservedDtu?: number; - readonly maxObservedStorageMB?: number; - readonly databases?: Database[]; - readonly metrics?: RecommendedElasticPoolMetric[]; +export interface AutomaticTuningServerOptions { + desiredState?: string; + readonly actualState?: string; + readonly reasonCode?: number; + readonly reasonDesc?: string; } /** * @class - * Initializes a new instance of the ElasticPool class. + * Initializes a new instance of the ServerAutomaticTuning class. * @constructor - * Represents a database elastic pool. + * Server-level Automatic Tuning. * - * @member {date} [creationDate] The creation date of the elastic pool (ISO8601 - * format). - * @member {string} [state] The state of the elastic pool. Possible values - * include: 'Creating', 'Ready', 'Disabled' - * @member {string} [edition] The edition of the elastic pool. Possible values - * include: 'Basic', 'Standard', 'Premium' - * @member {number} [dtu] The total shared DTU for the database elastic pool. - * @member {number} [databaseDtuMax] The maximum DTU any one database can - * consume. - * @member {number} [databaseDtuMin] The minimum DTU all databases are - * guaranteed. - * @member {number} [storageMB] Gets storage limit for the database elastic - * pool in MB. - * @member {string} [kind] Kind of elastic pool. This is metadata used for the - * Azure portal experience. + * @member {string} [desiredState] Automatic tuning desired state. Possible + * values include: 'Custom', 'Auto', 'Unspecified' + * @member {string} [actualState] Automatic tuning actual state. Possible + * values include: 'Custom', 'Auto', 'Unspecified' + * @member {object} [options] Automatic tuning options definition. */ -export interface ElasticPool extends TrackedResource { - readonly creationDate?: Date; - readonly state?: string; - edition?: string; - dtu?: number; - databaseDtuMax?: number; - databaseDtuMin?: number; - storageMB?: number; - readonly kind?: string; +export interface ServerAutomaticTuning extends ProxyResource { + desiredState?: string; + readonly actualState?: string; + options?: { [propertyName: string]: AutomaticTuningServerOptions }; } /** * @class - * Initializes a new instance of the ElasticPoolUpdate class. + * Initializes a new instance of the ServerDnsAlias class. * @constructor - * Represents an elastic pool update. + * A server DNS alias. * - * @member {object} [tags] Resource tags. - * @member {date} [creationDate] The creation date of the elastic pool (ISO8601 - * format). - * @member {string} [state] The state of the elastic pool. Possible values - * include: 'Creating', 'Ready', 'Disabled' - * @member {string} [edition] The edition of the elastic pool. Possible values - * include: 'Basic', 'Standard', 'Premium' - * @member {number} [dtu] The total shared DTU for the database elastic pool. - * @member {number} [databaseDtuMax] The maximum DTU any one database can - * consume. - * @member {number} [databaseDtuMin] The minimum DTU all databases are - * guaranteed. - * @member {number} [storageMB] Gets storage limit for the database elastic - * pool in MB. + * @member {string} [azureDnsRecord] The fully qualified DNS record for alias */ -export interface ElasticPoolUpdate extends Resource { - tags?: { [propertyName: string]: string }; - readonly creationDate?: Date; - readonly state?: string; - edition?: string; - dtu?: number; - databaseDtuMax?: number; - databaseDtuMin?: number; - storageMB?: number; +export interface ServerDnsAlias extends ProxyResource { + readonly azureDnsRecord?: string; } /** * @class - * Initializes a new instance of the ElasticPoolActivity class. + * Initializes a new instance of the ServerDnsAliasAcquisition class. * @constructor - * Represents the activity on an elastic pool. + * A server DNS alias acquisition request. * - * @member {string} [location] The geo-location where the resource lives - * @member {date} [endTime] The time the operation finished (ISO8601 format). - * @member {number} [errorCode] The error code if available. - * @member {string} [errorMessage] The error message if available. - * @member {number} [errorSeverity] The error severity if available. - * @member {string} [operation] The operation name. - * @member {uuid} [operationId] The unique operation ID. - * @member {number} [percentComplete] The percentage complete if available. - * @member {number} [requestedDatabaseDtuMax] The requested max DTU per - * database if available. - * @member {number} [requestedDatabaseDtuMin] The requested min DTU per - * database if available. - * @member {number} [requestedDtu] The requested DTU for the pool if available. - * @member {string} [requestedElasticPoolName] The requested name for the - * elastic pool if available. - * @member {number} [requestedStorageLimitInGB] The requested storage limit for - * the pool in GB if available. - * @member {string} [elasticPoolName] The name of the elastic pool. - * @member {string} [serverName] The name of the server the elastic pool is in. - * @member {date} [startTime] The time the operation started (ISO8601 format). - * @member {string} [state] The current state of the operation. - * @member {number} [requestedStorageLimitInMB] The requested storage limit in - * MB. - * @member {number} [requestedDatabaseDtuGuarantee] The requested per database - * DTU guarantee. - * @member {number} [requestedDatabaseDtuCap] The requested per database DTU - * cap. - * @member {number} [requestedDtuGuarantee] The requested DTU guarantee. + * @member {string} [oldServerDnsAliasId] The id of the server alias that will + * be acquired to point to this server instead. */ -export interface ElasticPoolActivity extends ProxyResource { - location?: string; - readonly endTime?: Date; - readonly errorCode?: number; - readonly errorMessage?: string; - readonly errorSeverity?: number; - readonly operation?: string; - readonly operationId?: string; - readonly percentComplete?: number; - readonly requestedDatabaseDtuMax?: number; - readonly requestedDatabaseDtuMin?: number; - readonly requestedDtu?: number; - readonly requestedElasticPoolName?: string; - readonly requestedStorageLimitInGB?: number; - readonly elasticPoolName?: string; - readonly serverName?: string; - readonly startTime?: Date; - readonly state?: string; - readonly requestedStorageLimitInMB?: number; - readonly requestedDatabaseDtuGuarantee?: number; - readonly requestedDatabaseDtuCap?: number; - readonly requestedDtuGuarantee?: number; +export interface ServerDnsAliasAcquisition { + oldServerDnsAliasId?: string; } /** * @class - * Initializes a new instance of the ElasticPoolDatabaseActivity class. + * Initializes a new instance of the RestorePoint class. * @constructor - * Represents the activity on an elastic pool. + * Database restore points. * - * @member {string} [location] The geo-location where the resource lives - * @member {string} [databaseName] The database name. - * @member {date} [endTime] The time the operation finished (ISO8601 format). - * @member {number} [errorCode] The error code if available. - * @member {string} [errorMessage] The error message if available. - * @member {number} [errorSeverity] The error severity if available. - * @member {string} [operation] The operation name. - * @member {uuid} [operationId] The unique operation ID. - * @member {number} [percentComplete] The percentage complete if available. - * @member {string} [requestedElasticPoolName] The name for the elastic pool - * the database is moving into if available. - * @member {string} [currentElasticPoolName] The name of the current elastic - * pool the database is in if available. - * @member {string} [currentServiceObjective] The name of the current service - * objective if available. - * @member {string} [requestedServiceObjective] The name of the requested - * service objective if available. - * @member {string} [serverName] The name of the server the elastic pool is in. - * @member {date} [startTime] The time the operation started (ISO8601 format). - * @member {string} [state] The current state of the operation. + * @member {string} [location] Resource location. + * @member {string} [restorePointType] The type of restore point. Possible + * values include: 'CONTINUOUS', 'DISCRETE' + * @member {date} [earliestRestoreDate] The earliest time to which this + * database can be restored + * @member {date} [restorePointCreationDate] The time the backup was taken + * @member {string} [restorePointLabel] The label of restore point for backup + * request by user */ -export interface ElasticPoolDatabaseActivity extends ProxyResource { - location?: string; - readonly databaseName?: string; - readonly endTime?: Date; - readonly errorCode?: number; - readonly errorMessage?: string; - readonly errorSeverity?: number; - readonly operation?: string; - readonly operationId?: string; - readonly percentComplete?: number; - readonly requestedElasticPoolName?: string; - readonly currentElasticPoolName?: string; - readonly currentServiceObjective?: string; - readonly requestedServiceObjective?: string; - readonly serverName?: string; - readonly startTime?: Date; - readonly state?: string; +export interface RestorePoint extends ProxyResource { + readonly location?: string; + readonly restorePointType?: string; + readonly earliestRestoreDate?: Date; + readonly restorePointCreationDate?: Date; + readonly restorePointLabel?: string; } /** * @class - * Initializes a new instance of the DatabaseUpdate class. + * Initializes a new instance of the CreateDatabaseRestorePointDefinition class. * @constructor - * Represents a database update. - * - * @member {object} [tags] Resource tags. - * @member {string} [collation] The collation of the database. If createMode is - * not Default, this value is ignored. - * @member {date} [creationDate] The creation date of the database (ISO8601 - * format). - * @member {number} [containmentState] The containment state of the database. - * @member {uuid} [currentServiceObjectiveId] The current service level - * objective ID of the database. This is the ID of the service level objective - * that is currently active. - * @member {uuid} [databaseId] The ID of the database. - * @member {date} [earliestRestoreDate] This records the earliest start date - * and time that restore is available for this database (ISO8601 format). - * @member {string} [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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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. + * Contains the information necessary to perform a create database restore + * point operation. * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * @member {string} [sourceDatabaseId] Conditional. If createMode is Copy, - * NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, or - * Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * @member {date} [sourceDatabaseDeletionDate] Conditional. If createMode is - * Restore and sourceDatabaseId is the deleted database's original resource id - * when it existed (as opposed to its current restorable dropped database id), - * then this value is required. Specifies the time that the database was - * deleted. - * @member {date} [restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * @member {string} [recoveryServicesRecoveryPointResourceId] Conditional. If - * createMode is RestoreLongTermRetentionBackup, then this value is required. - * Specifies the resource ID of the recovery point to restore from. - * @member {string} [edition] The edition of the database. The DatabaseEditions - * enumeration contains all the valid editions. If createMode is - * NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * @member {string} [maxSizeBytes] The max size of the database expressed in - * bytes. If createMode is not Default, this value is ignored. To see possible - * values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * @member {uuid} [requestedServiceObjectiveId] The configured service level - * objective ID of the database. This is the service level objective that is in - * the process of being applied to the database. Once successfully updated, it - * will match the value of currentServiceObjectiveId property. If - * requestedServiceObjectiveId and requestedServiceObjectiveName are both - * updated, the value of requestedServiceObjectiveId overrides the value of - * requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * @member {string} [requestedServiceObjectiveName] The name of the configured - * service level objective of the database. This is the service level objective - * that is in the process of being applied to the database. Once successfully - * updated, it will match the value of serviceLevelObjective property. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * @member {string} [serviceLevelObjective] The current service level objective - * of the database. Possible values include: 'Basic', 'S0', 'S1', 'S2', 'S3', - * 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', 'System2', - * 'ElasticPool' - * @member {string} [status] The status of the database. - * @member {string} [elasticPoolName] The name of the elastic pool the database - * is in. If elasticPoolName and requestedServiceObjectiveName are both - * updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * @member {string} [defaultSecondaryLocation] The default secondary region for - * this database. - * @member {array} [serviceTierAdvisors] The list of service tier advisors for - * this database. Expanded property - * @member {array} [transparentDataEncryption] The transparent data encryption - * info for this database. - * @member {array} [recommendedIndex] The recommended indices for this - * database. - * @member {string} [failoverGroupId] The resource identifier of the failover - * group containing this database. - * @member {string} [readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * @member {string} [sampleName] Indicates the name of the sample schema to - * apply when creating this database. If createMode is not Default, this value - * is ignored. Not supported for DataWarehouse edition. Possible values - * include: 'AdventureWorksLT' + * @member {string} restorePointLabel The restore point label to apply */ -export interface DatabaseUpdate extends Resource { - tags?: { [propertyName: string]: string }; - collation?: string; - readonly creationDate?: Date; - readonly containmentState?: number; - readonly currentServiceObjectiveId?: string; - readonly databaseId?: string; - readonly earliestRestoreDate?: Date; - createMode?: string; - sourceDatabaseId?: string; - sourceDatabaseDeletionDate?: Date; - restorePointInTime?: Date; - recoveryServicesRecoveryPointResourceId?: string; - edition?: string; - maxSizeBytes?: string; - requestedServiceObjectiveId?: string; - requestedServiceObjectiveName?: string; - readonly serviceLevelObjective?: string; - readonly status?: string; - elasticPoolName?: string; - readonly defaultSecondaryLocation?: string; - readonly serviceTierAdvisors?: ServiceTierAdvisor[]; - readonly transparentDataEncryption?: TransparentDataEncryption[]; - readonly recommendedIndex?: RecommendedIndex[]; - readonly failoverGroupId?: string; - readScale?: string; - sampleName?: string; +export interface CreateDatabaseRestorePointDefinition { + restorePointLabel: string; +} + +/** + * @class + * Initializes a new instance of the DatabaseOperation class. + * @constructor + * A database operation. + * + * @member {string} [databaseName] The name of the database the operation is + * being performed on. + * @member {string} [operation] The name of operation. + * @member {string} [operationFriendlyName] The friendly name of operation. + * @member {number} [percentComplete] The percentage of the operation + * completed. + * @member {string} [serverName] The name of the server. + * @member {date} [startTime] The operation start time. + * @member {string} [state] The operation state. Possible values include: + * 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', + * 'Cancelled' + * @member {number} [errorCode] The operation error code. + * @member {string} [errorDescription] The operation error description. + * @member {number} [errorSeverity] The operation error severity. + * @member {boolean} [isUserError] Whether or not the error is a user error. + * @member {date} [estimatedCompletionTime] The estimated completion time of + * the operation. + * @member {string} [description] The operation description. + * @member {boolean} [isCancellable] Whether the operation can be cancelled. + */ +export interface DatabaseOperation extends ProxyResource { + readonly databaseName?: string; + readonly operation?: string; + readonly operationFriendlyName?: string; + readonly percentComplete?: number; + readonly serverName?: string; + readonly startTime?: Date; + readonly state?: string; + readonly errorCode?: number; + readonly errorDescription?: string; + readonly errorSeverity?: number; + readonly isUserError?: boolean; + readonly estimatedCompletionTime?: Date; + readonly description?: string; + readonly isCancellable?: boolean; } /** * @class - * Initializes a new instance of the TransparentDataEncryptionActivity class. + * Initializes a new instance of the ElasticPoolOperation class. * @constructor - * Represents a database transparent data encryption Scan. + * A elastic pool operation. * - * @member {string} [location] Resource location. - * @member {string} [status] The status of the database. Possible values - * include: 'Encrypting', 'Decrypting' - * @member {number} [percentComplete] The percent complete of the transparent - * data encryption scan for a database. + * @member {string} [elasticPoolName] The name of the elastic pool the + * operation is being performed on. + * @member {string} [operation] The name of operation. + * @member {string} [operationFriendlyName] The friendly name of operation. + * @member {number} [percentComplete] The percentage of the operation + * completed. + * @member {string} [serverName] The name of the server. + * @member {date} [startTime] The operation start time. + * @member {string} [state] The operation state. + * @member {number} [errorCode] The operation error code. + * @member {string} [errorDescription] The operation error description. + * @member {number} [errorSeverity] The operation error severity. + * @member {boolean} [isUserError] Whether or not the error is a user error. + * @member {date} [estimatedCompletionTime] The estimated completion time of + * the operation. + * @member {string} [description] The operation description. + * @member {boolean} [isCancellable] Whether the operation can be cancelled. */ -export interface TransparentDataEncryptionActivity extends ProxyResource { - readonly location?: string; - readonly status?: string; +export interface ElasticPoolOperation extends ProxyResource { + readonly elasticPoolName?: string; + readonly operation?: string; + readonly operationFriendlyName?: string; readonly percentComplete?: number; + readonly serverName?: string; + readonly startTime?: Date; + readonly state?: string; + readonly errorCode?: number; + readonly errorDescription?: string; + readonly errorSeverity?: number; + readonly isUserError?: boolean; + readonly estimatedCompletionTime?: Date; + readonly description?: string; + readonly isCancellable?: boolean; } /** * @class - * Initializes a new instance of the ServerUsage class. + * Initializes a new instance of the MaxSizeCapability class. * @constructor - * Represents server metrics. + * The maximum size capability. * - * @member {string} [name] Name of the server usage metric. - * @member {string} [resourceName] The name of the resource. - * @member {string} [displayName] The metric display name. - * @member {number} [currentValue] The current value of the metric. - * @member {number} [limit] The current limit of the metric. - * @member {string} [unit] The units of the metric. - * @member {date} [nextResetTime] The next reset time for the metric (ISO8601 - * format). + * @member {number} [limit] The maximum size limit (see 'unit' for the units). + * @member {string} [unit] The units that the limit is expressed in. Possible + * values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' */ -export interface ServerUsage { - readonly name?: string; - readonly resourceName?: string; - readonly displayName?: string; - readonly currentValue?: number; +export interface MaxSizeCapability { readonly limit?: number; readonly unit?: string; - readonly nextResetTime?: Date; } /** * @class - * Initializes a new instance of the DatabaseUsage class. + * Initializes a new instance of the LogSizeCapability class. * @constructor - * The database usages. + * The log size capability. * - * @member {string} [name] The name of the usage metric. - * @member {string} [resourceName] The name of the resource. - * @member {string} [displayName] The usage metric display name. - * @member {number} [currentValue] The current value of the usage metric. - * @member {number} [limit] The current limit of the usage metric. - * @member {string} [unit] The units of the usage metric. - * @member {date} [nextResetTime] The next reset time for the usage metric - * (ISO8601 format). + * @member {number} [limit] The log size limit (see 'unit' for the units). + * @member {string} [unit] The units that the limit is expressed in. Possible + * values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', + * 'Percent' */ -export interface DatabaseUsage { - readonly name?: string; - readonly resourceName?: string; - readonly displayName?: string; - readonly currentValue?: number; +export interface LogSizeCapability { readonly limit?: number; readonly unit?: string; - readonly nextResetTime?: Date; } /** * @class - * Initializes a new instance of the DatabaseBlobAuditingPolicy class. + * Initializes a new instance of the MaxSizeRangeCapability class. * @constructor - * A database blob auditing policy. + * The maximum size range capability. * - * @member {string} [kind] Resource kind. - * @member {string} state Specifies the state of the policy. If state is - * Enabled, storageEndpoint and storageAccountAccessKey are required. Possible - * values include: 'Enabled', 'Disabled' - * @member {string} [storageEndpoint] Specifies the blob storage endpoint (e.g. - * https://MyAccount.blob.core.windows.net). If state is Enabled, - * storageEndpoint is required. - * @member {string} [storageAccountAccessKey] Specifies the identifier key of - * the auditing storage account. If state is Enabled, storageAccountAccessKey - * is required. - * @member {number} [retentionDays] Specifies the number of days to keep in the - * audit logs. - * @member {array} [auditActionsAndGroups] Specifies the Actions and - * Actions-Groups to audit. - * @member {uuid} [storageAccountSubscriptionId] Specifies the blob storage - * subscription Id. - * @member {boolean} [isStorageSecondaryKeyInUse] Specifies whether - * storageAccountAccessKey value is the storage’s secondary key. + * @member {object} [minValue] Minimum value. + * @member {number} [minValue.limit] The maximum size limit (see 'unit' for the + * units). + * @member {string} [minValue.unit] The units that the limit is expressed in. + * Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' + * @member {object} [maxValue] Maximum value. + * @member {number} [maxValue.limit] The maximum size limit (see 'unit' for the + * units). + * @member {string} [maxValue.unit] The units that the limit is expressed in. + * Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' + * @member {object} [scaleSize] Scale/step size for discrete values between the + * minimum value and the maximum value. + * @member {number} [scaleSize.limit] The maximum size limit (see 'unit' for + * the units). + * @member {string} [scaleSize.unit] The units that the limit is expressed in. + * Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' + * @member {object} [logSize] Size of transaction log. + * @member {number} [logSize.limit] The log size limit (see 'unit' for the + * units). + * @member {string} [logSize.unit] The units that the limit is expressed in. + * Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', + * 'Percent' + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface DatabaseBlobAuditingPolicy extends ProxyResource { - readonly kind?: string; - state: string; - storageEndpoint?: string; - storageAccountAccessKey?: string; - retentionDays?: number; - auditActionsAndGroups?: string[]; - storageAccountSubscriptionId?: string; - isStorageSecondaryKeyInUse?: boolean; +export interface MaxSizeRangeCapability { + readonly minValue?: MaxSizeCapability; + readonly maxValue?: MaxSizeCapability; + readonly scaleSize?: MaxSizeCapability; + readonly logSize?: LogSizeCapability; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the EncryptionProtector class. + * Initializes a new instance of the PerformanceLevelCapability class. * @constructor - * The server encryption protector. + * The performance level capability. * - * @member {string} [kind] Kind of encryption protector. This is metadata used - * for the Azure portal experience. - * @member {string} [location] Resource location. - * @member {string} [subregion] Subregion of the encryption protector. - * @member {string} [serverKeyName] The name of the server key. - * @member {string} serverKeyType The encryption protector type like - * 'ServiceManaged', 'AzureKeyVault'. Possible values include: - * 'ServiceManaged', 'AzureKeyVault' - * @member {string} [uri] The URI of the server key. - * @member {string} [thumbprint] Thumbprint of the server key. + * @member {number} [value] Performance level value. + * @member {string} [unit] Unit type used to measure performance level. + * Possible values include: 'DTU', 'VCores' */ -export interface EncryptionProtector extends ProxyResource { - kind?: string; - readonly location?: string; - readonly subregion?: string; - serverKeyName?: string; - serverKeyType: string; - readonly uri?: string; - readonly thumbprint?: string; +export interface PerformanceLevelCapability { + readonly value?: number; + readonly unit?: string; } /** * @class - * Initializes a new instance of the FailoverGroupReadWriteEndpoint class. + * Initializes a new instance of the LicenseTypeCapability class. * @constructor - * Read-write endpoint of the failover group instance. + * The license type capability * - * @member {string} failoverPolicy Failover policy of the read-write endpoint - * for the failover group. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. Possible values include: - * 'Manual', 'Automatic' - * @member {number} [failoverWithDataLossGracePeriodMinutes] Grace period - * before failover with data loss is attempted for the read-write endpoint. If - * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is - * required. + * @member {string} [name] License type identifier. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface FailoverGroupReadWriteEndpoint { - failoverPolicy: string; - failoverWithDataLossGracePeriodMinutes?: number; +export interface LicenseTypeCapability { + readonly name?: string; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the FailoverGroupReadOnlyEndpoint class. + * Initializes a new instance of the ServiceObjectiveCapability class. * @constructor - * Read-only endpoint of the failover group instance. + * The service objectives capability. * - * @member {string} [failoverPolicy] Failover policy of the read-only endpoint - * for the failover group. Possible values include: 'Disabled', 'Enabled' + * @member {uuid} [id] The unique ID of the service objective. + * @member {string} [name] The service objective name. + * @member {array} [supportedMaxSizes] The list of supported maximum database + * sizes. + * @member {object} [performanceLevel] The performance level. + * @member {number} [performanceLevel.value] Performance level value. + * @member {string} [performanceLevel.unit] Unit type used to measure + * performance level. Possible values include: 'DTU', 'VCores' + * @member {object} [sku] The sku. + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {array} [supportedLicenseTypes] List of supported license types. + * @member {object} [includedMaxSize] The included (free) max size. + * @member {number} [includedMaxSize.limit] The maximum size limit (see 'unit' + * for the units). + * @member {string} [includedMaxSize.unit] The units that the limit is + * expressed in. Possible values include: 'Megabytes', 'Gigabytes', + * 'Terabytes', 'Petabytes' + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface FailoverGroupReadOnlyEndpoint { - failoverPolicy?: string; +export interface ServiceObjectiveCapability { + readonly id?: string; + readonly name?: string; + readonly supportedMaxSizes?: MaxSizeRangeCapability[]; + readonly performanceLevel?: PerformanceLevelCapability; + readonly sku?: Sku; + readonly supportedLicenseTypes?: LicenseTypeCapability[]; + readonly includedMaxSize?: MaxSizeCapability; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the PartnerInfo class. + * Initializes a new instance of the EditionCapability class. * @constructor - * Partner server information for the failover group. + * The edition capability. * - * @member {string} id Resource identifier of the partner server. - * @member {string} [location] Geo location of the partner server. - * @member {string} [replicationRole] Replication role of the partner server. - * Possible values include: 'Primary', 'Secondary' + * @member {string} [name] The database edition name. + * @member {array} [supportedServiceLevelObjectives] The list of supported + * service objectives for the edition. + * @member {boolean} [zoneRedundant] Whether or not zone redundancy is + * supported for the edition. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface PartnerInfo { - id: string; - readonly location?: string; - readonly replicationRole?: string; +export interface EditionCapability { + readonly name?: string; + readonly supportedServiceLevelObjectives?: ServiceObjectiveCapability[]; + readonly zoneRedundant?: boolean; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the FailoverGroup class. + * Initializes a new instance of the ElasticPoolPerDatabaseMinPerformanceLevelCapability class. * @constructor - * A failover group. + * The minimum per-database performance level capability. * - * @member {string} [location] Resource location. - * @member {object} [tags] Resource tags. - * @member {object} readWriteEndpoint Read-write endpoint of the failover group - * instance. - * @member {string} [readWriteEndpoint.failoverPolicy] Failover policy of the - * read-write endpoint for the failover group. If failoverPolicy is Automatic - * then failoverWithDataLossGracePeriodMinutes is required. Possible values - * include: 'Manual', 'Automatic' - * @member {number} [readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] - * Grace period before failover with data loss is attempted for the read-write - * endpoint. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. - * @member {object} [readOnlyEndpoint] Read-only endpoint of the failover group - * instance. - * @member {string} [readOnlyEndpoint.failoverPolicy] Failover policy of the - * read-only endpoint for the failover group. Possible values include: - * 'Disabled', 'Enabled' - * @member {string} [replicationRole] Local replication role of the failover - * group instance. Possible values include: 'Primary', 'Secondary' - * @member {string} [replicationState] Replication state of the failover group - * instance. - * @member {array} partnerServers List of partner server information for the - * failover group. - * @member {array} [databases] List of databases in the failover group. + * @member {number} [limit] The minimum performance level per database. + * @member {string} [unit] Unit type used to measure performance level. + * Possible values include: 'DTU', 'VCores' + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. + */ +export interface ElasticPoolPerDatabaseMinPerformanceLevelCapability { + readonly limit?: number; + readonly unit?: string; + readonly status?: string; + reason?: string; +} + +/** + * @class + * Initializes a new instance of the ElasticPoolPerDatabaseMaxPerformanceLevelCapability class. + * @constructor + * The max per-database performance level capability. + * + * @member {number} [limit] The maximum performance level per database. + * @member {string} [unit] Unit type used to measure performance level. + * Possible values include: 'DTU', 'VCores' + * @member {array} [supportedPerDatabaseMinPerformanceLevels] The list of + * supported min database performance levels. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. + */ +export interface ElasticPoolPerDatabaseMaxPerformanceLevelCapability { + readonly limit?: number; + readonly unit?: string; + readonly supportedPerDatabaseMinPerformanceLevels?: ElasticPoolPerDatabaseMinPerformanceLevelCapability[]; + readonly status?: string; + reason?: string; +} + +/** + * @class + * Initializes a new instance of the ElasticPoolPerformanceLevelCapability class. + * @constructor + * The Elastic Pool performance level capability. + * + * @member {object} [performanceLevel] The performance level for the pool. + * @member {number} [performanceLevel.value] Performance level value. + * @member {string} [performanceLevel.unit] Unit type used to measure + * performance level. Possible values include: 'DTU', 'VCores' + * @member {object} [sku] The sku. + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {array} [supportedLicenseTypes] List of supported license types. + * @member {number} [maxDatabaseCount] The maximum number of databases + * supported. + * @member {object} [includedMaxSize] The included (free) max size for this + * performance level. + * @member {number} [includedMaxSize.limit] The maximum size limit (see 'unit' + * for the units). + * @member {string} [includedMaxSize.unit] The units that the limit is + * expressed in. Possible values include: 'Megabytes', 'Gigabytes', + * 'Terabytes', 'Petabytes' + * @member {array} [supportedMaxSizes] The list of supported max sizes. + * @member {array} [supportedPerDatabaseMaxSizes] The list of supported per + * database max sizes. + * @member {array} [supportedPerDatabaseMaxPerformanceLevels] The list of + * supported per database max performance levels. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface FailoverGroup extends ProxyResource { - readonly location?: string; - tags?: { [propertyName: string]: string }; - readWriteEndpoint: FailoverGroupReadWriteEndpoint; - readOnlyEndpoint?: FailoverGroupReadOnlyEndpoint; - readonly replicationRole?: string; - readonly replicationState?: string; - partnerServers: PartnerInfo[]; - databases?: string[]; +export interface ElasticPoolPerformanceLevelCapability { + readonly performanceLevel?: PerformanceLevelCapability; + readonly sku?: Sku; + readonly supportedLicenseTypes?: LicenseTypeCapability[]; + readonly maxDatabaseCount?: number; + readonly includedMaxSize?: MaxSizeCapability; + readonly supportedMaxSizes?: MaxSizeRangeCapability[]; + readonly supportedPerDatabaseMaxSizes?: MaxSizeRangeCapability[]; + readonly supportedPerDatabaseMaxPerformanceLevels?: ElasticPoolPerDatabaseMaxPerformanceLevelCapability[]; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the FailoverGroupUpdate class. + * Initializes a new instance of the ElasticPoolEditionCapability class. * @constructor - * A failover group update request. + * The elastic pool edition capability. * - * @member {object} [readWriteEndpoint] Read-write endpoint of the failover - * group instance. - * @member {string} [readWriteEndpoint.failoverPolicy] Failover policy of the - * read-write endpoint for the failover group. If failoverPolicy is Automatic - * then failoverWithDataLossGracePeriodMinutes is required. Possible values - * include: 'Manual', 'Automatic' - * @member {number} [readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] - * Grace period before failover with data loss is attempted for the read-write - * endpoint. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. - * @member {object} [readOnlyEndpoint] Read-only endpoint of the failover group - * instance. - * @member {string} [readOnlyEndpoint.failoverPolicy] Failover policy of the - * read-only endpoint for the failover group. Possible values include: - * 'Disabled', 'Enabled' - * @member {array} [databases] List of databases in the failover group. - * @member {object} [tags] Resource tags. + * @member {string} [name] The elastic pool edition name. + * @member {array} [supportedElasticPoolPerformanceLevels] The list of + * supported elastic pool DTU levels for the edition. + * @member {boolean} [zoneRedundant] Whether or not zone redundancy is + * supported for the edition. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface FailoverGroupUpdate { - readWriteEndpoint?: FailoverGroupReadWriteEndpoint; - readOnlyEndpoint?: FailoverGroupReadOnlyEndpoint; - databases?: string[]; - tags?: { [propertyName: string]: string }; +export interface ElasticPoolEditionCapability { + readonly name?: string; + readonly supportedElasticPoolPerformanceLevels?: ElasticPoolPerformanceLevelCapability[]; + readonly zoneRedundant?: boolean; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the OperationDisplay class. + * Initializes a new instance of the ServerVersionCapability class. * @constructor - * Display metadata associated with the operation. + * The server capability * - * @member {string} [provider] The localized friendly form of the resource - * provider name. - * @member {string} [resource] The localized friendly form of the resource type - * related to this action/operation. - * @member {string} [operation] The localized friendly name for the operation. - * @member {string} [description] The localized friendly description for the - * operation. + * @member {string} [name] The server version name. + * @member {array} [supportedEditions] The list of supported database editions. + * @member {array} [supportedElasticPoolEditions] The list of supported elastic + * pool editions. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface OperationDisplay { - readonly provider?: string; - readonly resource?: string; - readonly operation?: string; - readonly description?: string; +export interface ServerVersionCapability { + readonly name?: string; + readonly supportedEditions?: EditionCapability[]; + readonly supportedElasticPoolEditions?: ElasticPoolEditionCapability[]; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the Operation class. + * Initializes a new instance of the ManagedInstanceVcoresCapability class. * @constructor - * SQL REST API operation definition. + * The managed instance virtual cores capability. * - * @member {string} [name] The name of the operation being performed on this - * particular object. - * @member {object} [display] The localized display information for this - * particular operation / action. - * @member {string} [display.provider] The localized friendly form of the - * resource provider name. - * @member {string} [display.resource] The localized friendly form of the - * resource type related to this action/operation. - * @member {string} [display.operation] The localized friendly name for the - * operation. - * @member {string} [display.description] The localized friendly description - * for the operation. - * @member {string} [origin] The intended executor of the operation. Possible - * values include: 'user', 'system' - * @member {object} [properties] Additional descriptions for the operation. + * @member {string} [name] The virtual cores identifier. + * @member {number} [value] The virtual cores value. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface Operation { +export interface ManagedInstanceVcoresCapability { readonly name?: string; - readonly display?: OperationDisplay; - readonly origin?: string; - readonly properties?: { [propertyName: string]: any }; + readonly value?: number; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the ServerKey class. + * Initializes a new instance of the ManagedInstanceFamilyCapability class. * @constructor - * A server key. + * The managed server family capability. * - * @member {string} [kind] Kind of encryption protector. This is metadata used - * for the Azure portal experience. - * @member {string} [location] Resource location. - * @member {string} [subregion] Subregion of the server key. - * @member {string} serverKeyType The server key type like 'ServiceManaged', - * 'AzureKeyVault'. Possible values include: 'ServiceManaged', 'AzureKeyVault' - * @member {string} [uri] The URI of the server key. - * @member {string} [thumbprint] Thumbprint of the server key. - * @member {date} [creationDate] The server key creation date. + * @member {string} [name] Family name. + * @member {string} [sku] SKU name. + * @member {array} [supportedLicenseTypes] List of supported license types. + * @member {array} [supportedVcoresValues] List of supported virtual cores + * values. + * @member {object} [includedMaxSize] Included size. + * @member {number} [includedMaxSize.limit] The maximum size limit (see 'unit' + * for the units). + * @member {string} [includedMaxSize.unit] The units that the limit is + * expressed in. Possible values include: 'Megabytes', 'Gigabytes', + * 'Terabytes', 'Petabytes' + * @member {array} [supportedStorageSizes] Storage size ranges. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface ServerKey extends ProxyResource { - kind?: string; - readonly location?: string; - readonly subregion?: string; - serverKeyType: string; - uri?: string; - thumbprint?: string; - creationDate?: Date; +export interface ManagedInstanceFamilyCapability { + readonly name?: string; + readonly sku?: string; + readonly supportedLicenseTypes?: LicenseTypeCapability[]; + readonly supportedVcoresValues?: ManagedInstanceVcoresCapability[]; + readonly includedMaxSize?: MaxSizeCapability; + readonly supportedStorageSizes?: MaxSizeRangeCapability[]; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the ResourceIdentity class. + * Initializes a new instance of the ManagedInstanceEditionCapability class. * @constructor - * Azure Active Directory identity configuration for a resource. + * The managed server capability * - * @member {uuid} [principalId] The Azure Active Directory principal id. - * @member {string} [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' - * @member {uuid} [tenantId] The Azure Active Directory tenant id. + * @member {string} [name] The managed server version name. + * @member {array} [supportedFamilies] The supported families. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface ResourceIdentity { - readonly principalId?: string; - type?: string; - readonly tenantId?: string; +export interface ManagedInstanceEditionCapability { + readonly name?: string; + readonly supportedFamilies?: ManagedInstanceFamilyCapability[]; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the Server class. + * Initializes a new instance of the ManagedInstanceVersionCapability class. * @constructor - * An Azure SQL Database server. + * The managed instance capability * - * @member {object} [identity] The Azure Active Directory identity of the - * server. - * @member {uuid} [identity.principalId] The Azure Active Directory principal - * id. - * @member {string} [identity.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' - * @member {uuid} [identity.tenantId] The Azure Active Directory tenant id. - * @member {string} [kind] Kind of sql server. This is metadata used for the - * Azure portal experience. - * @member {string} [administratorLogin] Administrator username for the server. - * Once created it cannot be changed. - * @member {string} [administratorLoginPassword] The administrator login - * password (required for server creation). - * @member {string} [version] The version of the server. - * @member {string} [state] The state of the server. - * @member {string} [fullyQualifiedDomainName] The fully qualified domain name - * of the server. + * @member {string} [name] The server version name. + * @member {array} [supportedEditions] The list of supported managed instance + * editions. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface Server extends TrackedResource { - identity?: ResourceIdentity; - readonly kind?: string; - administratorLogin?: string; - administratorLoginPassword?: string; - version?: string; - readonly state?: string; - readonly fullyQualifiedDomainName?: string; +export interface ManagedInstanceVersionCapability { + readonly name?: string; + readonly supportedEditions?: ManagedInstanceEditionCapability[]; + readonly status?: string; + reason?: string; } /** * @class - * Initializes a new instance of the ServerUpdate class. + * Initializes a new instance of the LocationCapabilities class. * @constructor - * An update request for an Azure SQL Database server. + * The location capability. * - * @member {string} [administratorLogin] Administrator username for the server. - * Once created it cannot be changed. - * @member {string} [administratorLoginPassword] The administrator login - * password (required for server creation). - * @member {string} [version] The version of the server. - * @member {string} [state] The state of the server. - * @member {string} [fullyQualifiedDomainName] The fully qualified domain name - * of the server. - * @member {object} [tags] Resource tags. + * @member {string} [name] The location name. + * @member {array} [supportedServerVersions] The list of supported server + * versions. + * @member {array} [supportedManagedInstanceVersions] The list of supported + * managed instance versions. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being available. */ -export interface ServerUpdate { - administratorLogin?: string; - administratorLoginPassword?: string; - version?: string; - readonly state?: string; - readonly fullyQualifiedDomainName?: string; - tags?: { [propertyName: string]: string }; +export interface LocationCapabilities { + readonly name?: string; + readonly supportedServerVersions?: ServerVersionCapability[]; + readonly supportedManagedInstanceVersions?: ManagedInstanceVersionCapability[]; + readonly status?: string; + reason?: string; +} + +/** + * @class + * Initializes a new instance of the Database class. + * @constructor + * A database resource. + * + * @member {object} [sku] The name and tier of the SKU. + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {string} [kind] Kind of database. This is metadata used for the + * Azure portal experience. + * @member {string} [managedBy] Resource that manages the database. + * @member {string} [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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * @member {string} [collation] The collation of the database. + * @member {number} [maxSizeBytes] The max size of the database expressed in + * bytes. + * @member {string} [sampleName] The name of the sample schema to apply when + * creating this database. Possible values include: 'AdventureWorksLT', + * 'WideWorldImportersStd', 'WideWorldImportersFull' + * @member {string} [elasticPoolId] The resource identifier of the elastic pool + * containing this database. + * @member {string} [sourceDatabaseId] The resource identifier of the source + * database associated with create operation of this database. + * @member {string} [status] The status of the database. Possible values + * include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', + * 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling' + * @member {uuid} [databaseId] The ID of the database. + * @member {date} [creationDate] The creation date of the database (ISO8601 + * format). + * @member {string} [currentServiceObjectiveName] The current service level + * objective name of the database. + * @member {string} [requestedServiceObjectiveName] The requested service level + * objective name of the database. + * @member {string} [defaultSecondaryLocation] The default secondary region for + * this database. + * @member {string} [failoverGroupId] Failover Group resource identifier that + * this database belongs to. + * @member {date} [restorePointInTime] Specifies the point in time (ISO8601 + * format) of the source database that will be restored to create the new + * database. + * @member {date} [sourceDatabaseDeletionDate] Specifies the time that the + * database was deleted. + * @member {string} [recoveryServicesRecoveryPointId] The resource identifier + * of the recovery point associated with create operation of this database. + * @member {string} [longTermRetentionBackupResourceId] The resource identifier + * of the long term retention backup associated with create operation of this + * database. + * @member {string} [recoverableDatabaseId] The resource identifier of the + * recoverable database associated with create operation of this database. + * @member {string} [restorableDroppedDatabaseId] The resource identifier of + * the restorable dropped database associated with create operation of this + * database. + * @member {string} [catalogCollation] Collation of the metadata catalog. + * Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS' + * @member {boolean} [zoneRedundant] Whether or not this database is zone + * redundant, which means the replicas of this database will be spread across + * multiple availability zones. + * @member {string} [licenseType] The license type to apply for this database. + * Possible values include: 'LicenseIncluded', 'BasePrice' + * @member {number} [maxLogSizeBytes] The max log size for this database. + * @member {date} [earliestRestoreDate] This records the earliest start date + * and time that restore is available for this database (ISO8601 format). + * @member {string} [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: 'Enabled', 'Disabled' + * @member {object} [currentSku] The name and tier of the SKU. + * @member {string} [currentSku.name] The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * @member {string} [currentSku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * @member {string} [currentSku.size] Size of the particular SKU + * @member {string} [currentSku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * @member {number} [currentSku.capacity] Capacity of the particular SKU. + */ +export interface Database extends TrackedResource { + sku?: Sku; + readonly kind?: string; + readonly managedBy?: string; + createMode?: string; + collation?: string; + maxSizeBytes?: number; + sampleName?: string; + elasticPoolId?: string; + sourceDatabaseId?: string; + readonly status?: string; + readonly databaseId?: string; + readonly creationDate?: Date; + readonly currentServiceObjectiveName?: string; + readonly requestedServiceObjectiveName?: string; + readonly defaultSecondaryLocation?: string; + readonly failoverGroupId?: string; + restorePointInTime?: Date; + sourceDatabaseDeletionDate?: Date; + recoveryServicesRecoveryPointId?: string; + longTermRetentionBackupResourceId?: string; + recoverableDatabaseId?: string; + restorableDroppedDatabaseId?: string; + catalogCollation?: string; + zoneRedundant?: boolean; + licenseType?: string; + readonly maxLogSizeBytes?: number; + readonly earliestRestoreDate?: Date; + readScale?: string; + readonly currentSku?: Sku; } /** * @class - * Initializes a new instance of the SyncAgent class. + * Initializes a new instance of the DatabaseUpdate class. * @constructor - * An Azure SQL Database sync agent. + * A database resource. + * + * @member {object} [sku] The name and tier of the SKU. + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {string} [createMode] Specifies the mode of database creation. * - * @member {string} [syncAgentName] Name of the sync agent. - * @member {string} [syncDatabaseId] ARM resource id of the sync database in - * the sync agent. - * @member {date} [lastAliveTime] Last alive time of the sync agent. - * @member {string} [state] State of the sync agent. Possible values include: - * 'Online', 'Offline', 'NeverConnected' - * @member {boolean} [isUpToDate] If the sync agent version is up to date. - * @member {date} [expiryTime] Expiration time of the sync agent version. - * @member {string} [version] Version of the sync agent. + * 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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * @member {string} [collation] The collation of the database. + * @member {number} [maxSizeBytes] The max size of the database expressed in + * bytes. + * @member {string} [sampleName] The name of the sample schema to apply when + * creating this database. Possible values include: 'AdventureWorksLT', + * 'WideWorldImportersStd', 'WideWorldImportersFull' + * @member {string} [elasticPoolId] The resource identifier of the elastic pool + * containing this database. + * @member {string} [sourceDatabaseId] The resource identifier of the source + * database associated with create operation of this database. + * @member {string} [status] The status of the database. Possible values + * include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering', 'Suspect', + * 'Offline', 'Standby', 'Shutdown', 'EmergencyMode', 'AutoClosed', 'Copying', + * 'Creating', 'Inaccessible', 'OfflineSecondary', 'Pausing', 'Paused', + * 'Resuming', 'Scaling' + * @member {uuid} [databaseId] The ID of the database. + * @member {date} [creationDate] The creation date of the database (ISO8601 + * format). + * @member {string} [currentServiceObjectiveName] The current service level + * objective name of the database. + * @member {string} [requestedServiceObjectiveName] The requested service level + * objective name of the database. + * @member {string} [defaultSecondaryLocation] The default secondary region for + * this database. + * @member {string} [failoverGroupId] Failover Group resource identifier that + * this database belongs to. + * @member {date} [restorePointInTime] Specifies the point in time (ISO8601 + * format) of the source database that will be restored to create the new + * database. + * @member {date} [sourceDatabaseDeletionDate] Specifies the time that the + * database was deleted. + * @member {string} [recoveryServicesRecoveryPointId] The resource identifier + * of the recovery point associated with create operation of this database. + * @member {string} [longTermRetentionBackupResourceId] The resource identifier + * of the long term retention backup associated with create operation of this + * database. + * @member {string} [recoverableDatabaseId] The resource identifier of the + * recoverable database associated with create operation of this database. + * @member {string} [restorableDroppedDatabaseId] The resource identifier of + * the restorable dropped database associated with create operation of this + * database. + * @member {string} [catalogCollation] Collation of the metadata catalog. + * Possible values include: 'DATABASE_DEFAULT', 'SQL_Latin1_General_CP1_CI_AS' + * @member {boolean} [zoneRedundant] Whether or not this database is zone + * redundant, which means the replicas of this database will be spread across + * multiple availability zones. + * @member {string} [licenseType] The license type to apply for this database. + * Possible values include: 'LicenseIncluded', 'BasePrice' + * @member {number} [maxLogSizeBytes] The max log size for this database. + * @member {date} [earliestRestoreDate] This records the earliest start date + * and time that restore is available for this database (ISO8601 format). + * @member {string} [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: 'Enabled', 'Disabled' + * @member {object} [currentSku] The name and tier of the SKU. + * @member {string} [currentSku.name] The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * @member {string} [currentSku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * @member {string} [currentSku.size] Size of the particular SKU + * @member {string} [currentSku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * @member {number} [currentSku.capacity] Capacity of the particular SKU. + * @member {object} [tags] Resource tags. */ -export interface SyncAgent extends ProxyResource { - readonly syncAgentName?: string; - syncDatabaseId?: string; - readonly lastAliveTime?: Date; - readonly state?: string; - readonly isUpToDate?: boolean; - readonly expiryTime?: Date; - readonly version?: string; +export interface DatabaseUpdate { + sku?: Sku; + createMode?: string; + collation?: string; + maxSizeBytes?: number; + sampleName?: string; + elasticPoolId?: string; + sourceDatabaseId?: string; + readonly status?: string; + readonly databaseId?: string; + readonly creationDate?: Date; + readonly currentServiceObjectiveName?: string; + readonly requestedServiceObjectiveName?: string; + readonly defaultSecondaryLocation?: string; + readonly failoverGroupId?: string; + restorePointInTime?: Date; + sourceDatabaseDeletionDate?: Date; + recoveryServicesRecoveryPointId?: string; + longTermRetentionBackupResourceId?: string; + recoverableDatabaseId?: string; + restorableDroppedDatabaseId?: string; + catalogCollation?: string; + zoneRedundant?: boolean; + licenseType?: string; + readonly maxLogSizeBytes?: number; + readonly earliestRestoreDate?: Date; + readScale?: string; + readonly currentSku?: Sku; + tags?: { [propertyName: string]: string }; } /** * @class - * Initializes a new instance of the SyncAgentKeyProperties class. + * Initializes a new instance of the ResourceMoveDefinition class. * @constructor - * Properties of an Azure SQL Database sync agent key. + * Contains the information necessary to perform a resource move (rename). * - * @member {string} [syncAgentKey] Key of sync agent. + * @member {string} id The target ID for the resource */ -export interface SyncAgentKeyProperties { - readonly syncAgentKey?: string; +export interface ResourceMoveDefinition { + id: string; } /** * @class - * Initializes a new instance of the SyncAgentLinkedDatabase class. + * Initializes a new instance of the ElasticPoolPerDatabaseSettings class. * @constructor - * An Azure SQL Database sync agent linked database. + * Per database settings of an elastic pool. * - * @member {string} [databaseType] Type of the sync agent linked database. - * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' - * @member {string} [databaseId] Id of the sync agent linked database. - * @member {string} [description] Description of the sync agent linked - * database. - * @member {string} [serverName] Server name of the sync agent linked database. - * @member {string} [databaseName] Database name of the sync agent linked - * database. - * @member {string} [userName] User name of the sync agent linked database. + * @member {number} [minCapacity] The minimum capacity all databases are + * guaranteed. + * @member {number} [maxCapacity] The maximum capacity any one database can + * consume. */ -export interface SyncAgentLinkedDatabase extends ProxyResource { - readonly databaseType?: string; - readonly databaseId?: string; - readonly description?: string; - readonly serverName?: string; - readonly databaseName?: string; - readonly userName?: string; +export interface ElasticPoolPerDatabaseSettings { + minCapacity?: number; + maxCapacity?: number; } /** * @class - * Initializes a new instance of the SyncDatabaseIdProperties class. + * Initializes a new instance of the ElasticPool class. * @constructor - * Properties of the sync database id. - * - * @member {string} [id] ARM resource id of sync database. + * An elastic pool. + * + * @member {object} [sku] + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {string} [kind] Kind of elastic pool. This is metadata used for the + * Azure portal experience. + * @member {string} [state] The state of the elastic pool. Possible values + * include: 'Creating', 'Ready', 'Disabled' + * @member {date} [creationDate] The creation date of the elastic pool (ISO8601 + * format). + * @member {number} [maxSizeBytes] The storage limit for the database elastic + * pool in bytes. + * @member {object} [perDatabaseSettings] The per database settings for the + * elastic pool. + * @member {number} [perDatabaseSettings.minCapacity] The minimum capacity all + * databases are guaranteed. + * @member {number} [perDatabaseSettings.maxCapacity] The maximum capacity any + * one database can consume. + * @member {boolean} [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. + * @member {string} [licenseType] The license type to apply for this elastic + * pool. Possible values include: 'LicenseIncluded', 'BasePrice' */ -export interface SyncDatabaseIdProperties { - readonly id?: string; +export interface ElasticPool extends TrackedResource { + sku?: Sku; + readonly kind?: string; + readonly state?: string; + readonly creationDate?: Date; + maxSizeBytes?: number; + perDatabaseSettings?: ElasticPoolPerDatabaseSettings; + zoneRedundant?: boolean; + licenseType?: string; } /** * @class - * Initializes a new instance of the SyncFullSchemaTableColumn class. + * Initializes a new instance of the ElasticPoolUpdate class. * @constructor - * Properties of the column in the table of database full schema. - * - * @member {string} [dataSize] Data size of the column. - * @member {string} [dataType] Data type of the column. - * @member {string} [errorId] Error id of the column. - * @member {boolean} [hasError] If there is error in the table. - * @member {boolean} [isPrimaryKey] If it is the primary key of the table. - * @member {string} [name] Name of the column. - * @member {string} [quotedName] Quoted name of the column. + * An elastic pool update. + * + * @member {object} [sku] + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {number} [maxSizeBytes] The storage limit for the database elastic + * pool in bytes. + * @member {object} [perDatabaseSettings] The per database settings for the + * elastic pool. + * @member {number} [perDatabaseSettings.minCapacity] The minimum capacity all + * databases are guaranteed. + * @member {number} [perDatabaseSettings.maxCapacity] The maximum capacity any + * one database can consume. + * @member {boolean} [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. + * @member {string} [licenseType] The license type to apply for this elastic + * pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * @member {object} [tags] Resource tags. */ -export interface SyncFullSchemaTableColumn { - readonly dataSize?: string; - readonly dataType?: string; - readonly errorId?: string; - readonly hasError?: boolean; - readonly isPrimaryKey?: boolean; - readonly name?: string; - readonly quotedName?: string; +export interface ElasticPoolUpdate { + sku?: Sku; + maxSizeBytes?: number; + perDatabaseSettings?: ElasticPoolPerDatabaseSettings; + zoneRedundant?: boolean; + licenseType?: string; + tags?: { [propertyName: string]: string }; } /** * @class - * Initializes a new instance of the SyncFullSchemaTable class. + * Initializes a new instance of the VulnerabilityAssessmentRecurringScansProperties class. * @constructor - * Properties of the table in the database full schema. + * Properties of a Vulnerability Assessment recurring scans. * - * @member {array} [columns] List of columns in the table of database full - * schema. - * @member {string} [errorId] Error id of the table. - * @member {boolean} [hasError] If there is error in the table. - * @member {string} [name] Name of the table. - * @member {string} [quotedName] Quoted name of the table. + * @member {boolean} [isEnabled] Recurring scans state. + * @member {boolean} [emailSubscriptionAdmins] Specifies that the schedule scan + * notification will be is sent to the subscription administrators. Default + * value: true . + * @member {array} [emails] Specifies an array of e-mail addresses to which the + * scan notification is sent. */ -export interface SyncFullSchemaTable { - readonly columns?: SyncFullSchemaTableColumn[]; - readonly errorId?: string; - readonly hasError?: boolean; - readonly name?: string; - readonly quotedName?: string; +export interface VulnerabilityAssessmentRecurringScansProperties { + isEnabled?: boolean; + emailSubscriptionAdmins?: boolean; + emails?: string[]; } /** * @class - * Initializes a new instance of the SyncFullSchemaProperties class. + * Initializes a new instance of the DatabaseVulnerabilityAssessment class. * @constructor - * Properties of the database full schema. + * A database vulnerability assessment. * - * @member {array} [tables] List of tables in the database full schema. - * @member {date} [lastUpdateTime] Last update time of the database schema. + * @member {string} [storageContainerPath] A blob storage container path to + * hold the scan results (e.g. + * https://myStorage.blob.core.windows.net/VaScans/). + * @member {string} [storageContainerSasKey] A shared access signature (SAS + * Key) that has write access to the blob container specified in + * 'storageContainerPath' parameter. + * @member {object} [recurringScans] The recurring scans settings + * @member {boolean} [recurringScans.isEnabled] Recurring scans state. + * @member {boolean} [recurringScans.emailSubscriptionAdmins] Specifies that + * the schedule scan notification will be is sent to the subscription + * administrators. + * @member {array} [recurringScans.emails] Specifies an array of e-mail + * addresses to which the scan notification is sent. */ -export interface SyncFullSchemaProperties { - readonly tables?: SyncFullSchemaTable[]; - readonly lastUpdateTime?: Date; +export interface DatabaseVulnerabilityAssessment extends ProxyResource { + storageContainerPath?: string; + storageContainerSasKey?: string; + recurringScans?: VulnerabilityAssessmentRecurringScansProperties; } /** * @class - * Initializes a new instance of the SyncGroupLogProperties class. + * Initializes a new instance of the VulnerabilityAssessmentScanError class. * @constructor - * Properties of an Azure SQL Database sync group log. + * Properties of a vulnerability assessment scan error. * - * @member {date} [timestamp] Timestamp of the sync group log. - * @member {string} [type] Type of the sync group log. Possible values include: - * 'All', 'Error', 'Warning', 'Success' - * @member {string} [source] Source of the sync group log. - * @member {string} [details] Details of the sync group log. - * @member {uuid} [tracingId] TracingId of the sync group log. - * @member {string} [operationStatus] OperationStatus of the sync group log. + * @member {string} [code] The error code. + * @member {string} [message] The error message. */ -export interface SyncGroupLogProperties { - readonly timestamp?: Date; - readonly type?: string; - readonly source?: string; - readonly details?: string; - readonly tracingId?: string; - readonly operationStatus?: string; +export interface VulnerabilityAssessmentScanError { + readonly code?: string; + readonly message?: string; } /** * @class - * Initializes a new instance of the SyncGroupSchemaTableColumn class. + * Initializes a new instance of the VulnerabilityAssessmentScanRecord class. * @constructor - * Properties of column in sync group table. + * A vulnerability assessment scan record. * - * @member {string} [quotedName] Quoted name of sync group table column. - * @member {string} [dataSize] Data size of the column. - * @member {string} [dataType] Data type of the column. + * @member {string} [scanId] The scan ID. + * @member {string} [triggerType] The scan trigger type. Possible values + * include: 'OnDemand', 'Recurring' + * @member {string} [state] The scan status. Possible values include: 'Passed', + * 'Failed', 'FailedToRun', 'InProgress' + * @member {date} [startTime] The scan start time (UTC). + * @member {date} [endTime] The scan end time (UTC). + * @member {array} [errors] The scan errors. + * @member {string} [storageContainerPath] The scan results storage container + * path. + * @member {number} [numberOfFailedSecurityChecks] The number of failed + * security checks. */ -export interface SyncGroupSchemaTableColumn { - quotedName?: string; - dataSize?: string; - dataType?: string; +export interface VulnerabilityAssessmentScanRecord extends ProxyResource { + readonly scanId?: string; + readonly triggerType?: string; + readonly state?: string; + readonly startTime?: Date; + readonly endTime?: Date; + readonly errors?: VulnerabilityAssessmentScanError[]; + readonly storageContainerPath?: string; + readonly numberOfFailedSecurityChecks?: number; } /** * @class - * Initializes a new instance of the SyncGroupSchemaTable class. + * Initializes a new instance of the DatabaseVulnerabilityAssessmentScansExport class. * @constructor - * Properties of table in sync group schema. + * A database Vulnerability Assessment scan export resource. * - * @member {array} [columns] List of columns in sync group schema. - * @member {string} [quotedName] Quoted name of sync group schema table. + * @member {string} [exportedReportLocation] Location of the exported report + * (e.g. + * https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). */ -export interface SyncGroupSchemaTable { - columns?: SyncGroupSchemaTableColumn[]; - quotedName?: string; +export interface DatabaseVulnerabilityAssessmentScansExport extends ProxyResource { + readonly exportedReportLocation?: string; } /** * @class - * Initializes a new instance of the SyncGroupSchema class. + * Initializes a new instance of the InstanceFailoverGroupReadWriteEndpoint class. * @constructor - * Properties of sync group schema. + * Read-write endpoint of the failover group instance. * - * @member {array} [tables] List of tables in sync group schema. - * @member {string} [masterSyncMemberName] Name of master sync member where the - * schema is from. + * @member {string} failoverPolicy Failover policy of the read-write endpoint + * for the failover group. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. Possible values include: + * 'Manual', 'Automatic' + * @member {number} [failoverWithDataLossGracePeriodMinutes] Grace period + * before failover with data loss is attempted for the read-write endpoint. If + * failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes is + * required. */ -export interface SyncGroupSchema { - tables?: SyncGroupSchemaTable[]; - masterSyncMemberName?: string; +export interface InstanceFailoverGroupReadWriteEndpoint { + failoverPolicy: string; + failoverWithDataLossGracePeriodMinutes?: number; } /** * @class - * Initializes a new instance of the SyncGroup class. + * Initializes a new instance of the InstanceFailoverGroupReadOnlyEndpoint class. * @constructor - * An Azure SQL Database sync group. + * Read-only endpoint of the failover group instance. * - * @member {number} [interval] Sync interval of the sync group. - * @member {date} [lastSyncTime] Last sync time of the sync group. - * @member {string} [conflictResolutionPolicy] Conflict resolution policy of - * the sync group. Possible values include: 'HubWin', 'MemberWin' - * @member {string} [syncDatabaseId] ARM resource id of the sync database in - * the sync group. - * @member {string} [hubDatabaseUserName] User name for the sync group hub - * database credential. - * @member {string} [hubDatabasePassword] Password for the sync group hub - * database credential. - * @member {string} [syncState] Sync state of the sync group. Possible values - * include: 'NotReady', 'Error', 'Warning', 'Progressing', 'Good' - * @member {object} [schema] Sync schema of the sync group. - * @member {array} [schema.tables] List of tables in sync group schema. - * @member {string} [schema.masterSyncMemberName] Name of master sync member - * where the schema is from. + * @member {string} [failoverPolicy] Failover policy of the read-only endpoint + * for the failover group. Possible values include: 'Disabled', 'Enabled' */ -export interface SyncGroup extends ProxyResource { - interval?: number; - readonly lastSyncTime?: Date; - conflictResolutionPolicy?: string; - syncDatabaseId?: string; - hubDatabaseUserName?: string; - hubDatabasePassword?: string; - readonly syncState?: string; - schema?: SyncGroupSchema; +export interface InstanceFailoverGroupReadOnlyEndpoint { + failoverPolicy?: string; } /** * @class - * Initializes a new instance of the SyncMember class. + * Initializes a new instance of the PartnerRegionInfo class. * @constructor - * An Azure SQL Database sync member. + * Partner region information for the failover group. * - * @member {string} [databaseType] Database type of the sync member. Possible - * values include: 'AzureSqlDatabase', 'SqlServerDatabase' - * @member {string} [syncAgentId] ARM resource id of the sync agent in the sync - * member. - * @member {uuid} [sqlServerDatabaseId] SQL Server database id of the sync - * member. - * @member {string} [serverName] Server name of the member database in the sync - * member - * @member {string} [databaseName] Database name of the member database in the - * sync member. - * @member {string} [userName] User name of the member database in the sync - * member. - * @member {string} [password] Password of the member database in the sync - * member. - * @member {string} [syncDirection] Sync direction of the sync member. Possible - * values include: 'Bidirectional', 'OneWayMemberToHub', 'OneWayHubToMember' - * @member {string} [syncState] Sync state of the sync member. Possible values - * include: 'SyncInProgress', 'SyncSucceeded', 'SyncFailed', - * 'DisabledTombstoneCleanup', 'DisabledBackupRestore', - * 'SyncSucceededWithWarnings', 'SyncCancelling', 'SyncCancelled', - * 'UnProvisioned', 'Provisioning', 'Provisioned', 'ProvisionFailed', - * 'DeProvisioning', 'DeProvisioned', 'DeProvisionFailed', 'Reprovisioning', - * 'ReprovisionFailed', 'UnReprovisioned' + * @member {string} [location] Geo location of the partner managed instances. + * @member {string} [replicationRole] Replication role of the partner managed + * instances. Possible values include: 'Primary', 'Secondary' */ -export interface SyncMember extends ProxyResource { - databaseType?: string; - syncAgentId?: string; - sqlServerDatabaseId?: string; - serverName?: string; - databaseName?: string; - userName?: string; - password?: string; - syncDirection?: string; - readonly syncState?: string; +export interface PartnerRegionInfo { + location?: string; + readonly replicationRole?: string; } /** * @class - * Initializes a new instance of the VirtualNetworkRule class. + * Initializes a new instance of the ManagedInstancePairInfo class. * @constructor - * A virtual network rule. + * Pairs of Managed Instances in the failover group. * - * @member {string} virtualNetworkSubnetId The ARM resource id of the virtual - * network subnet. - * @member {boolean} [ignoreMissingVnetServiceEndpoint] Create firewall rule - * before the virtual network has vnet service endpoint enabled. - * @member {string} [state] Virtual Network Rule State. Possible values - * include: 'Initializing', 'InProgress', 'Ready', 'Deleting', 'Unknown' + * @member {string} [primaryManagedInstanceId] Id of Primary Managed Instance + * in pair. + * @member {string} [partnerManagedInstanceId] Id of Partner Managed Instance + * in pair. */ -export interface VirtualNetworkRule extends ProxyResource { - virtualNetworkSubnetId: string; - ignoreMissingVnetServiceEndpoint?: boolean; - readonly state?: string; +export interface ManagedInstancePairInfo { + primaryManagedInstanceId?: string; + partnerManagedInstanceId?: string; } /** * @class - * Initializes a new instance of the DatabaseOperation class. + * Initializes a new instance of the InstanceFailoverGroup class. * @constructor - * A database operation. + * An instance failover group. * - * @member {string} [databaseName] The name of the database the operation is - * being performed on. - * @member {string} [operation] The name of operation. - * @member {string} [operationFriendlyName] The friendly name of operation. - * @member {number} [percentComplete] The percentage of the operation - * completed. - * @member {string} [serverName] The name of the server. - * @member {date} [startTime] The operation start time. - * @member {string} [state] The operation state. Possible values include: - * 'Pending', 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', - * 'Cancelled' - * @member {number} [errorCode] The operation error code. - * @member {string} [errorDescription] The operation error description. - * @member {number} [errorSeverity] The operation error severity. - * @member {boolean} [isUserError] Whether or not the error is a user error. + * @member {object} readWriteEndpoint Read-write endpoint of the failover group + * instance. + * @member {string} [readWriteEndpoint.failoverPolicy] Failover policy of the + * read-write endpoint for the failover group. If failoverPolicy is Automatic + * then failoverWithDataLossGracePeriodMinutes is required. Possible values + * include: 'Manual', 'Automatic' + * @member {number} [readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] + * Grace period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * @member {object} [readOnlyEndpoint] Read-only endpoint of the failover group + * instance. + * @member {string} [readOnlyEndpoint.failoverPolicy] Failover policy of the + * read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * @member {string} [replicationRole] Local replication role of the failover + * group instance. Possible values include: 'Primary', 'Secondary' + * @member {string} [replicationState] Replication state of the failover group + * instance. + * @member {array} partnerRegions Partner region information for the failover + * group. + * @member {array} managedInstancePairs List of managed instance pairs in the + * failover group. */ -export interface DatabaseOperation extends ProxyResource { - readonly databaseName?: string; - readonly operation?: string; - readonly operationFriendlyName?: string; - readonly percentComplete?: number; - readonly serverName?: string; - readonly startTime?: Date; - readonly state?: string; - readonly errorCode?: number; - readonly errorDescription?: string; - readonly errorSeverity?: number; - readonly isUserError?: boolean; +export interface InstanceFailoverGroup extends ProxyResource { + readWriteEndpoint: InstanceFailoverGroupReadWriteEndpoint; + readOnlyEndpoint?: InstanceFailoverGroupReadOnlyEndpoint; + readonly replicationRole?: string; + readonly replicationState?: string; + partnerRegions: PartnerRegionInfo[]; + managedInstancePairs: ManagedInstancePairInfo[]; } - /** * @class - * Initializes a new instance of the RestorePointListResult class. + * Initializes a new instance of the ShortTermRetentionPolicy class. * @constructor - * The response to a list database restore points request. + * A short term retention policy resource. * + * @member {number} [retentionDays] The backup retention period in days. This + * is how many days Point-in-Time Restore will be supported. */ -export interface RestorePointListResult extends Array { +export interface ShortTermRetentionPolicy extends ProxyResource { + retentionDays?: number; } + /** * @class * Initializes a new instance of the RecoverableDatabaseListResult class. @@ -2398,6 +3306,18 @@ export interface RecoverableDatabaseListResult extends Array { } +/** + * @class + * Initializes a new instance of the ServerListResult class. + * @constructor + * A list of servers. + * + * @member {string} [nextLink] Link to retrieve next page of results. + */ +export interface ServerListResult extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the DataMaskingRuleListResult class. @@ -2452,20 +3372,44 @@ export interface MetricDefinitionListResult extends Array { * @class * Initializes a new instance of the DatabaseListResult class. * @constructor - * Represents the response to a list database request. + * A list of databases. * + * @member {string} [nextLink] Link to retrieve next page of results. */ export interface DatabaseListResult extends Array { + readonly nextLink?: string; } /** * @class * Initializes a new instance of the ElasticPoolListResult class. * @constructor - * Represents the response to a list elastic pool request. + * The result of an elastic pool list request. * + * @member {string} [nextLink] Link to retrieve next page of results. */ export interface ElasticPoolListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the RecommendedElasticPoolListResult class. + * @constructor + * Represents the response to a list recommended elastic pool request. + * + */ +export interface RecommendedElasticPoolListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the RecommendedElasticPoolListMetricsResult class. + * @constructor + * Represents the response to a list recommended elastic pool metrics request. + * + */ +export interface RecommendedElasticPoolListMetricsResult extends Array { } /** @@ -2508,18 +3452,6 @@ export interface ServerCommunicationLinkListResult extends Array { } -/** - * @class - * Initializes a new instance of the ServerListResult class. - * @constructor - * A list of servers. - * - * @member {string} [nextLink] Link to retrieve next page of results. - */ -export interface ServerListResult extends Array { - readonly nextLink?: string; -} - /** * @class * Initializes a new instance of the ElasticPoolActivityListResult class. @@ -2540,26 +3472,6 @@ export interface ElasticPoolActivityListResult extends Array { } -/** - * @class - * Initializes a new instance of the RecommendedElasticPoolListResult class. - * @constructor - * Represents the response to a list recommended elastic pool request. - * - */ -export interface RecommendedElasticPoolListResult extends Array { -} - -/** - * @class - * Initializes a new instance of the RecommendedElasticPoolListMetricsResult class. - * @constructor - * Represents the response to a list recommended elastic pool metrics request. - * - */ -export interface RecommendedElasticPoolListMetricsResult extends Array { -} - /** * @class * Initializes a new instance of the ServiceTierAdvisorListResult class. @@ -2625,6 +3537,18 @@ export interface FailoverGroupListResult extends Array { readonly nextLink?: string; } +/** + * @class + * Initializes a new instance of the ManagedInstanceListResult class. + * @constructor + * A list of managed instances. + * + * @member {string} [nextLink] Link to retrieve next page of results. + */ +export interface ManagedInstanceListResult extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the OperationListResult class. @@ -2733,6 +3657,18 @@ export interface SyncMemberListResult extends Array { readonly nextLink?: string; } +/** + * @class + * Initializes a new instance of the SubscriptionUsageListResult class. + * @constructor + * A list of subscription usage metrics in a location. + * + * @member {string} [nextLink] Link to retrieve next page of results. + */ +export interface SubscriptionUsageListResult extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the VirtualNetworkRuleListResult class. @@ -2745,6 +3681,54 @@ export interface VirtualNetworkRuleListResult extends Array readonly nextLink?: string; } +/** + * @class + * Initializes a new instance of the LongTermRetentionBackupListResult class. + * @constructor + * A list of long term retention bacukps. + * + * @member {string} [nextLink] Link to retrieve next page of results. + */ +export interface LongTermRetentionBackupListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ManagedDatabaseListResult class. + * @constructor + * A list of managed databases. + * + * @member {string} [nextLink] Link to retrieve next page of results. + */ +export interface ManagedDatabaseListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ServerDnsAliasListResult class. + * @constructor + * A list of server DNS aliases. + * + * @member {string} [nextLink] Link to retrieve next page of results. + */ +export interface ServerDnsAliasListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the RestorePointListResult class. + * @constructor + * A list of long term retention bacukps. + * + * @member {string} [nextLink] Link to retrieve next page of results. + */ +export interface RestorePointListResult extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the DatabaseOperationListResult class. @@ -2756,3 +3740,39 @@ export interface VirtualNetworkRuleListResult extends Array export interface DatabaseOperationListResult extends Array { readonly nextLink?: string; } + +/** + * @class + * Initializes a new instance of the ElasticPoolOperationListResult class. + * @constructor + * The response to a list elastic pool operations request + * + * @member {string} [nextLink] Link to retrieve next page of results. + */ +export interface ElasticPoolOperationListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the VulnerabilityAssessmentScanRecordListResult class. + * @constructor + * A list of vulnerability assessment scan records. + * + * @member {string} [nextLink] Link to retrieve next page of results. + */ +export interface VulnerabilityAssessmentScanRecordListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the InstanceFailoverGroupListResult class. + * @constructor + * A list of instance failover groups. + * + * @member {string} [nextLink] Link to retrieve next page of results. + */ +export interface InstanceFailoverGroupListResult extends Array { + readonly nextLink?: string; +} diff --git a/lib/services/sqlManagement2/lib/models/index.js b/lib/services/sqlManagement2/lib/models/index.js index 8699dee3ab..e5d2ab0c0e 100644 --- a/lib/services/sqlManagement2/lib/models/index.js +++ b/lib/services/sqlManagement2/lib/models/index.js @@ -19,22 +19,12 @@ var msRestAzure = require('ms-rest-azure'); exports.BaseResource = msRestAzure.BaseResource; exports.CloudError = msRestAzure.CloudError; exports.Resource = require('./resource'); -exports.ProxyResource = require('./proxyResource'); -exports.BackupLongTermRetentionPolicy = require('./backupLongTermRetentionPolicy'); -exports.BackupLongTermRetentionVault = require('./backupLongTermRetentionVault'); exports.TrackedResource = require('./trackedResource'); -exports.RestorePoint = require('./restorePoint'); +exports.ProxyResource = require('./proxyResource'); exports.RecoverableDatabase = require('./recoverableDatabase'); exports.RestorableDroppedDatabase = require('./restorableDroppedDatabase'); -exports.MaxSizeCapability = require('./maxSizeCapability'); -exports.ServiceObjectiveCapability = require('./serviceObjectiveCapability'); -exports.EditionCapability = require('./editionCapability'); -exports.ElasticPoolPerDatabaseMinDtuCapability = require('./elasticPoolPerDatabaseMinDtuCapability'); -exports.ElasticPoolPerDatabaseMaxDtuCapability = require('./elasticPoolPerDatabaseMaxDtuCapability'); -exports.ElasticPoolDtuCapability = require('./elasticPoolDtuCapability'); -exports.ElasticPoolEditionCapability = require('./elasticPoolEditionCapability'); -exports.ServerVersionCapability = require('./serverVersionCapability'); -exports.LocationCapabilities = require('./locationCapabilities'); +exports.CheckNameAvailabilityRequest = require('./checkNameAvailabilityRequest'); +exports.CheckNameAvailabilityResponse = require('./checkNameAvailabilityResponse'); exports.ServerConnectionPolicy = require('./serverConnectionPolicy'); exports.DatabaseSecurityAlertPolicy = require('./databaseSecurityAlertPolicy'); exports.DataMaskingPolicy = require('./dataMaskingPolicy'); @@ -50,39 +40,38 @@ exports.MetricName = require('./metricName'); exports.Metric = require('./metric'); exports.MetricAvailability = require('./metricAvailability'); exports.MetricDefinition = require('./metricDefinition'); +exports.RecommendedElasticPoolMetric = require('./recommendedElasticPoolMetric'); +exports.RecommendedElasticPool = require('./recommendedElasticPool'); exports.ReplicationLink = require('./replicationLink'); exports.ServerAzureADAdministrator = require('./serverAzureADAdministrator'); exports.ServerCommunicationLink = require('./serverCommunicationLink'); exports.ServiceObjective = require('./serviceObjective'); -exports.CheckNameAvailabilityRequest = require('./checkNameAvailabilityRequest'); -exports.CheckNameAvailabilityResponse = require('./checkNameAvailabilityResponse'); -exports.RecommendedElasticPoolMetric = require('./recommendedElasticPoolMetric'); -exports.SloUsageMetric = require('./sloUsageMetric'); -exports.ServiceTierAdvisor = require('./serviceTierAdvisor'); -exports.TransparentDataEncryption = require('./transparentDataEncryption'); -exports.OperationImpact = require('./operationImpact'); -exports.RecommendedIndex = require('./recommendedIndex'); -exports.Database = require('./database'); -exports.RecommendedElasticPool = require('./recommendedElasticPool'); -exports.ElasticPool = require('./elasticPool'); -exports.ElasticPoolUpdate = require('./elasticPoolUpdate'); exports.ElasticPoolActivity = require('./elasticPoolActivity'); exports.ElasticPoolDatabaseActivity = require('./elasticPoolDatabaseActivity'); -exports.DatabaseUpdate = require('./databaseUpdate'); +exports.OperationImpact = require('./operationImpact'); +exports.RecommendedIndex = require('./recommendedIndex'); +exports.TransparentDataEncryption = require('./transparentDataEncryption'); +exports.SloUsageMetric = require('./sloUsageMetric'); +exports.ServiceTierAdvisor = require('./serviceTierAdvisor'); exports.TransparentDataEncryptionActivity = require('./transparentDataEncryptionActivity'); exports.ServerUsage = require('./serverUsage'); exports.DatabaseUsage = require('./databaseUsage'); exports.DatabaseBlobAuditingPolicy = require('./databaseBlobAuditingPolicy'); +exports.AutomaticTuningOptions = require('./automaticTuningOptions'); +exports.DatabaseAutomaticTuning = require('./databaseAutomaticTuning'); exports.EncryptionProtector = require('./encryptionProtector'); exports.FailoverGroupReadWriteEndpoint = require('./failoverGroupReadWriteEndpoint'); exports.FailoverGroupReadOnlyEndpoint = require('./failoverGroupReadOnlyEndpoint'); exports.PartnerInfo = require('./partnerInfo'); exports.FailoverGroup = require('./failoverGroup'); exports.FailoverGroupUpdate = require('./failoverGroupUpdate'); +exports.ResourceIdentity = require('./resourceIdentity'); +exports.Sku = require('./sku'); +exports.ManagedInstance = require('./managedInstance'); +exports.ManagedInstanceUpdate = require('./managedInstanceUpdate'); exports.OperationDisplay = require('./operationDisplay'); exports.Operation = require('./operation'); exports.ServerKey = require('./serverKey'); -exports.ResourceIdentity = require('./resourceIdentity'); exports.Server = require('./server'); exports.ServerUpdate = require('./serverUpdate'); exports.SyncAgent = require('./syncAgent'); @@ -98,11 +87,58 @@ exports.SyncGroupSchemaTable = require('./syncGroupSchemaTable'); exports.SyncGroupSchema = require('./syncGroupSchema'); exports.SyncGroup = require('./syncGroup'); exports.SyncMember = require('./syncMember'); +exports.SubscriptionUsage = require('./subscriptionUsage'); exports.VirtualNetworkRule = require('./virtualNetworkRule'); +exports.LongTermRetentionBackup = require('./longTermRetentionBackup'); +exports.BackupLongTermRetentionPolicy = require('./backupLongTermRetentionPolicy'); +exports.CompleteDatabaseRestoreDefinition = require('./completeDatabaseRestoreDefinition'); +exports.ManagedDatabase = require('./managedDatabase'); +exports.ManagedDatabaseUpdate = require('./managedDatabaseUpdate'); +exports.AutomaticTuningServerOptions = require('./automaticTuningServerOptions'); +exports.ServerAutomaticTuning = require('./serverAutomaticTuning'); +exports.ServerDnsAlias = require('./serverDnsAlias'); +exports.ServerDnsAliasAcquisition = require('./serverDnsAliasAcquisition'); +exports.RestorePoint = require('./restorePoint'); +exports.CreateDatabaseRestorePointDefinition = require('./createDatabaseRestorePointDefinition'); exports.DatabaseOperation = require('./databaseOperation'); -exports.RestorePointListResult = require('./restorePointListResult'); +exports.ElasticPoolOperation = require('./elasticPoolOperation'); +exports.MaxSizeCapability = require('./maxSizeCapability'); +exports.LogSizeCapability = require('./logSizeCapability'); +exports.MaxSizeRangeCapability = require('./maxSizeRangeCapability'); +exports.PerformanceLevelCapability = require('./performanceLevelCapability'); +exports.LicenseTypeCapability = require('./licenseTypeCapability'); +exports.ServiceObjectiveCapability = require('./serviceObjectiveCapability'); +exports.EditionCapability = require('./editionCapability'); +exports.ElasticPoolPerDatabaseMinPerformanceLevelCapability = require('./elasticPoolPerDatabaseMinPerformanceLevelCapability'); +exports.ElasticPoolPerDatabaseMaxPerformanceLevelCapability = require('./elasticPoolPerDatabaseMaxPerformanceLevelCapability'); +exports.ElasticPoolPerformanceLevelCapability = require('./elasticPoolPerformanceLevelCapability'); +exports.ElasticPoolEditionCapability = require('./elasticPoolEditionCapability'); +exports.ServerVersionCapability = require('./serverVersionCapability'); +exports.ManagedInstanceVcoresCapability = require('./managedInstanceVcoresCapability'); +exports.ManagedInstanceFamilyCapability = require('./managedInstanceFamilyCapability'); +exports.ManagedInstanceEditionCapability = require('./managedInstanceEditionCapability'); +exports.ManagedInstanceVersionCapability = require('./managedInstanceVersionCapability'); +exports.LocationCapabilities = require('./locationCapabilities'); +exports.Database = require('./database'); +exports.DatabaseUpdate = require('./databaseUpdate'); +exports.ResourceMoveDefinition = require('./resourceMoveDefinition'); +exports.ElasticPoolPerDatabaseSettings = require('./elasticPoolPerDatabaseSettings'); +exports.ElasticPool = require('./elasticPool'); +exports.ElasticPoolUpdate = require('./elasticPoolUpdate'); +exports.VulnerabilityAssessmentRecurringScansProperties = require('./vulnerabilityAssessmentRecurringScansProperties'); +exports.DatabaseVulnerabilityAssessment = require('./databaseVulnerabilityAssessment'); +exports.VulnerabilityAssessmentScanError = require('./vulnerabilityAssessmentScanError'); +exports.VulnerabilityAssessmentScanRecord = require('./vulnerabilityAssessmentScanRecord'); +exports.DatabaseVulnerabilityAssessmentScansExport = require('./databaseVulnerabilityAssessmentScansExport'); +exports.InstanceFailoverGroupReadWriteEndpoint = require('./instanceFailoverGroupReadWriteEndpoint'); +exports.InstanceFailoverGroupReadOnlyEndpoint = require('./instanceFailoverGroupReadOnlyEndpoint'); +exports.PartnerRegionInfo = require('./partnerRegionInfo'); +exports.ManagedInstancePairInfo = require('./managedInstancePairInfo'); +exports.InstanceFailoverGroup = require('./instanceFailoverGroup'); +exports.ShortTermRetentionPolicy = require('./shortTermRetentionPolicy'); exports.RecoverableDatabaseListResult = require('./recoverableDatabaseListResult'); exports.RestorableDroppedDatabaseListResult = require('./restorableDroppedDatabaseListResult'); +exports.ServerListResult = require('./serverListResult'); exports.DataMaskingRuleListResult = require('./dataMaskingRuleListResult'); exports.FirewallRuleListResult = require('./firewallRuleListResult'); exports.GeoBackupPolicyListResult = require('./geoBackupPolicyListResult'); @@ -110,21 +146,21 @@ exports.MetricListResult = require('./metricListResult'); exports.MetricDefinitionListResult = require('./metricDefinitionListResult'); exports.DatabaseListResult = require('./databaseListResult'); exports.ElasticPoolListResult = require('./elasticPoolListResult'); +exports.RecommendedElasticPoolListResult = require('./recommendedElasticPoolListResult'); +exports.RecommendedElasticPoolListMetricsResult = require('./recommendedElasticPoolListMetricsResult'); exports.ReplicationLinkListResult = require('./replicationLinkListResult'); exports.ServerAdministratorListResult = require('./serverAdministratorListResult'); exports.ServerCommunicationLinkListResult = require('./serverCommunicationLinkListResult'); exports.ServiceObjectiveListResult = require('./serviceObjectiveListResult'); -exports.ServerListResult = require('./serverListResult'); exports.ElasticPoolActivityListResult = require('./elasticPoolActivityListResult'); exports.ElasticPoolDatabaseActivityListResult = require('./elasticPoolDatabaseActivityListResult'); -exports.RecommendedElasticPoolListResult = require('./recommendedElasticPoolListResult'); -exports.RecommendedElasticPoolListMetricsResult = require('./recommendedElasticPoolListMetricsResult'); exports.ServiceTierAdvisorListResult = require('./serviceTierAdvisorListResult'); exports.TransparentDataEncryptionActivityListResult = require('./transparentDataEncryptionActivityListResult'); exports.ServerUsageListResult = require('./serverUsageListResult'); exports.DatabaseUsageListResult = require('./databaseUsageListResult'); exports.EncryptionProtectorListResult = require('./encryptionProtectorListResult'); exports.FailoverGroupListResult = require('./failoverGroupListResult'); +exports.ManagedInstanceListResult = require('./managedInstanceListResult'); exports.OperationListResult = require('./operationListResult'); exports.ServerKeyListResult = require('./serverKeyListResult'); exports.SyncAgentListResult = require('./syncAgentListResult'); @@ -134,5 +170,13 @@ exports.SyncFullSchemaPropertiesListResult = require('./syncFullSchemaProperties exports.SyncGroupLogListResult = require('./syncGroupLogListResult'); exports.SyncGroupListResult = require('./syncGroupListResult'); exports.SyncMemberListResult = require('./syncMemberListResult'); +exports.SubscriptionUsageListResult = require('./subscriptionUsageListResult'); exports.VirtualNetworkRuleListResult = require('./virtualNetworkRuleListResult'); +exports.LongTermRetentionBackupListResult = require('./longTermRetentionBackupListResult'); +exports.ManagedDatabaseListResult = require('./managedDatabaseListResult'); +exports.ServerDnsAliasListResult = require('./serverDnsAliasListResult'); +exports.RestorePointListResult = require('./restorePointListResult'); exports.DatabaseOperationListResult = require('./databaseOperationListResult'); +exports.ElasticPoolOperationListResult = require('./elasticPoolOperationListResult'); +exports.VulnerabilityAssessmentScanRecordListResult = require('./vulnerabilityAssessmentScanRecordListResult'); +exports.InstanceFailoverGroupListResult = require('./instanceFailoverGroupListResult'); diff --git a/lib/services/sqlManagement2/lib/models/instanceFailoverGroup.js b/lib/services/sqlManagement2/lib/models/instanceFailoverGroup.js new file mode 100644 index 0000000000..e9922cbba8 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/instanceFailoverGroup.js @@ -0,0 +1,158 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An instance failover group. + * + * @extends models['ProxyResource'] + */ +class InstanceFailoverGroup extends models['ProxyResource'] { + /** + * Create a InstanceFailoverGroup. + * @member {object} readWriteEndpoint Read-write endpoint of the failover + * group instance. + * @member {string} [readWriteEndpoint.failoverPolicy] Failover policy of the + * read-write endpoint for the failover group. If failoverPolicy is Automatic + * then failoverWithDataLossGracePeriodMinutes is required. Possible values + * include: 'Manual', 'Automatic' + * @member {number} + * [readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace period + * before failover with data loss is attempted for the read-write endpoint. + * If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes + * is required. + * @member {object} [readOnlyEndpoint] Read-only endpoint of the failover + * group instance. + * @member {string} [readOnlyEndpoint.failoverPolicy] Failover policy of the + * read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * @member {string} [replicationRole] Local replication role of the failover + * group instance. Possible values include: 'Primary', 'Secondary' + * @member {string} [replicationState] Replication state of the failover + * group instance. + * @member {array} partnerRegions Partner region information for the failover + * group. + * @member {array} managedInstancePairs List of managed instance pairs in the + * failover group. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of InstanceFailoverGroup + * + * @returns {object} metadata of InstanceFailoverGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'InstanceFailoverGroup', + type: { + name: 'Composite', + className: 'InstanceFailoverGroup', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + readWriteEndpoint: { + required: true, + serializedName: 'properties.readWriteEndpoint', + type: { + name: 'Composite', + className: 'InstanceFailoverGroupReadWriteEndpoint' + } + }, + readOnlyEndpoint: { + required: false, + serializedName: 'properties.readOnlyEndpoint', + type: { + name: 'Composite', + className: 'InstanceFailoverGroupReadOnlyEndpoint' + } + }, + replicationRole: { + required: false, + readOnly: true, + serializedName: 'properties.replicationRole', + type: { + name: 'String' + } + }, + replicationState: { + required: false, + readOnly: true, + serializedName: 'properties.replicationState', + type: { + name: 'String' + } + }, + partnerRegions: { + required: true, + serializedName: 'properties.partnerRegions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PartnerRegionInfoElementType', + type: { + name: 'Composite', + className: 'PartnerRegionInfo' + } + } + } + }, + managedInstancePairs: { + required: true, + serializedName: 'properties.managedInstancePairs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ManagedInstancePairInfoElementType', + type: { + name: 'Composite', + className: 'ManagedInstancePairInfo' + } + } + } + } + } + } + }; + } +} + +module.exports = InstanceFailoverGroup; diff --git a/lib/services/sqlManagement2/lib/models/instanceFailoverGroupListResult.js b/lib/services/sqlManagement2/lib/models/instanceFailoverGroupListResult.js new file mode 100644 index 0000000000..48f17c2c73 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/instanceFailoverGroupListResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A list of instance failover groups. + */ +class InstanceFailoverGroupListResult extends Array { + /** + * Create a InstanceFailoverGroupListResult. + * @member {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of InstanceFailoverGroupListResult + * + * @returns {object} metadata of InstanceFailoverGroupListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'InstanceFailoverGroupListResult', + type: { + name: 'Composite', + className: 'InstanceFailoverGroupListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'InstanceFailoverGroupElementType', + type: { + name: 'Composite', + className: 'InstanceFailoverGroup' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = InstanceFailoverGroupListResult; diff --git a/lib/services/sqlManagement2/lib/models/instanceFailoverGroupReadOnlyEndpoint.js b/lib/services/sqlManagement2/lib/models/instanceFailoverGroupReadOnlyEndpoint.js new file mode 100644 index 0000000000..a1ddd1b8a8 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/instanceFailoverGroupReadOnlyEndpoint.js @@ -0,0 +1,54 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Read-only endpoint of the failover group instance. + * + */ +class InstanceFailoverGroupReadOnlyEndpoint { + /** + * Create a InstanceFailoverGroupReadOnlyEndpoint. + * @member {string} [failoverPolicy] Failover policy of the read-only + * endpoint for the failover group. Possible values include: 'Disabled', + * 'Enabled' + */ + constructor() { + } + + /** + * Defines the metadata of InstanceFailoverGroupReadOnlyEndpoint + * + * @returns {object} metadata of InstanceFailoverGroupReadOnlyEndpoint + * + */ + mapper() { + return { + required: false, + serializedName: 'InstanceFailoverGroupReadOnlyEndpoint', + type: { + name: 'Composite', + className: 'InstanceFailoverGroupReadOnlyEndpoint', + modelProperties: { + failoverPolicy: { + required: false, + serializedName: 'failoverPolicy', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = InstanceFailoverGroupReadOnlyEndpoint; diff --git a/lib/services/sqlManagement2/lib/models/instanceFailoverGroupReadWriteEndpoint.js b/lib/services/sqlManagement2/lib/models/instanceFailoverGroupReadWriteEndpoint.js new file mode 100644 index 0000000000..860c661d76 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/instanceFailoverGroupReadWriteEndpoint.js @@ -0,0 +1,66 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Read-write endpoint of the failover group instance. + * + */ +class InstanceFailoverGroupReadWriteEndpoint { + /** + * Create a InstanceFailoverGroupReadWriteEndpoint. + * @member {string} failoverPolicy Failover policy of the read-write endpoint + * for the failover group. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. Possible values + * include: 'Manual', 'Automatic' + * @member {number} [failoverWithDataLossGracePeriodMinutes] Grace period + * before failover with data loss is attempted for the read-write endpoint. + * If failoverPolicy is Automatic then failoverWithDataLossGracePeriodMinutes + * is required. + */ + constructor() { + } + + /** + * Defines the metadata of InstanceFailoverGroupReadWriteEndpoint + * + * @returns {object} metadata of InstanceFailoverGroupReadWriteEndpoint + * + */ + mapper() { + return { + required: false, + serializedName: 'InstanceFailoverGroupReadWriteEndpoint', + type: { + name: 'Composite', + className: 'InstanceFailoverGroupReadWriteEndpoint', + modelProperties: { + failoverPolicy: { + required: true, + serializedName: 'failoverPolicy', + type: { + name: 'String' + } + }, + failoverWithDataLossGracePeriodMinutes: { + required: false, + serializedName: 'failoverWithDataLossGracePeriodMinutes', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = InstanceFailoverGroupReadWriteEndpoint; diff --git a/lib/services/sqlManagement2/lib/models/licenseTypeCapability.js b/lib/services/sqlManagement2/lib/models/licenseTypeCapability.js new file mode 100644 index 0000000000..7149b0c6b8 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/licenseTypeCapability.js @@ -0,0 +1,73 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The license type capability + * + */ +class LicenseTypeCapability { + /** + * Create a LicenseTypeCapability. + * @member {string} [name] License type identifier. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. + */ + constructor() { + } + + /** + * Defines the metadata of LicenseTypeCapability + * + * @returns {object} metadata of LicenseTypeCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'LicenseTypeCapability', + type: { + name: 'Composite', + className: 'LicenseTypeCapability', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LicenseTypeCapability; diff --git a/lib/services/sqlManagement2/lib/models/locationCapabilities.js b/lib/services/sqlManagement2/lib/models/locationCapabilities.js index 4b7e537941..0f72b83c59 100644 --- a/lib/services/sqlManagement2/lib/models/locationCapabilities.js +++ b/lib/services/sqlManagement2/lib/models/locationCapabilities.js @@ -13,17 +13,21 @@ const models = require('./index'); /** - * The capabilities for a location. + * The location capability. * */ class LocationCapabilities { /** * Create a LocationCapabilities. * @member {string} [name] The location name. - * @member {string} [status] Azure SQL Database's status for the location. - * Possible values include: 'Visible', 'Available', 'Default', 'Disabled' * @member {array} [supportedServerVersions] The list of supported server * versions. + * @member {array} [supportedManagedInstanceVersions] The list of supported + * managed instance versions. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. */ constructor() { } @@ -50,30 +54,53 @@ class LocationCapabilities { name: 'String' } }, - status: { + supportedServerVersions: { required: false, readOnly: true, - serializedName: 'status', + serializedName: 'supportedServerVersions', type: { - name: 'Enum', - allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + name: 'Sequence', + element: { + required: false, + serializedName: 'ServerVersionCapabilityElementType', + type: { + name: 'Composite', + className: 'ServerVersionCapability' + } + } } }, - supportedServerVersions: { + supportedManagedInstanceVersions: { required: false, readOnly: true, - serializedName: 'supportedServerVersions', + serializedName: 'supportedManagedInstanceVersions', type: { name: 'Sequence', element: { required: false, - serializedName: 'ServerVersionCapabilityElementType', + serializedName: 'ManagedInstanceVersionCapabilityElementType', type: { name: 'Composite', - className: 'ServerVersionCapability' + className: 'ManagedInstanceVersionCapability' } } } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } } } } diff --git a/lib/services/sqlManagement2/lib/models/logSizeCapability.js b/lib/services/sqlManagement2/lib/models/logSizeCapability.js new file mode 100644 index 0000000000..939f3898f1 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/logSizeCapability.js @@ -0,0 +1,64 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The log size capability. + * + */ +class LogSizeCapability { + /** + * Create a LogSizeCapability. + * @member {number} [limit] The log size limit (see 'unit' for the units). + * @member {string} [unit] The units that the limit is expressed in. Possible + * values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes', + * 'Percent' + */ + constructor() { + } + + /** + * Defines the metadata of LogSizeCapability + * + * @returns {object} metadata of LogSizeCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'LogSizeCapability', + type: { + name: 'Composite', + className: 'LogSizeCapability', + modelProperties: { + limit: { + required: false, + readOnly: true, + serializedName: 'limit', + type: { + name: 'Number' + } + }, + unit: { + required: false, + readOnly: true, + serializedName: 'unit', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LogSizeCapability; diff --git a/lib/services/sqlManagement2/lib/models/longTermRetentionBackup.js b/lib/services/sqlManagement2/lib/models/longTermRetentionBackup.js new file mode 100644 index 0000000000..d5c13d1442 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/longTermRetentionBackup.js @@ -0,0 +1,129 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A long term retention backup. + * + * @extends models['ProxyResource'] + */ +class LongTermRetentionBackup extends models['ProxyResource'] { + /** + * Create a LongTermRetentionBackup. + * @member {string} [serverName] The server name that the backup database + * belong to. + * @member {date} [serverCreateTime] The create time of the server. + * @member {string} [databaseName] The name of the database the backup belong + * to + * @member {date} [databaseDeletionTime] The delete time of the database + * @member {date} [backupTime] The time the backup was taken + * @member {date} [backupExpirationTime] The time the long term retention + * backup will expire. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LongTermRetentionBackup + * + * @returns {object} metadata of LongTermRetentionBackup + * + */ + mapper() { + return { + required: false, + serializedName: 'LongTermRetentionBackup', + type: { + name: 'Composite', + className: 'LongTermRetentionBackup', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + serverName: { + required: false, + readOnly: true, + serializedName: 'properties.serverName', + type: { + name: 'String' + } + }, + serverCreateTime: { + required: false, + readOnly: true, + serializedName: 'properties.serverCreateTime', + type: { + name: 'DateTime' + } + }, + databaseName: { + required: false, + readOnly: true, + serializedName: 'properties.databaseName', + type: { + name: 'String' + } + }, + databaseDeletionTime: { + required: false, + readOnly: true, + serializedName: 'properties.databaseDeletionTime', + type: { + name: 'DateTime' + } + }, + backupTime: { + required: false, + readOnly: true, + serializedName: 'properties.backupTime', + type: { + name: 'DateTime' + } + }, + backupExpirationTime: { + required: false, + readOnly: true, + serializedName: 'properties.backupExpirationTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = LongTermRetentionBackup; diff --git a/lib/services/sqlManagement2/lib/models/longTermRetentionBackupListResult.js b/lib/services/sqlManagement2/lib/models/longTermRetentionBackupListResult.js new file mode 100644 index 0000000000..a03e44911a --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/longTermRetentionBackupListResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A list of long term retention bacukps. + */ +class LongTermRetentionBackupListResult extends Array { + /** + * Create a LongTermRetentionBackupListResult. + * @member {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LongTermRetentionBackupListResult + * + * @returns {object} metadata of LongTermRetentionBackupListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LongTermRetentionBackupListResult', + type: { + name: 'Composite', + className: 'LongTermRetentionBackupListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LongTermRetentionBackupElementType', + type: { + name: 'Composite', + className: 'LongTermRetentionBackup' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LongTermRetentionBackupListResult; diff --git a/lib/services/sqlManagement2/lib/models/managedDatabase.js b/lib/services/sqlManagement2/lib/models/managedDatabase.js new file mode 100644 index 0000000000..42e4dcefc4 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedDatabase.js @@ -0,0 +1,213 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A managed database resource. + * + * @extends models['TrackedResource'] + */ +class ManagedDatabase extends models['TrackedResource'] { + /** + * Create a ManagedDatabase. + * @member {string} [collation] Collation of the managed database. + * @member {string} [status] Status for the database. Possible values + * include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible' + * @member {date} [creationDate] Creation date of the database. + * @member {date} [earliestRestorePoint] Earliest restore point in time for + * point in time restore. + * @member {date} [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. + * @member {string} [defaultSecondaryLocation] Geo paired region. + * @member {string} [catalogCollation] Collation of the metadata catalog. + * Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * @member {string} [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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * @member {string} [storageContainerUri] Conditional. If createMode is + * RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * @member {string} [sourceDatabaseId] The resource identifier of the source + * database associated with create operation of this database. + * @member {string} [storageContainerSasToken] Conditional. If createMode is + * RestoreExternalBackup, this value is required. Specifies the storage + * container sas token. + * @member {string} [failoverGroupId] Instance Failover Group resource + * identifier that this managed database belongs to. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ManagedDatabase + * + * @returns {object} metadata of ManagedDatabase + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedDatabase', + type: { + name: 'Composite', + className: 'ManagedDatabase', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + collation: { + required: false, + serializedName: 'properties.collation', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + creationDate: { + required: false, + readOnly: true, + serializedName: 'properties.creationDate', + type: { + name: 'DateTime' + } + }, + earliestRestorePoint: { + required: false, + readOnly: true, + serializedName: 'properties.earliestRestorePoint', + type: { + name: 'DateTime' + } + }, + restorePointInTime: { + required: false, + serializedName: 'properties.restorePointInTime', + type: { + name: 'DateTime' + } + }, + defaultSecondaryLocation: { + required: false, + readOnly: true, + serializedName: 'properties.defaultSecondaryLocation', + type: { + name: 'String' + } + }, + catalogCollation: { + required: false, + serializedName: 'properties.catalogCollation', + type: { + name: 'String' + } + }, + createMode: { + required: false, + serializedName: 'properties.createMode', + type: { + name: 'String' + } + }, + storageContainerUri: { + required: false, + serializedName: 'properties.storageContainerUri', + type: { + name: 'String' + } + }, + sourceDatabaseId: { + required: false, + serializedName: 'properties.sourceDatabaseId', + type: { + name: 'String' + } + }, + storageContainerSasToken: { + required: false, + serializedName: 'properties.storageContainerSasToken', + type: { + name: 'String' + } + }, + failoverGroupId: { + required: false, + readOnly: true, + serializedName: 'properties.failoverGroupId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedDatabase; diff --git a/lib/services/sqlManagement2/lib/models/managedDatabaseListResult.js b/lib/services/sqlManagement2/lib/models/managedDatabaseListResult.js new file mode 100644 index 0000000000..dcd44d94b3 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedDatabaseListResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A list of managed databases. + */ +class ManagedDatabaseListResult extends Array { + /** + * Create a ManagedDatabaseListResult. + * @member {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ManagedDatabaseListResult + * + * @returns {object} metadata of ManagedDatabaseListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedDatabaseListResult', + type: { + name: 'Composite', + className: 'ManagedDatabaseListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ManagedDatabaseElementType', + type: { + name: 'Composite', + className: 'ManagedDatabase' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedDatabaseListResult; diff --git a/lib/services/sqlManagement2/lib/models/managedDatabaseUpdate.js b/lib/services/sqlManagement2/lib/models/managedDatabaseUpdate.js new file mode 100644 index 0000000000..8649d21350 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedDatabaseUpdate.js @@ -0,0 +1,179 @@ +/* + * 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. + */ + +'use strict'; + +/** + * An managed database update. + * + */ +class ManagedDatabaseUpdate { + /** + * Create a ManagedDatabaseUpdate. + * @member {string} [collation] Collation of the managed database. + * @member {string} [status] Status for the database. Possible values + * include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible' + * @member {date} [creationDate] Creation date of the database. + * @member {date} [earliestRestorePoint] Earliest restore point in time for + * point in time restore. + * @member {date} [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. + * @member {string} [defaultSecondaryLocation] Geo paired region. + * @member {string} [catalogCollation] Collation of the metadata catalog. + * Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * @member {string} [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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * @member {string} [storageContainerUri] Conditional. If createMode is + * RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * @member {string} [sourceDatabaseId] The resource identifier of the source + * database associated with create operation of this database. + * @member {string} [storageContainerSasToken] Conditional. If createMode is + * RestoreExternalBackup, this value is required. Specifies the storage + * container sas token. + * @member {string} [failoverGroupId] Instance Failover Group resource + * identifier that this managed database belongs to. + * @member {object} [tags] Resource tags. + */ + constructor() { + } + + /** + * Defines the metadata of ManagedDatabaseUpdate + * + * @returns {object} metadata of ManagedDatabaseUpdate + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedDatabaseUpdate', + type: { + name: 'Composite', + className: 'ManagedDatabaseUpdate', + modelProperties: { + collation: { + required: false, + serializedName: 'properties.collation', + type: { + name: 'String' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'properties.status', + type: { + name: 'String' + } + }, + creationDate: { + required: false, + readOnly: true, + serializedName: 'properties.creationDate', + type: { + name: 'DateTime' + } + }, + earliestRestorePoint: { + required: false, + readOnly: true, + serializedName: 'properties.earliestRestorePoint', + type: { + name: 'DateTime' + } + }, + restorePointInTime: { + required: false, + serializedName: 'properties.restorePointInTime', + type: { + name: 'DateTime' + } + }, + defaultSecondaryLocation: { + required: false, + readOnly: true, + serializedName: 'properties.defaultSecondaryLocation', + type: { + name: 'String' + } + }, + catalogCollation: { + required: false, + serializedName: 'properties.catalogCollation', + type: { + name: 'String' + } + }, + createMode: { + required: false, + serializedName: 'properties.createMode', + type: { + name: 'String' + } + }, + storageContainerUri: { + required: false, + serializedName: 'properties.storageContainerUri', + type: { + name: 'String' + } + }, + sourceDatabaseId: { + required: false, + serializedName: 'properties.sourceDatabaseId', + type: { + name: 'String' + } + }, + storageContainerSasToken: { + required: false, + serializedName: 'properties.storageContainerSasToken', + type: { + name: 'String' + } + }, + failoverGroupId: { + required: false, + readOnly: true, + serializedName: 'properties.failoverGroupId', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ManagedDatabaseUpdate; diff --git a/lib/services/sqlManagement2/lib/models/managedInstance.js b/lib/services/sqlManagement2/lib/models/managedInstance.js new file mode 100644 index 0000000000..bfef773885 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedInstance.js @@ -0,0 +1,198 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An Azure SQL managed instance. + * + * @extends models['TrackedResource'] + */ +class ManagedInstance extends models['TrackedResource'] { + /** + * Create a ManagedInstance. + * @member {object} [identity] The Azure Active Directory identity of the + * managed instance. + * @member {uuid} [identity.principalId] The Azure Active Directory principal + * id. + * @member {string} [identity.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' + * @member {uuid} [identity.tenantId] The Azure Active Directory tenant id. + * @member {object} [sku] Managed instance sku + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {string} [fullyQualifiedDomainName] The fully qualified domain + * name of the managed instance. + * @member {string} [administratorLogin] Administrator username for the + * managed instance. Can only be specified when the managed instance is being + * created (and is required for creation). + * @member {string} [administratorLoginPassword] The administrator login + * password (required for managed instance creation). + * @member {string} [subnetId] Subnet resource ID for the managed instance. + * @member {string} [state] The state of the managed instance. + * @member {string} [licenseType] The license type. Possible values are + * 'LicenseIncluded' and 'BasePrice'. + * @member {number} [vCores] The number of VCores. + * @member {number} [storageSizeInGB] The maximum storage size in GB. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ManagedInstance + * + * @returns {object} metadata of ManagedInstance + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedInstance', + type: { + name: 'Composite', + className: 'ManagedInstance', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + location: { + required: true, + serializedName: 'location', + type: { + name: 'String' + } + }, + identity: { + required: false, + serializedName: 'identity', + type: { + name: 'Composite', + className: 'ResourceIdentity' + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + fullyQualifiedDomainName: { + required: false, + readOnly: true, + serializedName: 'properties.fullyQualifiedDomainName', + type: { + name: 'String' + } + }, + administratorLogin: { + required: false, + serializedName: 'properties.administratorLogin', + type: { + name: 'String' + } + }, + administratorLoginPassword: { + required: false, + serializedName: 'properties.administratorLoginPassword', + type: { + name: 'String' + } + }, + subnetId: { + required: false, + serializedName: 'properties.subnetId', + type: { + name: 'String' + } + }, + state: { + required: false, + readOnly: true, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + licenseType: { + required: false, + serializedName: 'properties.licenseType', + type: { + name: 'String' + } + }, + vCores: { + required: false, + serializedName: 'properties.vCores', + type: { + name: 'Number' + } + }, + storageSizeInGB: { + required: false, + serializedName: 'properties.storageSizeInGB', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ManagedInstance; diff --git a/lib/services/sqlManagement2/lib/models/managedInstanceEditionCapability.js b/lib/services/sqlManagement2/lib/models/managedInstanceEditionCapability.js new file mode 100644 index 0000000000..c117ce2d74 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedInstanceEditionCapability.js @@ -0,0 +1,92 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The managed server capability + * + */ +class ManagedInstanceEditionCapability { + /** + * Create a ManagedInstanceEditionCapability. + * @member {string} [name] The managed server version name. + * @member {array} [supportedFamilies] The supported families. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. + */ + constructor() { + } + + /** + * Defines the metadata of ManagedInstanceEditionCapability + * + * @returns {object} metadata of ManagedInstanceEditionCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedInstanceEditionCapability', + type: { + name: 'Composite', + className: 'ManagedInstanceEditionCapability', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + supportedFamilies: { + required: false, + readOnly: true, + serializedName: 'supportedFamilies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ManagedInstanceFamilyCapabilityElementType', + type: { + name: 'Composite', + className: 'ManagedInstanceFamilyCapability' + } + } + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedInstanceEditionCapability; diff --git a/lib/services/sqlManagement2/lib/models/managedInstanceFamilyCapability.js b/lib/services/sqlManagement2/lib/models/managedInstanceFamilyCapability.js new file mode 100644 index 0000000000..1ef2e7e779 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedInstanceFamilyCapability.js @@ -0,0 +1,151 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The managed server family capability. + * + */ +class ManagedInstanceFamilyCapability { + /** + * Create a ManagedInstanceFamilyCapability. + * @member {string} [name] Family name. + * @member {string} [sku] SKU name. + * @member {array} [supportedLicenseTypes] List of supported license types. + * @member {array} [supportedVcoresValues] List of supported virtual cores + * values. + * @member {object} [includedMaxSize] Included size. + * @member {number} [includedMaxSize.limit] The maximum size limit (see + * 'unit' for the units). + * @member {string} [includedMaxSize.unit] The units that the limit is + * expressed in. Possible values include: 'Megabytes', 'Gigabytes', + * 'Terabytes', 'Petabytes' + * @member {array} [supportedStorageSizes] Storage size ranges. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. + */ + constructor() { + } + + /** + * Defines the metadata of ManagedInstanceFamilyCapability + * + * @returns {object} metadata of ManagedInstanceFamilyCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedInstanceFamilyCapability', + type: { + name: 'Composite', + className: 'ManagedInstanceFamilyCapability', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + sku: { + required: false, + readOnly: true, + serializedName: 'sku', + type: { + name: 'String' + } + }, + supportedLicenseTypes: { + required: false, + readOnly: true, + serializedName: 'supportedLicenseTypes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LicenseTypeCapabilityElementType', + type: { + name: 'Composite', + className: 'LicenseTypeCapability' + } + } + } + }, + supportedVcoresValues: { + required: false, + readOnly: true, + serializedName: 'supportedVcoresValues', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ManagedInstanceVcoresCapabilityElementType', + type: { + name: 'Composite', + className: 'ManagedInstanceVcoresCapability' + } + } + } + }, + includedMaxSize: { + required: false, + readOnly: true, + serializedName: 'includedMaxSize', + type: { + name: 'Composite', + className: 'MaxSizeCapability' + } + }, + supportedStorageSizes: { + required: false, + readOnly: true, + serializedName: 'supportedStorageSizes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MaxSizeRangeCapabilityElementType', + type: { + name: 'Composite', + className: 'MaxSizeRangeCapability' + } + } + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedInstanceFamilyCapability; diff --git a/lib/services/sqlManagement2/lib/models/managedInstanceListResult.js b/lib/services/sqlManagement2/lib/models/managedInstanceListResult.js new file mode 100644 index 0000000000..a6b27f7ebf --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedInstanceListResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A list of managed instances. + */ +class ManagedInstanceListResult extends Array { + /** + * Create a ManagedInstanceListResult. + * @member {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ManagedInstanceListResult + * + * @returns {object} metadata of ManagedInstanceListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedInstanceListResult', + type: { + name: 'Composite', + className: 'ManagedInstanceListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ManagedInstanceElementType', + type: { + name: 'Composite', + className: 'ManagedInstance' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedInstanceListResult; diff --git a/lib/services/sqlManagement2/lib/models/managedInstancePairInfo.js b/lib/services/sqlManagement2/lib/models/managedInstancePairInfo.js new file mode 100644 index 0000000000..c352f8d74c --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedInstancePairInfo.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Pairs of Managed Instances in the failover group. + * + */ +class ManagedInstancePairInfo { + /** + * Create a ManagedInstancePairInfo. + * @member {string} [primaryManagedInstanceId] Id of Primary Managed Instance + * in pair. + * @member {string} [partnerManagedInstanceId] Id of Partner Managed Instance + * in pair. + */ + constructor() { + } + + /** + * Defines the metadata of ManagedInstancePairInfo + * + * @returns {object} metadata of ManagedInstancePairInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedInstancePairInfo', + type: { + name: 'Composite', + className: 'ManagedInstancePairInfo', + modelProperties: { + primaryManagedInstanceId: { + required: false, + serializedName: 'primaryManagedInstanceId', + type: { + name: 'String' + } + }, + partnerManagedInstanceId: { + required: false, + serializedName: 'partnerManagedInstanceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedInstancePairInfo; diff --git a/lib/services/sqlManagement2/lib/models/managedInstanceUpdate.js b/lib/services/sqlManagement2/lib/models/managedInstanceUpdate.js new file mode 100644 index 0000000000..0e6ca36d12 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedInstanceUpdate.js @@ -0,0 +1,149 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * An update request for an Azure SQL Database managed instance. + * + */ +class ManagedInstanceUpdate { + /** + * Create a ManagedInstanceUpdate. + * @member {object} [sku] Managed instance sku + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {string} [fullyQualifiedDomainName] The fully qualified domain + * name of the managed instance. + * @member {string} [administratorLogin] Administrator username for the + * managed instance. Can only be specified when the managed instance is being + * created (and is required for creation). + * @member {string} [administratorLoginPassword] The administrator login + * password (required for managed instance creation). + * @member {string} [subnetId] Subnet resource ID for the managed instance. + * @member {string} [state] The state of the managed instance. + * @member {string} [licenseType] The license type. Possible values are + * 'LicenseIncluded' and 'BasePrice'. + * @member {number} [vCores] The number of VCores. + * @member {number} [storageSizeInGB] The maximum storage size in GB. + * @member {object} [tags] Resource tags. + */ + constructor() { + } + + /** + * Defines the metadata of ManagedInstanceUpdate + * + * @returns {object} metadata of ManagedInstanceUpdate + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedInstanceUpdate', + type: { + name: 'Composite', + className: 'ManagedInstanceUpdate', + modelProperties: { + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'Sku' + } + }, + fullyQualifiedDomainName: { + required: false, + readOnly: true, + serializedName: 'properties.fullyQualifiedDomainName', + type: { + name: 'String' + } + }, + administratorLogin: { + required: false, + serializedName: 'properties.administratorLogin', + type: { + name: 'String' + } + }, + administratorLoginPassword: { + required: false, + serializedName: 'properties.administratorLoginPassword', + type: { + name: 'String' + } + }, + subnetId: { + required: false, + serializedName: 'properties.subnetId', + type: { + name: 'String' + } + }, + state: { + required: false, + readOnly: true, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + licenseType: { + required: false, + serializedName: 'properties.licenseType', + type: { + name: 'String' + } + }, + vCores: { + required: false, + serializedName: 'properties.vCores', + type: { + name: 'Number' + } + }, + storageSizeInGB: { + required: false, + serializedName: 'properties.storageSizeInGB', + type: { + name: 'Number' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ManagedInstanceUpdate; diff --git a/lib/services/sqlManagement2/lib/models/managedInstanceVcoresCapability.js b/lib/services/sqlManagement2/lib/models/managedInstanceVcoresCapability.js new file mode 100644 index 0000000000..2bed9e08d7 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedInstanceVcoresCapability.js @@ -0,0 +1,82 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The managed instance virtual cores capability. + * + */ +class ManagedInstanceVcoresCapability { + /** + * Create a ManagedInstanceVcoresCapability. + * @member {string} [name] The virtual cores identifier. + * @member {number} [value] The virtual cores value. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. + */ + constructor() { + } + + /** + * Defines the metadata of ManagedInstanceVcoresCapability + * + * @returns {object} metadata of ManagedInstanceVcoresCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedInstanceVcoresCapability', + type: { + name: 'Composite', + className: 'ManagedInstanceVcoresCapability', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'Number' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedInstanceVcoresCapability; diff --git a/lib/services/sqlManagement2/lib/models/managedInstanceVersionCapability.js b/lib/services/sqlManagement2/lib/models/managedInstanceVersionCapability.js new file mode 100644 index 0000000000..8cd7cdf2e5 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/managedInstanceVersionCapability.js @@ -0,0 +1,93 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The managed instance capability + * + */ +class ManagedInstanceVersionCapability { + /** + * Create a ManagedInstanceVersionCapability. + * @member {string} [name] The server version name. + * @member {array} [supportedEditions] The list of supported managed instance + * editions. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. + */ + constructor() { + } + + /** + * Defines the metadata of ManagedInstanceVersionCapability + * + * @returns {object} metadata of ManagedInstanceVersionCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'ManagedInstanceVersionCapability', + type: { + name: 'Composite', + className: 'ManagedInstanceVersionCapability', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + supportedEditions: { + required: false, + readOnly: true, + serializedName: 'supportedEditions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ManagedInstanceEditionCapabilityElementType', + type: { + name: 'Composite', + className: 'ManagedInstanceEditionCapability' + } + } + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ManagedInstanceVersionCapability; diff --git a/lib/services/sqlManagement2/lib/models/maxSizeCapability.js b/lib/services/sqlManagement2/lib/models/maxSizeCapability.js index 04a717e819..14fe8dc472 100644 --- a/lib/services/sqlManagement2/lib/models/maxSizeCapability.js +++ b/lib/services/sqlManagement2/lib/models/maxSizeCapability.js @@ -11,18 +11,16 @@ 'use strict'; /** - * The maximum size limits for a database. + * The maximum size capability. * */ class MaxSizeCapability { /** * Create a MaxSizeCapability. - * @member {number} [limit] The maximum size of the database (see 'unit' for - * the units). + * @member {number} [limit] The maximum size limit (see 'unit' for the + * units). * @member {string} [unit] The units that the limit is expressed in. Possible * values include: 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' - * @member {string} [status] The status of the maximum size capability. - * Possible values include: 'Visible', 'Available', 'Default', 'Disabled' */ constructor() { } @@ -54,17 +52,7 @@ class MaxSizeCapability { readOnly: true, serializedName: 'unit', type: { - name: 'Enum', - allowedValues: [ 'Megabytes', 'Gigabytes', 'Terabytes', 'Petabytes' ] - } - }, - status: { - required: false, - readOnly: true, - serializedName: 'status', - type: { - name: 'Enum', - allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + name: 'String' } } } diff --git a/lib/services/sqlManagement2/lib/models/maxSizeRangeCapability.js b/lib/services/sqlManagement2/lib/models/maxSizeRangeCapability.js new file mode 100644 index 0000000000..b5f5a10131 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/maxSizeRangeCapability.js @@ -0,0 +1,127 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The maximum size range capability. + * + */ +class MaxSizeRangeCapability { + /** + * Create a MaxSizeRangeCapability. + * @member {object} [minValue] Minimum value. + * @member {number} [minValue.limit] The maximum size limit (see 'unit' for + * the units). + * @member {string} [minValue.unit] The units that the limit is expressed in. + * Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', + * 'Petabytes' + * @member {object} [maxValue] Maximum value. + * @member {number} [maxValue.limit] The maximum size limit (see 'unit' for + * the units). + * @member {string} [maxValue.unit] The units that the limit is expressed in. + * Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', + * 'Petabytes' + * @member {object} [scaleSize] Scale/step size for discrete values between + * the minimum value and the maximum value. + * @member {number} [scaleSize.limit] The maximum size limit (see 'unit' for + * the units). + * @member {string} [scaleSize.unit] The units that the limit is expressed + * in. Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', + * 'Petabytes' + * @member {object} [logSize] Size of transaction log. + * @member {number} [logSize.limit] The log size limit (see 'unit' for the + * units). + * @member {string} [logSize.unit] The units that the limit is expressed in. + * Possible values include: 'Megabytes', 'Gigabytes', 'Terabytes', + * 'Petabytes', 'Percent' + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. + */ + constructor() { + } + + /** + * Defines the metadata of MaxSizeRangeCapability + * + * @returns {object} metadata of MaxSizeRangeCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'MaxSizeRangeCapability', + type: { + name: 'Composite', + className: 'MaxSizeRangeCapability', + modelProperties: { + minValue: { + required: false, + readOnly: true, + serializedName: 'minValue', + type: { + name: 'Composite', + className: 'MaxSizeCapability' + } + }, + maxValue: { + required: false, + readOnly: true, + serializedName: 'maxValue', + type: { + name: 'Composite', + className: 'MaxSizeCapability' + } + }, + scaleSize: { + required: false, + readOnly: true, + serializedName: 'scaleSize', + type: { + name: 'Composite', + className: 'MaxSizeCapability' + } + }, + logSize: { + required: false, + readOnly: true, + serializedName: 'logSize', + type: { + name: 'Composite', + className: 'LogSizeCapability' + } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = MaxSizeRangeCapability; diff --git a/lib/services/sqlManagement2/lib/models/partnerRegionInfo.js b/lib/services/sqlManagement2/lib/models/partnerRegionInfo.js new file mode 100644 index 0000000000..dc0b958260 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/partnerRegionInfo.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Partner region information for the failover group. + * + */ +class PartnerRegionInfo { + /** + * Create a PartnerRegionInfo. + * @member {string} [location] Geo location of the partner managed instances. + * @member {string} [replicationRole] Replication role of the partner managed + * instances. Possible values include: 'Primary', 'Secondary' + */ + constructor() { + } + + /** + * Defines the metadata of PartnerRegionInfo + * + * @returns {object} metadata of PartnerRegionInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'PartnerRegionInfo', + type: { + name: 'Composite', + className: 'PartnerRegionInfo', + modelProperties: { + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + replicationRole: { + required: false, + readOnly: true, + serializedName: 'replicationRole', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PartnerRegionInfo; diff --git a/lib/services/sqlManagement2/lib/models/performanceLevelCapability.js b/lib/services/sqlManagement2/lib/models/performanceLevelCapability.js new file mode 100644 index 0000000000..236196e0d3 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/performanceLevelCapability.js @@ -0,0 +1,63 @@ +/* + * 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. + */ + +'use strict'; + +/** + * The performance level capability. + * + */ +class PerformanceLevelCapability { + /** + * Create a PerformanceLevelCapability. + * @member {number} [value] Performance level value. + * @member {string} [unit] Unit type used to measure performance level. + * Possible values include: 'DTU', 'VCores' + */ + constructor() { + } + + /** + * Defines the metadata of PerformanceLevelCapability + * + * @returns {object} metadata of PerformanceLevelCapability + * + */ + mapper() { + return { + required: false, + serializedName: 'PerformanceLevelCapability', + type: { + name: 'Composite', + className: 'PerformanceLevelCapability', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'Number' + } + }, + unit: { + required: false, + readOnly: true, + serializedName: 'unit', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PerformanceLevelCapability; diff --git a/lib/services/sqlManagement2/lib/models/recommendedElasticPool.js b/lib/services/sqlManagement2/lib/models/recommendedElasticPool.js index 1a55e0d85e..dd8c75d9c7 100644 --- a/lib/services/sqlManagement2/lib/models/recommendedElasticPool.js +++ b/lib/services/sqlManagement2/lib/models/recommendedElasticPool.js @@ -157,10 +157,10 @@ class RecommendedElasticPool extends models['ProxyResource'] { name: 'Sequence', element: { required: false, - serializedName: 'DatabaseElementType', + serializedName: 'TrackedResourceElementType', type: { name: 'Composite', - className: 'Database' + className: 'TrackedResource' } } } diff --git a/lib/services/sqlManagement2/lib/models/resourceMoveDefinition.js b/lib/services/sqlManagement2/lib/models/resourceMoveDefinition.js new file mode 100644 index 0000000000..db42dcff0f --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/resourceMoveDefinition.js @@ -0,0 +1,52 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Contains the information necessary to perform a resource move (rename). + * + */ +class ResourceMoveDefinition { + /** + * Create a ResourceMoveDefinition. + * @member {string} id The target ID for the resource + */ + constructor() { + } + + /** + * Defines the metadata of ResourceMoveDefinition + * + * @returns {object} metadata of ResourceMoveDefinition + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceMoveDefinition', + type: { + name: 'Composite', + className: 'ResourceMoveDefinition', + modelProperties: { + id: { + required: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResourceMoveDefinition; diff --git a/lib/services/sqlManagement2/lib/models/restorePoint.js b/lib/services/sqlManagement2/lib/models/restorePoint.js index 0df5375556..0765e34c30 100644 --- a/lib/services/sqlManagement2/lib/models/restorePoint.js +++ b/lib/services/sqlManagement2/lib/models/restorePoint.js @@ -13,20 +13,21 @@ const models = require('./index'); /** - * A database restore point. + * Database restore points. * * @extends models['ProxyResource'] */ class RestorePoint extends models['ProxyResource'] { /** * Create a RestorePoint. - * @member {string} [restorePointType] The restore point type of the database - * restore point. Possible values include: 'DISCRETE', 'CONTINUOUS' - * @member {date} [restorePointCreationDate] Restore point creation time - * (ISO8601 format). Populated when restorePointType = CONTINUOUS. Null - * otherwise. - * @member {date} [earliestRestoreDate] Earliest restore time (ISO8601 - * format). Populated when restorePointType = DISCRETE. Null otherwise. + * @member {string} [location] Resource location. + * @member {string} [restorePointType] The type of restore point. Possible + * values include: 'CONTINUOUS', 'DISCRETE' + * @member {date} [earliestRestoreDate] The earliest time to which this + * database can be restored + * @member {date} [restorePointCreationDate] The time the backup was taken + * @member {string} [restorePointLabel] The label of restore point for backup + * request by user */ constructor() { super(); @@ -70,13 +71,29 @@ class RestorePoint extends models['ProxyResource'] { name: 'String' } }, + location: { + required: false, + readOnly: true, + serializedName: 'location', + type: { + name: 'String' + } + }, restorePointType: { required: false, readOnly: true, serializedName: 'properties.restorePointType', type: { name: 'Enum', - allowedValues: [ 'DISCRETE', 'CONTINUOUS' ] + allowedValues: [ 'CONTINUOUS', 'DISCRETE' ] + } + }, + earliestRestoreDate: { + required: false, + readOnly: true, + serializedName: 'properties.earliestRestoreDate', + type: { + name: 'DateTime' } }, restorePointCreationDate: { @@ -87,12 +104,12 @@ class RestorePoint extends models['ProxyResource'] { name: 'DateTime' } }, - earliestRestoreDate: { + restorePointLabel: { required: false, readOnly: true, - serializedName: 'properties.earliestRestoreDate', + serializedName: 'properties.restorePointLabel', type: { - name: 'DateTime' + name: 'String' } } } diff --git a/lib/services/sqlManagement2/lib/models/restorePointListResult.js b/lib/services/sqlManagement2/lib/models/restorePointListResult.js index 013c4b5fda..e89c1079ba 100644 --- a/lib/services/sqlManagement2/lib/models/restorePointListResult.js +++ b/lib/services/sqlManagement2/lib/models/restorePointListResult.js @@ -11,11 +11,12 @@ 'use strict'; /** - * The response to a list database restore points request. + * A list of long term retention bacukps. */ class RestorePointListResult extends Array { /** * Create a RestorePointListResult. + * @member {string} [nextLink] Link to retrieve next page of results. */ constructor() { super(); @@ -36,7 +37,8 @@ class RestorePointListResult extends Array { className: 'RestorePointListResult', modelProperties: { value: { - required: true, + required: false, + readOnly: true, serializedName: '', type: { name: 'Sequence', diff --git a/lib/services/sqlManagement2/lib/models/serverAutomaticTuning.js b/lib/services/sqlManagement2/lib/models/serverAutomaticTuning.js new file mode 100644 index 0000000000..339999b62f --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/serverAutomaticTuning.js @@ -0,0 +1,109 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Server-level Automatic Tuning. + * + * @extends models['ProxyResource'] + */ +class ServerAutomaticTuning extends models['ProxyResource'] { + /** + * Create a ServerAutomaticTuning. + * @member {string} [desiredState] Automatic tuning desired state. Possible + * values include: 'Custom', 'Auto', 'Unspecified' + * @member {string} [actualState] Automatic tuning actual state. Possible + * values include: 'Custom', 'Auto', 'Unspecified' + * @member {object} [options] Automatic tuning options definition. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServerAutomaticTuning + * + * @returns {object} metadata of ServerAutomaticTuning + * + */ + mapper() { + return { + required: false, + serializedName: 'ServerAutomaticTuning', + type: { + name: 'Composite', + className: 'ServerAutomaticTuning', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + desiredState: { + required: false, + serializedName: 'properties.desiredState', + type: { + name: 'Enum', + allowedValues: [ 'Custom', 'Auto', 'Unspecified' ] + } + }, + actualState: { + required: false, + readOnly: true, + serializedName: 'properties.actualState', + type: { + name: 'Enum', + allowedValues: [ 'Custom', 'Auto', 'Unspecified' ] + } + }, + options: { + required: false, + serializedName: 'properties.options', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'AutomaticTuningServerOptionsElementType', + type: { + name: 'Composite', + className: 'AutomaticTuningServerOptions' + } + } + } + } + } + } + }; + } +} + +module.exports = ServerAutomaticTuning; diff --git a/lib/services/sqlManagement2/lib/models/serverDnsAlias.js b/lib/services/sqlManagement2/lib/models/serverDnsAlias.js new file mode 100644 index 0000000000..34d55a5648 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/serverDnsAlias.js @@ -0,0 +1,81 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A server DNS alias. + * + * @extends models['ProxyResource'] + */ +class ServerDnsAlias extends models['ProxyResource'] { + /** + * Create a ServerDnsAlias. + * @member {string} [azureDnsRecord] The fully qualified DNS record for alias + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServerDnsAlias + * + * @returns {object} metadata of ServerDnsAlias + * + */ + mapper() { + return { + required: false, + serializedName: 'ServerDnsAlias', + type: { + name: 'Composite', + className: 'ServerDnsAlias', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + azureDnsRecord: { + required: false, + readOnly: true, + serializedName: 'properties.azureDnsRecord', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServerDnsAlias; diff --git a/lib/services/sqlManagement2/lib/models/serverDnsAliasAcquisition.js b/lib/services/sqlManagement2/lib/models/serverDnsAliasAcquisition.js new file mode 100644 index 0000000000..7ea9139af4 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/serverDnsAliasAcquisition.js @@ -0,0 +1,53 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A server DNS alias acquisition request. + * + */ +class ServerDnsAliasAcquisition { + /** + * Create a ServerDnsAliasAcquisition. + * @member {string} [oldServerDnsAliasId] The id of the server alias that + * will be acquired to point to this server instead. + */ + constructor() { + } + + /** + * Defines the metadata of ServerDnsAliasAcquisition + * + * @returns {object} metadata of ServerDnsAliasAcquisition + * + */ + mapper() { + return { + required: false, + serializedName: 'ServerDnsAliasAcquisition', + type: { + name: 'Composite', + className: 'ServerDnsAliasAcquisition', + modelProperties: { + oldServerDnsAliasId: { + required: false, + serializedName: 'oldServerDnsAliasId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServerDnsAliasAcquisition; diff --git a/lib/services/sqlManagement2/lib/models/serverDnsAliasListResult.js b/lib/services/sqlManagement2/lib/models/serverDnsAliasListResult.js new file mode 100644 index 0000000000..6d85947ac1 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/serverDnsAliasListResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A list of server DNS aliases. + */ +class ServerDnsAliasListResult extends Array { + /** + * Create a ServerDnsAliasListResult. + * @member {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ServerDnsAliasListResult + * + * @returns {object} metadata of ServerDnsAliasListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ServerDnsAliasListResult', + type: { + name: 'Composite', + className: 'ServerDnsAliasListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServerDnsAliasElementType', + type: { + name: 'Composite', + className: 'ServerDnsAlias' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServerDnsAliasListResult; diff --git a/lib/services/sqlManagement2/lib/models/serverVersionCapability.js b/lib/services/sqlManagement2/lib/models/serverVersionCapability.js index add9a6e39a..aa369f80bb 100644 --- a/lib/services/sqlManagement2/lib/models/serverVersionCapability.js +++ b/lib/services/sqlManagement2/lib/models/serverVersionCapability.js @@ -13,19 +13,21 @@ const models = require('./index'); /** - * The server capabilities. + * The server capability * */ class ServerVersionCapability { /** * Create a ServerVersionCapability. * @member {string} [name] The server version name. - * @member {string} [status] The status of the server version. Possible - * values include: 'Visible', 'Available', 'Default', 'Disabled' * @member {array} [supportedEditions] The list of supported database * editions. * @member {array} [supportedElasticPoolEditions] The list of supported * elastic pool editions. + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. */ constructor() { } @@ -52,15 +54,6 @@ class ServerVersionCapability { name: 'String' } }, - status: { - required: false, - readOnly: true, - serializedName: 'status', - type: { - name: 'Enum', - allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] - } - }, supportedEditions: { required: false, readOnly: true, @@ -92,6 +85,22 @@ class ServerVersionCapability { } } } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } } } } diff --git a/lib/services/sqlManagement2/lib/models/serviceObjectiveCapability.js b/lib/services/sqlManagement2/lib/models/serviceObjectiveCapability.js index f700e2a0ab..0b9970c1e5 100644 --- a/lib/services/sqlManagement2/lib/models/serviceObjectiveCapability.js +++ b/lib/services/sqlManagement2/lib/models/serviceObjectiveCapability.js @@ -19,25 +19,34 @@ const models = require('./index'); class ServiceObjectiveCapability { /** * Create a ServiceObjectiveCapability. - * @member {string} [name] The service objective name. - * @member {string} [status] The status of the service objective. Possible - * values include: 'Visible', 'Available', 'Default', 'Disabled' - * @member {string} [unit] Unit type used to measure service objective - * performance level. Possible values include: 'DTU' - * @member {number} [value] Performance level value. * @member {uuid} [id] The unique ID of the service objective. + * @member {string} [name] The service objective name. * @member {array} [supportedMaxSizes] The list of supported maximum database - * sizes for this service objective. - * @member {object} [includedMaxSize] The included (free) max size for this - * service level objective. - * @member {number} [includedMaxSize.limit] The maximum size of the database - * (see 'unit' for the units). + * sizes. + * @member {object} [performanceLevel] The performance level. + * @member {number} [performanceLevel.value] Performance level value. + * @member {string} [performanceLevel.unit] Unit type used to measure + * performance level. Possible values include: 'DTU', 'VCores' + * @member {object} [sku] The sku. + * @member {string} [sku.name] The name of the SKU, typically, a letter + + * Number code, e.g. P3. + * @member {string} [sku.tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [sku.size] Size of the particular SKU + * @member {string} [sku.family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [sku.capacity] Capacity of the particular SKU. + * @member {array} [supportedLicenseTypes] List of supported license types. + * @member {object} [includedMaxSize] The included (free) max size. + * @member {number} [includedMaxSize.limit] The maximum size limit (see + * 'unit' for the units). * @member {string} [includedMaxSize.unit] The units that the limit is * expressed in. Possible values include: 'Megabytes', 'Gigabytes', * 'Terabytes', 'Petabytes' - * @member {string} [includedMaxSize.status] The status of the maximum size - * capability. Possible values include: 'Visible', 'Available', 'Default', - * 'Disabled' + * @member {string} [status] The status of the capability. Possible values + * include: 'Visible', 'Available', 'Default', 'Disabled' + * @member {string} [reason] The reason for the capability not being + * available. */ constructor() { } @@ -56,60 +65,68 @@ class ServiceObjectiveCapability { name: 'Composite', className: 'ServiceObjectiveCapability', modelProperties: { - name: { + id: { required: false, readOnly: true, - serializedName: 'name', + serializedName: 'id', type: { name: 'String' } }, - status: { + name: { required: false, readOnly: true, - serializedName: 'status', + serializedName: 'name', type: { - name: 'Enum', - allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + name: 'String' } }, - unit: { + supportedMaxSizes: { required: false, readOnly: true, - serializedName: 'performanceLevel.unit', + serializedName: 'supportedMaxSizes', type: { - name: 'Enum', - allowedValues: [ 'DTU' ] + name: 'Sequence', + element: { + required: false, + serializedName: 'MaxSizeRangeCapabilityElementType', + type: { + name: 'Composite', + className: 'MaxSizeRangeCapability' + } + } } }, - value: { + performanceLevel: { required: false, readOnly: true, - serializedName: 'performanceLevel.value', + serializedName: 'performanceLevel', type: { - name: 'Number' + name: 'Composite', + className: 'PerformanceLevelCapability' } }, - id: { + sku: { required: false, readOnly: true, - serializedName: 'id', + serializedName: 'sku', type: { - name: 'String' + name: 'Composite', + className: 'Sku' } }, - supportedMaxSizes: { + supportedLicenseTypes: { required: false, readOnly: true, - serializedName: 'supportedMaxSizes', + serializedName: 'supportedLicenseTypes', type: { name: 'Sequence', element: { required: false, - serializedName: 'MaxSizeCapabilityElementType', + serializedName: 'LicenseTypeCapabilityElementType', type: { name: 'Composite', - className: 'MaxSizeCapability' + className: 'LicenseTypeCapability' } } } @@ -122,6 +139,22 @@ class ServiceObjectiveCapability { name: 'Composite', className: 'MaxSizeCapability' } + }, + status: { + required: false, + readOnly: true, + serializedName: 'status', + type: { + name: 'Enum', + allowedValues: [ 'Visible', 'Available', 'Default', 'Disabled' ] + } + }, + reason: { + required: false, + serializedName: 'reason', + type: { + name: 'String' + } } } } diff --git a/lib/services/sqlManagement2/lib/models/shortTermRetentionPolicy.js b/lib/services/sqlManagement2/lib/models/shortTermRetentionPolicy.js new file mode 100644 index 0000000000..10bf5396d9 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/shortTermRetentionPolicy.js @@ -0,0 +1,81 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A short term retention policy resource. + * + * @extends models['ProxyResource'] + */ +class ShortTermRetentionPolicy extends models['ProxyResource'] { + /** + * Create a ShortTermRetentionPolicy. + * @member {number} [retentionDays] The backup retention period in days. This + * is how many days Point-in-Time Restore will be supported. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ShortTermRetentionPolicy + * + * @returns {object} metadata of ShortTermRetentionPolicy + * + */ + mapper() { + return { + required: false, + serializedName: 'ShortTermRetentionPolicy', + type: { + name: 'Composite', + className: 'ShortTermRetentionPolicy', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + retentionDays: { + required: false, + serializedName: 'properties.retentionDays', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ShortTermRetentionPolicy; diff --git a/lib/services/sqlManagement2/lib/models/sku.js b/lib/services/sqlManagement2/lib/models/sku.js new file mode 100644 index 0000000000..698c630dff --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/sku.js @@ -0,0 +1,87 @@ +/* + * 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. + */ + +'use strict'; + +/** + * An ARM Resource SKU. + * + */ +class Sku { + /** + * Create a Sku. + * @member {string} name The name of the SKU, typically, a letter + Number + * code, e.g. P3. + * @member {string} [tier] The tier of the particular SKU, e.g. Basic, + * Premium. + * @member {string} [size] Size of the particular SKU + * @member {string} [family] If the service has different generations of + * hardware, for the same SKU, then that can be captured here. + * @member {number} [capacity] Capacity of the particular SKU. + */ + constructor() { + } + + /** + * Defines the metadata of Sku + * + * @returns {object} metadata of Sku + * + */ + mapper() { + return { + required: false, + serializedName: 'Sku', + type: { + name: 'Composite', + className: 'Sku', + modelProperties: { + name: { + required: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + tier: { + required: false, + serializedName: 'tier', + type: { + name: 'String' + } + }, + size: { + required: false, + serializedName: 'size', + type: { + name: 'String' + } + }, + family: { + required: false, + serializedName: 'family', + type: { + name: 'String' + } + }, + capacity: { + required: false, + serializedName: 'capacity', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = Sku; diff --git a/lib/services/sqlManagement2/lib/models/sloUsageMetric.js b/lib/services/sqlManagement2/lib/models/sloUsageMetric.js index 5a33118590..5f0b849435 100644 --- a/lib/services/sqlManagement2/lib/models/sloUsageMetric.js +++ b/lib/services/sqlManagement2/lib/models/sloUsageMetric.js @@ -18,9 +18,15 @@ class SloUsageMetric { /** * Create a SloUsageMetric. * @member {string} [serviceLevelObjective] The serviceLevelObjective for SLO - * usage metric. Possible values include: 'Basic', 'S0', 'S1', 'S2', 'S3', - * 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', 'System2', - * 'ElasticPool' + * usage metric. Possible values include: 'System', 'System0', 'System1', + * 'System2', 'System3', 'System4', 'System2L', 'System3L', 'System4L', + * 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', 'S7', 'S9', 'S12', + * 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', 'PRS2', 'PRS4', + * 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', 'DW600', 'DW1000', + * 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', 'DW2000c', 'DW3000', + * 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', 'DW7500c', + * 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', 'DS400', + * 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', 'ElasticPool' * @member {uuid} [serviceLevelObjectiveId] The serviceLevelObjectiveId for * SLO usage metric. * @member {number} [inRangeTimeRatio] Gets or sets inRangeTimeRatio for SLO diff --git a/lib/services/sqlManagement2/lib/models/subscriptionUsage.js b/lib/services/sqlManagement2/lib/models/subscriptionUsage.js new file mode 100644 index 0000000000..d58c9739c1 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/subscriptionUsage.js @@ -0,0 +1,108 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Usage Metric of a Subscription in a Location. + * + * @extends models['ProxyResource'] + */ +class SubscriptionUsage extends models['ProxyResource'] { + /** + * Create a SubscriptionUsage. + * @member {string} [displayName] User-readable name of the metric. + * @member {number} [currentValue] Current value of the metric. + * @member {number} [limit] Boundary value of the metric. + * @member {string} [unit] Unit of the metric. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SubscriptionUsage + * + * @returns {object} metadata of SubscriptionUsage + * + */ + mapper() { + return { + required: false, + serializedName: 'SubscriptionUsage', + type: { + name: 'Composite', + className: 'SubscriptionUsage', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + displayName: { + required: false, + readOnly: true, + serializedName: 'properties.displayName', + type: { + name: 'String' + } + }, + currentValue: { + required: false, + readOnly: true, + serializedName: 'properties.currentValue', + type: { + name: 'Number' + } + }, + limit: { + required: false, + readOnly: true, + serializedName: 'properties.limit', + type: { + name: 'Number' + } + }, + unit: { + required: false, + readOnly: true, + serializedName: 'properties.unit', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SubscriptionUsage; diff --git a/lib/services/sqlManagement2/lib/models/subscriptionUsageListResult.js b/lib/services/sqlManagement2/lib/models/subscriptionUsageListResult.js new file mode 100644 index 0000000000..9405a6b359 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/subscriptionUsageListResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A list of subscription usage metrics in a location. + */ +class SubscriptionUsageListResult extends Array { + /** + * Create a SubscriptionUsageListResult. + * @member {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SubscriptionUsageListResult + * + * @returns {object} metadata of SubscriptionUsageListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SubscriptionUsageListResult', + type: { + name: 'Composite', + className: 'SubscriptionUsageListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubscriptionUsageElementType', + type: { + name: 'Composite', + className: 'SubscriptionUsage' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SubscriptionUsageListResult; diff --git a/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentRecurringScansProperties.js b/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentRecurringScansProperties.js new file mode 100644 index 0000000000..b08942b1ca --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentRecurringScansProperties.js @@ -0,0 +1,79 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Properties of a Vulnerability Assessment recurring scans. + * + */ +class VulnerabilityAssessmentRecurringScansProperties { + /** + * Create a VulnerabilityAssessmentRecurringScansProperties. + * @member {boolean} [isEnabled] Recurring scans state. + * @member {boolean} [emailSubscriptionAdmins] Specifies that the schedule + * scan notification will be is sent to the subscription administrators. + * Default value: true . + * @member {array} [emails] Specifies an array of e-mail addresses to which + * the scan notification is sent. + */ + constructor() { + } + + /** + * Defines the metadata of VulnerabilityAssessmentRecurringScansProperties + * + * @returns {object} metadata of VulnerabilityAssessmentRecurringScansProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'VulnerabilityAssessmentRecurringScansProperties', + type: { + name: 'Composite', + className: 'VulnerabilityAssessmentRecurringScansProperties', + modelProperties: { + isEnabled: { + required: false, + serializedName: 'isEnabled', + type: { + name: 'Boolean' + } + }, + emailSubscriptionAdmins: { + required: false, + serializedName: 'emailSubscriptionAdmins', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + emails: { + required: false, + serializedName: 'emails', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = VulnerabilityAssessmentRecurringScansProperties; diff --git a/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentScanError.js b/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentScanError.js new file mode 100644 index 0000000000..29ed29a2d7 --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentScanError.js @@ -0,0 +1,62 @@ +/* + * 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. + */ + +'use strict'; + +/** + * Properties of a vulnerability assessment scan error. + * + */ +class VulnerabilityAssessmentScanError { + /** + * Create a VulnerabilityAssessmentScanError. + * @member {string} [code] The error code. + * @member {string} [message] The error message. + */ + constructor() { + } + + /** + * Defines the metadata of VulnerabilityAssessmentScanError + * + * @returns {object} metadata of VulnerabilityAssessmentScanError + * + */ + mapper() { + return { + required: false, + serializedName: 'VulnerabilityAssessmentScanError', + type: { + name: 'Composite', + className: 'VulnerabilityAssessmentScanError', + modelProperties: { + code: { + required: false, + readOnly: true, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + readOnly: true, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VulnerabilityAssessmentScanError; diff --git a/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentScanRecord.js b/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentScanRecord.js new file mode 100644 index 0000000000..cbef4bb19f --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentScanRecord.js @@ -0,0 +1,156 @@ +/* + * 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. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A vulnerability assessment scan record. + * + * @extends models['ProxyResource'] + */ +class VulnerabilityAssessmentScanRecord extends models['ProxyResource'] { + /** + * Create a VulnerabilityAssessmentScanRecord. + * @member {string} [scanId] The scan ID. + * @member {string} [triggerType] The scan trigger type. Possible values + * include: 'OnDemand', 'Recurring' + * @member {string} [state] The scan status. Possible values include: + * 'Passed', 'Failed', 'FailedToRun', 'InProgress' + * @member {date} [startTime] The scan start time (UTC). + * @member {date} [endTime] The scan end time (UTC). + * @member {array} [errors] The scan errors. + * @member {string} [storageContainerPath] The scan results storage container + * path. + * @member {number} [numberOfFailedSecurityChecks] The number of failed + * security checks. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VulnerabilityAssessmentScanRecord + * + * @returns {object} metadata of VulnerabilityAssessmentScanRecord + * + */ + mapper() { + return { + required: false, + serializedName: 'VulnerabilityAssessmentScanRecord', + type: { + name: 'Composite', + className: 'VulnerabilityAssessmentScanRecord', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + scanId: { + required: false, + readOnly: true, + serializedName: 'properties.scanId', + type: { + name: 'String' + } + }, + triggerType: { + required: false, + readOnly: true, + serializedName: 'properties.triggerType', + type: { + name: 'String' + } + }, + state: { + required: false, + readOnly: true, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + startTime: { + required: false, + readOnly: true, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + readOnly: true, + serializedName: 'properties.endTime', + type: { + name: 'DateTime' + } + }, + errors: { + required: false, + readOnly: true, + serializedName: 'properties.errors', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VulnerabilityAssessmentScanErrorElementType', + type: { + name: 'Composite', + className: 'VulnerabilityAssessmentScanError' + } + } + } + }, + storageContainerPath: { + required: false, + readOnly: true, + serializedName: 'properties.storageContainerPath', + type: { + name: 'String' + } + }, + numberOfFailedSecurityChecks: { + required: false, + readOnly: true, + serializedName: 'properties.numberOfFailedSecurityChecks', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = VulnerabilityAssessmentScanRecord; diff --git a/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentScanRecordListResult.js b/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentScanRecordListResult.js new file mode 100644 index 0000000000..04d5447c1b --- /dev/null +++ b/lib/services/sqlManagement2/lib/models/vulnerabilityAssessmentScanRecordListResult.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +'use strict'; + +/** + * A list of vulnerability assessment scan records. + */ +class VulnerabilityAssessmentScanRecordListResult extends Array { + /** + * Create a VulnerabilityAssessmentScanRecordListResult. + * @member {string} [nextLink] Link to retrieve next page of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VulnerabilityAssessmentScanRecordListResult + * + * @returns {object} metadata of VulnerabilityAssessmentScanRecordListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'VulnerabilityAssessmentScanRecordListResult', + type: { + name: 'Composite', + className: 'VulnerabilityAssessmentScanRecordListResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VulnerabilityAssessmentScanRecordElementType', + type: { + name: 'Composite', + className: 'VulnerabilityAssessmentScanRecord' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VulnerabilityAssessmentScanRecordListResult; diff --git a/lib/services/sqlManagement2/lib/operations/backupLongTermRetentionPolicies.js b/lib/services/sqlManagement2/lib/operations/backupLongTermRetentionPolicies.js index 7f1daa1b00..c61520f84b 100644 --- a/lib/services/sqlManagement2/lib/operations/backupLongTermRetentionPolicies.js +++ b/lib/services/sqlManagement2/lib/operations/backupLongTermRetentionPolicies.js @@ -15,7 +15,7 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Returns a database backup long term retention policy + * Gets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -54,13 +54,10 @@ function _get(resourceGroupName, serverName, databaseName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; - let backupLongTermRetentionPolicyName = 'Default'; + let policyName = 'default'; + let apiVersion = '2017-03-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } @@ -70,6 +67,9 @@ function _get(resourceGroupName, serverName, databaseName, options, callback) { if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { throw new Error('databaseName cannot be null or undefined and it must be of type string.'); } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -79,12 +79,12 @@ function _get(resourceGroupName, serverName, databaseName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); - requestUrl = requestUrl.replace('{backupLongTermRetentionPolicyName}', encodeURIComponent(backupLongTermRetentionPolicyName)); + requestUrl = requestUrl.replace('{policyName}', encodeURIComponent(policyName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -170,7 +170,7 @@ function _get(resourceGroupName, serverName, databaseName, options, callback) { /** - * Creates or updates a database backup long term retention policy + * Sets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -178,16 +178,21 @@ function _get(resourceGroupName, serverName, databaseName, options, callback) { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The long term retention policy info. + * + * @param {string} [parameters.weeklyRetention] The weekly retention policy for + * an LTR backup in an ISO 8601 format. * - * @param {object} parameters The required parameters to update a backup long - * term retention policy + * @param {string} [parameters.monthlyRetention] The montly retention policy + * for an LTR backup in an ISO 8601 format. * - * @param {string} parameters.state The status of the backup long term - * retention policy. Possible values include: 'Disabled', 'Enabled' + * @param {string} [parameters.yearlyRetention] The yearly retention policy for + * an LTR backup in an ISO 8601 format. * - * @param {string} parameters.recoveryServicesBackupPolicyResourceId The azure - * recovery services backup protection policy resource id + * @param {number} [parameters.weekOfYear] The week of year to take the yearly + * backup in an ISO 8601 format. * * @param {object} [options] Optional Parameters. * @@ -261,7 +266,159 @@ function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters } /** - * Creates or updates a database backup long term retention policy + * Gets a database's long term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BackupLongTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDatabase(resourceGroupName, serverName, databaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BackupLongTermRetentionPolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Sets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -269,16 +426,21 @@ function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The long term retention policy info. + * + * @param {string} [parameters.weeklyRetention] The weekly retention policy for + * an LTR backup in an ISO 8601 format. * - * @param {object} parameters The required parameters to update a backup long - * term retention policy + * @param {string} [parameters.monthlyRetention] The montly retention policy + * for an LTR backup in an ISO 8601 format. * - * @param {string} parameters.state The status of the backup long term - * retention policy. Possible values include: 'Disabled', 'Enabled' + * @param {string} [parameters.yearlyRetention] The yearly retention policy for + * an LTR backup in an ISO 8601 format. * - * @param {string} parameters.recoveryServicesBackupPolicyResourceId The azure - * recovery services backup protection policy resource id + * @param {number} [parameters.weekOfYear] The week of year to take the yearly + * backup in an ISO 8601 format. * * @param {object} [options] Optional Parameters. * @@ -309,13 +471,10 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; - let backupLongTermRetentionPolicyName = 'Default'; + let policyName = 'default'; + let apiVersion = '2017-03-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } @@ -328,6 +487,9 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -337,12 +499,12 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{backupLongTermRetentionPolicyName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupLongTermRetentionPolicies/{policyName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); - requestUrl = requestUrl.replace('{backupLongTermRetentionPolicyName}', encodeURIComponent(backupLongTermRetentionPolicyName)); + requestUrl = requestUrl.replace('{policyName}', encodeURIComponent(policyName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -390,7 +552,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + if (statusCode !== 200 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -435,23 +597,6 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param return callback(deserializationError); } } - // Deserialize Response - if (statusCode === 201) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['BackupLongTermRetentionPolicy']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError1.request = msRest.stripRequest(httpRequest); - deserializationError1.response = msRest.stripResponse(response); - return callback(deserializationError1); - } - } return callback(null, result, httpRequest, response); }); @@ -467,11 +612,12 @@ class BackupLongTermRetentionPolicies { this.client = client; this._get = _get; this._createOrUpdate = _createOrUpdate; + this._listByDatabase = _listByDatabase; this._beginCreateOrUpdate = _beginCreateOrUpdate; } /** - * Returns a database backup long term retention policy + * Gets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -507,7 +653,7 @@ class BackupLongTermRetentionPolicies { } /** - * Returns a database backup long term retention policy + * Gets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -566,7 +712,7 @@ class BackupLongTermRetentionPolicies { } /** - * Creates or updates a database backup long term retention policy + * Sets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -574,16 +720,21 @@ class BackupLongTermRetentionPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The long term retention policy info. * - * @param {object} parameters The required parameters to update a backup long - * term retention policy + * @param {string} [parameters.weeklyRetention] The weekly retention policy for + * an LTR backup in an ISO 8601 format. * - * @param {string} parameters.state The status of the backup long term - * retention policy. Possible values include: 'Disabled', 'Enabled' + * @param {string} [parameters.monthlyRetention] The montly retention policy + * for an LTR backup in an ISO 8601 format. * - * @param {string} parameters.recoveryServicesBackupPolicyResourceId The azure - * recovery services backup protection policy resource id + * @param {string} [parameters.yearlyRetention] The yearly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {number} [parameters.weekOfYear] The week of year to take the yearly + * backup in an ISO 8601 format. * * @param {object} [options] Optional Parameters. * @@ -611,7 +762,7 @@ class BackupLongTermRetentionPolicies { } /** - * Creates or updates a database backup long term retention policy + * Sets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -619,16 +770,21 @@ class BackupLongTermRetentionPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The long term retention policy info. + * + * @param {string} [parameters.weeklyRetention] The weekly retention policy for + * an LTR backup in an ISO 8601 format. * - * @param {object} parameters The required parameters to update a backup long - * term retention policy + * @param {string} [parameters.monthlyRetention] The montly retention policy + * for an LTR backup in an ISO 8601 format. * - * @param {string} parameters.state The status of the backup long term - * retention policy. Possible values include: 'Disabled', 'Enabled' + * @param {string} [parameters.yearlyRetention] The yearly retention policy for + * an LTR backup in an ISO 8601 format. * - * @param {string} parameters.recoveryServicesBackupPolicyResourceId The azure - * recovery services backup protection policy resource id + * @param {number} [parameters.weekOfYear] The week of year to take the yearly + * backup in an ISO 8601 format. * * @param {object} [options] Optional Parameters. * @@ -679,7 +835,7 @@ class BackupLongTermRetentionPolicies { } /** - * Creates or updates a database backup long term retention policy + * Gets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -687,16 +843,116 @@ class BackupLongTermRetentionPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database + * @param {string} databaseName The name of the database. * - * @param {object} parameters The required parameters to update a backup long - * term retention policy + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.state The status of the backup long term - * retention policy. Possible values include: 'Disabled', 'Enabled' + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned * - * @param {string} parameters.recoveryServicesBackupPolicyResourceId The azure - * recovery services backup protection policy resource id + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDatabaseWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDatabase(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a database's long term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {BackupLongTermRetentionPolicy} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link BackupLongTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabase(resourceGroupName, serverName, databaseName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDatabase(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDatabase(resourceGroupName, serverName, databaseName, options, optionalCallback); + } + } + + /** + * Sets a database's long term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The long term retention policy info. + * + * @param {string} [parameters.weeklyRetention] The weekly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {string} [parameters.monthlyRetention] The montly retention policy + * for an LTR backup in an ISO 8601 format. + * + * @param {string} [parameters.yearlyRetention] The yearly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {number} [parameters.weekOfYear] The week of year to take the yearly + * backup in an ISO 8601 format. * * @param {object} [options] Optional Parameters. * @@ -724,7 +980,7 @@ class BackupLongTermRetentionPolicies { } /** - * Creates or updates a database backup long term retention policy + * Sets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -732,16 +988,21 @@ class BackupLongTermRetentionPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The long term retention policy info. + * + * @param {string} [parameters.weeklyRetention] The weekly retention policy for + * an LTR backup in an ISO 8601 format. * - * @param {object} parameters The required parameters to update a backup long - * term retention policy + * @param {string} [parameters.monthlyRetention] The montly retention policy + * for an LTR backup in an ISO 8601 format. * - * @param {string} parameters.state The status of the backup long term - * retention policy. Possible values include: 'Disabled', 'Enabled' + * @param {string} [parameters.yearlyRetention] The yearly retention policy for + * an LTR backup in an ISO 8601 format. * - * @param {string} parameters.recoveryServicesBackupPolicyResourceId The azure - * recovery services backup protection policy resource id + * @param {number} [parameters.weekOfYear] The week of year to take the yearly + * backup in an ISO 8601 format. * * @param {object} [options] Optional Parameters. * diff --git a/lib/services/sqlManagement2/lib/operations/capabilities.js b/lib/services/sqlManagement2/lib/operations/capabilities.js index cd8f64438f..86da4bf0e9 100644 --- a/lib/services/sqlManagement2/lib/operations/capabilities.js +++ b/lib/services/sqlManagement2/lib/operations/capabilities.js @@ -15,12 +15,18 @@ const msRestAzure = require('ms-rest-azure'); const WebResource = msRest.WebResource; /** - * Gets the capabilities available for the specified location. + * Gets the subscription capabilities available for the specified location. * - * @param {string} locationId The location id whose capabilities are retrieved. + * @param {string} locationName The location name whose capabilities are + * retrieved. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.include] If specified, restricts the response to + * only include the selected item. Possible values include: + * 'supportedEditions', 'supportedElasticPoolEditions', + * 'supportedManagedInstanceVersions' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -37,7 +43,7 @@ const WebResource = msRest.WebResource; * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listByLocation(locationId, options, callback) { +function _listByLocation(locationName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -47,15 +53,19 @@ function _listByLocation(locationId, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; + let include = (options && options.include !== undefined) ? options.include : undefined; + let apiVersion = '2017-10-01-preview'; // Validate try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (include !== null && include !== undefined && typeof include.valueOf() !== 'string') { + throw new Error('include must be of type string.'); + } if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } - if (locationId === null || locationId === undefined || typeof locationId.valueOf() !== 'string') { - throw new Error('locationId cannot be null or undefined and it must be of type string.'); - } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -65,10 +75,13 @@ function _listByLocation(locationId, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationId}/capabilities'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/capabilities'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{locationId}', encodeURIComponent(locationId)); let queryParameters = []; + if (include !== null && include !== undefined) { + queryParameters.push('include=' + encodeURIComponent(include)); + } queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); @@ -163,12 +176,18 @@ class Capabilities { } /** - * Gets the capabilities available for the specified location. + * Gets the subscription capabilities available for the specified location. * - * @param {string} locationId The location id whose capabilities are retrieved. + * @param {string} locationName The location name whose capabilities are + * retrieved. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.include] If specified, restricts the response to + * only include the selected item. Possible values include: + * 'supportedEditions', 'supportedElasticPoolEditions', + * 'supportedManagedInstanceVersions' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -178,11 +197,11 @@ class Capabilities { * * @reject {Error} - The error object. */ - listByLocationWithHttpOperationResponse(locationId, options) { + listByLocationWithHttpOperationResponse(locationName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByLocation(locationId, options, (err, result, request, response) => { + self._listByLocation(locationName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -193,12 +212,18 @@ class Capabilities { } /** - * Gets the capabilities available for the specified location. + * Gets the subscription capabilities available for the specified location. * - * @param {string} locationId The location id whose capabilities are retrieved. + * @param {string} locationName The location name whose capabilities are + * retrieved. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.include] If specified, restricts the response to + * only include the selected item. Possible values include: + * 'supportedEditions', 'supportedElasticPoolEditions', + * 'supportedManagedInstanceVersions' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -224,7 +249,7 @@ class Capabilities { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByLocation(locationId, options, optionalCallback) { + listByLocation(locationName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -233,14 +258,14 @@ class Capabilities { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByLocation(locationId, options, (err, result, request, response) => { + self._listByLocation(locationName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByLocation(locationId, options, optionalCallback); + return self._listByLocation(locationName, options, optionalCallback); } } diff --git a/lib/services/sqlManagement2/lib/operations/databaseAutomaticTuningOperations.js b/lib/services/sqlManagement2/lib/operations/databaseAutomaticTuningOperations.js new file mode 100644 index 0000000000..5bf2f22d25 --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/databaseAutomaticTuningOperations.js @@ -0,0 +1,563 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets a database's automatic tuning. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAutomaticTuning} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, serverName, databaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-05-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DatabaseAutomaticTuning']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Update automatic tuning properties for target database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested automatic tuning resource state. + * + * @param {string} [parameters.desiredState] Automatic tuning desired state. + * Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + * + * @param {object} [parameters.options] Automatic tuning options definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAutomaticTuning} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, serverName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-05-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/automaticTuning/current'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DatabaseAutomaticTuning']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DatabaseAutomaticTuning']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a DatabaseAutomaticTuningOperations. */ +class DatabaseAutomaticTuningOperations { + /** + * Create a DatabaseAutomaticTuningOperations. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._update = _update; + } + + /** + * Gets a database's automatic tuning. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a database's automatic tuning. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DatabaseAutomaticTuning} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAutomaticTuning} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, serverName, databaseName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serverName, databaseName, options, optionalCallback); + } + } + + /** + * Update automatic tuning properties for target database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested automatic tuning resource state. + * + * @param {string} [parameters.desiredState] Automatic tuning desired state. + * Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + * + * @param {object} [parameters.options] Automatic tuning options definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update automatic tuning properties for target database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested automatic tuning resource state. + * + * @param {string} [parameters.desiredState] Automatic tuning desired state. + * Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + * + * @param {object} [parameters.options] Automatic tuning options definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DatabaseAutomaticTuning} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAutomaticTuning} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + } + } + +} + +module.exports = DatabaseAutomaticTuningOperations; diff --git a/lib/services/sqlManagement2/lib/operations/databaseOperations.js b/lib/services/sqlManagement2/lib/operations/databaseOperations.js index 8eeb0eaf28..28a46543cf 100644 --- a/lib/services/sqlManagement2/lib/operations/databaseOperations.js +++ b/lib/services/sqlManagement2/lib/operations/databaseOperations.js @@ -54,7 +54,7 @@ function _cancel(resourceGroupName, serverName, databaseName, operationId, optio if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-03-01-preview'; + let apiVersion = '2017-10-01-preview'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { @@ -193,7 +193,7 @@ function _listByDatabase(resourceGroupName, serverName, databaseName, options, c if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2017-03-01-preview'; + let apiVersion = '2017-10-01-preview'; // Validate try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { diff --git a/lib/services/sqlManagement2/lib/operations/databaseVulnerabilityAssessmentScans.js b/lib/services/sqlManagement2/lib/operations/databaseVulnerabilityAssessmentScans.js new file mode 100644 index 0000000000..a710edfb82 --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/databaseVulnerabilityAssessmentScans.js @@ -0,0 +1,1448 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets a vulnerability assessment scan record of a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VulnerabilityAssessmentScanRecord} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, serverName, databaseName, scanId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let vulnerabilityAssessmentName = 'default'; + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (scanId === null || scanId === undefined || typeof scanId.valueOf() !== 'string') { + throw new Error('scanId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{vulnerabilityAssessmentName}', encodeURIComponent(vulnerabilityAssessmentName)); + requestUrl = requestUrl.replace('{scanId}', encodeURIComponent(scanId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VulnerabilityAssessmentScanRecord']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Executes a Vulnerability Assessment database scan. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _execute(resourceGroupName, serverName, databaseName, scanId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginExecute(resourceGroupName, serverName, databaseName, scanId, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists the vulnerability assessment scans of a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VulnerabilityAssessmentScanRecordListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDatabase(resourceGroupName, serverName, databaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let vulnerabilityAssessmentName = 'default'; + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{vulnerabilityAssessmentName}', encodeURIComponent(vulnerabilityAssessmentName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VulnerabilityAssessmentScanRecordListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Convert an existing scan result to a human readable format. If already + * exists nothing happens + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the scanned database. + * + * @param {string} scanId The vulnerability assessment scan Id. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseVulnerabilityAssessmentScansExport} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _exportMethod(resourceGroupName, serverName, databaseName, scanId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let vulnerabilityAssessmentName = 'default'; + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (scanId === null || scanId === undefined || typeof scanId.valueOf() !== 'string') { + throw new Error('scanId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{vulnerabilityAssessmentName}', encodeURIComponent(vulnerabilityAssessmentName)); + requestUrl = requestUrl.replace('{scanId}', encodeURIComponent(scanId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DatabaseVulnerabilityAssessmentScansExport']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DatabaseVulnerabilityAssessmentScansExport']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Executes a Vulnerability Assessment database scan. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginExecute(resourceGroupName, serverName, databaseName, scanId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let vulnerabilityAssessmentName = 'default'; + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (scanId === null || scanId === undefined || typeof scanId.valueOf() !== 'string') { + throw new Error('scanId cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{vulnerabilityAssessmentName}', encodeURIComponent(vulnerabilityAssessmentName)); + requestUrl = requestUrl.replace('{scanId}', encodeURIComponent(scanId)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the vulnerability assessment scans of a database. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VulnerabilityAssessmentScanRecordListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDatabaseNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VulnerabilityAssessmentScanRecordListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a DatabaseVulnerabilityAssessmentScans. */ +class DatabaseVulnerabilityAssessmentScans { + /** + * Create a DatabaseVulnerabilityAssessmentScans. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._execute = _execute; + this._listByDatabase = _listByDatabase; + this._exportMethod = _exportMethod; + this._beginExecute = _beginExecute; + this._listByDatabaseNext = _listByDatabaseNext; + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, serverName, databaseName, scanId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, databaseName, scanId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a vulnerability assessment scan record of a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VulnerabilityAssessmentScanRecord} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VulnerabilityAssessmentScanRecord} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, serverName, databaseName, scanId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, databaseName, scanId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serverName, databaseName, scanId, options, optionalCallback); + } + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + executeWithHttpOperationResponse(resourceGroupName, serverName, databaseName, scanId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._execute(resourceGroupName, serverName, databaseName, scanId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + execute(resourceGroupName, serverName, databaseName, scanId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._execute(resourceGroupName, serverName, databaseName, scanId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._execute(resourceGroupName, serverName, databaseName, scanId, options, optionalCallback); + } + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDatabaseWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDatabase(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VulnerabilityAssessmentScanRecordListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VulnerabilityAssessmentScanRecordListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabase(resourceGroupName, serverName, databaseName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDatabase(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDatabase(resourceGroupName, serverName, databaseName, options, optionalCallback); + } + } + + /** + * Convert an existing scan result to a human readable format. If already + * exists nothing happens + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the scanned database. + * + * @param {string} scanId The vulnerability assessment scan Id. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + exportMethodWithHttpOperationResponse(resourceGroupName, serverName, databaseName, scanId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._exportMethod(resourceGroupName, serverName, databaseName, scanId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Convert an existing scan result to a human readable format. If already + * exists nothing happens + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the scanned database. + * + * @param {string} scanId The vulnerability assessment scan Id. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DatabaseVulnerabilityAssessmentScansExport} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseVulnerabilityAssessmentScansExport} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + exportMethod(resourceGroupName, serverName, databaseName, scanId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._exportMethod(resourceGroupName, serverName, databaseName, scanId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._exportMethod(resourceGroupName, serverName, databaseName, scanId, options, optionalCallback); + } + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginExecuteWithHttpOperationResponse(resourceGroupName, serverName, databaseName, scanId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginExecute(resourceGroupName, serverName, databaseName, scanId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Executes a Vulnerability Assessment database scan. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginExecute(resourceGroupName, serverName, databaseName, scanId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginExecute(resourceGroupName, serverName, databaseName, scanId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginExecute(resourceGroupName, serverName, databaseName, scanId, options, optionalCallback); + } + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDatabaseNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDatabaseNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the vulnerability assessment scans of a database. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VulnerabilityAssessmentScanRecordListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VulnerabilityAssessmentScanRecordListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabaseNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDatabaseNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDatabaseNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = DatabaseVulnerabilityAssessmentScans; diff --git a/lib/services/sqlManagement2/lib/operations/databases.js b/lib/services/sqlManagement2/lib/operations/databases.js index 972ce3df41..7febf21ad9 100644 --- a/lib/services/sqlManagement2/lib/operations/databases.js +++ b/lib/services/sqlManagement2/lib/operations/databases.js @@ -31,12 +31,20 @@ const WebResource = msRest.WebResource; * * @param {string} parameters.edition The edition for the database being * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' * * @param {string} parameters.serviceObjectiveName The name of the service - * objective to assign to the database. Possible values include: 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' + * objective to assign to the database. Possible values include: 'System', + * 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', + * 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', + * 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', + * 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', + * 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', + * 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', + * 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', + * 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', + * 'ElasticPool' * * @param {string} parameters.maxSizeBytes The maximum size for the newly * imported database. @@ -648,7 +656,7 @@ function _listMetricDefinitions(resourceGroupName, serverName, databaseName, opt /** - * Pauses a data warehouse. + * Upgrades a data warehouse. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -656,7 +664,7 @@ function _listMetricDefinitions(resourceGroupName, serverName, databaseName, opt * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to pause. + * @param {string} databaseName The name of the database to be upgraded. * * @param {object} [options] Optional Parameters. * @@ -675,7 +683,7 @@ function _listMetricDefinitions(resourceGroupName, serverName, databaseName, opt * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _pause(resourceGroupName, serverName, databaseName, options, callback) { +function _upgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -688,7 +696,7 @@ function _pause(resourceGroupName, serverName, databaseName, options, callback) } // Send request - this.beginPause(resourceGroupName, serverName, databaseName, options, (err, parsedResult, httpRequest, response) => { + this.beginUpgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, (err, parsedResult, httpRequest, response) => { if (err) return callback(err); let initialResult = new msRest.HttpOperationResponse(); @@ -713,9 +721,8 @@ function _pause(resourceGroupName, serverName, databaseName, options, callback) }); } - /** - * Resumes a data warehouse. + * Gets a list of databases. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -723,8 +730,6 @@ function _pause(resourceGroupName, serverName, databaseName, options, callback) * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to resume. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -736,241 +741,117 @@ function _pause(resourceGroupName, serverName, databaseName, options, callback) * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _resume(resourceGroupName, serverName, databaseName, options, callback) { +function _listByServer(resourceGroupName, serverName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { callback = options; options = null; } - if (!callback) { throw new Error('callback cannot be null.'); } - - // Send request - this.beginResume(resourceGroupName, serverName, databaseName, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - - return callback(null, result, httpRequest, response); - }); - }); -} - - -/** - * Creates a new database or updates an existing database. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to be operated on - * (updated or created). - * - * @param {object} parameters The required parameters for creating or updating - * a database. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} parameters.location Resource location. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} callback - The callback. - * - * @returns {function} callback(err, result, request, response) - * - * {Error} err - The Error object if an error occurred, null otherwise. - * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ -function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); } - if (!callback) { - throw new Error('callback cannot be null.'); + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); } - // Send request - this.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); if (responseBody === '') responseBody = null; - - // Deserialize Response + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['Database']().mapper(); + let resultMapper = new client.models['DatabaseListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -979,15 +860,14 @@ function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters deserializationError.response = msRest.stripResponse(response); return callback(deserializationError); } + } - return callback(null, result, httpRequest, response); - }); + return callback(null, result, httpRequest, response); }); } - /** - * Updates an existing database. + * Gets a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -995,126 +875,7 @@ function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be updated. - * - * @param {object} parameters The required parameters for updating a database. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -1134,102 +895,19 @@ function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _update(resourceGroupName, serverName, databaseName, parameters, options, callback) { +function _get(resourceGroupName, serverName, databaseName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { callback = options; options = null; } - if (!callback) { throw new Error('callback cannot be null.'); } - - // Send request - this.beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['Database']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError.request = msRest.stripRequest(httpRequest); - deserializationError.response = msRest.stripResponse(response); - return callback(deserializationError); - } - - return callback(null, result, httpRequest, response); - }); - }); -} - -/** - * Deletes a database. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to be deleted. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} callback - The callback. - * - * @returns {function} callback(err, result, request, response) - * - * {Error} err - The Error object if an error occurred, null otherwise. - * - * {null} [result] - The deserialized result object if an error did not occur. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ -function _deleteMethod(resourceGroupName, serverName, databaseName, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - let apiVersion = '2014-04-01'; + let apiVersion = '2017-10-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } @@ -1239,6 +917,9 @@ function _deleteMethod(resourceGroupName, serverName, databaseName, options, cal if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { throw new Error('databaseName cannot be null or undefined and it must be of type string.'); } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -1249,10 +930,10 @@ function _deleteMethod(resourceGroupName, serverName, databaseName, options, cal // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -1261,7 +942,7 @@ function _deleteMethod(resourceGroupName, serverName, databaseName, options, cal // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'DELETE'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1286,7 +967,7 @@ function _deleteMethod(resourceGroupName, serverName, databaseName, options, cal return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 204) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1314,13 +995,31 @@ function _deleteMethod(resourceGroupName, serverName, databaseName, options, cal // Create Result let result = null; if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Database']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } return callback(null, result, httpRequest, response); }); } + /** - * Gets a database. + * Creates a new database or updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1328,13 +1027,121 @@ function _deleteMethod(resourceGroupName, serverName, databaseName, options, cal * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. * - * @param {object} [options] Optional Parameters. + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' * - * @param {string} [options.expand] A comma separated list of child objects to - * expand in the response. Possible properties: serviceTierAdvisors, - * transparentDataEncryption. + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1352,115 +1159,297 @@ function _deleteMethod(resourceGroupName, serverName, databaseName, options, cal * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _get(resourceGroupName, serverName, databaseName, options, callback) { +function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { callback = options; options = null; } + if (!callback) { throw new Error('callback cannot be null.'); } - let expand = (options && options.expand !== undefined) ? options.expand : undefined; - let apiVersion = '2014-04-01'; - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { - throw new Error('serverName cannot be null or undefined and it must be of type string.'); - } - if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { - throw new Error('databaseName cannot be null or undefined and it must be of type string.'); - } - if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { - throw new Error('expand must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); - requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (expand !== null && expand !== undefined) { - queryParameters.push('$expand=' + encodeURIComponent(expand)); - } - if (queryParameters.length > 0) { - requestUrl += '?' + queryParameters.join('&'); - } + // Send request + this.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); - // Create HTTP transport objects - let httpRequest = new WebResource(); - httpRequest.method = 'GET'; - httpRequest.url = requestUrl; - httpRequest.headers = {}; - // Set Headers - httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - if (this.client.generateClientRequestId) { - httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); - } - if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { - httpRequest.headers['accept-language'] = this.client.acceptLanguage; - } - if(options) { - for(let headerName in options['customHeaders']) { - if (options['customHeaders'].hasOwnProperty(headerName)) { - httpRequest.headers[headerName] = options['customHeaders'][headerName]; - } - } - } - httpRequest.body = null; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; if (responseBody === '') responseBody = null; - let parsedErrorResponse; + + // Deserialize Response + let parsedResponse = null; try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; - if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; - if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Database']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes the database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serverName, databaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, serverName, databaseName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates an existing database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, serverName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -1475,14 +1464,14 @@ function _get(resourceGroupName, serverName, databaseName, options, callback) { deserializationError.response = msRest.stripResponse(response); return callback(deserializationError); } - } - return callback(null, result, httpRequest, response); + return callback(null, result, httpRequest, response); + }); }); } /** - * Returns a list of databases in a server. + * Gets a list of databases in an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1490,14 +1479,9 @@ function _get(resourceGroupName, serverName, databaseName, options, callback) { * * @param {string} serverName The name of the server. * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.expand] A comma separated list of child objects to - * expand in the response. Possible properties: serviceTierAdvisors, - * transparentDataEncryption. + * @param {string} elasticPoolName The name of the elastic pool. * - * @param {string} [options.filter] An OData filter expression that describes a - * subset of databases to return. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1515,7 +1499,7 @@ function _get(resourceGroupName, serverName, databaseName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listByServer(resourceGroupName, serverName, options, callback) { +function _listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1525,25 +1509,20 @@ function _listByServer(resourceGroupName, serverName, options, callback) { if (!callback) { throw new Error('callback cannot be null.'); } - let expand = (options && options.expand !== undefined) ? options.expand : undefined; - let filter = (options && options.filter !== undefined) ? options.filter : undefined; - let apiVersion = '2014-04-01'; + let apiVersion = '2017-10-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { throw new Error('serverName cannot be null or undefined and it must be of type string.'); } - if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { - throw new Error('expand must be of type string.'); + if (elasticPoolName === null || elasticPoolName === undefined || typeof elasticPoolName.valueOf() !== 'string') { + throw new Error('elasticPoolName cannot be null or undefined and it must be of type string.'); } - if (filter !== null && filter !== undefined && typeof filter.valueOf() !== 'string') { - throw new Error('filter must be of type string.'); + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -1554,18 +1533,13 @@ function _listByServer(resourceGroupName, serverName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (expand !== null && expand !== undefined) { - queryParameters.push('$expand=' + encodeURIComponent(expand)); - } - if (filter !== null && filter !== undefined) { - queryParameters.push('$filter=' + encodeURIComponent(filter)); - } if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); } @@ -1647,8 +1621,9 @@ function _listByServer(resourceGroupName, serverName, options, callback) { }); } + /** - * Gets a database inside of an elastic pool. + * Pauses a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1656,10 +1631,7 @@ function _listByServer(resourceGroupName, serverName, options, callback) { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. - * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} databaseName The name of the database to be paused. * * @param {object} [options] Optional Parameters. * @@ -1679,112 +1651,38 @@ function _listByServer(resourceGroupName, serverName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _getByElasticPool(resourceGroupName, serverName, elasticPoolName, databaseName, options, callback) { +function _pause(resourceGroupName, serverName, databaseName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { callback = options; options = null; } + if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { - throw new Error('serverName cannot be null or undefined and it must be of type string.'); - } - if (elasticPoolName === null || elasticPoolName === undefined || typeof elasticPoolName.valueOf() !== 'string') { - throw new Error('elasticPoolName cannot be null or undefined and it must be of type string.'); - } - if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { - throw new Error('databaseName cannot be null or undefined and it must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases/{databaseName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); - requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); - requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (queryParameters.length > 0) { - requestUrl += '?' + queryParameters.join('&'); - } + // Send request + this.beginPause(resourceGroupName, serverName, databaseName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); - // Create HTTP transport objects - let httpRequest = new WebResource(); - httpRequest.method = 'GET'; - httpRequest.url = requestUrl; - httpRequest.headers = {}; - // Set Headers - httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - if (this.client.generateClientRequestId) { - httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); - } - if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { - httpRequest.headers['accept-language'] = this.client.acceptLanguage; - } - if(options) { - for(let headerName in options['customHeaders']) { - if (options['customHeaders'].hasOwnProperty(headerName)) { - httpRequest.headers[headerName] = options['customHeaders'][headerName]; - } - } - } - httpRequest.body = null; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; - if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; - if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); - } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { + + // Deserialize Response let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -1799,14 +1697,15 @@ function _getByElasticPool(resourceGroupName, serverName, elasticPoolName, datab deserializationError.response = msRest.stripResponse(response); return callback(deserializationError); } - } - return callback(null, result, httpRequest, response); + return callback(null, result, httpRequest, response); + }); }); } + /** - * Returns a list of databases in an elastic pool. + * Resumes a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1814,8 +1713,7 @@ function _getByElasticPool(resourceGroupName, serverName, elasticPoolName, datab * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} databaseName The name of the database to be resumed. * * @param {object} [options] Optional Parameters. * @@ -1829,120 +1727,50 @@ function _getByElasticPool(resourceGroupName, serverName, elasticPoolName, datab * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseListResult} for more information. + * See {@link Database} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, callback) { +function _resume(resourceGroupName, serverName, databaseName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { callback = options; options = null; } + if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { - throw new Error('serverName cannot be null or undefined and it must be of type string.'); - } - if (elasticPoolName === null || elasticPoolName === undefined || typeof elasticPoolName.valueOf() !== 'string') { - throw new Error('elasticPoolName cannot be null or undefined and it must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/databases'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); - requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (queryParameters.length > 0) { - requestUrl += '?' + queryParameters.join('&'); - } + // Send request + this.beginResume(resourceGroupName, serverName, databaseName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); - // Create HTTP transport objects - let httpRequest = new WebResource(); - httpRequest.method = 'GET'; - httpRequest.url = requestUrl; - httpRequest.headers = {}; - // Set Headers - httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - if (this.client.generateClientRequestId) { - httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); - } - if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { - httpRequest.headers['accept-language'] = this.client.acceptLanguage; - } - if(options) { - for(let headerName in options['customHeaders']) { - if (options['customHeaders'].hasOwnProperty(headerName)) { - httpRequest.headers[headerName] = options['customHeaders'][headerName]; - } - } - } - httpRequest.body = null; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; - if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; - if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); - } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { + + // Deserialize Response let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['DatabaseListResult']().mapper(); + let resultMapper = new client.models['Database']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1951,14 +1779,14 @@ function _listByElasticPool(resourceGroupName, serverName, elasticPoolName, opti deserializationError.response = msRest.stripResponse(response); return callback(deserializationError); } - } - return callback(null, result, httpRequest, response); + return callback(null, result, httpRequest, response); + }); }); } /** - * Gets a database inside of a recommented elastic pool. + * Renames a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1966,10 +1794,12 @@ function _listByElasticPool(resourceGroupName, serverName, elasticPoolName, opti * * @param {string} serverName The name of the server. * - * @param {string} recommendedElasticPoolName The name of the elastic pool to - * be retrieved. + * @param {string} databaseName The name of the database to rename. + * + * @param {object} parameters The resource move definition for renaming this + * database. * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} parameters.id The target ID for the resource * * @param {object} [options] Optional Parameters. * @@ -1982,14 +1812,13 @@ function _listByElasticPool(resourceGroupName, serverName, elasticPoolName, opti * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _getByRecommendedElasticPool(resourceGroupName, serverName, recommendedElasticPoolName, databaseName, options, callback) { +function _rename(resourceGroupName, serverName, databaseName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1999,24 +1828,24 @@ function _getByRecommendedElasticPool(resourceGroupName, serverName, recommended if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; + let apiVersion = '2017-10-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { throw new Error('serverName cannot be null or undefined and it must be of type string.'); } - if (recommendedElasticPoolName === null || recommendedElasticPoolName === undefined || typeof recommendedElasticPoolName.valueOf() !== 'string') { - throw new Error('recommendedElasticPoolName cannot be null or undefined and it must be of type string.'); - } if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { throw new Error('databaseName cannot be null or undefined and it must be of type string.'); } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -2026,12 +1855,11 @@ function _getByRecommendedElasticPool(resourceGroupName, serverName, recommended // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases/{databaseName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/move'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); - requestUrl = requestUrl.replace('{recommendedElasticPoolName}', encodeURIComponent(recommendedElasticPoolName)); requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -2040,7 +1868,7 @@ function _getByRecommendedElasticPool(resourceGroupName, serverName, recommended // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'GET'; + httpRequest.method = 'POST'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -2058,7 +1886,21 @@ function _getByRecommendedElasticPool(resourceGroupName, serverName, recommended } } } - httpRequest.body = null; + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ResourceMoveDefinition']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { @@ -2093,175 +1935,6 @@ function _getByRecommendedElasticPool(resourceGroupName, serverName, recommended // Create Result let result = null; if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['Database']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError.request = msRest.stripRequest(httpRequest); - deserializationError.response = msRest.stripResponse(response); - return callback(deserializationError); - } - } - - return callback(null, result, httpRequest, response); - }); -} - -/** - * Returns a list of databases inside a recommented elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} recommendedElasticPoolName The name of the recommended - * elastic pool to be retrieved. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} callback - The callback. - * - * @returns {function} callback(err, result, request, response) - * - * {Error} err - The Error object if an error occurred, null otherwise. - * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseListResult} for more information. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ -function _listByRecommendedElasticPool(resourceGroupName, serverName, recommendedElasticPoolName, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - if (!callback) { - throw new Error('callback cannot be null.'); - } - let apiVersion = '2014-04-01'; - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { - throw new Error('serverName cannot be null or undefined and it must be of type string.'); - } - if (recommendedElasticPoolName === null || recommendedElasticPoolName === undefined || typeof recommendedElasticPoolName.valueOf() !== 'string') { - throw new Error('recommendedElasticPoolName cannot be null or undefined and it must be of type string.'); - } - if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { - throw new Error('this.client.acceptLanguage must be of type string.'); - } - } catch (error) { - return callback(error); - } - - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/recommendedElasticPools/{recommendedElasticPoolName}/databases'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); - requestUrl = requestUrl.replace('{recommendedElasticPoolName}', encodeURIComponent(recommendedElasticPoolName)); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (queryParameters.length > 0) { - requestUrl += '?' + queryParameters.join('&'); - } - - // Create HTTP transport objects - let httpRequest = new WebResource(); - httpRequest.method = 'GET'; - httpRequest.url = requestUrl; - httpRequest.headers = {}; - // Set Headers - httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - if (this.client.generateClientRequestId) { - httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); - } - if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { - httpRequest.headers['accept-language'] = this.client.acceptLanguage; - } - if(options) { - for(let headerName in options['customHeaders']) { - if (options['customHeaders'].hasOwnProperty(headerName)) { - httpRequest.headers[headerName] = options['customHeaders'][headerName]; - } - } - } - httpRequest.body = null; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; - if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; - if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); - } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['DatabaseListResult']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError.request = msRest.stripRequest(httpRequest); - deserializationError.response = msRest.stripResponse(response); - return callback(deserializationError); - } - } return callback(null, result, httpRequest, response); }); @@ -2283,12 +1956,20 @@ function _listByRecommendedElasticPool(resourceGroupName, serverName, recommende * * @param {string} parameters.edition The edition for the database being * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' * * @param {string} parameters.serviceObjectiveName The name of the service - * objective to assign to the database. Possible values include: 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' + * objective to assign to the database. Possible values include: 'System', + * 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', + * 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', + * 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', + * 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', + * 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', + * 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', + * 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', + * 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', + * 'ElasticPool' * * @param {string} parameters.maxSizeBytes The maximum size for the newly * imported database. @@ -2850,7 +2531,7 @@ function _beginExportMethod(resourceGroupName, serverName, databaseName, paramet } /** - * Pauses a data warehouse. + * Upgrades a data warehouse. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2858,7 +2539,7 @@ function _beginExportMethod(resourceGroupName, serverName, databaseName, paramet * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to pause. + * @param {string} databaseName The name of the database to be upgraded. * * @param {object} [options] Optional Parameters. * @@ -2877,7 +2558,7 @@ function _beginExportMethod(resourceGroupName, serverName, databaseName, paramet * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginPause(resourceGroupName, serverName, databaseName, options, callback) { +function _beginUpgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2887,12 +2568,9 @@ function _beginPause(resourceGroupName, serverName, databaseName, options, callb if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; + let apiVersion = '2017-10-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } @@ -2902,6 +2580,9 @@ function _beginPause(resourceGroupName, serverName, databaseName, options, callb if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { throw new Error('databaseName cannot be null or undefined and it must be of type string.'); } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -2911,11 +2592,11 @@ function _beginPause(resourceGroupName, serverName, databaseName, options, callb // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/upgradeDataWarehouse'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -2983,7 +2664,7 @@ function _beginPause(resourceGroupName, serverName, databaseName, options, callb } /** - * Resumes a data warehouse. + * Creates a new database or updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2991,7 +2672,119 @@ function _beginPause(resourceGroupName, serverName, databaseName, options, callb * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to resume. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -3004,13 +2797,14 @@ function _beginPause(resourceGroupName, serverName, databaseName, options, callb * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginResume(resourceGroupName, serverName, databaseName, options, callback) { +function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -3020,12 +2814,9 @@ function _beginResume(resourceGroupName, serverName, databaseName, options, call if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; + let apiVersion = '2017-10-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } @@ -3035,6 +2826,12 @@ function _beginResume(resourceGroupName, serverName, databaseName, options, call if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { throw new Error('databaseName cannot be null or undefined and it must be of type string.'); } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -3044,11 +2841,11 @@ function _beginResume(resourceGroupName, serverName, databaseName, options, call // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -3057,7 +2854,7 @@ function _beginResume(resourceGroupName, serverName, databaseName, options, call // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'POST'; + httpRequest.method = 'PUT'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -3075,14 +2872,28 @@ function _beginResume(resourceGroupName, serverName, databaseName, options, call } } } - httpRequest.body = null; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 202 && statusCode !== 200) { + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['Database']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -3110,13 +2921,47 @@ function _beginResume(resourceGroupName, serverName, databaseName, options, call // Create Result let result = null; if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Database']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Database']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } return callback(null, result, httpRequest, response); }); } /** - * Creates a new database or updates an existing database. + * Deletes the database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3124,130 +2969,7 @@ function _beginResume(resourceGroupName, serverName, databaseName, options, call * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be operated on - * (updated or created). - * - * @param {object} parameters The required parameters for creating or updating - * a database. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} parameters.location Resource location. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -3260,14 +2982,13 @@ function _beginResume(resourceGroupName, serverName, databaseName, options, call * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, callback) { +function _beginDeleteMethod(resourceGroupName, serverName, databaseName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -3277,12 +2998,9 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; + let apiVersion = '2017-10-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } @@ -3292,8 +3010,8 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { throw new Error('databaseName cannot be null or undefined and it must be of type string.'); } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -3305,10 +3023,10 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -3317,7 +3035,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'DELETE'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -3335,28 +3053,14 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['Database']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -3384,40 +3088,6 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param // Create Result let result = null; if (responseBody === '') responseBody = null; - // Deserialize Response - if (statusCode === 200) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['Database']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError.request = msRest.stripRequest(httpRequest); - deserializationError.response = msRest.stripResponse(response); - return callback(deserializationError); - } - } - // Deserialize Response - if (statusCode === 201) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['Database']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError1.request = msRest.stripRequest(httpRequest); - deserializationError1.response = msRest.stripResponse(response); - return callback(deserializationError1); - } - } return callback(null, result, httpRequest, response); }); @@ -3432,14 +3102,24 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be updated. + * @param {string} databaseName The name of the database. * - * @param {object} parameters The required parameters for updating a database. + * @param {object} parameters The requested database resource state. * - * @param {object} [parameters.tags] Resource tags. + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * * @param {string} [parameters.createMode] Specifies the mode of database * creation. @@ -3449,9 +3129,9 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param * Copy: creates a database as a copy of an existing database. sourceDatabaseId * must be specified as the resource ID of the source database. * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) secondary replica of an existing database. sourceDatabaseId - * must be specified as the resource ID of the existing primary 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 @@ -3472,86 +3152,67 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, param * term retention vault. recoveryServicesRecoveryPointResourceId must be * specified as the recovery point resource ID. * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for + * DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -3581,12 +3242,9 @@ function _beginUpdate(resourceGroupName, serverName, databaseName, parameters, o if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; + let apiVersion = '2017-10-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } @@ -3599,6 +3257,9 @@ function _beginUpdate(resourceGroupName, serverName, databaseName, parameters, o if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -3609,10 +3270,10 @@ function _beginUpdate(resourceGroupName, serverName, databaseName, parameters, o // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -3710,41 +3371,918 @@ function _beginUpdate(resourceGroupName, serverName, databaseName, parameters, o }); } -/** Class representing a Databases. */ -class Databases { - /** - * Create a Databases. - * @param {SqlManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._importMethod = _importMethod; - this._createImportOperation = _createImportOperation; - this._exportMethod = _exportMethod; - this._listMetrics = _listMetrics; - this._listMetricDefinitions = _listMetricDefinitions; - this._pause = _pause; - this._resume = _resume; - this._createOrUpdate = _createOrUpdate; - this._update = _update; - this._deleteMethod = _deleteMethod; - this._get = _get; - this._listByServer = _listByServer; - this._getByElasticPool = _getByElasticPool; - this._listByElasticPool = _listByElasticPool; - this._getByRecommendedElasticPool = _getByRecommendedElasticPool; - this._listByRecommendedElasticPool = _listByRecommendedElasticPool; - this._beginImportMethod = _beginImportMethod; - this._beginCreateImportOperation = _beginCreateImportOperation; - this._beginExportMethod = _beginExportMethod; - this._beginPause = _beginPause; - this._beginResume = _beginResume; - this._beginCreateOrUpdate = _beginCreateOrUpdate; - this._beginUpdate = _beginUpdate; +/** + * Pauses a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be paused. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginPause(resourceGroupName, serverName, databaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; } - - /** - * Imports a bacpac into a new database. + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/pause'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Database']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Resumes a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be resumed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginResume(resourceGroupName, serverName, databaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/resume'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Database']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a list of databases. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByServerNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DatabaseListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a list of databases in an elastic pool. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByElasticPoolNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DatabaseListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Databases. */ +class Databases { + /** + * Create a Databases. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._importMethod = _importMethod; + this._createImportOperation = _createImportOperation; + this._exportMethod = _exportMethod; + this._listMetrics = _listMetrics; + this._listMetricDefinitions = _listMetricDefinitions; + this._upgradeDataWarehouse = _upgradeDataWarehouse; + this._listByServer = _listByServer; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._listByElasticPool = _listByElasticPool; + this._pause = _pause; + this._resume = _resume; + this._rename = _rename; + this._beginImportMethod = _beginImportMethod; + this._beginCreateImportOperation = _beginCreateImportOperation; + this._beginExportMethod = _beginExportMethod; + this._beginUpgradeDataWarehouse = _beginUpgradeDataWarehouse; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdate = _beginUpdate; + this._beginPause = _beginPause; + this._beginResume = _beginResume; + this._listByServerNext = _listByServerNext; + this._listByElasticPoolNext = _listByElasticPoolNext; + } + + /** + * Imports a bacpac into a new database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} parameters.databaseName The name of the database to import. + * + * @param {string} parameters.edition The edition for the database being + * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' + * + * @param {string} parameters.serviceObjectiveName The name of the service + * objective to assign to the database. Possible values include: 'System', + * 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', + * 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', + * 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', + * 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', + * 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', + * 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', + * 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', + * 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', + * 'ElasticPool' + * + * @param {string} parameters.maxSizeBytes The maximum size for the newly + * imported database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + importMethodWithHttpOperationResponse(resourceGroupName, serverName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._importMethod(resourceGroupName, serverName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Imports a bacpac into a new database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} parameters.databaseName The name of the database to import. + * + * @param {string} parameters.edition The edition for the database being + * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' + * + * @param {string} parameters.serviceObjectiveName The name of the service + * objective to assign to the database. Possible values include: 'System', + * 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', + * 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', + * 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', + * 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', + * 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', + * 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', + * 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', + * 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', + * 'ElasticPool' + * + * @param {string} parameters.maxSizeBytes The maximum size for the newly + * imported database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ImportExportResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ImportExportResponse} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + importMethod(resourceGroupName, serverName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._importMethod(resourceGroupName, serverName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._importMethod(resourceGroupName, serverName, parameters, options, optionalCallback); + } + } + + /** + * Creates an import operation that imports a bacpac into an existing database. + * The existing database must be empty. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to import into + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} [parameters.name] The name of the extension. + * + * @param {string} [parameters.type] The type of the extension. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createImportOperationWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createImportOperation(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates an import operation that imports a bacpac into an existing database. + * The existing database must be empty. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to import into + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} [parameters.name] The name of the extension. + * + * @param {string} [parameters.type] The type of the extension. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ImportExportResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ImportExportResponse} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createImportOperation(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createImportOperation(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createImportOperation(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Exports a database to a bacpac. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3752,22 +4290,64 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. + * @param {string} databaseName The name of the database to be exported. * - * @param {string} parameters.databaseName The name of the database to import. + * @param {object} parameters The required parameters for exporting a database. * - * @param {string} parameters.edition The edition for the database being - * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' * - * @param {string} parameters.serviceObjectiveName The name of the service - * objective to assign to the database. Possible values include: 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." * - * @param {string} parameters.maxSizeBytes The maximum size for the newly - * imported database. + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + exportMethodWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._exportMethod(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Exports a database to a bacpac. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be exported. + * + * @param {object} parameters The required parameters for exporting a database. * * @param {string} parameters.storageKeyType The type of the storage key to * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' @@ -3791,17 +4371,175 @@ class Databases { * @param {object} [options.customHeaders] Headers that will be added to the * request * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ImportExportResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ImportExportResponse} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + exportMethod(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._exportMethod(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._exportMethod(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Returns database metrics. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} filter An OData filter expression that describes a subset of + * metrics to return. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listMetricsWithHttpOperationResponse(resourceGroupName, serverName, databaseName, filter, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listMetrics(resourceGroupName, serverName, databaseName, filter, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns database metrics. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} filter An OData filter expression that describes a subset of + * metrics to return. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {MetricListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link MetricListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listMetrics(resourceGroupName, serverName, databaseName, filter, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listMetrics(resourceGroupName, serverName, databaseName, filter, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listMetrics(resourceGroupName, serverName, databaseName, filter, options, optionalCallback); + } + } + + /** + * Returns database metric definitions. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - importMethodWithHttpOperationResponse(resourceGroupName, serverName, parameters, options) { + listMetricDefinitionsWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._importMethod(resourceGroupName, serverName, parameters, options, (err, result, request, response) => { + self._listMetricDefinitions(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3812,7 +4550,7 @@ class Databases { } /** - * Imports a bacpac into a new database. + * Returns database metric definitions. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3820,39 +4558,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. - * - * @param {string} parameters.databaseName The name of the database to import. - * - * @param {string} parameters.edition The edition for the database being - * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} parameters.serviceObjectiveName The name of the service - * objective to assign to the database. Possible values include: 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' - * - * @param {string} parameters.maxSizeBytes The maximum size for the newly - * imported database. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -3866,7 +4572,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {ImportExportResponse} - The deserialized result object. + * @resolve {MetricDefinitionListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3875,13 +4581,14 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * See {@link MetricDefinitionListResult} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - importMethod(resourceGroupName, serverName, parameters, options, optionalCallback) { + listMetricDefinitions(resourceGroupName, serverName, databaseName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3890,20 +4597,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._importMethod(resourceGroupName, serverName, parameters, options, (err, result, request, response) => { + self._listMetricDefinitions(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._importMethod(resourceGroupName, serverName, parameters, options, optionalCallback); + return self._listMetricDefinitions(resourceGroupName, serverName, databaseName, options, optionalCallback); } } /** - * Creates an import operation that imports a bacpac into an existing database. - * The existing database must be empty. + * Upgrades a data warehouse. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3911,31 +4617,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to import into - * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. - * - * @param {string} [parameters.name] The name of the extension. - * - * @param {string} [parameters.type] The type of the extension. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} databaseName The name of the database to be upgraded. * * @param {object} [options] Optional Parameters. * @@ -3944,15 +4626,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - createImportOperationWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + upgradeDataWarehouseWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._createImportOperation(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._upgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3963,8 +4645,7 @@ class Databases { } /** - * Creates an import operation that imports a bacpac into an existing database. - * The existing database must be empty. + * Upgrades a data warehouse. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3972,31 +4653,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to import into - * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. - * - * @param {string} [parameters.name] The name of the extension. - * - * @param {string} [parameters.type] The type of the extension. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} databaseName The name of the database to be upgraded. * * @param {object} [options] Optional Parameters. * @@ -4010,7 +4667,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {ImportExportResponse} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -4018,14 +4675,13 @@ class Databases { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - createImportOperation(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + upgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -4034,19 +4690,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._createImportOperation(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._upgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._createImportOperation(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + return self._upgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, optionalCallback); } } /** - * Exports a database to a bacpac. + * Gets a list of databases. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4054,27 +4710,6 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be exported. - * - * @param {object} parameters The required parameters for exporting a database. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -4082,15 +4717,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - exportMethodWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + listByServerWithHttpOperationResponse(resourceGroupName, serverName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._exportMethod(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -4101,7 +4736,7 @@ class Databases { } /** - * Exports a database to a bacpac. + * Gets a list of databases. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4109,27 +4744,6 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be exported. - * - * @param {object} parameters The required parameters for exporting a database. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -4142,7 +4756,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {ImportExportResponse} - The deserialized result object. + * @resolve {DatabaseListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -4151,13 +4765,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * See {@link DatabaseListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - exportMethod(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + listByServer(resourceGroupName, serverName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -4166,19 +4780,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._exportMethod(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._exportMethod(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + return self._listByServer(resourceGroupName, serverName, options, optionalCallback); } } /** - * Returns database metrics. + * Gets a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4188,9 +4802,6 @@ class Databases { * * @param {string} databaseName The name of the database. * - * @param {string} filter An OData filter expression that describes a subset of - * metrics to return. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -4198,15 +4809,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listMetricsWithHttpOperationResponse(resourceGroupName, serverName, databaseName, filter, options) { + getWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listMetrics(resourceGroupName, serverName, databaseName, filter, options, (err, result, request, response) => { + self._get(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -4217,7 +4828,7 @@ class Databases { } /** - * Returns database metrics. + * Gets a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4227,9 +4838,6 @@ class Databases { * * @param {string} databaseName The name of the database. * - * @param {string} filter An OData filter expression that describes a subset of - * metrics to return. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -4242,7 +4850,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {MetricListResult} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error} - The error object. * @@ -4251,13 +4859,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link MetricListResult} for more information. + * See {@link Database} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listMetrics(resourceGroupName, serverName, databaseName, filter, options, optionalCallback) { + get(resourceGroupName, serverName, databaseName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -4266,19 +4874,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listMetrics(resourceGroupName, serverName, databaseName, filter, options, (err, result, request, response) => { + self._get(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listMetrics(resourceGroupName, serverName, databaseName, filter, options, optionalCallback); + return self._get(resourceGroupName, serverName, databaseName, options, optionalCallback); } } /** - * Returns database metric definitions. + * Creates a new database or updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4286,7 +4894,119 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -4295,15 +5015,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listMetricDefinitionsWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { + createOrUpdateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listMetricDefinitions(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + self._createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -4314,7 +5034,7 @@ class Databases { } /** - * Returns database metric definitions. + * Creates a new database or updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4324,6 +5044,118 @@ class Databases { * * @param {string} databaseName The name of the database. * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -4336,7 +5168,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {MetricDefinitionListResult} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error} - The error object. * @@ -4345,14 +5177,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link MetricDefinitionListResult} for more - * information. + * See {@link Database} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listMetricDefinitions(resourceGroupName, serverName, databaseName, options, optionalCallback) { + createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -4361,19 +5192,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listMetricDefinitions(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + self._createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listMetricDefinitions(resourceGroupName, serverName, databaseName, options, optionalCallback); + return self._createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); } } /** - * Pauses a data warehouse. + * Deletes the database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4381,7 +5212,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to pause. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -4394,11 +5225,11 @@ class Databases { * * @reject {Error} - The error object. */ - pauseWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { + deleteMethodWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._pause(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + self._deleteMethod(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -4409,7 +5240,7 @@ class Databases { } /** - * Pauses a data warehouse. + * Deletes the database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4417,7 +5248,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to pause. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -4445,7 +5276,7 @@ class Databases { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - pause(resourceGroupName, serverName, databaseName, options, optionalCallback) { + deleteMethod(resourceGroupName, serverName, databaseName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -4454,19 +5285,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._pause(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + self._deleteMethod(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._pause(resourceGroupName, serverName, databaseName, options, optionalCallback); + return self._deleteMethod(resourceGroupName, serverName, databaseName, options, optionalCallback); } } /** - * Resumes a data warehouse. + * Updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4474,7 +5305,117 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to resume. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -4483,15 +5424,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - resumeWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { + updateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._resume(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + self._update(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -4502,7 +5443,7 @@ class Databases { } /** - * Resumes a data warehouse. + * Updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4510,71 +5451,24 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to resume. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} [optionalCallback] - The optional callback. - * - * @returns {function|Promise} If a callback was passed as the last parameter - * then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned - * - * @resolve {null} - The deserialized result object. - * - * @reject {Error} - The error object. - * - * {function} optionalCallback(err, result, request, response) - * - * {Error} err - The Error object if an error occurred, null otherwise. - * - * {null} [result] - The deserialized result object if an error did not occur. + * @param {string} databaseName The name of the database. * - * {object} [request] - The HTTP Request object if an error did not occur. + * @param {object} parameters The requested database resource state. * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ - resume(resourceGroupName, serverName, databaseName, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._resume(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._resume(resourceGroupName, serverName, databaseName, options, optionalCallback); - } - } - - /** - * Creates a new database or updates an existing database. + * @param {object} [parameters.sku] The name and tier of the SKU. * - * @param {string} 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. + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * @param {string} serverName The name of the server. + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {string} databaseName The name of the database to be operated on - * (updated or created). + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @param {object} parameters The required parameters for creating or updating - * a database. + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * * @param {string} [parameters.createMode] Specifies the mode of database * creation. @@ -4584,9 +5478,9 @@ class Databases { * Copy: creates a database as a copy of an existing database. sourceDatabaseId * must be specified as the resource ID of the source database. * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) secondary replica of an existing database. sourceDatabaseId - * must be specified as the resource ID of the existing primary 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 @@ -4607,90 +5501,125 @@ class Databases { * term retention vault. recoveryServicesRecoveryPointResourceId must be * specified as the recovery point resource ID. * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for + * DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {Database} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Gets a list of databases in an elastic pool. + * + * @param {string} 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. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} serverName The name of the server. * - * @param {string} parameters.location Resource location. + * @param {string} elasticPoolName The name of the elastic pool. * * @param {object} [options] Optional Parameters. * @@ -4699,15 +5628,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + listByElasticPoolWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -4718,7 +5647,7 @@ class Databases { } /** - * Creates a new database or updates an existing database. + * Gets a list of databases in an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4726,130 +5655,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be operated on - * (updated or created). - * - * @param {object} parameters The required parameters for creating or updating - * a database. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} parameters.location Resource location. + * @param {string} elasticPoolName The name of the elastic pool. * * @param {object} [options] Optional Parameters. * @@ -4863,7 +5669,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {Database} - The deserialized result object. + * @resolve {DatabaseListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -4872,13 +5678,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * See {@link DatabaseListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -4887,19 +5693,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + return self._listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, optionalCallback); } } /** - * Updates an existing database. + * Pauses a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4907,126 +5713,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be updated. - * - * @param {object} parameters The required parameters for updating a database. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * @param {string} databaseName The name of the database to be paused. * * @param {object} [options] Optional Parameters. * @@ -5039,11 +5726,11 @@ class Databases { * * @reject {Error} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + pauseWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._update(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._pause(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5054,7 +5741,7 @@ class Databases { } /** - * Updates an existing database. + * Pauses a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5062,126 +5749,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be updated. - * - * @param {object} parameters The required parameters for updating a database. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * @param {string} databaseName The name of the database to be paused. * * @param {object} [options] Optional Parameters. * @@ -5210,7 +5778,7 @@ class Databases { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + pause(resourceGroupName, serverName, databaseName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5219,19 +5787,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._update(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._pause(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._update(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + return self._pause(resourceGroupName, serverName, databaseName, options, optionalCallback); } } /** - * Deletes a database. + * Resumes a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5239,7 +5807,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be deleted. + * @param {string} databaseName The name of the database to be resumed. * * @param {object} [options] Optional Parameters. * @@ -5248,15 +5816,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { + resumeWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + self._resume(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5267,7 +5835,7 @@ class Databases { } /** - * Deletes a database. + * Resumes a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5275,7 +5843,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be deleted. + * @param {string} databaseName The name of the database to be resumed. * * @param {object} [options] Optional Parameters. * @@ -5289,7 +5857,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5297,13 +5865,14 @@ class Databases { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName, serverName, databaseName, options, optionalCallback) { + resume(resourceGroupName, serverName, databaseName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5312,19 +5881,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + self._resume(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._deleteMethod(resourceGroupName, serverName, databaseName, options, optionalCallback); + return self._resume(resourceGroupName, serverName, databaseName, options, optionalCallback); } } /** - * Gets a database. + * Renames a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5332,28 +5901,29 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} databaseName The name of the database to rename. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters The resource move definition for renaming this + * database. + * + * @param {string} parameters.id The target ID for the resource * - * @param {string} [options.expand] A comma separated list of child objects to - * expand in the response. Possible properties: serviceTierAdvisors, - * transparentDataEncryption. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { + renameWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._get(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + self._rename(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5364,7 +5934,7 @@ class Databases { } /** - * Gets a database. + * Renames a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5372,13 +5942,14 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} databaseName The name of the database to rename. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters The resource move definition for renaming this + * database. + * + * @param {string} parameters.id The target ID for the resource * - * @param {string} [options.expand] A comma separated list of child objects to - * expand in the response. Possible properties: serviceTierAdvisors, - * transparentDataEncryption. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -5390,7 +5961,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {Database} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5398,14 +5969,13 @@ class Databases { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName, serverName, databaseName, options, optionalCallback) { + rename(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5414,19 +5984,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._get(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + self._rename(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._get(resourceGroupName, serverName, databaseName, options, optionalCallback); + return self._rename(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); } } /** - * Returns a list of databases in a server. + * Imports a bacpac into a new database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5434,29 +6004,64 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} parameters.databaseName The name of the database to import. + * + * @param {string} parameters.edition The edition for the database being + * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' + * + * @param {string} parameters.serviceObjectiveName The name of the service + * objective to assign to the database. Possible values include: 'System', + * 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', + * 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', + * 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', + * 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', + * 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', + * 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', + * 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', + * 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', + * 'ElasticPool' + * + * @param {string} parameters.maxSizeBytes The maximum size for the newly + * imported database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. * - * @param {string} [options.expand] A comma separated list of child objects to - * expand in the response. Possible properties: serviceTierAdvisors, - * transparentDataEncryption. + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * - * @param {string} [options.filter] An OData filter expression that describes a - * subset of databases to return. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName, serverName, options) { + beginImportMethodWithHttpOperationResponse(resourceGroupName, serverName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { + self._beginImportMethod(resourceGroupName, serverName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5467,7 +6072,7 @@ class Databases { } /** - * Returns a list of databases in a server. + * Imports a bacpac into a new database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5475,14 +6080,49 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} parameters.databaseName The name of the database to import. + * + * @param {string} parameters.edition The edition for the database being + * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' + * + * @param {string} parameters.serviceObjectiveName The name of the service + * objective to assign to the database. Possible values include: 'System', + * 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', + * 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', + * 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', + * 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', + * 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', + * 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', + * 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', + * 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', + * 'ElasticPool' + * + * @param {string} parameters.maxSizeBytes The maximum size for the newly + * imported database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. * - * @param {string} [options.expand] A comma separated list of child objects to - * expand in the response. Possible properties: serviceTierAdvisors, - * transparentDataEncryption. + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * - * @param {string} [options.filter] An OData filter expression that describes a - * subset of databases to return. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -5494,7 +6134,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {DatabaseListResult} - The deserialized result object. + * @resolve {ImportExportResponse} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5503,13 +6143,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseListResult} for more information. + * See {@link ImportExportResponse} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName, serverName, options, optionalCallback) { + beginImportMethod(resourceGroupName, serverName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5518,19 +6158,20 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { + self._beginImportMethod(resourceGroupName, serverName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByServer(resourceGroupName, serverName, options, optionalCallback); + return self._beginImportMethod(resourceGroupName, serverName, parameters, options, optionalCallback); } } /** - * Gets a database inside of an elastic pool. + * Creates an import operation that imports a bacpac into an existing database. + * The existing database must be empty. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5538,10 +6179,31 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} databaseName The name of the database to import into + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} [parameters.name] The name of the extension. + * + * @param {string} [parameters.type] The type of the extension. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * * @param {object} [options] Optional Parameters. * @@ -5550,15 +6212,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getByElasticPoolWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, databaseName, options) { + beginCreateImportOperationWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._getByElasticPool(resourceGroupName, serverName, elasticPoolName, databaseName, options, (err, result, request, response) => { + self._beginCreateImportOperation(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5569,7 +6231,8 @@ class Databases { } /** - * Gets a database inside of an elastic pool. + * Creates an import operation that imports a bacpac into an existing database. + * The existing database must be empty. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5577,10 +6240,31 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} databaseName The name of the database to import into + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} [parameters.name] The name of the extension. + * + * @param {string} [parameters.type] The type of the extension. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * * @param {object} [options] Optional Parameters. * @@ -5594,7 +6278,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {Database} - The deserialized result object. + * @resolve {ImportExportResponse} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5603,13 +6287,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * See {@link ImportExportResponse} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - getByElasticPool(resourceGroupName, serverName, elasticPoolName, databaseName, options, optionalCallback) { + beginCreateImportOperation(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5618,19 +6302,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getByElasticPool(resourceGroupName, serverName, elasticPoolName, databaseName, options, (err, result, request, response) => { + self._beginCreateImportOperation(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._getByElasticPool(resourceGroupName, serverName, elasticPoolName, databaseName, options, optionalCallback); + return self._beginCreateImportOperation(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); } } /** - * Returns a list of databases in an elastic pool. + * Exports a database to a bacpac. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5638,8 +6322,26 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} databaseName The name of the database to be exported. + * + * @param {object} parameters The required parameters for exporting a database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * * @param {object} [options] Optional Parameters. * @@ -5648,15 +6350,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listByElasticPoolWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, options) { + beginExportMethodWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + self._beginExportMethod(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5667,7 +6369,7 @@ class Databases { } /** - * Returns a list of databases in an elastic pool. + * Exports a database to a bacpac. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5675,8 +6377,26 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} databaseName The name of the database to be exported. + * + * @param {object} parameters The required parameters for exporting a database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * * @param {object} [options] Optional Parameters. * @@ -5690,7 +6410,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {DatabaseListResult} - The deserialized result object. + * @resolve {ImportExportResponse} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5699,13 +6419,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseListResult} for more information. + * See {@link ImportExportResponse} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, optionalCallback) { + beginExportMethod(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5714,19 +6434,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + self._beginExportMethod(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, optionalCallback); + return self._beginExportMethod(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); } } /** - * Gets a database inside of a recommented elastic pool. + * Upgrades a data warehouse. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5734,10 +6454,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} recommendedElasticPoolName The name of the elastic pool to - * be retrieved. - * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} databaseName The name of the database to be upgraded. * * @param {object} [options] Optional Parameters. * @@ -5746,15 +6463,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - getByRecommendedElasticPoolWithHttpOperationResponse(resourceGroupName, serverName, recommendedElasticPoolName, databaseName, options) { + beginUpgradeDataWarehouseWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._getByRecommendedElasticPool(resourceGroupName, serverName, recommendedElasticPoolName, databaseName, options, (err, result, request, response) => { + self._beginUpgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5765,7 +6482,7 @@ class Databases { } /** - * Gets a database inside of a recommented elastic pool. + * Upgrades a data warehouse. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5773,10 +6490,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} recommendedElasticPoolName The name of the elastic pool to - * be retrieved. - * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} databaseName The name of the database to be upgraded. * * @param {object} [options] Optional Parameters. * @@ -5790,7 +6504,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {Database} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5798,14 +6512,13 @@ class Databases { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - getByRecommendedElasticPool(resourceGroupName, serverName, recommendedElasticPoolName, databaseName, options, optionalCallback) { + beginUpgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5814,19 +6527,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getByRecommendedElasticPool(resourceGroupName, serverName, recommendedElasticPoolName, databaseName, options, (err, result, request, response) => { + self._beginUpgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._getByRecommendedElasticPool(resourceGroupName, serverName, recommendedElasticPoolName, databaseName, options, optionalCallback); + return self._beginUpgradeDataWarehouse(resourceGroupName, serverName, databaseName, options, optionalCallback); } } /** - * Returns a list of databases inside a recommented elastic pool. + * Creates a new database or updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5834,8 +6547,119 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} recommendedElasticPoolName The name of the recommended - * elastic pool to be retrieved. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -5844,15 +6668,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listByRecommendedElasticPoolWithHttpOperationResponse(resourceGroupName, serverName, recommendedElasticPoolName, options) { + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByRecommendedElasticPool(resourceGroupName, serverName, recommendedElasticPoolName, options, (err, result, request, response) => { + self._beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5863,16 +6687,127 @@ class Databases { } /** - * Returns a list of databases inside a recommented elastic pool. + * Creates a new database or updates an existing database. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. * - * @param {string} recommendedElasticPoolName The name of the recommended - * elastic pool to be retrieved. + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -5886,7 +6821,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {DatabaseListResult} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error} - The error object. * @@ -5895,13 +6830,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseListResult} for more information. + * See {@link Database} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByRecommendedElasticPool(resourceGroupName, serverName, recommendedElasticPoolName, options, optionalCallback) { + beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -5910,19 +6845,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByRecommendedElasticPool(resourceGroupName, serverName, recommendedElasticPoolName, options, (err, result, request, response) => { + self._beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByRecommendedElasticPool(resourceGroupName, serverName, recommendedElasticPoolName, options, optionalCallback); + return self._beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); } } /** - * Imports a bacpac into a new database. + * Deletes the database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5930,39 +6865,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. - * - * @param {string} parameters.databaseName The name of the database to import. - * - * @param {string} parameters.edition The edition for the database being - * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} parameters.serviceObjectiveName The name of the service - * objective to assign to the database. Possible values include: 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' - * - * @param {string} parameters.maxSizeBytes The maximum size for the newly - * imported database. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -5971,15 +6874,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - beginImportMethodWithHttpOperationResponse(resourceGroupName, serverName, parameters, options) { + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginImportMethod(resourceGroupName, serverName, parameters, options, (err, result, request, response) => { + self._beginDeleteMethod(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -5990,7 +6893,7 @@ class Databases { } /** - * Imports a bacpac into a new database. + * Deletes the database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5998,39 +6901,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. - * - * @param {string} parameters.databaseName The name of the database to import. - * - * @param {string} parameters.edition The edition for the database being - * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} parameters.serviceObjectiveName The name of the service - * objective to assign to the database. Possible values include: 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' - * - * @param {string} parameters.maxSizeBytes The maximum size for the newly - * imported database. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -6044,7 +6915,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {ImportExportResponse} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6052,14 +6923,13 @@ class Databases { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginImportMethod(resourceGroupName, serverName, parameters, options, optionalCallback) { + beginDeleteMethod(resourceGroupName, serverName, databaseName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6068,20 +6938,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginImportMethod(resourceGroupName, serverName, parameters, options, (err, result, request, response) => { + self._beginDeleteMethod(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginImportMethod(resourceGroupName, serverName, parameters, options, optionalCallback); + return self._beginDeleteMethod(resourceGroupName, serverName, databaseName, options, optionalCallback); } } /** - * Creates an import operation that imports a bacpac into an existing database. - * The existing database must be empty. + * Updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6089,142 +6958,145 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to import into - * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. + * @param {string} databaseName The name of the database. * - * @param {string} [parameters.name] The name of the extension. + * @param {object} parameters The requested database resource state. * - * @param {string} [parameters.type] The type of the extension. + * @param {object} [parameters.sku] The name and tier of the SKU. * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {string} parameters.storageUri The storage uri to use. + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} [parameters.createMode] Specifies the mode of database + * creation. * - * @param {object} [options] Optional Parameters. + * Default: regular database creation. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * Copy: creates a database as a copy of an existing database. sourceDatabaseId + * must be specified as the resource ID of the source database. * - * @returns {Promise} A promise is returned + * 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. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * 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. * - * @reject {Error} - The error object. - */ - beginCreateImportOperationWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._beginCreateImportOperation(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Creates an import operation that imports a bacpac into an existing database. - * The existing database must be empty. + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource ID + * to restore. * - * @param {string} 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. + * 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. * - * @param {string} serverName The name of the server. + * RestoreLongTermRetentionBackup: Creates a database by restoring from a long + * term retention vault. recoveryServicesRecoveryPointResourceId must be + * specified as the recovery point resource ID. * - * @param {string} databaseName The name of the database to import into + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for + * DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. + * @param {string} [parameters.collation] The collation of the database. * - * @param {string} [parameters.name] The name of the extension. + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. * - * @param {string} [parameters.type] The type of the extension. + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. * - * @param {string} parameters.storageUri The storage uri to use. + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. * - * @param {object} [options] Optional Parameters. + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. * - * @param {function} [optionalCallback] - The optional callback. + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' * - * @returns {function|Promise} If a callback was passed as the last parameter - * then it returns the callback else returns a Promise. + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. * - * {Promise} A promise is returned + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' * - * @resolve {ImportExportResponse} - The deserialized result object. + * @param {string} [parameters.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: 'Enabled', 'Disabled' * - * @reject {Error} - The error object. + * @param {object} [parameters.tags] Resource tags. * - * {function} optionalCallback(err, result, request, response) + * @param {object} [options] Optional Parameters. * - * {Error} err - The Error object if an error occurred, null otherwise. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * @returns {Promise} A promise is returned * - * {object} [request] - The HTTP Request object if an error did not occur. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * {stream} [response] - The HTTP Response stream if an error did not occur. + * @reject {Error} - The error object. */ - beginCreateImportOperation(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + beginUpdateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { let client = this.client; let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; - } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._beginCreateImportOperation(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; }); - } else { - return self._beginCreateImportOperation(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); - } + }); } /** - * Exports a database to a bacpac. + * Updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6232,81 +7104,117 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be exported. + * @param {string} databaseName The name of the database. * - * @param {object} parameters The required parameters for exporting a database. + * @param {object} parameters The requested database resource state. * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * @param {object} [parameters.sku] The name and tier of the SKU. * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * @param {string} parameters.storageUri The storage uri to use. + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for + * DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} [parameters.collation] The collation of the database. * - * @param {object} [options] Optional Parameters. + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' * - * @returns {Promise} A promise is returned + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. * - * @reject {Error} - The error object. - */ - beginExportMethodWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._beginExportMethod(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Exports a database to a bacpac. + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. * - * @param {string} 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. + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. * - * @param {string} serverName The name of the server. + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. * - * @param {string} databaseName The name of the database to be exported. + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. * - * @param {object} parameters The required parameters for exporting a database. + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' * - * @param {string} parameters.storageUri The storage uri to use. + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {string} [parameters.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: 'Enabled', 'Disabled' * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -6320,7 +7228,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {ImportExportResponse} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6329,13 +7237,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * See {@link Database} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginExportMethod(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6344,19 +7252,19 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginExportMethod(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginExportMethod(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + return self._beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); } } /** - * Pauses a data warehouse. + * Pauses a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6364,7 +7272,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to pause. + * @param {string} databaseName The name of the database to be paused. * * @param {object} [options] Optional Parameters. * @@ -6373,7 +7281,7 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -6392,7 +7300,7 @@ class Databases { } /** - * Pauses a data warehouse. + * Pauses a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6400,7 +7308,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to pause. + * @param {string} databaseName The name of the database to be paused. * * @param {object} [options] Optional Parameters. * @@ -6414,7 +7322,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6422,7 +7330,8 @@ class Databases { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -6449,7 +7358,7 @@ class Databases { } /** - * Resumes a data warehouse. + * Resumes a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6457,7 +7366,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to resume. + * @param {string} databaseName The name of the database to be resumed. * * @param {object} [options] Optional Parameters. * @@ -6466,7 +7375,7 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -6485,7 +7394,7 @@ class Databases { } /** - * Resumes a data warehouse. + * Resumes a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6493,7 +7402,7 @@ class Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to resume. + * @param {string} databaseName The name of the database to be resumed. * * @param {object} [options] Optional Parameters. * @@ -6507,7 +7416,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6515,7 +7424,8 @@ class Databases { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -6542,138 +7452,10 @@ class Databases { } /** - * Creates a new database or updates an existing database. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to be operated on - * (updated or created). - * - * @param {object} parameters The required parameters for creating or updating - * a database. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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. + * Gets a list of databases. * - * RestoreLongTermRetentionBackup: Creates a database by restoring from a long - * term retention vault. recoveryServicesRecoveryPointResourceId must be - * specified as the recovery point resource ID. - * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} parameters.location Resource location. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -6682,15 +7464,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + listByServerNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._listByServerNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -6701,138 +7483,10 @@ class Databases { } /** - * Creates a new database or updates an existing database. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to be operated on - * (updated or created). - * - * @param {object} parameters The required parameters for creating or updating - * a database. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' - * - * @param {object} [parameters.tags] Resource tags. + * Gets a list of databases. * - * @param {string} parameters.location Resource location. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -6846,7 +7500,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {Database} - The deserialized result object. + * @resolve {DatabaseListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6855,13 +7509,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * See {@link DatabaseListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + listByServerNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6870,146 +7524,22 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._listByServerNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + return self._listByServerNext(nextPageLink, options, optionalCallback); } } /** - * Updates an existing database. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to be updated. - * - * @param {object} parameters The required parameters for updating a database. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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. + * Gets a list of databases in an elastic pool. * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -7018,15 +7548,15 @@ class Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - beginUpdateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + listByElasticPoolNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._listByElasticPoolNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -7037,134 +7567,10 @@ class Databases { } /** - * Updates an existing database. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to be updated. - * - * @param {object} parameters The required parameters for updating a database. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.createMode] Specifies the mode of database - * creation. + * Gets a list of databases in an elastic pool. * - * 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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -7178,7 +7584,7 @@ class Databases { * * {Promise} A promise is returned * - * @resolve {Database} - The deserialized result object. + * @resolve {DatabaseListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -7187,13 +7593,13 @@ class Databases { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * See {@link DatabaseListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + listByElasticPoolNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -7202,14 +7608,14 @@ class Databases { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + self._listByElasticPoolNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + return self._listByElasticPoolNext(nextPageLink, options, optionalCallback); } } diff --git a/lib/services/sqlManagement2/lib/operations/elasticPoolOperations.js b/lib/services/sqlManagement2/lib/operations/elasticPoolOperations.js new file mode 100644 index 0000000000..46a0be2f1c --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/elasticPoolOperations.js @@ -0,0 +1,728 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Cancels the asynchronous operation on the elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName + * + * @param {uuid} operationId The operation identifier. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _cancel(resourceGroupName, serverName, elasticPoolName, operationId, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (elasticPoolName === null || elasticPoolName === undefined || typeof elasticPoolName.valueOf() !== 'string') { + throw new Error('elasticPoolName cannot be null or undefined and it must be of type string.'); + } + if (operationId === null || operationId === undefined || typeof operationId.valueOf() !== 'string' || !msRest.isValidUuid(operationId)) { + throw new Error('operationId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations/{operationId}/cancel'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); + requestUrl = requestUrl.replace('{operationId}', encodeURIComponent(operationId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a list of operations performed on the elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolOperationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (elasticPoolName === null || elasticPoolName === undefined || typeof elasticPoolName.valueOf() !== 'string') { + throw new Error('elasticPoolName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}/operations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ElasticPoolOperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a list of operations performed on the elastic pool. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolOperationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByElasticPoolNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ElasticPoolOperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ElasticPoolOperations. */ +class ElasticPoolOperations { + /** + * Create a ElasticPoolOperations. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._cancel = _cancel; + this._listByElasticPool = _listByElasticPool; + this._listByElasticPoolNext = _listByElasticPoolNext; + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName + * + * @param {uuid} operationId The operation identifier. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + cancelWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, operationId, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._cancel(resourceGroupName, serverName, elasticPoolName, operationId, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Cancels the asynchronous operation on the elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName + * + * @param {uuid} operationId The operation identifier. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + cancel(resourceGroupName, serverName, elasticPoolName, operationId, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._cancel(resourceGroupName, serverName, elasticPoolName, operationId, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._cancel(resourceGroupName, serverName, elasticPoolName, operationId, options, optionalCallback); + } + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByElasticPoolWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ElasticPoolOperationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolOperationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByElasticPool(resourceGroupName, serverName, elasticPoolName, options, optionalCallback); + } + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByElasticPoolNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByElasticPoolNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ElasticPoolOperationListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolOperationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByElasticPoolNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByElasticPoolNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByElasticPoolNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ElasticPoolOperations; diff --git a/lib/services/sqlManagement2/lib/operations/elasticPools.js b/lib/services/sqlManagement2/lib/operations/elasticPools.js index 614b262a5e..00900cb8d8 100644 --- a/lib/services/sqlManagement2/lib/operations/elasticPools.js +++ b/lib/services/sqlManagement2/lib/operations/elasticPools.js @@ -324,9 +324,8 @@ function _listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, }); } - /** - * Creates a new elastic pool or updates an existing elastic pool. + * Gets all elastic pools in a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -334,134 +333,10 @@ function _listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be operated - * on (updated or created). - * - * @param {object} parameters The required parameters for creating or updating - * an elastic pool. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} parameters.location Resource location. - * * @param {object} [options] Optional Parameters. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} callback - The callback. - * - * @returns {function} callback(err, result, request, response) - * - * {Error} err - The Error object if an error occurred, null otherwise. - * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPool} for more information. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ -function _createOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['ElasticPool']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError.request = msRest.stripRequest(httpRequest); - deserializationError.response = msRest.stripResponse(response); - return callback(deserializationError); - } - - return callback(null, result, httpRequest, response); - }); - }); -} - - -/** - * Updates an existing elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be updated. - * - * @param {object} parameters The required parameters for updating an elastic - * pool. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. - * - * @param {object} [options] Optional Parameters. + * @param {number} [options.skip] The number of elements in the collection to + * skip. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -473,93 +348,13 @@ function _createOrUpdate(resourceGroupName, serverName, elasticPoolName, paramet * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPool} for more information. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ -function _update(resourceGroupName, serverName, elasticPoolName, parameters, options, callback) { - /* jshint validthis: true */ - let client = this.client; - if(!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (!callback) { - throw new Error('callback cannot be null.'); - } - - // Send request - this.beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, parsedResult, httpRequest, response) => { - if (err) return callback(err); - - let initialResult = new msRest.HttpOperationResponse(); - initialResult.request = httpRequest; - initialResult.response = response; - initialResult.body = response.body; - client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { - if (err) return callback(err); - - // Create Result - let result = null; - - httpRequest = pollingResult.request; - response = pollingResult.response; - let responseBody = pollingResult.body; - if (responseBody === '') responseBody = null; - - // Deserialize Response - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['ElasticPool']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError.request = msRest.stripRequest(httpRequest); - deserializationError.response = msRest.stripResponse(response); - return callback(deserializationError); - } - - return callback(null, result, httpRequest, response); - }); - }); -} - -/** - * Deletes the elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be deleted. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} callback - The callback. - * - * @returns {function} callback(err, result, request, response) - * - * {Error} err - The Error object if an error occurred, null otherwise. - * - * {null} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _deleteMethod(resourceGroupName, serverName, elasticPoolName, options, callback) { +function _listByServer(resourceGroupName, serverName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -569,20 +364,21 @@ function _deleteMethod(resourceGroupName, serverName, elasticPoolName, options, if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; + let skip = (options && options.skip !== undefined) ? options.skip : undefined; + let apiVersion = '2017-10-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { throw new Error('serverName cannot be null or undefined and it must be of type string.'); } - if (elasticPoolName === null || elasticPoolName === undefined || typeof elasticPoolName.valueOf() !== 'string') { - throw new Error('elasticPoolName cannot be null or undefined and it must be of type string.'); + if (skip !== null && skip !== undefined && typeof skip !== 'number') { + throw new Error('skip must be of type number.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -593,12 +389,14 @@ function _deleteMethod(resourceGroupName, serverName, elasticPoolName, options, // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); - requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; + if (skip !== null && skip !== undefined) { + queryParameters.push('$skip=' + encodeURIComponent(skip.toString())); + } queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); @@ -606,7 +404,7 @@ function _deleteMethod(resourceGroupName, serverName, elasticPoolName, options, // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'DELETE'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -631,7 +429,7 @@ function _deleteMethod(resourceGroupName, serverName, elasticPoolName, options, return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 204) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -659,6 +457,23 @@ function _deleteMethod(resourceGroupName, serverName, elasticPoolName, options, // Create Result let result = null; if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ElasticPoolListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } return callback(null, result, httpRequest, response); }); @@ -673,8 +488,7 @@ function _deleteMethod(resourceGroupName, serverName, elasticPoolName, options, * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} elasticPoolName The name of the elastic pool. * * @param {object} [options] Optional Parameters. * @@ -704,12 +518,9 @@ function _get(resourceGroupName, serverName, elasticPoolName, options, callback) if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; + let apiVersion = '2017-10-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } @@ -719,6 +530,9 @@ function _get(resourceGroupName, serverName, elasticPoolName, options, callback) if (elasticPoolName === null || elasticPoolName === undefined || typeof elasticPoolName.valueOf() !== 'string') { throw new Error('elasticPoolName cannot be null or undefined and it must be of type string.'); } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -729,10 +543,10 @@ function _get(resourceGroupName, serverName, elasticPoolName, options, callback) // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -816,8 +630,9 @@ function _get(resourceGroupName, serverName, elasticPoolName, options, callback) }); } + /** - * Returns a list of elastic pools in a server. + * Creates or updates an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -825,6 +640,48 @@ function _get(resourceGroupName, serverName, elasticPoolName, options, callback) * * @param {string} serverName The name of the server. * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -837,34 +694,348 @@ function _get(resourceGroupName, serverName, elasticPoolName, options, callback) * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPoolListResult} for more information. + * See {@link ElasticPool} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listByServer(resourceGroupName, serverName, options, callback) { +function _createOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { callback = options; options = null; } + if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; - // Validate - try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ElasticPool']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serverName, elasticPoolName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, serverName, elasticPoolName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool update parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPool} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, serverName, elasticPoolName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ElasticPool']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates or updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPool} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { throw new Error('serverName cannot be null or undefined and it must be of type string.'); } + if (elasticPoolName === null || elasticPoolName === undefined || typeof elasticPoolName.valueOf() !== 'string') { + throw new Error('elasticPoolName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -874,10 +1045,11 @@ function _listByServer(resourceGroupName, serverName, options, callback) { // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'; requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -886,7 +1058,7 @@ function _listByServer(resourceGroupName, serverName, options, callback) { // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'GET'; + httpRequest.method = 'PUT'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -904,14 +1076,28 @@ function _listByServer(resourceGroupName, serverName, options, callback) { } } } - httpRequest.body = null; + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ElasticPool']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -946,7 +1132,7 @@ function _listByServer(resourceGroupName, serverName, options, callback) { parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['ElasticPoolListResult']().mapper(); + let resultMapper = new client.models['ElasticPool']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -956,13 +1142,30 @@ function _listByServer(resourceGroupName, serverName, options, callback) { return callback(deserializationError); } } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ElasticPool']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } return callback(null, result, httpRequest, response); }); } /** - * Creates a new elastic pool or updates an existing elastic pool. + * Deletes an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -970,30 +1173,178 @@ function _listByServer(resourceGroupName, serverName, options, callback) { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be operated - * on (updated or created). + * @param {string} elasticPoolName The name of the elastic pool. * - * @param {object} parameters The required parameters for creating or updating - * an elastic pool. + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. + * @param {function} callback - The callback. * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. + * @returns {function} callback(err, result, request, response) * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. + * {Error} err - The Error object if an error occurred, null otherwise. * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * {null} [result] - The deserialized result object if an error did not occur. * - * @param {object} [parameters.tags] Resource tags. + * {object} [request] - The HTTP Request object if an error did not occur. * - * @param {string} parameters.location Resource location. + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, serverName, elasticPoolName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (elasticPoolName === null || elasticPoolName === undefined || typeof elasticPoolName.valueOf() !== 'string') { + throw new Error('elasticPoolName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool update parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -1013,7 +1364,7 @@ function _listByServer(resourceGroupName, serverName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, callback) { +function _beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1023,12 +1374,9 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, pa if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; + let apiVersion = '2017-10-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } @@ -1041,6 +1389,9 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, pa if (parameters === null || parameters === undefined) { throw new Error('parameters cannot be null or undefined.'); } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -1051,10 +1402,10 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, pa // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -1063,7 +1414,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, pa // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PUT'; + httpRequest.method = 'PATCH'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1086,7 +1437,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, pa let requestModel = null; try { if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['ElasticPool']().mapper(); + let requestModelMapper = new client.models['ElasticPoolUpdate']().mapper(); requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); requestContent = JSON.stringify(requestModel); } @@ -1102,7 +1453,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, pa return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + if (statusCode !== 200 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1147,58 +1498,16 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, pa return callback(deserializationError); } } - // Deserialize Response - if (statusCode === 201) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['ElasticPool']().mapper(); - result = client.deserialize(resultMapper, parsedResponse, 'result'); - } - } catch (error) { - let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); - deserializationError1.request = msRest.stripRequest(httpRequest); - deserializationError1.response = msRest.stripResponse(response); - return callback(deserializationError1); - } - } return callback(null, result, httpRequest, response); }); } /** - * Updates an existing elastic pool. + * Gets all elastic pools in a server. * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be updated. - * - * @param {object} parameters The required parameters for updating an elastic - * pool. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -1212,13 +1521,13 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, pa * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPool} for more information. + * See {@link ElasticPoolListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, callback) { +function _listByServerNext(nextPageLink, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1228,23 +1537,10 @@ function _beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } - if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { - throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); - } - if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { - throw new Error('serverName cannot be null or undefined and it must be of type string.'); - } - if (elasticPoolName === null || elasticPoolName === undefined || typeof elasticPoolName.valueOf() !== 'string') { - throw new Error('elasticPoolName cannot be null or undefined and it must be of type string.'); - } - if (parameters === null || parameters === undefined) { - throw new Error('parameters cannot be null or undefined.'); + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -1254,21 +1550,12 @@ function _beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters } // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/elasticPools/{elasticPoolName}'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); - requestUrl = requestUrl.replace('{elasticPoolName}', encodeURIComponent(elasticPoolName)); - let queryParameters = []; - queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); - if (queryParameters.length > 0) { - requestUrl += '?' + queryParameters.join('&'); - } + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); // Create HTTP transport objects let httpRequest = new WebResource(); - httpRequest.method = 'PATCH'; + httpRequest.method = 'GET'; httpRequest.url = requestUrl; httpRequest.headers = {}; // Set Headers @@ -1286,28 +1573,14 @@ function _beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters } } } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['ElasticPoolUpdate']().mapper(); - requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); - requestContent = JSON.stringify(requestModel); - } - } catch (error) { - let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(parameters, null, 2)}.`); - return callback(serializationError); - } - httpRequest.body = requestContent; + httpRequest.body = null; // Send Request return client.pipeline(httpRequest, (err, response, responseBody) => { if (err) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { + if (statusCode !== 200) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -1342,7 +1615,7 @@ function _beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['ElasticPool']().mapper(); + let resultMapper = new client.models['ElasticPoolListResult']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1367,13 +1640,15 @@ class ElasticPools { this.client = client; this._listMetrics = _listMetrics; this._listMetricDefinitions = _listMetricDefinitions; + this._listByServer = _listByServer; + this._get = _get; this._createOrUpdate = _createOrUpdate; - this._update = _update; this._deleteMethod = _deleteMethod; - this._get = _get; - this._listByServer = _listByServer; + this._update = _update; this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; this._beginUpdate = _beginUpdate; + this._listByServerNext = _listByServerNext; } /** @@ -1472,12 +1747,203 @@ class ElasticPools { }); }); } else { - return self._listMetrics(resourceGroupName, serverName, elasticPoolName, filter, options, optionalCallback); + return self._listMetrics(resourceGroupName, serverName, elasticPoolName, filter, options, optionalCallback); + } + } + + /** + * Returns elastic pool metric definitions. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listMetricDefinitionsWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Returns elastic pool metric definitions. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {MetricDefinitionListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link MetricDefinitionListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, options, optionalCallback); + } + } + + /** + * Gets all elastic pools in a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.skip] The number of elements in the collection to + * skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName, serverName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all elastic pools in a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.skip] The number of elements in the collection to + * skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ElasticPoolListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName, serverName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServer(resourceGroupName, serverName, options, optionalCallback); } } /** - * Returns elastic pool metric definitions. + * Gets an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1494,15 +1960,15 @@ class ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listMetricDefinitionsWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, options) { + getWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + self._get(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1513,7 +1979,7 @@ class ElasticPools { } /** - * Returns elastic pool metric definitions. + * Gets an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1535,7 +2001,7 @@ class ElasticPools { * * {Promise} A promise is returned * - * @resolve {MetricDefinitionListResult} - The deserialized result object. + * @resolve {ElasticPool} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1544,14 +2010,13 @@ class ElasticPools { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link MetricDefinitionListResult} for more - * information. + * See {@link ElasticPool} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, options, optionalCallback) { + get(resourceGroupName, serverName, elasticPoolName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1560,19 +2025,19 @@ class ElasticPools { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + self._get(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listMetricDefinitions(resourceGroupName, serverName, elasticPoolName, options, optionalCallback); + return self._get(resourceGroupName, serverName, elasticPoolName, options, optionalCallback); } } /** - * Creates a new elastic pool or updates an existing elastic pool. + * Creates or updates an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1580,26 +2045,43 @@ class ElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be operated - * on (updated or created). + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {object} parameters The required parameters for creating or updating - * an elastic pool. + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' * * @param {object} [parameters.tags] Resource tags. * @@ -1631,7 +2113,7 @@ class ElasticPools { } /** - * Creates a new elastic pool or updates an existing elastic pool. + * Creates or updates an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1639,26 +2121,43 @@ class ElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be operated - * on (updated or created). + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {object} parameters The required parameters for creating or updating - * an elastic pool. + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' * * @param {object} [parameters.tags] Resource tags. * @@ -1712,7 +2211,7 @@ class ElasticPools { } /** - * Updates an existing elastic pool. + * Deletes an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1720,27 +2219,7 @@ class ElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be updated. - * - * @param {object} parameters The required parameters for updating an elastic - * pool. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} elasticPoolName The name of the elastic pool. * * @param {object} [options] Optional Parameters. * @@ -1749,15 +2228,15 @@ class ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, parameters, options) { + deleteMethodWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._update(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { + self._deleteMethod(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1768,7 +2247,7 @@ class ElasticPools { } /** - * Updates an existing elastic pool. + * Deletes an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1776,27 +2255,7 @@ class ElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be updated. - * - * @param {object} parameters The required parameters for updating an elastic - * pool. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} elasticPoolName The name of the elastic pool. * * @param {object} [options] Optional Parameters. * @@ -1810,7 +2269,7 @@ class ElasticPools { * * {Promise} A promise is returned * - * @resolve {ElasticPool} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1818,14 +2277,13 @@ class ElasticPools { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPool} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback) { + deleteMethod(resourceGroupName, serverName, elasticPoolName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1834,19 +2292,19 @@ class ElasticPools { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._update(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { + self._deleteMethod(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._update(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback); + return self._deleteMethod(resourceGroupName, serverName, elasticPoolName, options, optionalCallback); } } /** - * Deletes the elastic pool. + * Updates an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1854,7 +2312,45 @@ class ElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be deleted. + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool update parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -1863,15 +2359,15 @@ class ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, options) { + updateWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + self._update(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1882,7 +2378,7 @@ class ElasticPools { } /** - * Deletes the elastic pool. + * Updates an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1890,7 +2386,45 @@ class ElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be deleted. + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool update parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -1904,7 +2438,7 @@ class ElasticPools { * * {Promise} A promise is returned * - * @resolve {null} - The deserialized result object. + * @resolve {ElasticPool} - The deserialized result object. * * @reject {Error} - The error object. * @@ -1912,13 +2446,14 @@ class ElasticPools { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPool} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName, serverName, elasticPoolName, options, optionalCallback) { + update(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -1927,19 +2462,19 @@ class ElasticPools { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._deleteMethod(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + self._update(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._deleteMethod(resourceGroupName, serverName, elasticPoolName, options, optionalCallback); + return self._update(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback); } } /** - * Gets an elastic pool. + * Creates or updates an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1947,8 +2482,47 @@ class ElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -1961,11 +2535,11 @@ class ElasticPools { * * @reject {Error} - The error object. */ - getWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, options) { + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._get(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + self._beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -1976,7 +2550,7 @@ class ElasticPools { } /** - * Gets an elastic pool. + * Creates or updates an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1984,8 +2558,47 @@ class ElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -2014,7 +2627,7 @@ class ElasticPools { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName, serverName, elasticPoolName, options, optionalCallback) { + beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2023,19 +2636,19 @@ class ElasticPools { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._get(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { + self._beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._get(resourceGroupName, serverName, elasticPoolName, options, optionalCallback); + return self._beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback); } } /** - * Returns a list of elastic pools in a server. + * Deletes an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2043,6 +2656,8 @@ class ElasticPools { * * @param {string} serverName The name of the server. * + * @param {string} elasticPoolName The name of the elastic pool. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2050,15 +2665,15 @@ class ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName, serverName, options) { + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { + self._beginDeleteMethod(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2069,7 +2684,7 @@ class ElasticPools { } /** - * Returns a list of elastic pools in a server. + * Deletes an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2077,6 +2692,8 @@ class ElasticPools { * * @param {string} serverName The name of the server. * + * @param {string} elasticPoolName The name of the elastic pool. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2089,7 +2706,7 @@ class ElasticPools { * * {Promise} A promise is returned * - * @resolve {ElasticPoolListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2097,14 +2714,13 @@ class ElasticPools { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPoolListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName, serverName, options, optionalCallback) { + beginDeleteMethod(resourceGroupName, serverName, elasticPoolName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2113,19 +2729,19 @@ class ElasticPools { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { + self._beginDeleteMethod(resourceGroupName, serverName, elasticPoolName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByServer(resourceGroupName, serverName, options, optionalCallback); + return self._beginDeleteMethod(resourceGroupName, serverName, elasticPoolName, options, optionalCallback); } } /** - * Creates a new elastic pool or updates an existing elastic pool. + * Updates an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2133,30 +2749,45 @@ class ElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be operated - * on (updated or created). + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool update parameters. * - * @param {object} parameters The required parameters for creating or updating - * an elastic pool. + * @param {object} [parameters.sku] * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {object} [parameters.tags] Resource tags. + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. * - * @param {string} parameters.location Resource location. + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -2169,11 +2800,11 @@ class ElasticPools { * * @reject {Error} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, parameters, options) { + beginUpdateWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { + self._beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2184,7 +2815,7 @@ class ElasticPools { } /** - * Creates a new elastic pool or updates an existing elastic pool. + * Updates an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2192,30 +2823,45 @@ class ElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be operated - * on (updated or created). + * @param {string} elasticPoolName The name of the elastic pool. * - * @param {object} parameters The required parameters for creating or updating - * an elastic pool. + * @param {object} parameters The elastic pool update parameters. * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' + * @param {object} [parameters.sku] * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {object} [parameters.tags] Resource tags. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {string} parameters.location Resource location. + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -2244,7 +2890,7 @@ class ElasticPools { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback) { + beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2253,47 +2899,22 @@ class ElasticPools { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { + self._beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginCreateOrUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback); + return self._beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback); } } /** - * Updates an existing elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be updated. + * Gets all elastic pools in a server. * - * @param {object} parameters The required parameters for updating an elastic - * pool. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2302,15 +2923,15 @@ class ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - beginUpdateWithHttpOperationResponse(resourceGroupName, serverName, elasticPoolName, parameters, options) { + listByServerNextWithHttpOperationResponse(nextPageLink, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { + self._listByServerNext(nextPageLink, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2321,35 +2942,10 @@ class ElasticPools { } /** - * Updates an existing elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be updated. - * - * @param {object} parameters The required parameters for updating an elastic - * pool. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. + * Gets all elastic pools in a server. * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -2363,7 +2959,7 @@ class ElasticPools { * * {Promise} A promise is returned * - * @resolve {ElasticPool} - The deserialized result object. + * @resolve {ElasticPoolListResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2372,13 +2968,13 @@ class ElasticPools { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPool} for more information. + * See {@link ElasticPoolListResult} for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback) { + listByServerNext(nextPageLink, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2387,14 +2983,14 @@ class ElasticPools { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, (err, result, request, response) => { + self._listByServerNext(nextPageLink, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._beginUpdate(resourceGroupName, serverName, elasticPoolName, parameters, options, optionalCallback); + return self._listByServerNext(nextPageLink, options, optionalCallback); } } diff --git a/lib/services/sqlManagement2/lib/operations/failoverGroups.js b/lib/services/sqlManagement2/lib/operations/failoverGroups.js index 80156eedf9..5b8e881a26 100644 --- a/lib/services/sqlManagement2/lib/operations/failoverGroups.js +++ b/lib/services/sqlManagement2/lib/operations/failoverGroups.js @@ -923,7 +923,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, failoverGroupName, return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202 && statusCode !== 201) { + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); diff --git a/lib/services/sqlManagement2/lib/operations/geoBackupPolicies.js b/lib/services/sqlManagement2/lib/operations/geoBackupPolicies.js index b79462b6d7..0dc60c6b5b 100644 --- a/lib/services/sqlManagement2/lib/operations/geoBackupPolicies.js +++ b/lib/services/sqlManagement2/lib/operations/geoBackupPolicies.js @@ -140,7 +140,7 @@ function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 201 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 201) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -169,7 +169,7 @@ function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 201) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -186,7 +186,7 @@ function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters } } // Deserialize Response - if (statusCode === 200) { + if (statusCode === 201) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); diff --git a/lib/services/sqlManagement2/lib/operations/index.d.ts b/lib/services/sqlManagement2/lib/operations/index.d.ts index 5554b98d97..adf273f002 100644 --- a/lib/services/sqlManagement2/lib/operations/index.d.ts +++ b/lib/services/sqlManagement2/lib/operations/index.d.ts @@ -14,15 +14,16 @@ import * as models from '../models'; /** * @class - * BackupLongTermRetentionPolicies + * RecoverableDatabases * __NOTE__: An instance of this class is automatically created for an * instance of the SqlManagementClient. */ -export interface BackupLongTermRetentionPolicies { +export interface RecoverableDatabases { /** - * Returns a database backup long term retention policy + * Gets a recoverable database, which is a resource representing a database's + * geo backup * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -30,7 +31,7 @@ export interface BackupLongTermRetentionPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} databaseName The name of the database * * @param {object} [options] Optional Parameters. * @@ -39,14 +40,15 @@ export interface BackupLongTermRetentionPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns a database backup long term retention policy + * Gets a recoverable database, which is a resource representing a database's + * geo backup * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -54,7 +56,7 @@ export interface BackupLongTermRetentionPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} databaseName The name of the database * * @param {object} [options] Optional Parameters. * @@ -68,7 +70,7 @@ export interface BackupLongTermRetentionPolicies { * * {Promise} A promise is returned. * - * @resolve {BackupLongTermRetentionPolicy} - The deserialized result object. + * @resolve {RecoverableDatabase} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -76,21 +78,20 @@ export interface BackupLongTermRetentionPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {BackupLongTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link BackupLongTermRetentionPolicy} for more - * information. + * {RecoverableDatabase} [result] - The deserialized result object if an error did not occur. + * See {@link RecoverableDatabase} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a database backup long term retention policy + * Gets a list of recoverable databases * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -98,17 +99,6 @@ export interface BackupLongTermRetentionPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database - * - * @param {object} parameters The required parameters to update a backup long - * term retention policy - * - * @param {string} parameters.state The status of the backup long term - * retention policy. Possible values include: 'Disabled', 'Enabled' - * - * @param {string} parameters.recoveryServicesBackupPolicyResourceId The azure - * recovery services backup protection policy resource id - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -116,14 +106,14 @@ export interface BackupLongTermRetentionPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a database backup long term retention policy + * Gets a list of recoverable databases * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -131,17 +121,6 @@ export interface BackupLongTermRetentionPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database - * - * @param {object} parameters The required parameters to update a backup long - * term retention policy - * - * @param {string} parameters.state The status of the backup long term - * retention policy. Possible values include: 'Disabled', 'Enabled' - * - * @param {string} parameters.recoveryServicesBackupPolicyResourceId The azure - * recovery services backup protection policy resource id - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -154,7 +133,7 @@ export interface BackupLongTermRetentionPolicies { * * {Promise} A promise is returned. * - * @resolve {BackupLongTermRetentionPolicy} - The deserialized result object. + * @resolve {RecoverableDatabaseListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -162,21 +141,30 @@ export interface BackupLongTermRetentionPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {BackupLongTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link BackupLongTermRetentionPolicy} for more + * {RecoverableDatabaseListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RecoverableDatabaseListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RestorableDroppedDatabases + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface RestorableDroppedDatabases { /** - * Creates or updates a database backup long term retention policy + * Gets a deleted database that can be restored * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -184,16 +172,8 @@ export interface BackupLongTermRetentionPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database - * - * @param {object} parameters The required parameters to update a backup long - * term retention policy - * - * @param {string} parameters.state The status of the backup long term - * retention policy. Possible values include: 'Disabled', 'Enabled' - * - * @param {string} parameters.recoveryServicesBackupPolicyResourceId The azure - * recovery services backup protection policy resource id + * @param {string} restorableDroppededDatabaseId The id of the deleted database + * in the form of databaseName,deletionTimeInFileTimeFormat * * @param {object} [options] Optional Parameters. * @@ -202,14 +182,14 @@ export interface BackupLongTermRetentionPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, restorableDroppededDatabaseId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a database backup long term retention policy + * Gets a deleted database that can be restored * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -217,16 +197,8 @@ export interface BackupLongTermRetentionPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database - * - * @param {object} parameters The required parameters to update a backup long - * term retention policy - * - * @param {string} parameters.state The status of the backup long term - * retention policy. Possible values include: 'Disabled', 'Enabled' - * - * @param {string} parameters.recoveryServicesBackupPolicyResourceId The azure - * recovery services backup protection policy resource id + * @param {string} restorableDroppededDatabaseId The id of the deleted database + * in the form of databaseName,deletionTimeInFileTimeFormat * * @param {object} [options] Optional Parameters. * @@ -240,7 +212,7 @@ export interface BackupLongTermRetentionPolicies { * * {Promise} A promise is returned. * - * @resolve {BackupLongTermRetentionPolicy} - The deserialized result object. + * @resolve {RestorableDroppedDatabase} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -248,30 +220,21 @@ export interface BackupLongTermRetentionPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {BackupLongTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link BackupLongTermRetentionPolicy} for more + * {RestorableDroppedDatabase} [result] - The deserialized result object if an error did not occur. + * See {@link RestorableDroppedDatabase} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * BackupLongTermRetentionVaults - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface BackupLongTermRetentionVaults { + get(resourceGroupName: string, serverName: string, restorableDroppededDatabaseId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, restorableDroppededDatabaseId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, restorableDroppededDatabaseId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a server backup long term retention vault + * Gets a list of deleted databases that can be restored * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -286,14 +249,14 @@ export interface BackupLongTermRetentionVaults { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a server backup long term retention vault + * Gets a list of deleted databases that can be restored * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -313,7 +276,7 @@ export interface BackupLongTermRetentionVaults { * * {Promise} A promise is returned. * - * @resolve {BackupLongTermRetentionVault} - The deserialized result object. + * @resolve {RestorableDroppedDatabaseListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -321,33 +284,35 @@ export interface BackupLongTermRetentionVaults { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {BackupLongTermRetentionVault} [result] - The deserialized result object if an error did not occur. - * See {@link BackupLongTermRetentionVault} for more - * information. + * {RestorableDroppedDatabaseListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RestorableDroppedDatabaseListResult} for + * more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Servers + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface Servers { /** - * Updates a server backup long term retention vault - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Determines whether a resource can be created with the specified name. * - * @param {object} parameters The required parameters to update a backup long - * term retention vault + * @param {object} parameters The parameters to request for name availability. * - * @param {string} parameters.recoveryServicesVaultResourceId The azure - * recovery services vault resource id + * @param {string} parameters.name The name whose availability is to be + * checked. * * @param {object} [options] Optional Parameters. * @@ -356,26 +321,19 @@ export interface BackupLongTermRetentionVaults { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.BackupLongTermRetentionVault, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + checkNameAvailabilityWithHttpOperationResponse(parameters: models.CheckNameAvailabilityRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates a server backup long term retention vault - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Determines whether a resource can be created with the specified name. * - * @param {object} parameters The required parameters to update a backup long - * term retention vault + * @param {object} parameters The parameters to request for name availability. * - * @param {string} parameters.recoveryServicesVaultResourceId The azure - * recovery services vault resource id + * @param {string} parameters.name The name whose availability is to be + * checked. * * @param {object} [options] Optional Parameters. * @@ -389,7 +347,7 @@ export interface BackupLongTermRetentionVaults { * * {Promise} A promise is returned. * - * @resolve {BackupLongTermRetentionVault} - The deserialized result object. + * @resolve {CheckNameAvailabilityResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -397,33 +355,21 @@ export interface BackupLongTermRetentionVaults { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {BackupLongTermRetentionVault} [result] - The deserialized result object if an error did not occur. - * See {@link BackupLongTermRetentionVault} for more + * {CheckNameAvailabilityResponse} [result] - The deserialized result object if an error did not occur. + * See {@link CheckNameAvailabilityResponse} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.BackupLongTermRetentionVault, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.BackupLongTermRetentionVault, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.BackupLongTermRetentionVault, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + checkNameAvailability(parameters: models.CheckNameAvailabilityRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkNameAvailability(parameters: models.CheckNameAvailabilityRequest, callback: ServiceCallback): void; + checkNameAvailability(parameters: models.CheckNameAvailabilityRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates a server backup long term retention vault - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {object} parameters The required parameters to update a backup long - * term retention vault - * - * @param {string} parameters.recoveryServicesVaultResourceId The azure - * recovery services vault resource id + * Gets a list of all servers in the subscription. * * @param {object} [options] Optional Parameters. * @@ -432,26 +378,14 @@ export interface BackupLongTermRetentionVaults { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.BackupLongTermRetentionVault, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates a server backup long term retention vault - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {object} parameters The required parameters to update a backup long - * term retention vault - * - * @param {string} parameters.recoveryServicesVaultResourceId The azure - * recovery services vault resource id + * Gets a list of all servers in the subscription. * * @param {object} [options] Optional Parameters. * @@ -465,7 +399,7 @@ export interface BackupLongTermRetentionVaults { * * {Promise} A promise is returned. * - * @resolve {BackupLongTermRetentionVault} - The deserialized result object. + * @resolve {ServerListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -473,40 +407,25 @@ export interface BackupLongTermRetentionVaults { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {BackupLongTermRetentionVault} [result] - The deserialized result object if an error did not occur. - * See {@link BackupLongTermRetentionVault} for more - * information. + * {ServerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.BackupLongTermRetentionVault, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.BackupLongTermRetentionVault, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.BackupLongTermRetentionVault, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * RestorePoints - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface RestorePoints { + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of database restore points. + * Gets a list of servers in a resource groups. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to get available - * restore points. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -514,24 +433,19 @@ export interface RestorePoints { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of database restore points. + * Gets a list of servers in a resource groups. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to get available - * restore points. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -544,7 +458,7 @@ export interface RestorePoints { * * {Promise} A promise is returned. * - * @resolve {RestorePointListResult} - The deserialized result object. + * @resolve {ServerListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -552,31 +466,20 @@ export interface RestorePoints { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RestorePointListResult} [result] - The deserialized result object if an error did not occur. - * See {@link RestorePointListResult} for more - * information. + * {ServerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * RecoverableDatabases - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface RecoverableDatabases { + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a recoverable database, which is a resource representing a database's - * geo backup + * Gets a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -584,8 +487,6 @@ export interface RecoverableDatabases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -593,15 +494,14 @@ export interface RecoverableDatabases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a recoverable database, which is a resource representing a database's - * geo backup + * Gets a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -609,8 +509,6 @@ export interface RecoverableDatabases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -623,7 +521,7 @@ export interface RecoverableDatabases { * * {Promise} A promise is returned. * - * @resolve {RecoverableDatabase} - The deserialized result object. + * @resolve {Server} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -631,20 +529,20 @@ export interface RecoverableDatabases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RecoverableDatabase} [result] - The deserialized result object if an error did not occur. - * See {@link RecoverableDatabase} for more information. + * {Server} [result] - The deserialized result object if an error did not occur. + * See {@link Server} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of recoverable databases + * Creates or updates a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -652,21 +550,43 @@ export interface RecoverableDatabases { * * @param {string} serverName The name of the server. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters The requested server resource state. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the server. + * + * @param {string} [parameters.identity.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' + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the server. Once created it cannot be changed. + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for server creation). + * + * @param {string} [parameters.version] The version of the server. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.Server, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of recoverable databases + * Creates or updates a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -674,6 +594,28 @@ export interface RecoverableDatabases { * * @param {string} serverName The name of the server. * + * @param {object} parameters The requested server resource state. + * + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the server. + * + * @param {string} [parameters.identity.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' + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the server. Once created it cannot be changed. + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for server creation). + * + * @param {string} [parameters.version] The version of the server. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -686,7 +628,7 @@ export interface RecoverableDatabases { * * {Promise} A promise is returned. * - * @resolve {RecoverableDatabaseListResult} - The deserialized result object. + * @resolve {Server} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -694,30 +636,20 @@ export interface RecoverableDatabases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RecoverableDatabaseListResult} [result] - The deserialized result object if an error did not occur. - * See {@link RecoverableDatabaseListResult} for more - * information. + * {Server} [result] - The deserialized result object if an error did not occur. + * See {@link Server} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * RestorableDroppedDatabases - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface RestorableDroppedDatabases { + createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a deleted database that can be restored + * Deletes a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -725,9 +657,6 @@ export interface RestorableDroppedDatabases { * * @param {string} serverName The name of the server. * - * @param {string} restorableDroppededDatabaseId The id of the deleted database - * in the form of databaseName,deletionTimeInFileTimeFormat - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -735,14 +664,14 @@ export interface RestorableDroppedDatabases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, restorableDroppededDatabaseId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a deleted database that can be restored + * Deletes a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -750,9 +679,6 @@ export interface RestorableDroppedDatabases { * * @param {string} serverName The name of the server. * - * @param {string} restorableDroppededDatabaseId The id of the deleted database - * in the form of databaseName,deletionTimeInFileTimeFormat - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -765,7 +691,7 @@ export interface RestorableDroppedDatabases { * * {Promise} A promise is returned. * - * @resolve {RestorableDroppedDatabase} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -773,21 +699,19 @@ export interface RestorableDroppedDatabases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RestorableDroppedDatabase} [result] - The deserialized result object if an error did not occur. - * See {@link RestorableDroppedDatabase} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, restorableDroppededDatabaseId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, restorableDroppededDatabaseId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, restorableDroppededDatabaseId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of deleted databases that can be restored + * Updates a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -795,6 +719,18 @@ export interface RestorableDroppedDatabases { * * @param {string} serverName The name of the server. * + * @param {object} parameters The requested server resource state. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the server. Once created it cannot be changed. + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for server creation). + * + * @param {string} [parameters.version] The version of the server. + * + * @param {object} [parameters.tags] Resource tags. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -802,14 +738,14 @@ export interface RestorableDroppedDatabases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of deleted databases that can be restored + * Updates a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -817,6 +753,18 @@ export interface RestorableDroppedDatabases { * * @param {string} serverName The name of the server. * + * @param {object} parameters The requested server resource state. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the server. Once created it cannot be changed. + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for server creation). + * + * @param {string} [parameters.version] The version of the server. + * + * @param {object} [parameters.tags] Resource tags. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -829,7 +777,7 @@ export interface RestorableDroppedDatabases { * * {Promise} A promise is returned. * - * @resolve {RestorableDroppedDatabaseListResult} - The deserialized result object. + * @resolve {Server} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -837,32 +785,48 @@ export interface RestorableDroppedDatabases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RestorableDroppedDatabaseListResult} [result] - The deserialized result object if an error did not occur. - * See {@link RestorableDroppedDatabaseListResult} for - * more information. + * {Server} [result] - The deserialized result object if an error did not occur. + * See {@link Server} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * Capabilities - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface Capabilities { + update(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the capabilities available for the specified location. + * Creates or updates a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The requested server resource state. + * + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the server. + * + * @param {string} [parameters.identity.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' + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the server. Once created it cannot be changed. + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for server creation). + * + * @param {string} [parameters.version] The version of the server. + * + * @param {object} [parameters.tags] Resource tags. * - * @param {string} locationId The location id whose capabilities are retrieved. + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -871,16 +835,42 @@ export interface Capabilities { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByLocationWithHttpOperationResponse(locationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.Server, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the capabilities available for the specified location. + * Creates or updates a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. * - * @param {string} locationId The location id whose capabilities are retrieved. + * @param {object} parameters The requested server resource state. + * + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the server. + * + * @param {string} [parameters.identity.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' + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the server. Once created it cannot be changed. + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for server creation). + * + * @param {string} [parameters.version] The version of the server. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -894,7 +884,7 @@ export interface Capabilities { * * {Promise} A promise is returned. * - * @resolve {LocationCapabilities} - The deserialized result object. + * @resolve {Server} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -902,29 +892,20 @@ export interface Capabilities { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {LocationCapabilities} [result] - The deserialized result object if an error did not occur. - * See {@link LocationCapabilities} for more information. + * {Server} [result] - The deserialized result object if an error did not occur. + * See {@link Server} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByLocation(locationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByLocation(locationId: string, callback: ServiceCallback): void; - listByLocation(locationId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ServerConnectionPolicies - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface ServerConnectionPolicies { + beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates the server's connection policy. + * Deletes a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -932,12 +913,6 @@ export interface ServerConnectionPolicies { * * @param {string} serverName The name of the server. * - * @param {object} parameters The required parameters for updating a secure - * connection policy. - * - * @param {string} parameters.connectionType The server connection type. - * Possible values include: 'Default', 'Proxy', 'Redirect' - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -945,14 +920,14 @@ export interface ServerConnectionPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ServerConnectionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates the server's connection policy. + * Deletes a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -960,12 +935,6 @@ export interface ServerConnectionPolicies { * * @param {string} serverName The name of the server. * - * @param {object} parameters The required parameters for updating a secure - * connection policy. - * - * @param {string} parameters.connectionType The server connection type. - * Possible values include: 'Default', 'Proxy', 'Redirect' - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -978,7 +947,7 @@ export interface ServerConnectionPolicies { * * {Promise} A promise is returned. * - * @resolve {ServerConnectionPolicy} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -986,21 +955,19 @@ export interface ServerConnectionPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerConnectionPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link ServerConnectionPolicy} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerConnectionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerConnectionPolicy, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerConnectionPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets the server's secure connection policy. + * Updates a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1008,6 +975,18 @@ export interface ServerConnectionPolicies { * * @param {string} serverName The name of the server. * + * @param {object} parameters The requested server resource state. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the server. Once created it cannot be changed. + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for server creation). + * + * @param {string} [parameters.version] The version of the server. + * + * @param {object} [parameters.tags] Resource tags. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1015,14 +994,14 @@ export interface ServerConnectionPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the server's secure connection policy. + * Updates a server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1030,6 +1009,18 @@ export interface ServerConnectionPolicies { * * @param {string} serverName The name of the server. * + * @param {object} parameters The requested server resource state. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the server. Once created it cannot be changed. + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for server creation). + * + * @param {string} [parameters.version] The version of the server. + * + * @param {object} [parameters.tags] Resource tags. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1042,7 +1033,7 @@ export interface ServerConnectionPolicies { * * {Promise} A promise is returned. * - * @resolve {ServerConnectionPolicy} - The deserialized result object. + * @resolve {Server} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1050,39 +1041,23 @@ export interface ServerConnectionPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerConnectionPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link ServerConnectionPolicy} for more - * information. + * {Server} [result] - The deserialized result object if an error did not occur. + * See {@link Server} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DatabaseThreatDetectionPolicies - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface DatabaseThreatDetectionPolicies { + beginUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a database's threat detection policy. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a list of all servers in the subscription. * - * @param {string} databaseName The name of the database for which database - * Threat Detection policy is defined. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -1091,23 +1066,17 @@ export interface DatabaseThreatDetectionPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a database's threat detection policy. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a list of all servers in the subscription. * - * @param {string} databaseName The name of the database for which database - * Threat Detection policy is defined. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -1121,7 +1090,7 @@ export interface DatabaseThreatDetectionPolicies { * * {Promise} A promise is returned. * - * @resolve {DatabaseSecurityAlertPolicy} - The deserialized result object. + * @resolve {ServerListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1129,66 +1098,23 @@ export interface DatabaseThreatDetectionPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DatabaseSecurityAlertPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseSecurityAlertPolicy} for more - * information. + * {ServerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a database's threat detection policy. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database for which database - * Threat Detection policy is defined. - * - * @param {object} parameters The database Threat Detection policy. - * - * @param {string} [parameters.location] The geo-location where the resource - * lives - * - * @param {string} parameters.state Specifies the state of the policy. If state - * is Enabled, storageEndpoint and storageAccountAccessKey are required. - * Possible values include: 'New', 'Enabled', 'Disabled' - * - * @param {string} [parameters.disabledAlerts] Specifies the - * semicolon-separated list of alerts that are disabled, or empty string to - * disable no alerts. Possible values: Sql_Injection; - * Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. - * - * @param {string} [parameters.emailAddresses] Specifies the - * semicolon-separated list of e-mail addresses to which the alert is sent. - * - * @param {string} [parameters.emailAccountAdmins] Specifies that the alert is - * sent to the account administrators. Possible values include: 'Enabled', - * 'Disabled' - * - * @param {string} [parameters.storageEndpoint] Specifies the blob storage - * endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage - * will hold all Threat Detection audit logs. If state is Enabled, - * storageEndpoint is required. - * - * @param {string} [parameters.storageAccountAccessKey] Specifies the - * identifier key of the Threat Detection audit storage account. If state is - * Enabled, storageAccountAccessKey is required. - * - * @param {number} [parameters.retentionDays] Specifies the number of days to - * keep in the Threat Detection audit logs. + * Gets a list of servers in a resource groups. * - * @param {string} [parameters.useServerDefault] Specifies whether to use the - * default server policy. Possible values include: 'Enabled', 'Disabled' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -1197,59 +1123,17 @@ export interface DatabaseThreatDetectionPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseSecurityAlertPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a database's threat detection policy. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database for which database - * Threat Detection policy is defined. - * - * @param {object} parameters The database Threat Detection policy. - * - * @param {string} [parameters.location] The geo-location where the resource - * lives - * - * @param {string} parameters.state Specifies the state of the policy. If state - * is Enabled, storageEndpoint and storageAccountAccessKey are required. - * Possible values include: 'New', 'Enabled', 'Disabled' - * - * @param {string} [parameters.disabledAlerts] Specifies the - * semicolon-separated list of alerts that are disabled, or empty string to - * disable no alerts. Possible values: Sql_Injection; - * Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. - * - * @param {string} [parameters.emailAddresses] Specifies the - * semicolon-separated list of e-mail addresses to which the alert is sent. - * - * @param {string} [parameters.emailAccountAdmins] Specifies that the alert is - * sent to the account administrators. Possible values include: 'Enabled', - * 'Disabled' - * - * @param {string} [parameters.storageEndpoint] Specifies the blob storage - * endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage - * will hold all Threat Detection audit logs. If state is Enabled, - * storageEndpoint is required. - * - * @param {string} [parameters.storageAccountAccessKey] Specifies the - * identifier key of the Threat Detection audit storage account. If state is - * Enabled, storageAccountAccessKey is required. - * - * @param {number} [parameters.retentionDays] Specifies the number of days to - * keep in the Threat Detection audit logs. + * Gets a list of servers in a resource groups. * - * @param {string} [parameters.useServerDefault] Specifies whether to use the - * default server policy. Possible values include: 'Enabled', 'Disabled' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -1263,7 +1147,7 @@ export interface DatabaseThreatDetectionPolicies { * * {Promise} A promise is returned. * - * @resolve {DatabaseSecurityAlertPolicy} - The deserialized result object. + * @resolve {ServerListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1271,30 +1155,29 @@ export interface DatabaseThreatDetectionPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DatabaseSecurityAlertPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseSecurityAlertPolicy} for more - * information. + * {ServerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseSecurityAlertPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseSecurityAlertPolicy, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseSecurityAlertPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * DataMaskingPolicies + * ServerConnectionPolicies * __NOTE__: An instance of this class is automatically created for an * instance of the SqlManagementClient. */ -export interface DataMaskingPolicies { +export interface ServerConnectionPolicies { /** - * Creates or updates a database data masking policy + * Creates or updates the server's connection policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1302,18 +1185,11 @@ export interface DataMaskingPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. - * - * @param {object} parameters Parameters for creating or updating a data - * masking policy. - * - * @param {string} parameters.dataMaskingState The state of the data masking - * policy. Possible values include: 'Disabled', 'Enabled' + * @param {object} parameters The required parameters for updating a secure + * connection policy. * - * @param {string} [parameters.exemptPrincipals] The list of the exempt - * principals. Specifies the semicolon-separated list of database users for - * which the data masking policy does not apply. The specified users receive - * data results without masking for all of the database queries. + * @param {string} parameters.connectionType The server connection type. + * Possible values include: 'Default', 'Proxy', 'Redirect' * * @param {object} [options] Optional Parameters. * @@ -1322,14 +1198,14 @@ export interface DataMaskingPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DataMaskingPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ServerConnectionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a database data masking policy + * Creates or updates the server's connection policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1337,20 +1213,13 @@ export interface DataMaskingPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {object} parameters The required parameters for updating a secure + * connection policy. * - * @param {object} parameters Parameters for creating or updating a data - * masking policy. + * @param {string} parameters.connectionType The server connection type. + * Possible values include: 'Default', 'Proxy', 'Redirect' * - * @param {string} parameters.dataMaskingState The state of the data masking - * policy. Possible values include: 'Disabled', 'Enabled' - * - * @param {string} [parameters.exemptPrincipals] The list of the exempt - * principals. Specifies the semicolon-separated list of database users for - * which the data masking policy does not apply. The specified users receive - * data results without masking for all of the database queries. - * - * @param {object} [options] Optional Parameters. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -1362,7 +1231,7 @@ export interface DataMaskingPolicies { * * {Promise} A promise is returned. * - * @resolve {DataMaskingPolicy} - The deserialized result object. + * @resolve {ServerConnectionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1370,20 +1239,21 @@ export interface DataMaskingPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DataMaskingPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link DataMaskingPolicy} for more information. + * {ServerConnectionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link ServerConnectionPolicy} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DataMaskingPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DataMaskingPolicy, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DataMaskingPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerConnectionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerConnectionPolicy, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerConnectionPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a database data masking policy. + * Gets the server's secure connection policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1391,8 +1261,6 @@ export interface DataMaskingPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1400,14 +1268,14 @@ export interface DataMaskingPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a database data masking policy. + * Gets the server's secure connection policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1415,8 +1283,6 @@ export interface DataMaskingPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1429,7 +1295,7 @@ export interface DataMaskingPolicies { * * {Promise} A promise is returned. * - * @resolve {DataMaskingPolicy} - The deserialized result object. + * @resolve {ServerConnectionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1437,29 +1303,30 @@ export interface DataMaskingPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DataMaskingPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link DataMaskingPolicy} for more information. + * {ServerConnectionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link ServerConnectionPolicy} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * DataMaskingRules + * DatabaseThreatDetectionPolicies * __NOTE__: An instance of this class is automatically created for an * instance of the SqlManagementClient. */ -export interface DataMaskingRules { +export interface DatabaseThreatDetectionPolicies { /** - * Creates or updates a database data masking rule. + * Gets a database's threat detection policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1467,55 +1334,8 @@ export interface DataMaskingRules { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. - * - * @param {string} dataMaskingRuleName The name of the data masking rule. - * - * @param {object} parameters The required parameters for creating or updating - * a data masking rule. - * - * @param {string} [parameters.aliasName] The alias name. This is a legacy - * parameter and is no longer used. - * - * @param {string} [parameters.ruleState] The rule state. Used to delete a - * rule. To delete an existing rule, specify the schemaName, tableName, - * columnName, maskingFunction, and specify ruleState as disabled. However, if - * the rule doesn't already exist, the rule will be created with ruleState set - * to enabled, regardless of the provided value of ruleState. Possible values - * include: 'Disabled', 'Enabled' - * - * @param {string} parameters.schemaName The schema name on which the data - * masking rule is applied. - * - * @param {string} parameters.tableName The table name on which the data - * masking rule is applied. - * - * @param {string} parameters.columnName The column name on which the data - * masking rule is applied. - * - * @param {string} parameters.maskingFunction The masking function that is used - * for the data masking rule. Possible values include: 'Default', 'CCN', - * 'Email', 'Number', 'SSN', 'Text' - * - * @param {string} [parameters.numberFrom] The numberFrom property of the - * masking rule. Required if maskingFunction is set to Number, otherwise this - * parameter will be ignored. - * - * @param {string} [parameters.numberTo] The numberTo property of the data - * masking rule. Required if maskingFunction is set to Number, otherwise this - * parameter will be ignored. - * - * @param {string} [parameters.prefixSize] If maskingFunction is set to Text, - * the number of characters to show unmasked in the beginning of the string. - * Otherwise, this parameter will be ignored. - * - * @param {string} [parameters.suffixSize] If maskingFunction is set to Text, - * the number of characters to show unmasked at the end of the string. - * Otherwise, this parameter will be ignored. - * - * @param {string} [parameters.replacementString] If maskingFunction is set to - * Text, the character to use for masking the unexposed part of the string. - * Otherwise, this parameter will be ignored. + * @param {string} databaseName The name of the database for which database + * Threat Detection policy is defined. * * @param {object} [options] Optional Parameters. * @@ -1524,14 +1344,14 @@ export interface DataMaskingRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, dataMaskingRuleName: string, parameters: models.DataMaskingRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a database data masking rule. + * Gets a database's threat detection policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1539,55 +1359,8 @@ export interface DataMaskingRules { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. - * - * @param {string} dataMaskingRuleName The name of the data masking rule. - * - * @param {object} parameters The required parameters for creating or updating - * a data masking rule. - * - * @param {string} [parameters.aliasName] The alias name. This is a legacy - * parameter and is no longer used. - * - * @param {string} [parameters.ruleState] The rule state. Used to delete a - * rule. To delete an existing rule, specify the schemaName, tableName, - * columnName, maskingFunction, and specify ruleState as disabled. However, if - * the rule doesn't already exist, the rule will be created with ruleState set - * to enabled, regardless of the provided value of ruleState. Possible values - * include: 'Disabled', 'Enabled' - * - * @param {string} parameters.schemaName The schema name on which the data - * masking rule is applied. - * - * @param {string} parameters.tableName The table name on which the data - * masking rule is applied. - * - * @param {string} parameters.columnName The column name on which the data - * masking rule is applied. - * - * @param {string} parameters.maskingFunction The masking function that is used - * for the data masking rule. Possible values include: 'Default', 'CCN', - * 'Email', 'Number', 'SSN', 'Text' - * - * @param {string} [parameters.numberFrom] The numberFrom property of the - * masking rule. Required if maskingFunction is set to Number, otherwise this - * parameter will be ignored. - * - * @param {string} [parameters.numberTo] The numberTo property of the data - * masking rule. Required if maskingFunction is set to Number, otherwise this - * parameter will be ignored. - * - * @param {string} [parameters.prefixSize] If maskingFunction is set to Text, - * the number of characters to show unmasked in the beginning of the string. - * Otherwise, this parameter will be ignored. - * - * @param {string} [parameters.suffixSize] If maskingFunction is set to Text, - * the number of characters to show unmasked at the end of the string. - * Otherwise, this parameter will be ignored. - * - * @param {string} [parameters.replacementString] If maskingFunction is set to - * Text, the character to use for masking the unexposed part of the string. - * Otherwise, this parameter will be ignored. + * @param {string} databaseName The name of the database for which database + * Threat Detection policy is defined. * * @param {object} [options] Optional Parameters. * @@ -1601,7 +1374,7 @@ export interface DataMaskingRules { * * {Promise} A promise is returned. * - * @resolve {DataMaskingRule} - The deserialized result object. + * @resolve {DatabaseSecurityAlertPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1609,20 +1382,21 @@ export interface DataMaskingRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DataMaskingRule} [result] - The deserialized result object if an error did not occur. - * See {@link DataMaskingRule} for more information. + * {DatabaseSecurityAlertPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseSecurityAlertPolicy} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, dataMaskingRuleName: string, parameters: models.DataMaskingRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, dataMaskingRuleName: string, parameters: models.DataMaskingRule, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, dataMaskingRuleName: string, parameters: models.DataMaskingRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of database data masking rules. + * Creates or updates a database's threat detection policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1630,7 +1404,44 @@ export interface DataMaskingRules { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} databaseName The name of the database for which database + * Threat Detection policy is defined. + * + * @param {object} parameters The database Threat Detection policy. + * + * @param {string} [parameters.location] The geo-location where the resource + * lives + * + * @param {string} parameters.state Specifies the state of the policy. If state + * is Enabled, storageEndpoint and storageAccountAccessKey are required. + * Possible values include: 'New', 'Enabled', 'Disabled' + * + * @param {string} [parameters.disabledAlerts] Specifies the + * semicolon-separated list of alerts that are disabled, or empty string to + * disable no alerts. Possible values: Sql_Injection; + * Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + * + * @param {string} [parameters.emailAddresses] Specifies the + * semicolon-separated list of e-mail addresses to which the alert is sent. + * + * @param {string} [parameters.emailAccountAdmins] Specifies that the alert is + * sent to the account administrators. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {string} [parameters.storageEndpoint] Specifies the blob storage + * endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage + * will hold all Threat Detection audit logs. If state is Enabled, + * storageEndpoint is required. + * + * @param {string} [parameters.storageAccountAccessKey] Specifies the + * identifier key of the Threat Detection audit storage account. If state is + * Enabled, storageAccountAccessKey is required. + * + * @param {number} [parameters.retentionDays] Specifies the number of days to + * keep in the Threat Detection audit logs. + * + * @param {string} [parameters.useServerDefault] Specifies whether to use the + * default server policy. Possible values include: 'Enabled', 'Disabled' * * @param {object} [options] Optional Parameters. * @@ -1639,14 +1450,14 @@ export interface DataMaskingRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseSecurityAlertPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of database data masking rules. + * Creates or updates a database's threat detection policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1654,7 +1465,44 @@ export interface DataMaskingRules { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} databaseName The name of the database for which database + * Threat Detection policy is defined. + * + * @param {object} parameters The database Threat Detection policy. + * + * @param {string} [parameters.location] The geo-location where the resource + * lives + * + * @param {string} parameters.state Specifies the state of the policy. If state + * is Enabled, storageEndpoint and storageAccountAccessKey are required. + * Possible values include: 'New', 'Enabled', 'Disabled' + * + * @param {string} [parameters.disabledAlerts] Specifies the + * semicolon-separated list of alerts that are disabled, or empty string to + * disable no alerts. Possible values: Sql_Injection; + * Sql_Injection_Vulnerability; Access_Anomaly; Usage_Anomaly. + * + * @param {string} [parameters.emailAddresses] Specifies the + * semicolon-separated list of e-mail addresses to which the alert is sent. + * + * @param {string} [parameters.emailAccountAdmins] Specifies that the alert is + * sent to the account administrators. Possible values include: 'Enabled', + * 'Disabled' + * + * @param {string} [parameters.storageEndpoint] Specifies the blob storage + * endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage + * will hold all Threat Detection audit logs. If state is Enabled, + * storageEndpoint is required. + * + * @param {string} [parameters.storageAccountAccessKey] Specifies the + * identifier key of the Threat Detection audit storage account. If state is + * Enabled, storageAccountAccessKey is required. + * + * @param {number} [parameters.retentionDays] Specifies the number of days to + * keep in the Threat Detection audit logs. + * + * @param {string} [parameters.useServerDefault] Specifies whether to use the + * default server policy. Possible values include: 'Enabled', 'Disabled' * * @param {object} [options] Optional Parameters. * @@ -1668,7 +1516,7 @@ export interface DataMaskingRules { * * {Promise} A promise is returned. * - * @resolve {DataMaskingRuleListResult} - The deserialized result object. + * @resolve {DatabaseSecurityAlertPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1676,30 +1524,30 @@ export interface DataMaskingRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DataMaskingRuleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DataMaskingRuleListResult} for more + * {DatabaseSecurityAlertPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseSecurityAlertPolicy} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseSecurityAlertPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseSecurityAlertPolicy, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseSecurityAlertPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * FirewallRules + * DataMaskingPolicies * __NOTE__: An instance of this class is automatically created for an * instance of the SqlManagementClient. */ -export interface FirewallRules { +export interface DataMaskingPolicies { /** - * Creates or updates a firewall rule. + * Creates or updates a database data masking policy * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1707,18 +1555,18 @@ export interface FirewallRules { * * @param {string} serverName The name of the server. * - * @param {string} firewallRuleName The name of the firewall rule. + * @param {string} databaseName The name of the database. * - * @param {object} parameters The required parameters for creating or updating - * a firewall rule. + * @param {object} parameters Parameters for creating or updating a data + * masking policy. * - * @param {string} parameters.startIpAddress The start IP address of the - * firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all - * Azure-internal IP addresses. + * @param {string} parameters.dataMaskingState The state of the data masking + * policy. Possible values include: 'Disabled', 'Enabled' * - * @param {string} parameters.endIpAddress The end IP address of the firewall - * rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. - * Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * @param {string} [parameters.exemptPrincipals] The list of the exempt + * principals. Specifies the semicolon-separated list of database users for + * which the data masking policy does not apply. The specified users receive + * data results without masking for all of the database queries. * * @param {object} [options] Optional Parameters. * @@ -1727,14 +1575,14 @@ export interface FirewallRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: models.FirewallRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DataMaskingPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a firewall rule. + * Creates or updates a database data masking policy * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1742,18 +1590,18 @@ export interface FirewallRules { * * @param {string} serverName The name of the server. * - * @param {string} firewallRuleName The name of the firewall rule. + * @param {string} databaseName The name of the database. * - * @param {object} parameters The required parameters for creating or updating - * a firewall rule. + * @param {object} parameters Parameters for creating or updating a data + * masking policy. * - * @param {string} parameters.startIpAddress The start IP address of the - * firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all - * Azure-internal IP addresses. + * @param {string} parameters.dataMaskingState The state of the data masking + * policy. Possible values include: 'Disabled', 'Enabled' * - * @param {string} parameters.endIpAddress The end IP address of the firewall - * rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. - * Use value '0.0.0.0' to represent all Azure-internal IP addresses. + * @param {string} [parameters.exemptPrincipals] The list of the exempt + * principals. Specifies the semicolon-separated list of database users for + * which the data masking policy does not apply. The specified users receive + * data results without masking for all of the database queries. * * @param {object} [options] Optional Parameters. * @@ -1767,7 +1615,7 @@ export interface FirewallRules { * * {Promise} A promise is returned. * - * @resolve {FirewallRule} - The deserialized result object. + * @resolve {DataMaskingPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1775,20 +1623,20 @@ export interface FirewallRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FirewallRule} [result] - The deserialized result object if an error did not occur. - * See {@link FirewallRule} for more information. + * {DataMaskingPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link DataMaskingPolicy} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: models.FirewallRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: models.FirewallRule, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: models.FirewallRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DataMaskingPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DataMaskingPolicy, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DataMaskingPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a firewall rule. + * Gets a database data masking policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1796,7 +1644,7 @@ export interface FirewallRules { * * @param {string} serverName The name of the server. * - * @param {string} firewallRuleName The name of the firewall rule. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -1805,14 +1653,14 @@ export interface FirewallRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a firewall rule. + * Gets a database data masking policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1820,7 +1668,7 @@ export interface FirewallRules { * * @param {string} serverName The name of the server. * - * @param {string} firewallRuleName The name of the firewall rule. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -1834,7 +1682,7 @@ export interface FirewallRules { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {DataMaskingPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1842,19 +1690,29 @@ export interface FirewallRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {DataMaskingPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link DataMaskingPolicy} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, firewallRuleName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, firewallRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DataMaskingRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface DataMaskingRules { /** - * Gets a firewall rule. + * Creates or updates a database data masking rule. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1862,7 +1720,55 @@ export interface FirewallRules { * * @param {string} serverName The name of the server. * - * @param {string} firewallRuleName The name of the firewall rule. + * @param {string} databaseName The name of the database. + * + * @param {string} dataMaskingRuleName The name of the data masking rule. + * + * @param {object} parameters The required parameters for creating or updating + * a data masking rule. + * + * @param {string} [parameters.aliasName] The alias name. This is a legacy + * parameter and is no longer used. + * + * @param {string} [parameters.ruleState] The rule state. Used to delete a + * rule. To delete an existing rule, specify the schemaName, tableName, + * columnName, maskingFunction, and specify ruleState as disabled. However, if + * the rule doesn't already exist, the rule will be created with ruleState set + * to enabled, regardless of the provided value of ruleState. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} parameters.schemaName The schema name on which the data + * masking rule is applied. + * + * @param {string} parameters.tableName The table name on which the data + * masking rule is applied. + * + * @param {string} parameters.columnName The column name on which the data + * masking rule is applied. + * + * @param {string} parameters.maskingFunction The masking function that is used + * for the data masking rule. Possible values include: 'Default', 'CCN', + * 'Email', 'Number', 'SSN', 'Text' + * + * @param {string} [parameters.numberFrom] The numberFrom property of the + * masking rule. Required if maskingFunction is set to Number, otherwise this + * parameter will be ignored. + * + * @param {string} [parameters.numberTo] The numberTo property of the data + * masking rule. Required if maskingFunction is set to Number, otherwise this + * parameter will be ignored. + * + * @param {string} [parameters.prefixSize] If maskingFunction is set to Text, + * the number of characters to show unmasked in the beginning of the string. + * Otherwise, this parameter will be ignored. + * + * @param {string} [parameters.suffixSize] If maskingFunction is set to Text, + * the number of characters to show unmasked at the end of the string. + * Otherwise, this parameter will be ignored. + * + * @param {string} [parameters.replacementString] If maskingFunction is set to + * Text, the character to use for masking the unexposed part of the string. + * Otherwise, this parameter will be ignored. * * @param {object} [options] Optional Parameters. * @@ -1871,14 +1777,14 @@ export interface FirewallRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, dataMaskingRuleName: string, parameters: models.DataMaskingRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a firewall rule. + * Creates or updates a database data masking rule. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1886,7 +1792,55 @@ export interface FirewallRules { * * @param {string} serverName The name of the server. * - * @param {string} firewallRuleName The name of the firewall rule. + * @param {string} databaseName The name of the database. + * + * @param {string} dataMaskingRuleName The name of the data masking rule. + * + * @param {object} parameters The required parameters for creating or updating + * a data masking rule. + * + * @param {string} [parameters.aliasName] The alias name. This is a legacy + * parameter and is no longer used. + * + * @param {string} [parameters.ruleState] The rule state. Used to delete a + * rule. To delete an existing rule, specify the schemaName, tableName, + * columnName, maskingFunction, and specify ruleState as disabled. However, if + * the rule doesn't already exist, the rule will be created with ruleState set + * to enabled, regardless of the provided value of ruleState. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} parameters.schemaName The schema name on which the data + * masking rule is applied. + * + * @param {string} parameters.tableName The table name on which the data + * masking rule is applied. + * + * @param {string} parameters.columnName The column name on which the data + * masking rule is applied. + * + * @param {string} parameters.maskingFunction The masking function that is used + * for the data masking rule. Possible values include: 'Default', 'CCN', + * 'Email', 'Number', 'SSN', 'Text' + * + * @param {string} [parameters.numberFrom] The numberFrom property of the + * masking rule. Required if maskingFunction is set to Number, otherwise this + * parameter will be ignored. + * + * @param {string} [parameters.numberTo] The numberTo property of the data + * masking rule. Required if maskingFunction is set to Number, otherwise this + * parameter will be ignored. + * + * @param {string} [parameters.prefixSize] If maskingFunction is set to Text, + * the number of characters to show unmasked in the beginning of the string. + * Otherwise, this parameter will be ignored. + * + * @param {string} [parameters.suffixSize] If maskingFunction is set to Text, + * the number of characters to show unmasked at the end of the string. + * Otherwise, this parameter will be ignored. + * + * @param {string} [parameters.replacementString] If maskingFunction is set to + * Text, the character to use for masking the unexposed part of the string. + * Otherwise, this parameter will be ignored. * * @param {object} [options] Optional Parameters. * @@ -1900,7 +1854,7 @@ export interface FirewallRules { * * {Promise} A promise is returned. * - * @resolve {FirewallRule} - The deserialized result object. + * @resolve {DataMaskingRule} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1908,20 +1862,20 @@ export interface FirewallRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FirewallRule} [result] - The deserialized result object if an error did not occur. - * See {@link FirewallRule} for more information. + * {DataMaskingRule} [result] - The deserialized result object if an error did not occur. + * See {@link DataMaskingRule} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, firewallRuleName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, firewallRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, dataMaskingRuleName: string, parameters: models.DataMaskingRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, dataMaskingRuleName: string, parameters: models.DataMaskingRule, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, dataMaskingRuleName: string, parameters: models.DataMaskingRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns a list of firewall rules. + * Gets a list of database data masking rules. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1929,6 +1883,8 @@ export interface FirewallRules { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1936,14 +1892,14 @@ export interface FirewallRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns a list of firewall rules. + * Gets a list of database data masking rules. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -1951,6 +1907,8 @@ export interface FirewallRules { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1963,7 +1921,7 @@ export interface FirewallRules { * * {Promise} A promise is returned. * - * @resolve {FirewallRuleListResult} - The deserialized result object. + * @resolve {DataMaskingRuleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -1971,30 +1929,30 @@ export interface FirewallRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FirewallRuleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link FirewallRuleListResult} for more + * {DataMaskingRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DataMaskingRuleListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * GeoBackupPolicies + * FirewallRules * __NOTE__: An instance of this class is automatically created for an * instance of the SqlManagementClient. */ -export interface GeoBackupPolicies { +export interface FirewallRules { /** - * Updates a database geo backup policy. + * Creates or updates a firewall rule. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2002,13 +1960,18 @@ export interface GeoBackupPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} firewallRuleName The name of the firewall rule. * * @param {object} parameters The required parameters for creating or updating - * the geo backup policy. + * a firewall rule. * - * @param {string} parameters.state The state of the geo backup policy. - * Possible values include: 'Disabled', 'Enabled' + * @param {string} parameters.startIpAddress The start IP address of the + * firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all + * Azure-internal IP addresses. + * + * @param {string} parameters.endIpAddress The end IP address of the firewall + * rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. + * Use value '0.0.0.0' to represent all Azure-internal IP addresses. * * @param {object} [options] Optional Parameters. * @@ -2017,14 +1980,14 @@ export interface GeoBackupPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.GeoBackupPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: models.FirewallRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates a database geo backup policy. + * Creates or updates a firewall rule. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2032,13 +1995,18 @@ export interface GeoBackupPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} firewallRuleName The name of the firewall rule. * * @param {object} parameters The required parameters for creating or updating - * the geo backup policy. + * a firewall rule. * - * @param {string} parameters.state The state of the geo backup policy. - * Possible values include: 'Disabled', 'Enabled' + * @param {string} parameters.startIpAddress The start IP address of the + * firewall rule. Must be IPv4 format. Use value '0.0.0.0' to represent all + * Azure-internal IP addresses. + * + * @param {string} parameters.endIpAddress The end IP address of the firewall + * rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. + * Use value '0.0.0.0' to represent all Azure-internal IP addresses. * * @param {object} [options] Optional Parameters. * @@ -2052,7 +2020,7 @@ export interface GeoBackupPolicies { * * {Promise} A promise is returned. * - * @resolve {GeoBackupPolicy} - The deserialized result object. + * @resolve {FirewallRule} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2060,20 +2028,20 @@ export interface GeoBackupPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {GeoBackupPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link GeoBackupPolicy} for more information. + * {FirewallRule} [result] - The deserialized result object if an error did not occur. + * See {@link FirewallRule} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.GeoBackupPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.GeoBackupPolicy, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.GeoBackupPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: models.FirewallRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: models.FirewallRule, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, firewallRuleName: string, parameters: models.FirewallRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a geo backup policy. + * Deletes a firewall rule. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2081,7 +2049,7 @@ export interface GeoBackupPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} firewallRuleName The name of the firewall rule. * * @param {object} [options] Optional Parameters. * @@ -2090,14 +2058,14 @@ export interface GeoBackupPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a geo backup policy. + * Deletes a firewall rule. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2105,7 +2073,7 @@ export interface GeoBackupPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} firewallRuleName The name of the firewall rule. * * @param {object} [options] Optional Parameters. * @@ -2119,7 +2087,7 @@ export interface GeoBackupPolicies { * * {Promise} A promise is returned. * - * @resolve {GeoBackupPolicy} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2127,20 +2095,19 @@ export interface GeoBackupPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {GeoBackupPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link GeoBackupPolicy} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, firewallRuleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, firewallRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns a list of geo backup policies. + * Gets a firewall rule. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2148,7 +2115,7 @@ export interface GeoBackupPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} firewallRuleName The name of the firewall rule. * * @param {object} [options] Optional Parameters. * @@ -2157,14 +2124,14 @@ export interface GeoBackupPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns a list of geo backup policies. + * Gets a firewall rule. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2172,7 +2139,7 @@ export interface GeoBackupPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} firewallRuleName The name of the firewall rule. * * @param {object} [options] Optional Parameters. * @@ -2186,7 +2153,7 @@ export interface GeoBackupPolicies { * * {Promise} A promise is returned. * - * @resolve {GeoBackupPolicyListResult} - The deserialized result object. + * @resolve {FirewallRule} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2194,30 +2161,20 @@ export interface GeoBackupPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {GeoBackupPolicyListResult} [result] - The deserialized result object if an error did not occur. - * See {@link GeoBackupPolicyListResult} for more - * information. + * {FirewallRule} [result] - The deserialized result object if an error did not occur. + * See {@link FirewallRule} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * Databases - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface Databases { + get(resourceGroupName: string, serverName: string, firewallRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, firewallRuleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, firewallRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Imports a bacpac into a new database. + * Returns a list of firewall rules. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2225,40 +2182,6 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. - * - * @param {string} parameters.databaseName The name of the database to import. - * - * @param {string} parameters.edition The edition for the database being - * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} parameters.serviceObjectiveName The name of the service - * objective to assign to the database. Possible values include: 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' - * - * @param {string} parameters.maxSizeBytes The maximum size for the newly - * imported database. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2266,14 +2189,14 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - importMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Imports a bacpac into a new database. + * Returns a list of firewall rules. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2281,40 +2204,6 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. - * - * @param {string} parameters.databaseName The name of the database to import. - * - * @param {string} parameters.edition The edition for the database being - * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} parameters.serviceObjectiveName The name of the service - * objective to assign to the database. Possible values include: 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' - * - * @param {string} parameters.maxSizeBytes The maximum size for the newly - * imported database. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2327,7 +2216,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {ImportExportResponse} - The deserialized result object. + * @resolve {FirewallRuleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2335,21 +2224,30 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * {FirewallRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link FirewallRuleListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - importMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - importMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, callback: ServiceCallback): void; - importMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * GeoBackupPolicies + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface GeoBackupPolicies { /** - * Creates an import operation that imports a bacpac into an existing database. - * The existing database must be empty. + * Updates a database geo backup policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2357,31 +2255,13 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to import into - * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. - * - * @param {string} [parameters.name] The name of the extension. - * - * @param {string} [parameters.type] The type of the extension. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @param {string} databaseName The name of the database. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {object} parameters The required parameters for creating or updating + * the geo backup policy. * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} parameters.state The state of the geo backup policy. + * Possible values include: 'Disabled', 'Enabled' * * @param {object} [options] Optional Parameters. * @@ -2390,15 +2270,14 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createImportOperationWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.GeoBackupPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates an import operation that imports a bacpac into an existing database. - * The existing database must be empty. + * Updates a database geo backup policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2406,31 +2285,13 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to import into - * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. - * - * @param {string} [parameters.name] The name of the extension. - * - * @param {string} [parameters.type] The type of the extension. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @param {string} databaseName The name of the database. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {object} parameters The required parameters for creating or updating + * the geo backup policy. * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} parameters.state The state of the geo backup policy. + * Possible values include: 'Disabled', 'Enabled' * * @param {object} [options] Optional Parameters. * @@ -2444,7 +2305,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {ImportExportResponse} - The deserialized result object. + * @resolve {GeoBackupPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2452,20 +2313,20 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * {GeoBackupPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link GeoBackupPolicy} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, callback: ServiceCallback): void; - createImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.GeoBackupPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.GeoBackupPolicy, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.GeoBackupPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Exports a database to a bacpac. + * Gets a geo backup policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2473,26 +2334,7 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be exported. - * - * @param {object} parameters The required parameters for exporting a database. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -2501,14 +2343,14 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - exportMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Exports a database to a bacpac. + * Gets a geo backup policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2516,26 +2358,7 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be exported. - * - * @param {object} parameters The required parameters for exporting a database. - * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' - * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." - * - * @param {string} parameters.storageUri The storage uri to use. - * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. - * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. - * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -2549,7 +2372,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {ImportExportResponse} - The deserialized result object. + * @resolve {GeoBackupPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2557,20 +2380,20 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * {GeoBackupPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link GeoBackupPolicy} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - exportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - exportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, callback: ServiceCallback): void; - exportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns database metrics. + * Returns a list of geo backup policies. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2580,9 +2403,6 @@ export interface Databases { * * @param {string} databaseName The name of the database. * - * @param {string} filter An OData filter expression that describes a subset of - * metrics to return. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2590,14 +2410,14 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listMetricsWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns database metrics. + * Returns a list of geo backup policies. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2607,9 +2427,6 @@ export interface Databases { * * @param {string} databaseName The name of the database. * - * @param {string} filter An OData filter expression that describes a subset of - * metrics to return. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2622,7 +2439,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {MetricListResult} - The deserialized result object. + * @resolve {GeoBackupPolicyListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2630,20 +2447,30 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {MetricListResult} [result] - The deserialized result object if an error did not occur. - * See {@link MetricListResult} for more information. + * {GeoBackupPolicyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link GeoBackupPolicyListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listMetrics(resourceGroupName: string, serverName: string, databaseName: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listMetrics(resourceGroupName: string, serverName: string, databaseName: string, filter: string, callback: ServiceCallback): void; - listMetrics(resourceGroupName: string, serverName: string, databaseName: string, filter: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Databases + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface Databases { /** - * Returns database metric definitions. + * Imports a bacpac into a new database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2651,7 +2478,47 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} parameters.databaseName The name of the database to import. + * + * @param {string} parameters.edition The edition for the database being + * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' + * + * @param {string} parameters.serviceObjectiveName The name of the service + * objective to assign to the database. Possible values include: 'System', + * 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', + * 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', + * 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', + * 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', + * 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', + * 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', + * 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', + * 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', + * 'ElasticPool' + * + * @param {string} parameters.maxSizeBytes The maximum size for the newly + * imported database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * * @param {object} [options] Optional Parameters. * @@ -2660,14 +2527,14 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listMetricDefinitionsWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + importMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns database metric definitions. + * Imports a bacpac into a new database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2675,7 +2542,47 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} parameters.databaseName The name of the database to import. + * + * @param {string} parameters.edition The edition for the database being + * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' + * + * @param {string} parameters.serviceObjectiveName The name of the service + * objective to assign to the database. Possible values include: 'System', + * 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', + * 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', + * 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', + * 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', + * 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', + * 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', + * 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', + * 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', + * 'ElasticPool' + * + * @param {string} parameters.maxSizeBytes The maximum size for the newly + * imported database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * * @param {object} [options] Optional Parameters. * @@ -2689,7 +2596,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {MetricDefinitionListResult} - The deserialized result object. + * @resolve {ImportExportResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2697,21 +2604,21 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {MetricDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link MetricDefinitionListResult} for more - * information. + * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ImportExportResponse} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listMetricDefinitions(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listMetricDefinitions(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - listMetricDefinitions(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + importMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + importMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, callback: ServiceCallback): void; + importMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Pauses a data warehouse. + * Creates an import operation that imports a bacpac into an existing database. + * The existing database must be empty. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2719,7 +2626,31 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to pause. + * @param {string} databaseName The name of the database to import into + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} [parameters.name] The name of the extension. + * + * @param {string} [parameters.type] The type of the extension. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * * @param {object} [options] Optional Parameters. * @@ -2728,14 +2659,15 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - pauseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createImportOperationWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Pauses a data warehouse. + * Creates an import operation that imports a bacpac into an existing database. + * The existing database must be empty. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2743,7 +2675,31 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to pause. + * @param {string} databaseName The name of the database to import into + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} [parameters.name] The name of the extension. + * + * @param {string} [parameters.type] The type of the extension. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * * @param {object} [options] Optional Parameters. * @@ -2757,7 +2713,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ImportExportResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2765,19 +2721,20 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ImportExportResponse} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - pause(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - pause(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - pause(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, callback: ServiceCallback): void; + createImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Resumes a data warehouse. + * Exports a database to a bacpac. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2785,23 +2742,42 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to resume. + * @param {string} databaseName The name of the database to be exported. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters The required parameters for exporting a database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - resumeWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + exportMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Resumes a data warehouse. + * Exports a database to a bacpac. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2809,7 +2785,26 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to resume. + * @param {string} databaseName The name of the database to be exported. + * + * @param {object} parameters The required parameters for exporting a database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' * * @param {object} [options] Optional Parameters. * @@ -2823,7 +2818,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ImportExportResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -2831,19 +2826,20 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ImportExportResponse} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - resume(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - resume(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - resume(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + exportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + exportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, callback: ServiceCallback): void; + exportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new database or updates an existing database. + * Returns database metrics. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2851,130 +2847,10 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be operated on - * (updated or created). - * - * @param {object} parameters The required parameters for creating or updating - * a database. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' - * - * @param {object} [parameters.tags] Resource tags. + * @param {string} databaseName The name of the database. * - * @param {string} parameters.location Resource location. + * @param {string} filter An OData filter expression that describes a subset of + * metrics to return. * * @param {object} [options] Optional Parameters. * @@ -2983,14 +2859,14 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listMetricsWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new database or updates an existing database. + * Returns database metrics. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -2998,130 +2874,10 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be operated on - * (updated or created). - * - * @param {object} parameters The required parameters for creating or updating - * a database. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' - * - * @param {object} [parameters.tags] Resource tags. + * @param {string} databaseName The name of the database. * - * @param {string} parameters.location Resource location. + * @param {string} filter An OData filter expression that describes a subset of + * metrics to return. * * @param {object} [options] Optional Parameters. * @@ -3135,7 +2891,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {Database} - The deserialized result object. + * @resolve {MetricListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3143,20 +2899,20 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Database} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * {MetricListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MetricListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listMetrics(resourceGroupName: string, serverName: string, databaseName: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listMetrics(resourceGroupName: string, serverName: string, databaseName: string, filter: string, callback: ServiceCallback): void; + listMetrics(resourceGroupName: string, serverName: string, databaseName: string, filter: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing database. + * Returns database metric definitions. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3164,126 +2920,7 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be updated. - * - * @param {object} parameters The required parameters for updating a database. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -3292,14 +2929,14 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listMetricDefinitionsWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates an existing database. + * Returns database metric definitions. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3307,126 +2944,7 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be updated. - * - * @param {object} parameters The required parameters for updating a database. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.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. - * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) 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, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. - * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -3440,7 +2958,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {Database} - The deserialized result object. + * @resolve {MetricDefinitionListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3448,20 +2966,21 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Database} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * {MetricDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MetricDefinitionListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, callback: ServiceCallback): void; - update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listMetricDefinitions(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listMetricDefinitions(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listMetricDefinitions(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a database. + * Upgrades a data warehouse. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3469,7 +2988,7 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be deleted. + * @param {string} databaseName The name of the database to be upgraded. * * @param {object} [options] Optional Parameters. * @@ -3482,10 +3001,10 @@ export interface Databases { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + upgradeDataWarehouseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a database. + * Upgrades a data warehouse. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3493,7 +3012,7 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be deleted. + * @param {string} databaseName The name of the database to be upgraded. * * @param {object} [options] Optional Parameters. * @@ -3521,13 +3040,13 @@ export interface Databases { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + upgradeDataWarehouse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + upgradeDataWarehouse(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + upgradeDataWarehouse(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a database. + * Gets a list of databases. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3535,27 +3054,21 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be retrieved. - * * @param {object} [options] Optional Parameters. * - * @param {string} [options.expand] A comma separated list of child objects to - * expand in the response. Possible properties: serviceTierAdvisors, - * transparentDataEncryption. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a database. + * Gets a list of databases. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3563,14 +3076,8 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be retrieved. - * * @param {object} [options] Optional Parameters. * - * @param {string} [options.expand] A comma separated list of child objects to - * expand in the response. Possible properties: serviceTierAdvisors, - * transparentDataEncryption. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -3581,7 +3088,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {Database} - The deserialized result object. + * @resolve {DatabaseListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3589,20 +3096,20 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Database} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * {DatabaseListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns a list of databases in a server. + * Gets a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3610,28 +3117,23 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.expand] A comma separated list of child objects to - * expand in the response. Possible properties: serviceTierAdvisors, - * transparentDataEncryption. + * @param {string} databaseName The name of the database. * - * @param {string} [options.filter] An OData filter expression that describes a - * subset of databases to return. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { expand? : string, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns a list of databases in a server. + * Gets a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3639,14 +3141,9 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {object} [options] Optional Parameters. - * - * @param {string} [options.expand] A comma separated list of child objects to - * expand in the response. Possible properties: serviceTierAdvisors, - * transparentDataEncryption. + * @param {string} databaseName The name of the database. * - * @param {string} [options.filter] An OData filter expression that describes a - * subset of databases to return. + * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -3658,7 +3155,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {DatabaseListResult} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3666,20 +3163,20 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DatabaseListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseListResult} for more information. + * {Database} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { expand? : string, filter? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { expand? : string, filter? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a database inside of an elastic pool. + * Creates a new database or updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3687,81 +3184,119 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} databaseName The name of the database. * - * @param {string} databaseName The name of the database to be retrieved. + * @param {object} parameters The requested database resource state. * - * @param {object} [options] Optional Parameters. + * @param {object} [parameters.sku] The name and tier of the SKU. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * @returns {Promise} A promise is returned + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @reject {Error|ServiceError} - The error object. - */ - getByElasticPoolWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets a database inside of an elastic pool. + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {string} 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. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {string} serverName The name of the server. + * @param {string} [parameters.createMode] Specifies the mode of database + * creation. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * Default: regular database creation. * - * @param {string} databaseName The name of the database to be retrieved. + * Copy: creates a database as a copy of an existing database. sourceDatabaseId + * must be specified as the resource ID of the source database. * - * @param {object} [options] Optional Parameters. + * 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. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * 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. * - * @param {ServiceCallback} [optionalCallback] - The optional callback. + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource ID + * to restore. * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. + * 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. * - * {Promise} A promise is returned. + * RestoreLongTermRetentionBackup: Creates a database by restoring from a long + * term retention vault. recoveryServicesRecoveryPointResourceId must be + * specified as the recovery point resource ID. * - * @resolve {Database} - The deserialized result object. + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for + * DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' * - * @reject {Error|ServiceError} - The error object. + * @param {string} [parameters.collation] The collation of the database. * - * {ServiceCallback} optionalCallback(err, result, request, response) + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' * - * {Database} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. * - * {WebResource} [request] - The HTTP Request object if an error did not occur. + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - getByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, databaseName: string, callback: ServiceCallback): void; - getByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Returns a list of databases in an elastic pool. + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. * - * @param {string} 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. + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. * - * @param {string} serverName The name of the server. + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -3770,14 +3305,14 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByElasticPoolWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns a list of databases in an elastic pool. + * Creates a new database or updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3785,81 +3320,119 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} databaseName The name of the database. * - * @param {object} [options] Optional Parameters. + * @param {object} parameters The requested database resource state. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {object} [parameters.sku] The name and tier of the SKU. * - * @param {ServiceCallback} [optionalCallback] - The optional callback. + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * {Promise} A promise is returned. + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @resolve {DatabaseListResult} - The deserialized result object. + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @reject {Error|ServiceError} - The error object. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * {ServiceCallback} optionalCallback(err, result, request, response) + * @param {string} [parameters.createMode] Specifies the mode of database + * creation. * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * Default: regular database creation. * - * {DatabaseListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseListResult} for more information. + * Copy: creates a database as a copy of an existing database. sourceDatabaseId + * must be specified as the resource ID of the source database. * - * {WebResource} [request] - The HTTP Request object if an error did not occur. + * 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. * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; - listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Gets a database inside of a recommented elastic pool. + * 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. * - * @param {string} 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. + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource ID + * to restore. * - * @param {string} serverName The name of the server. + * 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. * - * @param {string} recommendedElasticPoolName The name of the elastic pool to - * be retrieved. + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for + * DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} [parameters.collation] The collation of the database. * - * @param {object} [options] Optional Parameters. + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' * - * @returns {Promise} A promise is returned + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. * - * @reject {Error|ServiceError} - The error object. - */ - getByRecommendedElasticPoolWithHttpOperationResponse(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Gets a database inside of a recommented elastic pool. + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. * - * @param {string} 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. + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. * - * @param {string} serverName The name of the server. + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. * - * @param {string} recommendedElasticPoolName The name of the elastic pool to - * be retrieved. + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. * - * @param {string} databaseName The name of the database to be retrieved. + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -3888,13 +3461,13 @@ export interface Databases { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - getByRecommendedElasticPool(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - getByRecommendedElasticPool(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, databaseName: string, callback: ServiceCallback): void; - getByRecommendedElasticPool(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns a list of databases inside a recommented elastic pool. + * Deletes the database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3902,8 +3475,7 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} recommendedElasticPoolName The name of the recommended - * elastic pool to be retrieved. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -3912,14 +3484,14 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByRecommendedElasticPoolWithHttpOperationResponse(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns a list of databases inside a recommented elastic pool. + * Deletes the database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3927,8 +3499,7 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} recommendedElasticPoolName The name of the recommended - * elastic pool to be retrieved. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -3942,7 +3513,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {DatabaseListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -3950,20 +3521,19 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DatabaseListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByRecommendedElasticPool(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByRecommendedElasticPool(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, callback: ServiceCallback): void; - listByRecommendedElasticPool(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Imports a bacpac into a new database. + * Updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -3971,131 +3541,133 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. - * - * @param {string} parameters.databaseName The name of the database to import. + * @param {string} databaseName The name of the database. * - * @param {string} parameters.edition The edition for the database being - * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' + * @param {object} parameters The requested database resource state. * - * @param {string} parameters.serviceObjectiveName The name of the service - * objective to assign to the database. Possible values include: 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' + * @param {object} [parameters.sku] The name and tier of the SKU. * - * @param {string} parameters.maxSizeBytes The maximum size for the newly - * imported database. + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @param {string} parameters.storageUri The storage uri to use. + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {string} [parameters.createMode] Specifies the mode of database + * creation. * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * Default: regular database creation. * - * @param {object} [options] Optional Parameters. + * Copy: creates a database as a copy of an existing database. sourceDatabaseId + * must be specified as the resource ID of the source database. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * 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. * - * @returns {Promise} A promise is returned + * 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. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource ID + * to restore. * - * @reject {Error|ServiceError} - The error object. - */ - beginImportMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Imports a bacpac into a new database. + * 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. * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. + * RestoreLongTermRetentionBackup: Creates a database by restoring from a long + * term retention vault. recoveryServicesRecoveryPointResourceId must be + * specified as the recovery point resource ID. * - * @param {string} parameters.databaseName The name of the database to import. + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for + * DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' * - * @param {string} parameters.edition The edition for the database being - * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', - * 'Premium', 'Free', 'Stretch', 'DataWarehouse', 'System', 'System2' + * @param {string} [parameters.collation] The collation of the database. * - * @param {string} parameters.serviceObjectiveName The name of the service - * objective to assign to the database. Possible values include: 'Basic', 'S0', - * 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'System', - * 'System2', 'ElasticPool' + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. * - * @param {string} parameters.maxSizeBytes The maximum size for the newly - * imported database. + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. * - * @param {string} parameters.storageUri The storage uri to use. + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. * - * @param {object} [options] Optional Parameters. + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. * - * @param {ServiceCallback} [optionalCallback] - The optional callback. + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' * - * @returns {ServiceCallback|Promise} If a callback was passed as the last - * parameter then it returns the callback else returns a Promise. + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. * - * {Promise} A promise is returned. + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' * - * @resolve {ImportExportResponse} - The deserialized result object. + * @param {string} [parameters.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: 'Enabled', 'Disabled' * - * @reject {Error|ServiceError} - The error object. + * @param {object} [parameters.tags] Resource tags. * - * {ServiceCallback} optionalCallback(err, result, request, response) + * @param {object} [options] Optional Parameters. * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * @returns {Promise} A promise is returned * - * {WebResource} [request] - The HTTP Request object if an error did not occur. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + * @reject {Error|ServiceError} - The error object. */ - beginImportMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginImportMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, callback: ServiceCallback): void; - beginImportMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - + updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates an import operation that imports a bacpac into an existing database. - * The existing database must be empty. + * Updates an existing database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4103,80 +3675,117 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to import into + * @param {string} databaseName The name of the database. * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. + * @param {object} parameters The requested database resource state. * - * @param {string} [parameters.name] The name of the extension. + * @param {object} [parameters.sku] The name and tier of the SKU. * - * @param {string} [parameters.type] The type of the extension. + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @param {string} parameters.storageUri The storage uri to use. + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {string} [parameters.createMode] Specifies the mode of database + * creation. * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * Default: regular database creation. * - * @param {object} [options] Optional Parameters. + * Copy: creates a database as a copy of an existing database. sourceDatabaseId + * must be specified as the resource ID of the source database. * - * @param {object} [options.customHeaders] Headers that will be added to the - * request + * 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. * - * @returns {Promise} A promise is returned + * 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. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * Recovery: Creates a database by restoring a geo-replicated backup. + * sourceDatabaseId must be specified as the recoverable database resource ID + * to restore. * - * @reject {Error|ServiceError} - The error object. - */ - beginCreateImportOperationWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Creates an import operation that imports a bacpac into an existing database. - * The existing database must be empty. + * 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. * - * @param {string} 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. + * RestoreLongTermRetentionBackup: Creates a database by restoring from a long + * term retention vault. recoveryServicesRecoveryPointResourceId must be + * specified as the recovery point resource ID. * - * @param {string} serverName The name of the server. + * Copy, Secondary, and RestoreLongTermRetentionBackup are not supported for + * DataWarehouse edition. Possible values include: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' * - * @param {string} databaseName The name of the database to import into + * @param {string} [parameters.collation] The collation of the database. * - * @param {object} parameters The required parameters for importing a Bacpac - * into a database. + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. * - * @param {string} [parameters.name] The name of the extension. + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' * - * @param {string} [parameters.type] The type of the extension. + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. * - * @param {string} parameters.storageUri The storage uri to use. + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -4190,7 +3799,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {ImportExportResponse} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4198,20 +3807,20 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * {Database} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, callback: ServiceCallback): void; - beginCreateImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Exports a database to a bacpac. + * Gets a list of databases in an elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4219,42 +3828,66 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be exported. + * @param {string} elasticPoolName The name of the elastic pool. * - * @param {object} parameters The required parameters for exporting a database. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." + * @returns {Promise} A promise is returned * - * @param {string} parameters.storageUri The storage uri to use. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @reject {Error|ServiceError} - The error object. + */ + listByElasticPoolWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of databases in an elastic pool. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {string} 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. * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * - * @returns {Promise} A promise is returned + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @reject {Error|ServiceError} - The error object. + * {Promise} A promise is returned. + * + * @resolve {DatabaseListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {DatabaseListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginExportMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** - * Exports a database to a bacpac. + * Pauses a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4262,26 +3895,31 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be exported. + * @param {string} databaseName The name of the database to be paused. * - * @param {object} parameters The required parameters for exporting a database. + * @param {object} [options] Optional Parameters. * - * @param {string} parameters.storageKeyType The type of the storage key to - * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} parameters.storageKey The storage key to use. If storage - * key type is SharedAccessKey, it must be preceded with a "?." + * @returns {Promise} A promise is returned * - * @param {string} parameters.storageUri The storage uri to use. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} parameters.administratorLogin The name of the SQL - * administrator. + * @reject {Error|ServiceError} - The error object. + */ + pauseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Pauses a database. * - * @param {string} parameters.administratorLoginPassword The password of the - * SQL administrator. + * @param {string} 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. * - * @param {string} [parameters.authenticationType] The authentication type. - * Possible values include: 'SQL', 'ADPassword' + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be paused. * * @param {object} [options] Optional Parameters. * @@ -4295,7 +3933,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {ImportExportResponse} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4303,20 +3941,20 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. - * See {@link ImportExportResponse} for more information. + * {Database} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginExportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginExportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, callback: ServiceCallback): void; - beginExportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + pause(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + pause(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + pause(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Pauses a data warehouse. + * Resumes a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4324,7 +3962,7 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to pause. + * @param {string} databaseName The name of the database to be resumed. * * @param {object} [options] Optional Parameters. * @@ -4333,14 +3971,14 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginPauseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + resumeWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Pauses a data warehouse. + * Resumes a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4348,7 +3986,7 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to pause. + * @param {string} databaseName The name of the database to be resumed. * * @param {object} [options] Optional Parameters. * @@ -4362,7 +4000,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {Database} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4370,19 +4008,20 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {Database} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginPause(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginPause(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - beginPause(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + resume(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + resume(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + resume(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Resumes a data warehouse. + * Renames a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4390,7 +4029,12 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to resume. + * @param {string} databaseName The name of the database to rename. + * + * @param {object} parameters The resource move definition for renaming this + * database. + * + * @param {string} parameters.id The target ID for the resource * * @param {object} [options] Optional Parameters. * @@ -4403,10 +4047,10 @@ export interface Databases { * * @reject {Error|ServiceError} - The error object. */ - beginResumeWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + renameWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ResourceMoveDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Resumes a data warehouse. + * Renames a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4414,7 +4058,12 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the data warehouse to resume. + * @param {string} databaseName The name of the database to rename. + * + * @param {object} parameters The resource move definition for renaming this + * database. + * + * @param {string} parameters.id The target ID for the resource * * @param {object} [options] Optional Parameters. * @@ -4442,13 +4091,13 @@ export interface Databases { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginResume(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginResume(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - beginResume(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + rename(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ResourceMoveDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + rename(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ResourceMoveDefinition, callback: ServiceCallback): void; + rename(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ResourceMoveDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new database or updates an existing database. + * Imports a bacpac into a new database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -4456,130 +4105,6556 @@ export interface Databases { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to be operated on - * (updated or created). + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. * - * @param {object} parameters The required parameters for creating or updating - * a database. + * @param {string} parameters.databaseName The name of the database to import. + * + * @param {string} parameters.edition The edition for the database being + * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' + * + * @param {string} parameters.serviceObjectiveName The name of the service + * objective to assign to the database. Possible values include: 'System', + * 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', + * 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', + * 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', + * 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', + * 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', + * 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', + * 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', + * 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', + * 'ElasticPool' + * + * @param {string} parameters.maxSizeBytes The maximum size for the newly + * imported database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginImportMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Imports a bacpac into a new database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} parameters.databaseName The name of the database to import. + * + * @param {string} parameters.edition The edition for the database being + * created. Possible values include: 'Web', 'Business', 'Basic', 'Standard', + * 'Premium', 'PremiumRS', 'Free', 'Stretch', 'DataWarehouse', 'System', + * 'System2' + * + * @param {string} parameters.serviceObjectiveName The name of the service + * objective to assign to the database. Possible values include: 'System', + * 'System0', 'System1', 'System2', 'System3', 'System4', 'System2L', + * 'System3L', 'System4L', 'Free', 'Basic', 'S0', 'S1', 'S2', 'S3', 'S4', 'S6', + * 'S7', 'S9', 'S12', 'P1', 'P2', 'P3', 'P4', 'P6', 'P11', 'P15', 'PRS1', + * 'PRS2', 'PRS4', 'PRS6', 'DW100', 'DW200', 'DW300', 'DW400', 'DW500', + * 'DW600', 'DW1000', 'DW1200', 'DW1000c', 'DW1500', 'DW1500c', 'DW2000', + * 'DW2000c', 'DW3000', 'DW2500c', 'DW3000c', 'DW6000', 'DW5000c', 'DW6000c', + * 'DW7500c', 'DW10000c', 'DW15000c', 'DW30000c', 'DS100', 'DS200', 'DS300', + * 'DS400', 'DS500', 'DS600', 'DS1000', 'DS1200', 'DS1500', 'DS2000', + * 'ElasticPool' + * + * @param {string} parameters.maxSizeBytes The maximum size for the newly + * imported database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ImportExportResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ImportExportResponse} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginImportMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginImportMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, callback: ServiceCallback): void; + beginImportMethod(resourceGroupName: string, serverName: string, parameters: models.ImportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates an import operation that imports a bacpac into an existing database. + * The existing database must be empty. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to import into + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} [parameters.name] The name of the extension. + * + * @param {string} [parameters.type] The type of the extension. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateImportOperationWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates an import operation that imports a bacpac into an existing database. + * The existing database must be empty. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to import into + * + * @param {object} parameters The required parameters for importing a Bacpac + * into a database. + * + * @param {string} [parameters.name] The name of the extension. + * + * @param {string} [parameters.type] The type of the extension. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ImportExportResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ImportExportResponse} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, callback: ServiceCallback): void; + beginCreateImportOperation(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ImportExtensionRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Exports a database to a bacpac. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be exported. + * + * @param {object} parameters The required parameters for exporting a database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginExportMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Exports a database to a bacpac. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be exported. + * + * @param {object} parameters The required parameters for exporting a database. + * + * @param {string} parameters.storageKeyType The type of the storage key to + * use. Possible values include: 'StorageAccessKey', 'SharedAccessKey' + * + * @param {string} parameters.storageKey The storage key to use. If storage + * key type is SharedAccessKey, it must be preceded with a "?." + * + * @param {string} parameters.storageUri The storage uri to use. + * + * @param {string} parameters.administratorLogin The name of the SQL + * administrator. + * + * @param {string} parameters.administratorLoginPassword The password of the + * SQL administrator. + * + * @param {string} [parameters.authenticationType] The authentication type. + * Possible values include: 'SQL', 'ADPassword' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ImportExportResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ImportExportResponse} [result] - The deserialized result object if an error did not occur. + * See {@link ImportExportResponse} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginExportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginExportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, callback: ServiceCallback): void; + beginExportMethod(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ExportRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Upgrades a data warehouse. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be upgraded. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpgradeDataWarehouseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Upgrades a data warehouse. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be upgraded. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpgradeDataWarehouse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpgradeDataWarehouse(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + beginUpgradeDataWarehouse(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new database or updates an existing database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new database or updates an existing database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Database} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Database} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {object} [parameters.sku] The name and tier of the SKU. + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.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: 'Default', 'Copy', + * 'Secondary', 'PointInTimeRestore', 'Restore', 'Recovery', + * 'RestoreExternalBackup', 'RestoreExternalBackupSecondary', + * 'RestoreLongTermRetentionBackup', 'OnlineSecondary' + * + * @param {string} [parameters.collation] The collation of the database. + * + * @param {number} [parameters.maxSizeBytes] The max size of the database + * expressed in bytes. + * + * @param {string} [parameters.sampleName] The name of the sample schema to + * apply when creating this database. Possible values include: + * 'AdventureWorksLT', 'WideWorldImportersStd', 'WideWorldImportersFull' + * + * @param {string} [parameters.elasticPoolId] The resource identifier of the + * elastic pool containing this database. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {date} [parameters.restorePointInTime] Specifies the point in time + * (ISO8601 format) of the source database that will be restored to create the + * new database. + * + * @param {date} [parameters.sourceDatabaseDeletionDate] Specifies the time + * that the database was deleted. + * + * @param {string} [parameters.recoveryServicesRecoveryPointId] The resource + * identifier of the recovery point associated with create operation of this + * database. + * + * @param {string} [parameters.longTermRetentionBackupResourceId] The resource + * identifier of the long term retention backup associated with create + * operation of this database. + * + * @param {string} [parameters.recoverableDatabaseId] The resource identifier + * of the recoverable database associated with create operation of this + * database. + * + * @param {string} [parameters.restorableDroppedDatabaseId] The resource + * identifier of the restorable dropped database associated with create + * operation of this database. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {boolean} [parameters.zoneRedundant] Whether or not this database is + * zone redundant, which means the replicas of this database will be spread + * across multiple availability zones. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * database. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {string} [parameters.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: 'Enabled', 'Disabled' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Database} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Database} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Pauses a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be paused. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginPauseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Pauses a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be paused. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Database} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Database} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginPause(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginPause(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + beginPause(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resumes a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be resumed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginResumeWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resumes a database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to be resumed. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {Database} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {Database} [result] - The deserialized result object if an error did not occur. + * See {@link Database} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginResume(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginResume(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + beginResume(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a list of databases. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of databases. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DatabaseListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {DatabaseListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServerNext(nextPageLink: string, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a list of databases in an elastic pool. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByElasticPoolNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of databases in an elastic pool. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DatabaseListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {DatabaseListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByElasticPoolNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByElasticPoolNext(nextPageLink: string, callback: ServiceCallback): void; + listByElasticPoolNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ElasticPools + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ElasticPools { + + + /** + * Returns elastic pool metrics. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {string} filter An OData filter expression that describes a subset of + * metrics to return. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listMetricsWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns elastic pool metrics. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {string} filter An OData filter expression that describes a subset of + * metrics to return. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {MetricListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {MetricListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MetricListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listMetrics(resourceGroupName: string, serverName: string, elasticPoolName: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listMetrics(resourceGroupName: string, serverName: string, elasticPoolName: string, filter: string, callback: ServiceCallback): void; + listMetrics(resourceGroupName: string, serverName: string, elasticPoolName: string, filter: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns elastic pool metric definitions. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listMetricDefinitionsWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns elastic pool metric definitions. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {MetricDefinitionListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {MetricDefinitionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link MetricDefinitionListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listMetricDefinitions(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listMetricDefinitions(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; + listMetricDefinitions(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all elastic pools in a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.skip] The number of elements in the collection to + * skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all elastic pools in a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {number} [options.skip] The number of elements in the collection to + * skip. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ElasticPoolListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ElasticPoolListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName: string, serverName: string, options?: { skip? : number, customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { skip? : number, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ElasticPool} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ElasticPool} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPool} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ElasticPool} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ElasticPool} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPool} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool update parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool update parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ElasticPool} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ElasticPool} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPool} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ElasticPool} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ElasticPool} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPool} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool update parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} parameters The elastic pool update parameters. + * + * @param {object} [parameters.sku] + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {number} [parameters.maxSizeBytes] The storage limit for the database + * elastic pool in bytes. + * + * @param {object} [parameters.perDatabaseSettings] The per database settings + * for the elastic pool. + * + * @param {number} [parameters.perDatabaseSettings.minCapacity] The minimum + * capacity all databases are guaranteed. + * + * @param {number} [parameters.perDatabaseSettings.maxCapacity] The maximum + * capacity any one database can consume. + * + * @param {boolean} [parameters.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. + * + * @param {string} [parameters.licenseType] The license type to apply for this + * elastic pool. Possible values include: 'LicenseIncluded', 'BasePrice' + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ElasticPool} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ElasticPool} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPool} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all elastic pools in a server. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all elastic pools in a server. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ElasticPoolListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ElasticPoolListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServerNext(nextPageLink: string, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RecommendedElasticPools + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface RecommendedElasticPools { + + + /** + * Gets a recommented elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} recommendedElasticPoolName The name of the recommended + * elastic pool to be retrieved. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a recommented elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} recommendedElasticPoolName The name of the recommended + * elastic pool to be retrieved. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RecommendedElasticPool} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RecommendedElasticPool} [result] - The deserialized result object if an error did not occur. + * See {@link RecommendedElasticPool} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns recommended elastic pools. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns recommended elastic pools. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RecommendedElasticPoolListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RecommendedElasticPoolListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RecommendedElasticPoolListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns recommented elastic pool metrics. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} recommendedElasticPoolName The name of the recommended + * elastic pool to be retrieved. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listMetricsWithHttpOperationResponse(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns recommented elastic pool metrics. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} recommendedElasticPoolName The name of the recommended + * elastic pool to be retrieved. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RecommendedElasticPoolListMetricsResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {RecommendedElasticPoolListMetricsResult} [result] - The deserialized result object if an error did not occur. + * See {@link RecommendedElasticPoolListMetricsResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listMetrics(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listMetrics(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, callback: ServiceCallback): void; + listMetrics(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ReplicationLinks + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ReplicationLinks { + + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database that has the + * replication link to be dropped. + * + * @param {string} linkId The ID of the replication link to be deleted. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a database replication link. Cannot be done during failover. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database that has the + * replication link to be dropped. + * + * @param {string} linkId The ID of the replication link to be deleted. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a database replication link. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to get the link for. + * + * @param {string} linkId The replication link ID to be retrieved. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a database replication link. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to get the link for. + * + * @param {string} linkId The replication link ID to be retrieved. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ReplicationLink} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ReplicationLink} [result] - The deserialized result object if an error did not occur. + * See {@link ReplicationLink} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Sets which replica database is primary by failing over from the current + * primary replica database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database that has the + * replication link to be failed over. + * + * @param {string} linkId The ID of the replication link to be failed over. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + failoverWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Sets which replica database is primary by failing over from the current + * primary replica database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database that has the + * replication link to be failed over. + * + * @param {string} linkId The ID of the replication link to be failed over. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + failover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + failover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; + failover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Sets which replica database is primary by failing over from the current + * primary replica database. This operation might result in data loss. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database that has the + * replication link to be failed over. + * + * @param {string} linkId The ID of the replication link to be failed over. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + failoverAllowDataLossWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Sets which replica database is primary by failing over from the current + * primary replica database. This operation might result in data loss. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database that has the + * replication link to be failed over. + * + * @param {string} linkId The ID of the replication link to be failed over. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + failoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + failoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; + failoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists a database's replication links. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to retrieve links for. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists a database's replication links. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database to retrieve links for. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ReplicationLinkListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ReplicationLinkListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ReplicationLinkListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Sets which replica database is primary by failing over from the current + * primary replica database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database that has the + * replication link to be failed over. + * + * @param {string} linkId The ID of the replication link to be failed over. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginFailoverWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Sets which replica database is primary by failing over from the current + * primary replica database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database that has the + * replication link to be failed over. + * + * @param {string} linkId The ID of the replication link to be failed over. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginFailover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginFailover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; + beginFailover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Sets which replica database is primary by failing over from the current + * primary replica database. This operation might result in data loss. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database that has the + * replication link to be failed over. + * + * @param {string} linkId The ID of the replication link to be failed over. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginFailoverAllowDataLossWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Sets which replica database is primary by failing over from the current + * primary replica database. This operation might result in data loss. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database that has the + * replication link to be failed over. + * + * @param {string} linkId The ID of the replication link to be failed over. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginFailoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginFailoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; + beginFailoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ServerAzureADAdministrators + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ServerAzureADAdministrators { + + + /** + * Creates a new Server Active Directory Administrator or updates an existing + * server Active Directory Administrator. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} properties The required parameters for creating or updating + * an Active Directory Administrator. + * + * @param {string} properties.login The server administrator login value. + * + * @param {uuid} properties.sid The server administrator Sid (Secure ID). + * + * @param {uuid} properties.tenantId The server Active Directory Administrator + * tenant id. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Server Active Directory Administrator or updates an existing + * server Active Directory Administrator. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} properties The required parameters for creating or updating + * an Active Directory Administrator. + * + * @param {string} properties.login The server administrator login value. + * + * @param {uuid} properties.sid The server administrator Sid (Secure ID). + * + * @param {uuid} properties.tenantId The server Active Directory Administrator + * tenant id. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerAzureADAdministrator} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerAzureADAdministrator} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAzureADAdministrator} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerAzureADAdministrator} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerAzureADAdministrator} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAzureADAdministrator} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns an server Administrator. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns an server Administrator. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerAzureADAdministrator} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerAzureADAdministrator} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAzureADAdministrator} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns a list of server Administrators. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns a list of server Administrators. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerAdministratorListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerAdministratorListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAdministratorListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a new Server Active Directory Administrator or updates an existing + * server Active Directory Administrator. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} properties The required parameters for creating or updating + * an Active Directory Administrator. + * + * @param {string} properties.login The server administrator login value. + * + * @param {uuid} properties.sid The server administrator Sid (Secure ID). + * + * @param {uuid} properties.tenantId The server Active Directory Administrator + * tenant id. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a new Server Active Directory Administrator or updates an existing + * server Active Directory Administrator. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} properties The required parameters for creating or updating + * an Active Directory Administrator. + * + * @param {string} properties.login The server administrator login value. + * + * @param {uuid} properties.sid The server administrator Sid (Secure ID). + * + * @param {uuid} properties.tenantId The server Active Directory Administrator + * tenant id. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerAzureADAdministrator} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerAzureADAdministrator} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAzureADAdministrator} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes an existing server Active Directory Administrator. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerAzureADAdministrator} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerAzureADAdministrator} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAzureADAdministrator} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ServerCommunicationLinks + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ServerCommunicationLinks { + + + /** + * Deletes a server communication link. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} communicationLinkName The name of the server communication + * link. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, communicationLinkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a server communication link. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} communicationLinkName The name of the server communication + * link. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serverName: string, communicationLinkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, communicationLinkName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, communicationLinkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns a server communication link. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} communicationLinkName The name of the server communication + * link. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, communicationLinkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns a server communication link. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} communicationLinkName The name of the server communication + * link. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerCommunicationLink} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerCommunicationLink} [result] - The deserialized result object if an error did not occur. + * See {@link ServerCommunicationLink} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, communicationLinkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, communicationLinkName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, communicationLinkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a server communication link. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} communicationLinkName The name of the server communication + * link. + * + * @param {object} parameters The required parameters for creating a server + * communication link. + * + * @param {string} parameters.partnerServer The name of the partner server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a server communication link. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} communicationLinkName The name of the server communication + * link. + * + * @param {object} parameters The required parameters for creating a server + * communication link. + * + * @param {string} parameters.partnerServer The name of the partner server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerCommunicationLink} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerCommunicationLink} [result] - The deserialized result object if an error did not occur. + * See {@link ServerCommunicationLink} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a list of server communication links. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of server communication links. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerCommunicationLinkListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerCommunicationLinkListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerCommunicationLinkListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a server communication link. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} communicationLinkName The name of the server communication + * link. + * + * @param {object} parameters The required parameters for creating a server + * communication link. + * + * @param {string} parameters.partnerServer The name of the partner server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a server communication link. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} communicationLinkName The name of the server communication + * link. + * + * @param {object} parameters The required parameters for creating a server + * communication link. + * + * @param {string} parameters.partnerServer The name of the partner server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerCommunicationLink} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerCommunicationLink} [result] - The deserialized result object if an error did not occur. + * See {@link ServerCommunicationLink} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ServiceObjectives + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ServiceObjectives { + + + /** + * Gets a database service objective. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} serviceObjectiveName The name of the service objective to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, serviceObjectiveName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a database service objective. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} serviceObjectiveName The name of the service objective to + * retrieve. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServiceObjective} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServiceObjective} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceObjective} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, serviceObjectiveName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, serviceObjectiveName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, serviceObjectiveName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns database service objectives. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns database service objectives. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServiceObjectiveListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServiceObjectiveListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceObjectiveListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ElasticPoolActivities + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ElasticPoolActivities { + + + /** + * Returns elastic pool activities. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool for which to + * get the current activity. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByElasticPoolWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns elastic pool activities. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool for which to + * get the current activity. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ElasticPoolActivityListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ElasticPoolActivityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolActivityListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ElasticPoolDatabaseActivities + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ElasticPoolDatabaseActivities { + + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByElasticPoolWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns activity on databases inside of an elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName The name of the elastic pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ElasticPoolDatabaseActivityListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ElasticPoolDatabaseActivityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolDatabaseActivityListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ServiceTierAdvisors + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ServiceTierAdvisors { + + + /** + * Gets a service tier advisor. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of database. + * + * @param {string} serviceTierAdvisorName The name of service tier advisor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, serviceTierAdvisorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a service tier advisor. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of database. + * + * @param {string} serviceTierAdvisorName The name of service tier advisor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServiceTierAdvisor} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServiceTierAdvisor} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceTierAdvisor} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, databaseName: string, serviceTierAdvisorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, serviceTierAdvisorName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, serviceTierAdvisorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Returns service tier advisors for specified database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns service tier advisors for specified database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServiceTierAdvisorListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServiceTierAdvisorListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServiceTierAdvisorListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * TransparentDataEncryptions + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface TransparentDataEncryptions { + + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database for which setting the + * transparent data encryption applies. + * + * @param {object} parameters The required parameters for creating or updating + * transparent data encryption. + * + * @param {string} [parameters.status] The status of the database transparent + * data encryption. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.TransparentDataEncryption, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a database's transparent data encryption configuration. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database for which setting the + * transparent data encryption applies. + * + * @param {object} parameters The required parameters for creating or updating + * transparent data encryption. + * + * @param {string} [parameters.status] The status of the database transparent + * data encryption. Possible values include: 'Enabled', 'Disabled' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {TransparentDataEncryption} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {TransparentDataEncryption} [result] - The deserialized result object if an error did not occur. + * See {@link TransparentDataEncryption} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.TransparentDataEncryption, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.TransparentDataEncryption, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.TransparentDataEncryption, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a database's transparent data encryption configuration. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database for which the + * transparent data encryption applies. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a database's transparent data encryption configuration. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database for which the + * transparent data encryption applies. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {TransparentDataEncryption} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {TransparentDataEncryption} [result] - The deserialized result object if an error did not occur. + * See {@link TransparentDataEncryption} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * TransparentDataEncryptionActivities + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface TransparentDataEncryptionActivities { + + + /** + * Returns a database's transparent data encryption operation result. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database for which the + * transparent data encryption applies. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByConfigurationWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns a database's transparent data encryption operation result. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database for which the + * transparent data encryption applies. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {TransparentDataEncryptionActivityListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {TransparentDataEncryptionActivityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link TransparentDataEncryptionActivityListResult} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByConfiguration(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByConfiguration(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByConfiguration(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ServerUsages + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ServerUsages { + + + /** + * Returns server usages. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns server usages. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ServerUsageListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ServerUsageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerUsageListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DatabaseUsages + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface DatabaseUsages { + + + /** + * Returns database usages. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Returns database usages. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DatabaseUsageListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {DatabaseUsageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseUsageListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DatabaseBlobAuditingPolicies + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface DatabaseBlobAuditingPolicies { + + + /** + * Gets a database's blob auditing policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database for which the blob + * audit policy is defined. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a database's blob auditing policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database for which the blob + * audit policy is defined. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DatabaseBlobAuditingPolicy} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {DatabaseBlobAuditingPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseBlobAuditingPolicy} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a database's blob auditing policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database for which the blob + * auditing policy will be defined. + * + * @param {object} parameters The database blob auditing policy. + * + * @param {string} parameters.state Specifies the state of the policy. If state + * is Enabled, storageEndpoint and storageAccountAccessKey are required. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [parameters.storageEndpoint] Specifies the blob storage + * endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is + * Enabled, storageEndpoint is required. + * + * @param {string} [parameters.storageAccountAccessKey] Specifies the + * identifier key of the auditing storage account. If state is Enabled, + * storageAccountAccessKey is required. + * + * @param {number} [parameters.retentionDays] Specifies the number of days to + * keep in the audit logs. + * + * @param {array} [parameters.auditActionsAndGroups] Specifies the Actions and + * Actions-Groups to audit. + * + * @param {uuid} [parameters.storageAccountSubscriptionId] Specifies the blob + * storage subscription Id. + * + * @param {boolean} [parameters.isStorageSecondaryKeyInUse] Specifies whether + * storageAccountAccessKey value is the storage’s secondary key. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseBlobAuditingPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a database's blob auditing policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database for which the blob + * auditing policy will be defined. + * + * @param {object} parameters The database blob auditing policy. + * + * @param {string} parameters.state Specifies the state of the policy. If state + * is Enabled, storageEndpoint and storageAccountAccessKey are required. + * Possible values include: 'Enabled', 'Disabled' + * + * @param {string} [parameters.storageEndpoint] Specifies the blob storage + * endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is + * Enabled, storageEndpoint is required. + * + * @param {string} [parameters.storageAccountAccessKey] Specifies the + * identifier key of the auditing storage account. If state is Enabled, + * storageAccountAccessKey is required. + * + * @param {number} [parameters.retentionDays] Specifies the number of days to + * keep in the audit logs. + * + * @param {array} [parameters.auditActionsAndGroups] Specifies the Actions and + * Actions-Groups to audit. + * + * @param {uuid} [parameters.storageAccountSubscriptionId] Specifies the blob + * storage subscription Id. + * + * @param {boolean} [parameters.isStorageSecondaryKeyInUse] Specifies whether + * storageAccountAccessKey value is the storage’s secondary key. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DatabaseBlobAuditingPolicy} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {DatabaseBlobAuditingPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseBlobAuditingPolicy} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseBlobAuditingPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseBlobAuditingPolicy, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseBlobAuditingPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DatabaseAutomaticTuningOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface DatabaseAutomaticTuningOperations { + + + /** + * Gets a database's automatic tuning. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a database's automatic tuning. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DatabaseAutomaticTuning} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {DatabaseAutomaticTuning} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAutomaticTuning} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update automatic tuning properties for target database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested automatic tuning resource state. + * + * @param {string} [parameters.desiredState] Automatic tuning desired state. + * Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + * + * @param {object} [parameters.options] Automatic tuning options definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseAutomaticTuning, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update automatic tuning properties for target database. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested automatic tuning resource state. + * + * @param {string} [parameters.desiredState] Automatic tuning desired state. + * Possible values include: 'Inherit', 'Custom', 'Auto', 'Unspecified' + * + * @param {object} [parameters.options] Automatic tuning options definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DatabaseAutomaticTuning} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {DatabaseAutomaticTuning} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAutomaticTuning} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseAutomaticTuning, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseAutomaticTuning, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseAutomaticTuning, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * EncryptionProtectors + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface EncryptionProtectors { + + + /** + * Gets a list of server encryption protectors + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of server encryption protectors + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EncryptionProtectorListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EncryptionProtectorListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EncryptionProtectorListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a server encryption protector. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a server encryption protector. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EncryptionProtector} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EncryptionProtector} [result] - The deserialized result object if an error did not occur. + * See {@link EncryptionProtector} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing encryption protector. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The requested encryption protector resource + * state. + * + * @param {string} [parameters.kind] Kind of encryption protector. This is + * metadata used for the Azure portal experience. + * + * @param {string} [parameters.serverKeyName] The name of the server key. + * + * @param {string} parameters.serverKeyType The encryption protector type like + * 'ServiceManaged', 'AzureKeyVault'. Possible values include: + * 'ServiceManaged', 'AzureKeyVault' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing encryption protector. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The requested encryption protector resource + * state. + * + * @param {string} [parameters.kind] Kind of encryption protector. This is + * metadata used for the Azure portal experience. + * + * @param {string} [parameters.serverKeyName] The name of the server key. + * + * @param {string} parameters.serverKeyType The encryption protector type like + * 'ServiceManaged', 'AzureKeyVault'. Possible values include: + * 'ServiceManaged', 'AzureKeyVault' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EncryptionProtector} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EncryptionProtector} [result] - The deserialized result object if an error did not occur. + * See {@link EncryptionProtector} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an existing encryption protector. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The requested encryption protector resource + * state. + * + * @param {string} [parameters.kind] Kind of encryption protector. This is + * metadata used for the Azure portal experience. + * + * @param {string} [parameters.serverKeyName] The name of the server key. + * + * @param {string} parameters.serverKeyType The encryption protector type like + * 'ServiceManaged', 'AzureKeyVault'. Possible values include: + * 'ServiceManaged', 'AzureKeyVault' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an existing encryption protector. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The requested encryption protector resource + * state. + * + * @param {string} [parameters.kind] Kind of encryption protector. This is + * metadata used for the Azure portal experience. + * + * @param {string} [parameters.serverKeyName] The name of the server key. + * + * @param {string} parameters.serverKeyType The encryption protector type like + * 'ServiceManaged', 'AzureKeyVault'. Possible values include: + * 'ServiceManaged', 'AzureKeyVault' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EncryptionProtector} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EncryptionProtector} [result] - The deserialized result object if an error did not occur. + * See {@link EncryptionProtector} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a list of server encryption protectors + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of server encryption protectors + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {EncryptionProtectorListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {EncryptionProtectorListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EncryptionProtectorListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServerNext(nextPageLink: string, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * FailoverGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface FailoverGroups { + + + /** + * Gets a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FailoverGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerServers List of partner server information + * for the failover group. + * + * @param {array} [parameters.databases] List of databases in the failover + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerServers List of partner server information + * for the failover group. + * + * @param {array} [parameters.databases] List of databases in the failover + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FailoverGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} [parameters.readWriteEndpoint] Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} [parameters.databases] List of databases in the failover + * group. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} [parameters.readWriteEndpoint] Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} [parameters.databases] List of databases in the failover + * group. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FailoverGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the failover groups in a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the failover groups in a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FailoverGroupListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FailoverGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroupListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Fails over from the current primary server to this server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + failoverWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Fails over from the current primary server to this server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FailoverGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + failover(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + failover(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; + failover(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Fails over from the current primary server to this server. This operation + * might result in data loss. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + forceFailoverAllowDataLossWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Fails over from the current primary server to this server. This operation + * might result in data loss. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FailoverGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + forceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + forceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; + forceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerServers List of partner server information + * for the failover group. + * + * @param {array} [parameters.databases] List of databases in the failover + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerServers List of partner server information + * for the failover group. + * + * @param {array} [parameters.databases] List of databases in the failover + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FailoverGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} [parameters.readWriteEndpoint] Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} [parameters.databases] List of databases in the failover + * group. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a failover group. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} [parameters.readWriteEndpoint] Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} [parameters.databases] List of databases in the failover + * group. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FailoverGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Fails over from the current primary server to this server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginFailoverWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Fails over from the current primary server to this server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FailoverGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginFailover(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginFailover(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; + beginFailover(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Fails over from the current primary server to this server. This operation + * might result in data loss. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server containing the failover + * group. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginForceFailoverAllowDataLossWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Fails over from the current primary server to this server. This operation + * might result in data loss. * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. + * @param {string} 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. * - * @param {string} [parameters.createMode] Specifies the mode of database - * creation. + * @param {string} serverName The name of the server containing the failover + * group. * - * Default: regular database creation. + * @param {string} failoverGroupName The name of the failover group. * - * Copy: creates a database as a copy of an existing database. sourceDatabaseId - * must be specified as the resource ID of the source database. + * @param {object} [options] Optional Parameters. * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) secondary replica of an existing database. sourceDatabaseId - * must be specified as the resource ID of the existing primary database. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * 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. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * Recovery: Creates a database by restoring a geo-replicated backup. - * sourceDatabaseId must be specified as the recoverable database resource ID - * to restore. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * 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. + * {Promise} A promise is returned. * - * RestoreLongTermRetentionBackup: Creates a database by restoring from a long - * term retention vault. recoveryServicesRecoveryPointResourceId must be - * specified as the recovery point resource ID. + * @resolve {FailoverGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {object} [parameters.tags] Resource tags. + * {FailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroup} for more information. * - * @param {string} parameters.location Resource location. + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginForceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginForceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; + beginForceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists the failover groups in a server. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -4588,145 +10663,202 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new database or updates an existing database. + * Lists the failover groups in a server. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {FailoverGroupListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {FailoverGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link FailoverGroupListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServerNext(nextPageLink: string, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ManagedInstances + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ManagedInstances { + + + /** + * Gets a list of all managed instances in the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of all managed instances in the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ManagedInstanceListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {ManagedInstanceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a list of managed instances in a resource group. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {object} [options] Optional Parameters. * - * @param {string} databaseName The name of the database to be operated on - * (updated or created). + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} parameters The required parameters for creating or updating - * a database. + * @returns {Promise} A promise is returned * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [parameters.createMode] Specifies the mode of database - * creation. + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of managed instances in a resource group. * - * Default: regular database creation. + * @param {string} 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. * - * Copy: creates a database as a copy of an existing database. sourceDatabaseId - * must be specified as the resource ID of the source database. + * @param {object} [options] Optional Parameters. * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) secondary replica of an existing database. sourceDatabaseId - * must be specified as the resource ID of the existing primary database. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * 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. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * Recovery: Creates a database by restoring a geo-replicated backup. - * sourceDatabaseId must be specified as the recoverable database resource ID - * to restore. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * 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. + * {Promise} A promise is returned. * - * RestoreLongTermRetentionBackup: Creates a database by restoring from a long - * term retention vault. recoveryServicesRecoveryPointResourceId must be - * specified as the recovery point resource ID. + * @resolve {ManagedInstanceListResult} - The deserialized result object. * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. + * @reject {Error|ServiceError} - The error object. * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {object} [parameters.tags] Resource tags. + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} parameters.location Resource location. + * {ManagedInstanceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. * * @param {object} [options] Optional Parameters. * @@ -4740,7 +10872,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {Database} - The deserialized result object. + * @resolve {ManagedInstance} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -4748,147 +10880,72 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Database} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * {ManagedInstance} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.Database, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, managedInstanceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, managedInstanceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, managedInstanceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing database. + * Creates or updates a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} databaseName The name of the database to be updated. + * @param {object} parameters The requested managed instance resource state. * - * @param {object} parameters The required parameters for updating a database. + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the managed instance. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} [parameters.identity.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' * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. + * @param {object} [parameters.sku] Managed instance sku * - * @param {string} [parameters.createMode] Specifies the mode of database - * creation. + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * Default: regular database creation. + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * Copy: creates a database as a copy of an existing database. sourceDatabaseId - * must be specified as the resource ID of the source database. + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) secondary replica of an existing database. sourceDatabaseId - * must be specified as the resource ID of the existing primary database. + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). * - * 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. + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. * - * Recovery: Creates a database by restoring a geo-replicated backup. - * sourceDatabaseId must be specified as the recoverable database resource ID - * to restore. + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. * - * 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. + * @param {number} [parameters.vCores] The number of VCores. * - * RestoreLongTermRetentionBackup: Creates a database by restoring from a long - * term retention vault. recoveryServicesRecoveryPointResourceId must be - * specified as the recovery point resource ID. + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. + * @param {object} [parameters.tags] Resource tags. * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. - * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. - * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' - * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." - * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' - * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. - * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' - * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -4897,141 +10954,66 @@ export interface Databases { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates an existing database. + * Creates or updates a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to be updated. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {object} parameters The required parameters for updating a database. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.collation] The collation of the database. If - * createMode is not Default, this value is ignored. - * - * @param {string} [parameters.createMode] Specifies the mode of database - * creation. - * - * Default: regular database creation. + * @param {object} parameters The requested managed instance resource state. * - * Copy: creates a database as a copy of an existing database. sourceDatabaseId - * must be specified as the resource ID of the source database. + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the managed instance. * - * OnlineSecondary/NonReadableSecondary: creates a database as a (readable or - * nonreadable) secondary replica of an existing database. sourceDatabaseId - * must be specified as the resource ID of the existing primary database. + * @param {string} [parameters.identity.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' * - * 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. + * @param {object} [parameters.sku] Managed instance sku * - * Recovery: Creates a database by restoring a geo-replicated backup. - * sourceDatabaseId must be specified as the recoverable database resource ID - * to restore. + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. * - * 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. + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * RestoreLongTermRetentionBackup: Creates a database by restoring from a long - * term retention vault. recoveryServicesRecoveryPointResourceId must be - * specified as the recovery point resource ID. + * @param {string} [parameters.sku.size] Size of the particular SKU * - * Copy, NonReadableSecondary, OnlineSecondary and - * RestoreLongTermRetentionBackup are not supported for DataWarehouse edition. - * Possible values include: 'Copy', 'Default', 'NonReadableSecondary', - * 'OnlineSecondary', 'PointInTimeRestore', 'Recovery', 'Restore', - * 'RestoreLongTermRetentionBackup' - * - * @param {string} [parameters.sourceDatabaseId] Conditional. If createMode is - * Copy, NonReadableSecondary, OnlineSecondary, PointInTimeRestore, Recovery, - * or Restore, then this value is required. Specifies the resource ID of the - * source database. If createMode is NonReadableSecondary or OnlineSecondary, - * the name of the source database must be the same as the new database being - * created. - * - * @param {date} [parameters.sourceDatabaseDeletionDate] Conditional. If - * createMode is Restore and sourceDatabaseId is the deleted database's - * original resource id when it existed (as opposed to its current restorable - * dropped database id), then this value is required. Specifies the time that - * the database was deleted. + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {date} [parameters.restorePointInTime] Conditional. If createMode is - * PointInTimeRestore, this value is required. If createMode is Restore, this - * value is optional. Specifies the point in time (ISO8601 format) of the - * source database that will be restored to create the new database. Must be - * greater than or equal to the source database's earliestRestoreDate value. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {string} [parameters.recoveryServicesRecoveryPointResourceId] - * Conditional. If createMode is RestoreLongTermRetentionBackup, then this - * value is required. Specifies the resource ID of the recovery point to - * restore from. + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). * - * @param {string} [parameters.edition] The edition of the database. The - * DatabaseEditions enumeration contains all the valid editions. If createMode - * is NonReadableSecondary or OnlineSecondary, this value is ignored. To see - * possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Web', 'Business', 'Basic', 'Standard', 'Premium', 'Free', - * 'Stretch', 'DataWarehouse', 'System', 'System2' + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). * - * @param {string} [parameters.maxSizeBytes] The max size of the database - * expressed in bytes. If createMode is not Default, this value is ignored. To - * see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. * - * @param {uuid} [parameters.requestedServiceObjectiveId] The configured - * service level objective ID of the database. This is the service level - * objective that is in the process of being applied to the database. Once - * successfully updated, it will match the value of currentServiceObjectiveId - * property. If requestedServiceObjectiveId and requestedServiceObjectiveName - * are both updated, the value of requestedServiceObjectiveId overrides the - * value of requestedServiceObjectiveName. To see possible values, query the - * capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation." + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. * - * @param {string} [parameters.requestedServiceObjectiveName] The name of the - * configured service level objective of the database. This is the service - * level objective that is in the process of being applied to the database. - * Once successfully updated, it will match the value of serviceLevelObjective - * property. To see possible values, query the capabilities API - * (/subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationID}/capabilities) - * referred to by operationId: "Capabilities_ListByLocation.". Possible values - * include: 'Basic', 'S0', 'S1', 'S2', 'S3', 'P1', 'P2', 'P3', 'P4', 'P6', - * 'P11', 'P15', 'System', 'System2', 'ElasticPool' + * @param {number} [parameters.vCores] The number of VCores. * - * @param {string} [parameters.elasticPoolName] The name of the elastic pool - * the database is in. If elasticPoolName and requestedServiceObjectiveName are - * both updated, the value of requestedServiceObjectiveName is ignored. Not - * supported for DataWarehouse edition. + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. * - * @param {string} [parameters.readScale] Conditional. If the database is a - * geo-secondary, readScale indicates whether read-only connections are allowed - * to this database or not. Not supported for DataWarehouse edition. Possible - * values include: 'Enabled', 'Disabled' + * @param {object} [parameters.tags] Resource tags. * - * @param {string} [parameters.sampleName] Indicates the name of the sample - * schema to apply when creating this database. If createMode is not Default, - * this value is ignored. Not supported for DataWarehouse edition. Possible - * values include: 'AdventureWorksLT' + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -5045,7 +11027,7 @@ export interface Databases { * * {Promise} A promise is returned. * - * @resolve {Database} - The deserialized result object. + * @resolve {ManagedInstance} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5053,40 +11035,26 @@ export interface Databases { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Database} [result] - The deserialized result object if an error did not occur. - * See {@link Database} for more information. + * {ManagedInstance} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, callback: ServiceCallback): void; - beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ElasticPools - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface ElasticPools { + createOrUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstance, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstance, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns elastic pool metrics. + * Deletes a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool. - * - * @param {string} filter An OData filter expression that describes a subset of - * metrics to return. + * @param {string} managedInstanceName The name of the managed instance. * * @param {object} [options] Optional Parameters. * @@ -5095,25 +11063,20 @@ export interface ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listMetricsWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns elastic pool metrics. + * Deletes a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool. - * - * @param {string} filter An OData filter expression that describes a subset of - * metrics to return. + * @param {string} managedInstanceName The name of the managed instance. * * @param {object} [options] Optional Parameters. * @@ -5127,7 +11090,7 @@ export interface ElasticPools { * * {Promise} A promise is returned. * - * @resolve {MetricListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5135,28 +11098,61 @@ export interface ElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {MetricListResult} [result] - The deserialized result object if an error did not occur. - * See {@link MetricListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listMetrics(resourceGroupName: string, serverName: string, elasticPoolName: string, filter: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listMetrics(resourceGroupName: string, serverName: string, elasticPoolName: string, filter: string, callback: ServiceCallback): void; - listMetrics(resourceGroupName: string, serverName: string, elasticPoolName: string, filter: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, managedInstanceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, managedInstanceName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, managedInstanceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns elastic pool metric definitions. + * Updates a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} elasticPoolName The name of the elastic pool. + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -5165,22 +11161,56 @@ export interface ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listMetricDefinitionsWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstanceUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns elastic pool metric definitions. + * Updates a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} elasticPoolName The name of the elastic pool. + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -5194,7 +11224,7 @@ export interface ElasticPools { * * {Promise} A promise is returned. * - * @resolve {MetricDefinitionListResult} - The deserialized result object. + * @resolve {ManagedInstance} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5202,48 +11232,68 @@ export interface ElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {MetricDefinitionListResult} [result] - The deserialized result object if an error did not occur. - * See {@link MetricDefinitionListResult} for more - * information. + * {ManagedInstance} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listMetricDefinitions(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listMetricDefinitions(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; - listMetricDefinitions(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstanceUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstanceUpdate, callback: ServiceCallback): void; + update(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstanceUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new elastic pool or updates an existing elastic pool. + * Creates or updates a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} elasticPoolName The name of the elastic pool to be operated - * on (updated or created). + * @param {object} parameters The requested managed instance resource state. * - * @param {object} parameters The required parameters for creating or updating - * an elastic pool. + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the managed instance. + * + * @param {string} [parameters.identity.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' + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. + * @param {number} [parameters.vCores] The number of VCores. * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. * * @param {object} [parameters.tags] Resource tags. * @@ -5256,41 +11306,62 @@ export interface ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new elastic pool or updates an existing elastic pool. + * Creates or updates a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} elasticPoolName The name of the elastic pool to be operated - * on (updated or created). + * @param {object} parameters The requested managed instance resource state. * - * @param {object} parameters The required parameters for creating or updating - * an elastic pool. + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the managed instance. + * + * @param {string} [parameters.identity.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' + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' + * @param {string} [parameters.sku.size] Size of the particular SKU * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. * * @param {object} [parameters.tags] Resource tags. * @@ -5308,7 +11379,7 @@ export interface ElasticPools { * * {Promise} A promise is returned. * - * @resolve {ElasticPool} - The deserialized result object. + * @resolve {ManagedInstance} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5316,48 +11387,26 @@ export interface ElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ElasticPool} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPool} for more information. + * {ManagedInstance} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstance, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstance, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstance, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing elastic pool. + * Deletes a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be updated. - * - * @param {object} parameters The required parameters for updating an elastic - * pool. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} managedInstanceName The name of the managed instance. * * @param {object} [options] Optional Parameters. * @@ -5366,42 +11415,20 @@ export interface ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates an existing elastic pool. + * Deletes a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be updated. - * - * @param {object} parameters The required parameters for updating an elastic - * pool. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} managedInstanceName The name of the managed instance. * * @param {object} [options] Optional Parameters. * @@ -5415,7 +11442,7 @@ export interface ElasticPools { * * {Promise} A promise is returned. * - * @resolve {ElasticPool} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5423,52 +11450,119 @@ export interface ElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ElasticPool} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPool} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, callback: ServiceCallback): void; - update(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, managedInstanceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, managedInstanceName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, managedInstanceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the elastic pool. + * Updates a managed instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. * - * @param {string} elasticPoolName The name of the elastic pool to be deleted. + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * - * @returns {Promise} A promise is returned + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstanceUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). * - * @reject {Error|ServiceError} - The error object. - */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Deletes the elastic pool. + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. * - * @param {string} 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. + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. * - * @param {string} serverName The name of the server. + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. * - * @param {string} elasticPoolName The name of the elastic pool to be deleted. + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -5482,7 +11576,7 @@ export interface ElasticPools { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ManagedInstance} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5490,28 +11584,23 @@ export interface ElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ManagedInstance} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstanceUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstanceUpdate, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, managedInstanceName: string, parameters: models.ManagedInstanceUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets an elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a list of all managed instances in the subscription. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -5520,23 +11609,17 @@ export interface ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets an elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a list of all managed instances in the subscription. * - * @param {string} elasticPoolName The name of the elastic pool to be - * retrieved. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -5550,7 +11633,7 @@ export interface ElasticPools { * * {Promise} A promise is returned. * - * @resolve {ElasticPool} - The deserialized result object. + * @resolve {ManagedInstanceListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5558,26 +11641,24 @@ export interface ElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ElasticPool} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPool} for more information. + * {ManagedInstanceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns a list of elastic pools in a server. - * - * @param {string} 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. + * Gets a list of managed instances in a resource group. * - * @param {string} serverName The name of the server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -5586,20 +11667,17 @@ export interface ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns a list of elastic pools in a server. - * - * @param {string} 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. + * Gets a list of managed instances in a resource group. * - * @param {string} serverName The name of the server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -5613,7 +11691,7 @@ export interface ElasticPools { * * {Promise} A promise is returned. * - * @resolve {ElasticPoolListResult} - The deserialized result object. + * @resolve {ManagedInstanceListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5621,51 +11699,30 @@ export interface ElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ElasticPoolListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPoolListResult} for more information. + * {ManagedInstanceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface Operations { /** - * Creates a new elastic pool or updates an existing elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be operated - * on (updated or created). - * - * @param {object} parameters The required parameters for creating or updating - * an elastic pool. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} parameters.location Resource location. + * Lists all of the available SQL Rest API operations. * * @param {object} [options] Optional Parameters. * @@ -5674,45 +11731,14 @@ export interface ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new elastic pool or updates an existing elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be operated - * on (updated or created). - * - * @param {object} parameters The required parameters for creating or updating - * an elastic pool. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. - * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} parameters.location Resource location. + * Lists all of the available SQL Rest API operations. * * @param {object} [options] Optional Parameters. * @@ -5726,7 +11752,7 @@ export interface ElasticPools { * * {Promise} A promise is returned. * - * @resolve {ElasticPool} - The deserialized result object. + * @resolve {OperationListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5734,48 +11760,23 @@ export interface ElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ElasticPool} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPool} for more information. + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPool, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be updated. - * - * @param {object} parameters The required parameters for updating an elastic - * pool. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. + * Lists all of the available SQL Rest API operations. * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -5784,42 +11785,17 @@ export interface ElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates an existing elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} elasticPoolName The name of the elastic pool to be updated. - * - * @param {object} parameters The required parameters for updating an elastic - * pool. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} [parameters.edition] The edition of the elastic pool. - * Possible values include: 'Basic', 'Standard', 'Premium' - * - * @param {number} [parameters.dtu] The total shared DTU for the database - * elastic pool. - * - * @param {number} [parameters.databaseDtuMax] The maximum DTU any one database - * can consume. - * - * @param {number} [parameters.databaseDtuMin] The minimum DTU all databases - * are guaranteed. + * Lists all of the available SQL Rest API operations. * - * @param {number} [parameters.storageMB] Gets storage limit for the database - * elastic pool in MB. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -5833,7 +11809,7 @@ export interface ElasticPools { * * {Promise} A promise is returned. * - * @resolve {ElasticPool} - The deserialized result object. + * @resolve {OperationListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5841,29 +11817,29 @@ export interface ElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ElasticPool} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPool} for more information. + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, callback: ServiceCallback): void; - beginUpdate(resourceGroupName: string, serverName: string, elasticPoolName: string, parameters: models.ElasticPoolUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ReplicationLinks + * ServerKeys * __NOTE__: An instance of this class is automatically created for an * instance of the SqlManagementClient. */ -export interface ReplicationLinks { +export interface ServerKeys { /** - * Deletes a database replication link. Cannot be done during failover. + * Gets a list of server keys. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5871,11 +11847,6 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database that has the - * replication link to be dropped. - * - * @param {string} linkId The ID of the replication link to be deleted. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5883,14 +11854,14 @@ export interface ReplicationLinks { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a database replication link. Cannot be done during failover. + * Gets a list of server keys. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5898,11 +11869,6 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database that has the - * replication link to be dropped. - * - * @param {string} linkId The ID of the replication link to be deleted. - * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -5915,7 +11881,7 @@ export interface ReplicationLinks { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ServerKeyListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5923,19 +11889,20 @@ export interface ReplicationLinks { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ServerKeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerKeyListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a database replication link. + * Gets a server key. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5943,9 +11910,7 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to get the link for. - * - * @param {string} linkId The replication link ID to be retrieved. + * @param {string} keyName The name of the server key to be retrieved. * * @param {object} [options] Optional Parameters. * @@ -5954,14 +11919,14 @@ export interface ReplicationLinks { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a database replication link. + * Gets a server key. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -5969,9 +11934,7 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to get the link for. - * - * @param {string} linkId The replication link ID to be retrieved. + * @param {string} keyName The name of the server key to be retrieved. * * @param {object} [options] Optional Parameters. * @@ -5985,7 +11948,7 @@ export interface ReplicationLinks { * * {Promise} A promise is returned. * - * @resolve {ReplicationLink} - The deserialized result object. + * @resolve {ServerKey} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -5993,32 +11956,48 @@ export interface ReplicationLinks { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ReplicationLink} [result] - The deserialized result object if an error did not occur. - * See {@link ReplicationLink} for more information. + * {ServerKey} [result] - The deserialized result object if an error did not occur. + * See {@link ServerKey} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, keyName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Sets which replica database is primary by failing over from the current - * primary replica database. + * Creates or updates a server key. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} keyName The name of the server key to be operated on + * (updated or created). The key name is required to be in the format of + * 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, + * then the server key name should be formatted as: + * YourVaultName_YourKeyName_01234567890123456789012345678901 * - * @param {string} 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. + * @param {object} parameters The requested server key resource state. * - * @param {string} serverName The name of the server. + * @param {string} [parameters.kind] Kind of encryption protector. This is + * metadata used for the Azure portal experience. * - * @param {string} databaseName The name of the database that has the - * replication link to be failed over. + * @param {string} parameters.serverKeyType The server key type like + * 'ServiceManaged', 'AzureKeyVault'. Possible values include: + * 'ServiceManaged', 'AzureKeyVault' * - * @param {string} linkId The ID of the replication link to be failed over. + * @param {string} [parameters.uri] The URI of the server key. + * + * @param {string} [parameters.thumbprint] Thumbprint of the server key. + * + * @param {date} [parameters.creationDate] The server key creation date. * * @param {object} [options] Optional Parameters. * @@ -6027,15 +12006,14 @@ export interface ReplicationLinks { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - failoverWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Sets which replica database is primary by failing over from the current - * primary replica database. + * Creates or updates a server key. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6043,10 +12021,27 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database that has the - * replication link to be failed over. + * @param {string} keyName The name of the server key to be operated on + * (updated or created). The key name is required to be in the format of + * 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, + * then the server key name should be formatted as: + * YourVaultName_YourKeyName_01234567890123456789012345678901 * - * @param {string} linkId The ID of the replication link to be failed over. + * @param {object} parameters The requested server key resource state. + * + * @param {string} [parameters.kind] Kind of encryption protector. This is + * metadata used for the Azure portal experience. + * + * @param {string} parameters.serverKeyType The server key type like + * 'ServiceManaged', 'AzureKeyVault'. Possible values include: + * 'ServiceManaged', 'AzureKeyVault' + * + * @param {string} [parameters.uri] The URI of the server key. + * + * @param {string} [parameters.thumbprint] Thumbprint of the server key. + * + * @param {date} [parameters.creationDate] The server key creation date. * * @param {object} [options] Optional Parameters. * @@ -6060,7 +12055,7 @@ export interface ReplicationLinks { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ServerKey} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6068,20 +12063,20 @@ export interface ReplicationLinks { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ServerKey} [result] - The deserialized result object if an error did not occur. + * See {@link ServerKey} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - failover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - failover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; - failover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Sets which replica database is primary by failing over from the current - * primary replica database. This operation might result in data loss. + * Deletes the server key with the given name. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6089,10 +12084,7 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database that has the - * replication link to be failed over. - * - * @param {string} linkId The ID of the replication link to be failed over. + * @param {string} keyName The name of the server key to be deleted. * * @param {object} [options] Optional Parameters. * @@ -6105,11 +12097,10 @@ export interface ReplicationLinks { * * @reject {Error|ServiceError} - The error object. */ - failoverAllowDataLossWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Sets which replica database is primary by failing over from the current - * primary replica database. This operation might result in data loss. + * Deletes the server key with the given name. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6117,10 +12108,7 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database that has the - * replication link to be failed over. - * - * @param {string} linkId The ID of the replication link to be failed over. + * @param {string} keyName The name of the server key to be deleted. * * @param {object} [options] Optional Parameters. * @@ -6148,13 +12136,13 @@ export interface ReplicationLinks { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - failoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - failoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; - failoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, keyName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists a database's replication links. + * Creates or updates a server key. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6162,7 +12150,27 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to retrieve links for. + * @param {string} keyName The name of the server key to be operated on + * (updated or created). The key name is required to be in the format of + * 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, + * then the server key name should be formatted as: + * YourVaultName_YourKeyName_01234567890123456789012345678901 + * + * @param {object} parameters The requested server key resource state. + * + * @param {string} [parameters.kind] Kind of encryption protector. This is + * metadata used for the Azure portal experience. + * + * @param {string} parameters.serverKeyType The server key type like + * 'ServiceManaged', 'AzureKeyVault'. Possible values include: + * 'ServiceManaged', 'AzureKeyVault' + * + * @param {string} [parameters.uri] The URI of the server key. + * + * @param {string} [parameters.thumbprint] Thumbprint of the server key. + * + * @param {date} [parameters.creationDate] The server key creation date. * * @param {object} [options] Optional Parameters. * @@ -6171,14 +12179,14 @@ export interface ReplicationLinks { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists a database's replication links. + * Creates or updates a server key. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6186,7 +12194,27 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to retrieve links for. + * @param {string} keyName The name of the server key to be operated on + * (updated or created). The key name is required to be in the format of + * 'vault_key_version'. For example, if the keyId is + * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, + * then the server key name should be formatted as: + * YourVaultName_YourKeyName_01234567890123456789012345678901 + * + * @param {object} parameters The requested server key resource state. + * + * @param {string} [parameters.kind] Kind of encryption protector. This is + * metadata used for the Azure portal experience. + * + * @param {string} parameters.serverKeyType The server key type like + * 'ServiceManaged', 'AzureKeyVault'. Possible values include: + * 'ServiceManaged', 'AzureKeyVault' + * + * @param {string} [parameters.uri] The URI of the server key. + * + * @param {string} [parameters.thumbprint] Thumbprint of the server key. + * + * @param {date} [parameters.creationDate] The server key creation date. * * @param {object} [options] Optional Parameters. * @@ -6200,7 +12228,7 @@ export interface ReplicationLinks { * * {Promise} A promise is returned. * - * @resolve {ReplicationLinkListResult} - The deserialized result object. + * @resolve {ServerKey} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6208,22 +12236,20 @@ export interface ReplicationLinks { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ReplicationLinkListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ReplicationLinkListResult} for more - * information. + * {ServerKey} [result] - The deserialized result object if an error did not occur. + * See {@link ServerKey} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Sets which replica database is primary by failing over from the current - * primary replica database. + * Deletes the server key with the given name. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6231,10 +12257,7 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database that has the - * replication link to be failed over. - * - * @param {string} linkId The ID of the replication link to be failed over. + * @param {string} keyName The name of the server key to be deleted. * * @param {object} [options] Optional Parameters. * @@ -6247,11 +12270,10 @@ export interface ReplicationLinks { * * @reject {Error|ServiceError} - The error object. */ - beginFailoverWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Sets which replica database is primary by failing over from the current - * primary replica database. + * Deletes the server key with the given name. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -6259,10 +12281,7 @@ export interface ReplicationLinks { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database that has the - * replication link to be failed over. - * - * @param {string} linkId The ID of the replication link to be failed over. + * @param {string} keyName The name of the server key to be deleted. * * @param {object} [options] Optional Parameters. * @@ -6290,25 +12309,16 @@ export interface ReplicationLinks { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginFailover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginFailover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; - beginFailover(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, keyName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Sets which replica database is primary by failing over from the current - * primary replica database. This operation might result in data loss. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database that has the - * replication link to be failed over. + * Gets a list of server keys. * - * @param {string} linkId The ID of the replication link to be failed over. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -6317,26 +12327,17 @@ export interface ReplicationLinks { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginFailoverAllowDataLossWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Sets which replica database is primary by failing over from the current - * primary replica database. This operation might result in data loss. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database that has the - * replication link to be failed over. + * Gets a list of server keys. * - * @param {string} linkId The ID of the replication link to be failed over. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -6350,7 +12351,7 @@ export interface ReplicationLinks { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ServerKeyListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6358,45 +12359,38 @@ export interface ReplicationLinks { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ServerKeyListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerKeyListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginFailoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginFailoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, callback: ServiceCallback): void; - beginFailoverAllowDataLoss(resourceGroupName: string, serverName: string, databaseName: string, linkId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServerNext(nextPageLink: string, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * ServerAzureADAdministrators + * SyncAgents * __NOTE__: An instance of this class is automatically created for an * instance of the SqlManagementClient. */ -export interface ServerAzureADAdministrators { +export interface SyncAgents { /** - * Creates a new Server Active Directory Administrator or updates an existing - * server Active Directory Administrator. + * Gets a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {object} properties The required parameters for creating or updating - * an Active Directory Administrator. - * - * @param {string} properties.login The server administrator login value. - * - * @param {uuid} properties.sid The server administrator Sid (Secure ID). + * @param {string} serverName The name of the server on which the sync agent is + * hosted. * - * @param {uuid} properties.tenantId The server Active Directory Administrator - * tenant id. + * @param {string} syncAgentName The name of the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6405,31 +12399,23 @@ export interface ServerAzureADAdministrators { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new Server Active Directory Administrator or updates an existing - * server Active Directory Administrator. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {object} properties The required parameters for creating or updating - * an Active Directory Administrator. + * Gets a sync agent. * - * @param {string} properties.login The server administrator login value. + * @param {string} 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. * - * @param {uuid} properties.sid The server administrator Sid (Secure ID). + * @param {string} serverName The name of the server on which the sync agent is + * hosted. * - * @param {uuid} properties.tenantId The server Active Directory Administrator - * tenant id. + * @param {string} syncAgentName The name of the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6443,7 +12429,7 @@ export interface ServerAzureADAdministrators { * * {Promise} A promise is returned. * - * @resolve {ServerAzureADAdministrator} - The deserialized result object. + * @resolve {SyncAgent} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6451,27 +12437,34 @@ export interface ServerAzureADAdministrators { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerAzureADAdministrator} [result] - The deserialized result object if an error did not occur. - * See {@link ServerAzureADAdministrator} for more - * information. + * {SyncAgent} [result] - The deserialized result object if an error did not occur. + * See {@link SyncAgent} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, syncAgentName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, syncAgentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes an existing server Active Directory Administrator. + * Creates or updates a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. + * + * @param {string} syncAgentName The name of the sync agent. + * + * @param {object} parameters The requested sync agent resource state. + * + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6480,20 +12473,28 @@ export interface ServerAzureADAdministrators { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes an existing server Active Directory Administrator. + * Creates or updates a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. + * + * @param {string} syncAgentName The name of the sync agent. + * + * @param {object} parameters The requested sync agent resource state. + * + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6507,7 +12508,7 @@ export interface ServerAzureADAdministrators { * * {Promise} A promise is returned. * - * @resolve {ServerAzureADAdministrator} - The deserialized result object. + * @resolve {SyncAgent} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6515,27 +12516,29 @@ export interface ServerAzureADAdministrators { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerAzureADAdministrator} [result] - The deserialized result object if an error did not occur. - * See {@link ServerAzureADAdministrator} for more - * information. + * {SyncAgent} [result] - The deserialized result object if an error did not occur. + * See {@link SyncAgent} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns an server Administrator. + * Deletes a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. + * + * @param {string} syncAgentName The name of the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6544,20 +12547,23 @@ export interface ServerAzureADAdministrators { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns an server Administrator. + * Deletes a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. + * + * @param {string} syncAgentName The name of the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6571,7 +12577,7 @@ export interface ServerAzureADAdministrators { * * {Promise} A promise is returned. * - * @resolve {ServerAzureADAdministrator} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6579,27 +12585,26 @@ export interface ServerAzureADAdministrators { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerAzureADAdministrator} [result] - The deserialized result object if an error did not occur. - * See {@link ServerAzureADAdministrator} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns a list of server Administrators. + * Lists sync agents in a server. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. * * @param {object} [options] Optional Parameters. * @@ -6608,20 +12613,21 @@ export interface ServerAzureADAdministrators { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns a list of server Administrators. + * Lists sync agents in a server. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. * * @param {object} [options] Optional Parameters. * @@ -6635,7 +12641,7 @@ export interface ServerAzureADAdministrators { * * {Promise} A promise is returned. * - * @resolve {ServerAdministratorListResult} - The deserialized result object. + * @resolve {SyncAgentListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6643,38 +12649,29 @@ export interface ServerAzureADAdministrators { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerAdministratorListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServerAdministratorListResult} for more - * information. + * {SyncAgentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncAgentListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a new Server Active Directory Administrator or updates an existing - * server Active Directory Administrator. + * Generates a sync agent key. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {object} properties The required parameters for creating or updating - * an Active Directory Administrator. - * - * @param {string} properties.login The server administrator login value. - * - * @param {uuid} properties.sid The server administrator Sid (Secure ID). + * @param {string} serverName The name of the server on which the sync agent is + * hosted. * - * @param {uuid} properties.tenantId The server Active Directory Administrator - * tenant id. + * @param {string} syncAgentName The name of the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6683,31 +12680,23 @@ export interface ServerAzureADAdministrators { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + generateKeyWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a new Server Active Directory Administrator or updates an existing - * server Active Directory Administrator. + * Generates a sync agent key. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {object} properties The required parameters for creating or updating - * an Active Directory Administrator. - * - * @param {string} properties.login The server administrator login value. - * - * @param {uuid} properties.sid The server administrator Sid (Secure ID). + * @param {string} serverName The name of the server on which the sync agent is + * hosted. * - * @param {uuid} properties.tenantId The server Active Directory Administrator - * tenant id. + * @param {string} syncAgentName The name of the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6721,7 +12710,7 @@ export interface ServerAzureADAdministrators { * * {Promise} A promise is returned. * - * @resolve {ServerAzureADAdministrator} - The deserialized result object. + * @resolve {SyncAgentKeyProperties} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6729,27 +12718,30 @@ export interface ServerAzureADAdministrators { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerAzureADAdministrator} [result] - The deserialized result object if an error did not occur. - * See {@link ServerAzureADAdministrator} for more + * {SyncAgentKeyProperties} [result] - The deserialized result object if an error did not occur. + * See {@link SyncAgentKeyProperties} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, properties: models.ServerAzureADAdministrator, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + generateKey(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + generateKey(resourceGroupName: string, serverName: string, syncAgentName: string, callback: ServiceCallback): void; + generateKey(resourceGroupName: string, serverName: string, syncAgentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes an existing server Active Directory Administrator. + * Lists databases linked to a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. + * + * @param {string} syncAgentName The name of the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6758,20 +12750,23 @@ export interface ServerAzureADAdministrators { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listLinkedDatabasesWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes an existing server Active Directory Administrator. + * Lists databases linked to a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. + * + * @param {string} syncAgentName The name of the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6785,7 +12780,7 @@ export interface ServerAzureADAdministrators { * * {Promise} A promise is returned. * - * @resolve {ServerAzureADAdministrator} - The deserialized result object. + * @resolve {SyncAgentLinkedDatabaseListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6793,39 +12788,35 @@ export interface ServerAzureADAdministrators { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerAzureADAdministrator} [result] - The deserialized result object if an error did not occur. - * See {@link ServerAzureADAdministrator} for more + * {SyncAgentLinkedDatabaseListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncAgentLinkedDatabaseListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ServerCommunicationLinks - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface ServerCommunicationLinks { + listLinkedDatabases(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listLinkedDatabases(resourceGroupName: string, serverName: string, syncAgentName: string, callback: ServiceCallback): void; + listLinkedDatabases(resourceGroupName: string, serverName: string, syncAgentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a server communication link. + * Creates or updates a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. * - * @param {string} communicationLinkName The name of the server communication - * link. + * @param {string} syncAgentName The name of the sync agent. + * + * @param {object} parameters The requested sync agent resource state. + * + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6834,23 +12825,28 @@ export interface ServerCommunicationLinks { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, communicationLinkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a server communication link. + * Creates or updates a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. * - * @param {string} communicationLinkName The name of the server communication - * link. + * @param {string} syncAgentName The name of the sync agent. + * + * @param {object} parameters The requested sync agent resource state. + * + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6864,7 +12860,7 @@ export interface ServerCommunicationLinks { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {SyncAgent} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6872,28 +12868,29 @@ export interface ServerCommunicationLinks { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {SyncAgent} [result] - The deserialized result object if an error did not occur. + * See {@link SyncAgent} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, communicationLinkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, communicationLinkName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, communicationLinkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns a server communication link. + * Deletes a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. * - * @param {string} communicationLinkName The name of the server communication - * link. + * @param {string} syncAgentName The name of the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6902,23 +12899,23 @@ export interface ServerCommunicationLinks { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, communicationLinkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns a server communication link. + * Deletes a sync agent. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server on which the sync agent is + * hosted. * - * @param {string} communicationLinkName The name of the server communication - * link. + * @param {string} syncAgentName The name of the sync agent. * * @param {object} [options] Optional Parameters. * @@ -6932,7 +12929,7 @@ export interface ServerCommunicationLinks { * * {Promise} A promise is returned. * - * @resolve {ServerCommunicationLink} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -6940,35 +12937,22 @@ export interface ServerCommunicationLinks { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerCommunicationLink} [result] - The deserialized result object if an error did not occur. - * See {@link ServerCommunicationLink} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, communicationLinkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, communicationLinkName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, communicationLinkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates a server communication link. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} communicationLinkName The name of the server communication - * link. - * - * @param {object} parameters The required parameters for creating a server - * communication link. + * Lists sync agents in a server. * - * @param {string} parameters.partnerServer The name of the partner server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -6977,28 +12961,17 @@ export interface ServerCommunicationLinks { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a server communication link. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} communicationLinkName The name of the server communication - * link. - * - * @param {object} parameters The required parameters for creating a server - * communication link. + * Lists sync agents in a server. * - * @param {string} parameters.partnerServer The name of the partner server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -7012,7 +12985,7 @@ export interface ServerCommunicationLinks { * * {Promise} A promise is returned. * - * @resolve {ServerCommunicationLink} - The deserialized result object. + * @resolve {SyncAgentListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7020,27 +12993,23 @@ export interface ServerCommunicationLinks { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerCommunicationLink} [result] - The deserialized result object if an error did not occur. - * See {@link ServerCommunicationLink} for more - * information. + * {SyncAgentListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncAgentListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServerNext(nextPageLink: string, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of server communication links. - * - * @param {string} 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. + * Lists databases linked to a sync agent. * - * @param {string} serverName The name of the server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -7049,20 +13018,17 @@ export interface ServerCommunicationLinks { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listLinkedDatabasesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of server communication links. - * - * @param {string} 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. + * Lists databases linked to a sync agent. * - * @param {string} serverName The name of the server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -7076,7 +13042,7 @@ export interface ServerCommunicationLinks { * * {Promise} A promise is returned. * - * @resolve {ServerCommunicationLinkListResult} - The deserialized result object. + * @resolve {SyncAgentLinkedDatabaseListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7084,35 +13050,33 @@ export interface ServerCommunicationLinks { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerCommunicationLinkListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServerCommunicationLinkListResult} for more + * {SyncAgentLinkedDatabaseListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncAgentLinkedDatabaseListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listLinkedDatabasesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listLinkedDatabasesNext(nextPageLink: string, callback: ServiceCallback): void; + listLinkedDatabasesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SyncGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface SyncGroups { /** - * Creates a server communication link. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} communicationLinkName The name of the server communication - * link. - * - * @param {object} parameters The required parameters for creating a server - * communication link. + * Gets a collection of sync database ids. * - * @param {string} parameters.partnerServer The name of the partner server. + * @param {string} locationName The name of the region where the resource is + * located. * * @param {object} [options] Optional Parameters. * @@ -7121,28 +13085,17 @@ export interface ServerCommunicationLinks { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listSyncDatabaseIdsWithHttpOperationResponse(locationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates a server communication link. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} communicationLinkName The name of the server communication - * link. - * - * @param {object} parameters The required parameters for creating a server - * communication link. + * Gets a collection of sync database ids. * - * @param {string} parameters.partnerServer The name of the partner server. + * @param {string} locationName The name of the region where the resource is + * located. * * @param {object} [options] Optional Parameters. * @@ -7156,7 +13109,7 @@ export interface ServerCommunicationLinks { * * {Promise} A promise is returned. * - * @resolve {ServerCommunicationLink} - The deserialized result object. + * @resolve {SyncDatabaseIdListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7164,30 +13117,21 @@ export interface ServerCommunicationLinks { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerCommunicationLink} [result] - The deserialized result object if an error did not occur. - * See {@link ServerCommunicationLink} for more + * {SyncDatabaseIdListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncDatabaseIdListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, communicationLinkName: string, parameters: models.ServerCommunicationLink, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ServiceObjectives - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface ServiceObjectives { + listSyncDatabaseIds(locationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listSyncDatabaseIds(locationName: string, callback: ServiceCallback): void; + listSyncDatabaseIds(locationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a database service objective. + * Refreshes a hub database schema. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7195,8 +13139,10 @@ export interface ServiceObjectives { * * @param {string} serverName The name of the server. * - * @param {string} serviceObjectiveName The name of the service objective to - * retrieve. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. * * @param {object} [options] Optional Parameters. * @@ -7205,14 +13151,14 @@ export interface ServiceObjectives { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, serviceObjectiveName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + refreshHubSchemaWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a database service objective. + * Refreshes a hub database schema. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7220,8 +13166,10 @@ export interface ServiceObjectives { * * @param {string} serverName The name of the server. * - * @param {string} serviceObjectiveName The name of the service objective to - * retrieve. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. * * @param {object} [options] Optional Parameters. * @@ -7235,7 +13183,7 @@ export interface ServiceObjectives { * * {Promise} A promise is returned. * - * @resolve {ServiceObjective} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7243,20 +13191,19 @@ export interface ServiceObjectives { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServiceObjective} [result] - The deserialized result object if an error did not occur. - * See {@link ServiceObjective} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, serviceObjectiveName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, serviceObjectiveName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, serviceObjectiveName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + refreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + refreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; + refreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns database service objectives. + * Gets a collection of hub database schemas. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7264,6 +13211,11 @@ export interface ServiceObjectives { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7271,14 +13223,14 @@ export interface ServiceObjectives { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listHubSchemasWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns database service objectives. + * Gets a collection of hub database schemas. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7286,6 +13238,11 @@ export interface ServiceObjectives { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7298,7 +13255,7 @@ export interface ServiceObjectives { * * {Promise} A promise is returned. * - * @resolve {ServiceObjectiveListResult} - The deserialized result object. + * @resolve {SyncFullSchemaPropertiesListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7306,59 +13263,82 @@ export interface ServiceObjectives { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServiceObjectiveListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServiceObjectiveListResult} for more + * {SyncFullSchemaPropertiesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncFullSchemaPropertiesListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * Servers - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface Servers { + listHubSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listHubSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; + listHubSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Determines whether a resource can be created with the specified name. + * Gets a collection of sync group logs. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. * - * @param {object} parameters The parameters to request for name availability. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {string} parameters.name The name whose availability is to be - * checked. + * @param {string} syncGroupName The name of the sync group. + * + * @param {string} startTime Get logs generated after this time. + * + * @param {string} endTime Get logs generated before this time. + * + * @param {string} type The types of logs to retrieve. Possible values include: + * 'All', 'Error', 'Warning', 'Success' * * @param {object} [options] Optional Parameters. * + * @param {string} [options.continuationToken] The continuation token for this + * operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - checkNameAvailabilityWithHttpOperationResponse(parameters: models.CheckNameAvailabilityRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listLogsWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, startTime: string, endTime: string, type: string, options?: { continuationToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Determines whether a resource can be created with the specified name. + * Gets a collection of sync group logs. * - * @param {object} parameters The parameters to request for name availability. + * @param {string} 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. * - * @param {string} parameters.name The name whose availability is to be - * checked. + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * + * @param {string} startTime Get logs generated after this time. + * + * @param {string} endTime Get logs generated before this time. + * + * @param {string} type The types of logs to retrieve. Possible values include: + * 'All', 'Error', 'Warning', 'Success' * * @param {object} [options] Optional Parameters. * + * @param {string} [options.continuationToken] The continuation token for this + * operation. + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -7369,7 +13349,7 @@ export interface Servers { * * {Promise} A promise is returned. * - * @resolve {CheckNameAvailabilityResponse} - The deserialized result object. + * @resolve {SyncGroupLogListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7377,21 +13357,32 @@ export interface Servers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {CheckNameAvailabilityResponse} [result] - The deserialized result object if an error did not occur. - * See {@link CheckNameAvailabilityResponse} for more + * {SyncGroupLogListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroupLogListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - checkNameAvailability(parameters: models.CheckNameAvailabilityRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - checkNameAvailability(parameters: models.CheckNameAvailabilityRequest, callback: ServiceCallback): void; - checkNameAvailability(parameters: models.CheckNameAvailabilityRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listLogs(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, startTime: string, endTime: string, type: string, options?: { continuationToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listLogs(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, startTime: string, endTime: string, type: string, callback: ServiceCallback): void; + listLogs(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, startTime: string, endTime: string, type: string, options: { continuationToken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of all servers in the subscription. + * Cancels a sync group synchronization. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. * * @param {object} [options] Optional Parameters. * @@ -7400,14 +13391,25 @@ export interface Servers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + cancelSyncWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of all servers in the subscription. + * Cancels a sync group synchronization. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. * * @param {object} [options] Optional Parameters. * @@ -7421,7 +13423,7 @@ export interface Servers { * * {Promise} A promise is returned. * - * @resolve {ServerListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7429,25 +13431,31 @@ export interface Servers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServerListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + cancelSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + cancelSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; + cancelSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of servers in a resource groups. + * Triggers a sync group synchronization. * * @param {string} 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. * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7455,19 +13463,26 @@ export interface Servers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + triggerSyncWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of servers in a resource groups. + * Triggers a sync group synchronization. * * @param {string} 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. * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7480,7 +13495,7 @@ export interface Servers { * * {Promise} A promise is returned. * - * @resolve {ServerListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7488,20 +13503,19 @@ export interface Servers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServerListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + triggerSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + triggerSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; + triggerSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a server. + * Gets a sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7509,6 +13523,11 @@ export interface Servers { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7516,14 +13535,14 @@ export interface Servers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a server. + * Gets a sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7531,6 +13550,11 @@ export interface Servers { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7543,7 +13567,7 @@ export interface Servers { * * {Promise} A promise is returned. * - * @resolve {Server} - The deserialized result object. + * @resolve {SyncGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7551,20 +13575,20 @@ export interface Servers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Server} [result] - The deserialized result object if an error did not occur. - * See {@link Server} for more information. + * {SyncGroup} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroup} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a server. + * Creates or updates a sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7572,27 +13596,34 @@ export interface Servers { * * @param {string} serverName The name of the server. * - * @param {object} parameters The requested server resource state. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {object} [parameters.identity] The Azure Active Directory identity of - * the server. + * @param {string} syncGroupName The name of the sync group. * - * @param {string} [parameters.identity.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' + * @param {object} parameters The requested sync group resource state. * - * @param {string} [parameters.administratorLogin] Administrator username for - * the server. Once created it cannot be changed. + * @param {number} [parameters.interval] Sync interval of the sync group. * - * @param {string} [parameters.administratorLoginPassword] The administrator - * login password (required for server creation). + * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution + * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' * - * @param {string} [parameters.version] The version of the server. + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync group. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} [parameters.hubDatabaseUserName] User name for the sync + * group hub database credential. * - * @param {string} parameters.location Resource location. + * @param {string} [parameters.hubDatabasePassword] Password for the sync group + * hub database credential. + * + * @param {object} [parameters.schema] Sync schema of the sync group. + * + * @param {array} [parameters.schema.tables] List of tables in sync group + * schema. + * + * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync + * member where the schema is from. * * @param {object} [options] Optional Parameters. * @@ -7601,14 +13632,14 @@ export interface Servers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.Server, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a server. + * Creates or updates a sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7616,27 +13647,34 @@ export interface Servers { * * @param {string} serverName The name of the server. * - * @param {object} parameters The requested server resource state. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {object} [parameters.identity] The Azure Active Directory identity of - * the server. + * @param {string} syncGroupName The name of the sync group. * - * @param {string} [parameters.identity.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' + * @param {object} parameters The requested sync group resource state. * - * @param {string} [parameters.administratorLogin] Administrator username for - * the server. Once created it cannot be changed. + * @param {number} [parameters.interval] Sync interval of the sync group. * - * @param {string} [parameters.administratorLoginPassword] The administrator - * login password (required for server creation). + * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution + * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' * - * @param {string} [parameters.version] The version of the server. + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync group. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} [parameters.hubDatabaseUserName] User name for the sync + * group hub database credential. * - * @param {string} parameters.location Resource location. + * @param {string} [parameters.hubDatabasePassword] Password for the sync group + * hub database credential. + * + * @param {object} [parameters.schema] Sync schema of the sync group. + * + * @param {array} [parameters.schema.tables] List of tables in sync group + * schema. + * + * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync + * member where the schema is from. * * @param {object} [options] Optional Parameters. * @@ -7650,7 +13688,7 @@ export interface Servers { * * {Promise} A promise is returned. * - * @resolve {Server} - The deserialized result object. + * @resolve {SyncGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7658,20 +13696,20 @@ export interface Servers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Server} [result] - The deserialized result object if an error did not occur. - * See {@link Server} for more information. + * {SyncGroup} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroup} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a server. + * Deletes a sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7679,6 +13717,11 @@ export interface Servers { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7690,10 +13733,10 @@ export interface Servers { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a server. + * Deletes a sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7701,6 +13744,11 @@ export interface Servers { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7727,13 +13775,13 @@ export interface Servers { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates a server. + * Updates a sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7741,17 +13789,34 @@ export interface Servers { * * @param {string} serverName The name of the server. * - * @param {object} parameters The requested server resource state. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {string} [parameters.administratorLogin] Administrator username for - * the server. Once created it cannot be changed. + * @param {string} syncGroupName The name of the sync group. * - * @param {string} [parameters.administratorLoginPassword] The administrator - * login password (required for server creation). + * @param {object} parameters The requested sync group resource state. * - * @param {string} [parameters.version] The version of the server. + * @param {number} [parameters.interval] Sync interval of the sync group. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution + * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' + * + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync group. + * + * @param {string} [parameters.hubDatabaseUserName] User name for the sync + * group hub database credential. + * + * @param {string} [parameters.hubDatabasePassword] Password for the sync group + * hub database credential. + * + * @param {object} [parameters.schema] Sync schema of the sync group. + * + * @param {array} [parameters.schema.tables] List of tables in sync group + * schema. + * + * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync + * member where the schema is from. * * @param {object} [options] Optional Parameters. * @@ -7760,14 +13825,14 @@ export interface Servers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates a server. + * Updates a sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7775,17 +13840,34 @@ export interface Servers { * * @param {string} serverName The name of the server. * - * @param {object} parameters The requested server resource state. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {string} [parameters.administratorLogin] Administrator username for - * the server. Once created it cannot be changed. + * @param {string} syncGroupName The name of the sync group. * - * @param {string} [parameters.administratorLoginPassword] The administrator - * login password (required for server creation). + * @param {object} parameters The requested sync group resource state. * - * @param {string} [parameters.version] The version of the server. + * @param {number} [parameters.interval] Sync interval of the sync group. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution + * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' + * + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync group. + * + * @param {string} [parameters.hubDatabaseUserName] User name for the sync + * group hub database credential. + * + * @param {string} [parameters.hubDatabasePassword] Password for the sync group + * hub database credential. + * + * @param {object} [parameters.schema] Sync schema of the sync group. + * + * @param {array} [parameters.schema.tables] List of tables in sync group + * schema. + * + * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync + * member where the schema is from. * * @param {object} [options] Optional Parameters. * @@ -7799,7 +13881,7 @@ export interface Servers { * * {Promise} A promise is returned. * - * @resolve {Server} - The deserialized result object. + * @resolve {SyncGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7807,20 +13889,20 @@ export interface Servers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Server} [result] - The deserialized result object if an error did not occur. - * See {@link Server} for more information. + * {SyncGroup} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroup} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, callback: ServiceCallback): void; - update(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a server. + * Lists sync groups under a hub database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7828,27 +13910,8 @@ export interface Servers { * * @param {string} serverName The name of the server. * - * @param {object} parameters The requested server resource state. - * - * @param {object} [parameters.identity] The Azure Active Directory identity of - * the server. - * - * @param {string} [parameters.identity.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' - * - * @param {string} [parameters.administratorLogin] Administrator username for - * the server. Once created it cannot be changed. - * - * @param {string} [parameters.administratorLoginPassword] The administrator - * login password (required for server creation). - * - * @param {string} [parameters.version] The version of the server. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} parameters.location Resource location. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * * @param {object} [options] Optional Parameters. * @@ -7857,14 +13920,14 @@ export interface Servers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.Server, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a server. + * Lists sync groups under a hub database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7872,27 +13935,8 @@ export interface Servers { * * @param {string} serverName The name of the server. * - * @param {object} parameters The requested server resource state. - * - * @param {object} [parameters.identity] The Azure Active Directory identity of - * the server. - * - * @param {string} [parameters.identity.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' - * - * @param {string} [parameters.administratorLogin] Administrator username for - * the server. Once created it cannot be changed. - * - * @param {string} [parameters.administratorLoginPassword] The administrator - * login password (required for server creation). - * - * @param {string} [parameters.version] The version of the server. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {string} parameters.location Resource location. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * * @param {object} [options] Optional Parameters. * @@ -7906,7 +13950,7 @@ export interface Servers { * * {Promise} A promise is returned. * - * @resolve {Server} - The deserialized result object. + * @resolve {SyncGroupListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -7914,20 +13958,20 @@ export interface Servers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Server} [result] - The deserialized result object if an error did not occur. - * See {@link Server} for more information. + * {SyncGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroupListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.Server, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a server. + * Refreshes a hub database schema. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7935,6 +13979,11 @@ export interface Servers { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7946,10 +13995,10 @@ export interface Servers { * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginRefreshHubSchemaWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a server. + * Refreshes a hub database schema. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7957,6 +14006,11 @@ export interface Servers { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -7983,13 +14037,13 @@ export interface Servers { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginRefreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginRefreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; + beginRefreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates a server. + * Creates or updates a sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -7997,17 +14051,34 @@ export interface Servers { * * @param {string} serverName The name of the server. * - * @param {object} parameters The requested server resource state. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {string} [parameters.administratorLogin] Administrator username for - * the server. Once created it cannot be changed. + * @param {string} syncGroupName The name of the sync group. * - * @param {string} [parameters.administratorLoginPassword] The administrator - * login password (required for server creation). + * @param {object} parameters The requested sync group resource state. * - * @param {string} [parameters.version] The version of the server. + * @param {number} [parameters.interval] Sync interval of the sync group. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution + * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' + * + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync group. + * + * @param {string} [parameters.hubDatabaseUserName] User name for the sync + * group hub database credential. + * + * @param {string} [parameters.hubDatabasePassword] Password for the sync group + * hub database credential. + * + * @param {object} [parameters.schema] Sync schema of the sync group. + * + * @param {array} [parameters.schema.tables] List of tables in sync group + * schema. + * + * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync + * member where the schema is from. * * @param {object} [options] Optional Parameters. * @@ -8016,14 +14087,14 @@ export interface Servers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates a server. + * Creates or updates a sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8031,17 +14102,34 @@ export interface Servers { * * @param {string} serverName The name of the server. * - * @param {object} parameters The requested server resource state. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {string} [parameters.administratorLogin] Administrator username for - * the server. Once created it cannot be changed. + * @param {string} syncGroupName The name of the sync group. * - * @param {string} [parameters.administratorLoginPassword] The administrator - * login password (required for server creation). + * @param {object} parameters The requested sync group resource state. * - * @param {string} [parameters.version] The version of the server. + * @param {number} [parameters.interval] Sync interval of the sync group. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution + * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' + * + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync group. + * + * @param {string} [parameters.hubDatabaseUserName] User name for the sync + * group hub database credential. + * + * @param {string} [parameters.hubDatabasePassword] Password for the sync group + * hub database credential. + * + * @param {object} [parameters.schema] Sync schema of the sync group. + * + * @param {array} [parameters.schema.tables] List of tables in sync group + * schema. + * + * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync + * member where the schema is from. * * @param {object} [options] Optional Parameters. * @@ -8055,7 +14143,7 @@ export interface Servers { * * {Promise} A promise is returned. * - * @resolve {Server} - The deserialized result object. + * @resolve {SyncGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8063,23 +14151,31 @@ export interface Servers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {Server} [result] - The deserialized result object if an error did not occur. - * See {@link Server} for more information. + * {SyncGroup} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroup} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, callback: ServiceCallback): void; - beginUpdate(resourceGroupName: string, serverName: string, parameters: models.ServerUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of all servers in the subscription. + * Deletes a sync group. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. * * @param {object} [options] Optional Parameters. * @@ -8088,17 +14184,25 @@ export interface Servers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of all servers in the subscription. + * Deletes a sync group. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. * * @param {object} [options] Optional Parameters. * @@ -8112,7 +14216,7 @@ export interface Servers { * * {Promise} A promise is returned. * - * @resolve {ServerListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8120,23 +14224,54 @@ export interface Servers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServerListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listNext(nextPageLink: string, callback: ServiceCallback): void; - listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of servers in a resource groups. + * Updates a sync group. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * + * @param {object} parameters The requested sync group resource state. + * + * @param {number} [parameters.interval] Sync interval of the sync group. + * + * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution + * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' + * + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync group. + * + * @param {string} [parameters.hubDatabaseUserName] User name for the sync + * group hub database credential. + * + * @param {string} [parameters.hubDatabasePassword] Password for the sync group + * hub database credential. + * + * @param {object} [parameters.schema] Sync schema of the sync group. + * + * @param {array} [parameters.schema.tables] List of tables in sync group + * schema. + * + * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync + * member where the schema is from. * * @param {object} [options] Optional Parameters. * @@ -8145,17 +14280,49 @@ export interface Servers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of servers in a resource groups. + * Updates a sync group. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. + * + * @param {object} parameters The requested sync group resource state. + * + * @param {number} [parameters.interval] Sync interval of the sync group. + * + * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution + * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' + * + * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync + * database in the sync group. + * + * @param {string} [parameters.hubDatabaseUserName] User name for the sync + * group hub database credential. + * + * @param {string} [parameters.hubDatabasePassword] Password for the sync group + * hub database credential. + * + * @param {object} [parameters.schema] Sync schema of the sync group. + * + * @param {array} [parameters.schema.tables] List of tables in sync group + * schema. + * + * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync + * member where the schema is from. * * @param {object} [options] Optional Parameters. * @@ -8169,7 +14336,7 @@ export interface Servers { * * {Promise} A promise is returned. * - * @resolve {ServerListResult} - The deserialized result object. + * @resolve {SyncGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8177,38 +14344,23 @@ export interface Servers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServerListResult} for more information. + * {SyncGroup} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroup} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; - listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ElasticPoolActivities - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface ElasticPoolActivities { + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns elastic pool activities. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a collection of sync database ids. * - * @param {string} elasticPoolName The name of the elastic pool for which to - * get the current activity. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8217,23 +14369,17 @@ export interface ElasticPoolActivities { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByElasticPoolWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listSyncDatabaseIdsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns elastic pool activities. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a collection of sync database ids. * - * @param {string} elasticPoolName The name of the elastic pool for which to - * get the current activity. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8247,7 +14393,7 @@ export interface ElasticPoolActivities { * * {Promise} A promise is returned. * - * @resolve {ElasticPoolActivityListResult} - The deserialized result object. + * @resolve {SyncDatabaseIdListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8255,38 +14401,24 @@ export interface ElasticPoolActivities { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ElasticPoolActivityListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPoolActivityListResult} for more + * {SyncDatabaseIdListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncDatabaseIdListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; - listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ElasticPoolDatabaseActivities - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface ElasticPoolDatabaseActivities { + listSyncDatabaseIdsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listSyncDatabaseIdsNext(nextPageLink: string, callback: ServiceCallback): void; + listSyncDatabaseIdsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns activity on databases inside of an elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a collection of hub database schemas. * - * @param {string} elasticPoolName The name of the elastic pool. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8295,22 +14427,17 @@ export interface ElasticPoolDatabaseActivities { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByElasticPoolWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listHubSchemasNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns activity on databases inside of an elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a collection of hub database schemas. * - * @param {string} elasticPoolName The name of the elastic pool. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8324,7 +14451,7 @@ export interface ElasticPoolDatabaseActivities { * * {Promise} A promise is returned. * - * @resolve {ElasticPoolDatabaseActivityListResult} - The deserialized result object. + * @resolve {SyncFullSchemaPropertiesListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8332,39 +14459,24 @@ export interface ElasticPoolDatabaseActivities { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ElasticPoolDatabaseActivityListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ElasticPoolDatabaseActivityListResult} for - * more information. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; - listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * RecommendedElasticPools - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface RecommendedElasticPools { + * {SyncFullSchemaPropertiesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncFullSchemaPropertiesListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listHubSchemasNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listHubSchemasNext(nextPageLink: string, callback: ServiceCallback): void; + listHubSchemasNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a recommented elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a collection of sync group logs. * - * @param {string} recommendedElasticPoolName The name of the recommended - * elastic pool to be retrieved. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8373,23 +14485,17 @@ export interface RecommendedElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listLogsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a recommented elastic pool. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a collection of sync group logs. * - * @param {string} recommendedElasticPoolName The name of the recommended - * elastic pool to be retrieved. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8403,7 +14509,7 @@ export interface RecommendedElasticPools { * * {Promise} A promise is returned. * - * @resolve {RecommendedElasticPool} - The deserialized result object. + * @resolve {SyncGroupLogListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8411,27 +14517,24 @@ export interface RecommendedElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RecommendedElasticPool} [result] - The deserialized result object if an error did not occur. - * See {@link RecommendedElasticPool} for more + * {SyncGroupLogListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroupLogListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listLogsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listLogsNext(nextPageLink: string, callback: ServiceCallback): void; + listLogsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns recommended elastic pools. - * - * @param {string} 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. + * Lists sync groups under a hub database. * - * @param {string} serverName The name of the server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8440,20 +14543,17 @@ export interface RecommendedElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns recommended elastic pools. - * - * @param {string} 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. + * Lists sync groups under a hub database. * - * @param {string} serverName The name of the server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -8467,7 +14567,7 @@ export interface RecommendedElasticPools { * * {Promise} A promise is returned. * - * @resolve {RecommendedElasticPoolListResult} - The deserialized result object. + * @resolve {SyncGroupListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8475,21 +14575,29 @@ export interface RecommendedElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RecommendedElasticPoolListResult} [result] - The deserialized result object if an error did not occur. - * See {@link RecommendedElasticPoolListResult} for more - * information. + * {SyncGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncGroupListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabaseNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabaseNext(nextPageLink: string, callback: ServiceCallback): void; + listByDatabaseNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SyncMembers + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface SyncMembers { /** - * Returns recommented elastic pool metrics. + * Gets a sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8497,8 +14605,13 @@ export interface RecommendedElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} recommendedElasticPoolName The name of the recommended - * elastic pool to be retrieved. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. * * @param {object} [options] Optional Parameters. * @@ -8507,14 +14620,14 @@ export interface RecommendedElasticPools { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listMetricsWithHttpOperationResponse(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns recommented elastic pool metrics. + * Gets a sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8522,8 +14635,13 @@ export interface RecommendedElasticPools { * * @param {string} serverName The name of the server. * - * @param {string} recommendedElasticPoolName The name of the recommended - * elastic pool to be retrieved. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. * * @param {object} [options] Optional Parameters. * @@ -8537,7 +14655,7 @@ export interface RecommendedElasticPools { * * {Promise} A promise is returned. * - * @resolve {RecommendedElasticPoolListMetricsResult} - The deserialized result object. + * @resolve {SyncMember} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8545,30 +14663,20 @@ export interface RecommendedElasticPools { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {RecommendedElasticPoolListMetricsResult} [result] - The deserialized result object if an error did not occur. - * See {@link RecommendedElasticPoolListMetricsResult} for - * more information. + * {SyncMember} [result] - The deserialized result object if an error did not occur. + * See {@link SyncMember} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listMetrics(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listMetrics(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, callback: ServiceCallback): void; - listMetrics(resourceGroupName: string, serverName: string, recommendedElasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ServiceTierAdvisors - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface ServiceTierAdvisors { + get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a service tier advisor. + * Creates or updates a sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8576,9 +14684,40 @@ export interface ServiceTierAdvisors { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of database. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {string} serviceTierAdvisorName The name of service tier advisor. + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. + * + * @param {object} parameters The requested sync member resource state. + * + * @param {string} [parameters.databaseType] Database type of the sync member. + * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * + * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent + * in the sync member. + * + * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the + * sync member. + * + * @param {string} [parameters.serverName] Server name of the member database + * in the sync member + * + * @param {string} [parameters.databaseName] Database name of the member + * database in the sync member. + * + * @param {string} [parameters.userName] User name of the member database in + * the sync member. + * + * @param {string} [parameters.password] Password of the member database in the + * sync member. + * + * @param {string} [parameters.syncDirection] Sync direction of the sync + * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', + * 'OneWayHubToMember' * * @param {object} [options] Optional Parameters. * @@ -8587,14 +14726,14 @@ export interface ServiceTierAdvisors { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, serviceTierAdvisorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a service tier advisor. + * Creates or updates a sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8602,9 +14741,40 @@ export interface ServiceTierAdvisors { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of database. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {string} serviceTierAdvisorName The name of service tier advisor. + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. + * + * @param {object} parameters The requested sync member resource state. + * + * @param {string} [parameters.databaseType] Database type of the sync member. + * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * + * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent + * in the sync member. + * + * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the + * sync member. + * + * @param {string} [parameters.serverName] Server name of the member database + * in the sync member + * + * @param {string} [parameters.databaseName] Database name of the member + * database in the sync member. + * + * @param {string} [parameters.userName] User name of the member database in + * the sync member. + * + * @param {string} [parameters.password] Password of the member database in the + * sync member. + * + * @param {string} [parameters.syncDirection] Sync direction of the sync + * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', + * 'OneWayHubToMember' * * @param {object} [options] Optional Parameters. * @@ -8618,7 +14788,7 @@ export interface ServiceTierAdvisors { * * {Promise} A promise is returned. * - * @resolve {ServiceTierAdvisor} - The deserialized result object. + * @resolve {SyncMember} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8626,20 +14796,20 @@ export interface ServiceTierAdvisors { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServiceTierAdvisor} [result] - The deserialized result object if an error did not occur. - * See {@link ServiceTierAdvisor} for more information. + * {SyncMember} [result] - The deserialized result object if an error did not occur. + * See {@link SyncMember} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, serviceTierAdvisorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, serviceTierAdvisorName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, serviceTierAdvisorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns service tier advisors for specified database. + * Deletes a sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8647,7 +14817,13 @@ export interface ServiceTierAdvisors { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of database. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. * * @param {object} [options] Optional Parameters. * @@ -8656,14 +14832,14 @@ export interface ServiceTierAdvisors { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns service tier advisors for specified database. + * Deletes a sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8671,7 +14847,13 @@ export interface ServiceTierAdvisors { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of database. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. * * @param {object} [options] Optional Parameters. * @@ -8685,7 +14867,7 @@ export interface ServiceTierAdvisors { * * {Promise} A promise is returned. * - * @resolve {ServiceTierAdvisorListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8693,30 +14875,19 @@ export interface ServiceTierAdvisors { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServiceTierAdvisorListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServiceTierAdvisorListResult} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * TransparentDataEncryptions - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface TransparentDataEncryptions { + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a database's transparent data encryption configuration. + * Updates an existing sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8724,14 +14895,40 @@ export interface TransparentDataEncryptions { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database for which setting the - * transparent data encryption applies. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {object} parameters The required parameters for creating or updating - * transparent data encryption. + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. * - * @param {string} [parameters.status] The status of the database transparent - * data encryption. Possible values include: 'Enabled', 'Disabled' + * @param {string} syncMemberName The name of the sync member. + * + * @param {object} parameters The requested sync member resource state. + * + * @param {string} [parameters.databaseType] Database type of the sync member. + * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * + * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent + * in the sync member. + * + * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the + * sync member. + * + * @param {string} [parameters.serverName] Server name of the member database + * in the sync member + * + * @param {string} [parameters.databaseName] Database name of the member + * database in the sync member. + * + * @param {string} [parameters.userName] User name of the member database in + * the sync member. + * + * @param {string} [parameters.password] Password of the member database in the + * sync member. + * + * @param {string} [parameters.syncDirection] Sync direction of the sync + * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', + * 'OneWayHubToMember' * * @param {object} [options] Optional Parameters. * @@ -8740,14 +14937,14 @@ export interface TransparentDataEncryptions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.TransparentDataEncryption, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a database's transparent data encryption configuration. + * Updates an existing sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8755,14 +14952,40 @@ export interface TransparentDataEncryptions { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database for which setting the - * transparent data encryption applies. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {object} parameters The required parameters for creating or updating - * transparent data encryption. + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. * - * @param {string} [parameters.status] The status of the database transparent - * data encryption. Possible values include: 'Enabled', 'Disabled' + * @param {string} syncMemberName The name of the sync member. + * + * @param {object} parameters The requested sync member resource state. + * + * @param {string} [parameters.databaseType] Database type of the sync member. + * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * + * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent + * in the sync member. + * + * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the + * sync member. + * + * @param {string} [parameters.serverName] Server name of the member database + * in the sync member + * + * @param {string} [parameters.databaseName] Database name of the member + * database in the sync member. + * + * @param {string} [parameters.userName] User name of the member database in + * the sync member. + * + * @param {string} [parameters.password] Password of the member database in the + * sync member. + * + * @param {string} [parameters.syncDirection] Sync direction of the sync + * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', + * 'OneWayHubToMember' * * @param {object} [options] Optional Parameters. * @@ -8776,7 +14999,7 @@ export interface TransparentDataEncryptions { * * {Promise} A promise is returned. * - * @resolve {TransparentDataEncryption} - The deserialized result object. + * @resolve {SyncMember} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8784,21 +15007,20 @@ export interface TransparentDataEncryptions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {TransparentDataEncryption} [result] - The deserialized result object if an error did not occur. - * See {@link TransparentDataEncryption} for more - * information. + * {SyncMember} [result] - The deserialized result object if an error did not occur. + * See {@link SyncMember} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.TransparentDataEncryption, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.TransparentDataEncryption, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.TransparentDataEncryption, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a database's transparent data encryption configuration. + * Lists sync members in the given sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8806,8 +15028,10 @@ export interface TransparentDataEncryptions { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database for which the - * transparent data encryption applies. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. * * @param {object} [options] Optional Parameters. * @@ -8816,14 +15040,14 @@ export interface TransparentDataEncryptions { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBySyncGroupWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a database's transparent data encryption configuration. + * Lists sync members in the given sync group. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8831,8 +15055,10 @@ export interface TransparentDataEncryptions { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database for which the - * transparent data encryption applies. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group. * * @param {object} [options] Optional Parameters. * @@ -8846,7 +15072,7 @@ export interface TransparentDataEncryptions { * * {Promise} A promise is returned. * - * @resolve {TransparentDataEncryption} - The deserialized result object. + * @resolve {SyncMemberListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8854,30 +15080,20 @@ export interface TransparentDataEncryptions { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {TransparentDataEncryption} [result] - The deserialized result object if an error did not occur. - * See {@link TransparentDataEncryption} for more - * information. + * {SyncMemberListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncMemberListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * TransparentDataEncryptionActivities - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface TransparentDataEncryptionActivities { + listBySyncGroup(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySyncGroup(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; + listBySyncGroup(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns a database's transparent data encryption operation result. + * Gets a sync member database schema. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8885,8 +15101,13 @@ export interface TransparentDataEncryptionActivities { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database for which the - * transparent data encryption applies. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. * * @param {object} [options] Optional Parameters. * @@ -8895,14 +15116,14 @@ export interface TransparentDataEncryptionActivities { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByConfigurationWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listMemberSchemasWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns a database's transparent data encryption operation result. + * Gets a sync member database schema. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8910,8 +15131,13 @@ export interface TransparentDataEncryptionActivities { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database for which the - * transparent data encryption applies. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. * * @param {object} [options] Optional Parameters. * @@ -8925,7 +15151,7 @@ export interface TransparentDataEncryptionActivities { * * {Promise} A promise is returned. * - * @resolve {TransparentDataEncryptionActivityListResult} - The deserialized result object. + * @resolve {SyncFullSchemaPropertiesListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -8933,30 +15159,21 @@ export interface TransparentDataEncryptionActivities { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {TransparentDataEncryptionActivityListResult} [result] - The deserialized result object if an error did not occur. - * See {@link TransparentDataEncryptionActivityListResult} - * for more information. + * {SyncFullSchemaPropertiesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncFullSchemaPropertiesListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByConfiguration(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByConfiguration(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - listByConfiguration(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ServerUsages - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface ServerUsages { + listMemberSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listMemberSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; + listMemberSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns server usages. + * Refreshes a sync member database schema. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8964,6 +15181,14 @@ export interface ServerUsages { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -8971,14 +15196,14 @@ export interface ServerUsages { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + refreshMemberSchemaWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns server usages. + * Refreshes a sync member database schema. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -8986,6 +15211,14 @@ export interface ServerUsages { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -8998,37 +15231,27 @@ export interface ServerUsages { * * {Promise} A promise is returned. * - * @resolve {ServerUsageListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * - * {ServiceCallback} optionalCallback(err, result, request, response) - * - * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. - * - * {ServerUsageListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServerUsageListResult} for more information. - * - * {WebResource} [request] - The HTTP Request object if an error did not occur. - * - * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DatabaseUsages - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface DatabaseUsages { + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + refreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + refreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; + refreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Returns database usages. + * Creates or updates a sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -9036,7 +15259,40 @@ export interface DatabaseUsages { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. + * + * @param {object} parameters The requested sync member resource state. + * + * @param {string} [parameters.databaseType] Database type of the sync member. + * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * + * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent + * in the sync member. + * + * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the + * sync member. + * + * @param {string} [parameters.serverName] Server name of the member database + * in the sync member + * + * @param {string} [parameters.databaseName] Database name of the member + * database in the sync member. + * + * @param {string} [parameters.userName] User name of the member database in + * the sync member. + * + * @param {string} [parameters.password] Password of the member database in the + * sync member. + * + * @param {string} [parameters.syncDirection] Sync direction of the sync + * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', + * 'OneWayHubToMember' * * @param {object} [options] Optional Parameters. * @@ -9045,14 +15301,14 @@ export interface DatabaseUsages { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Returns database usages. + * Creates or updates a sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -9060,7 +15316,40 @@ export interface DatabaseUsages { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. + * + * @param {object} parameters The requested sync member resource state. + * + * @param {string} [parameters.databaseType] Database type of the sync member. + * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * + * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent + * in the sync member. + * + * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the + * sync member. + * + * @param {string} [parameters.serverName] Server name of the member database + * in the sync member + * + * @param {string} [parameters.databaseName] Database name of the member + * database in the sync member. + * + * @param {string} [parameters.userName] User name of the member database in + * the sync member. + * + * @param {string} [parameters.password] Password of the member database in the + * sync member. + * + * @param {string} [parameters.syncDirection] Sync direction of the sync + * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', + * 'OneWayHubToMember' * * @param {object} [options] Optional Parameters. * @@ -9074,7 +15363,7 @@ export interface DatabaseUsages { * * {Promise} A promise is returned. * - * @resolve {DatabaseUsageListResult} - The deserialized result object. + * @resolve {SyncMember} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9082,30 +15371,20 @@ export interface DatabaseUsages { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DatabaseUsageListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseUsageListResult} for more - * information. + * {SyncMember} [result] - The deserialized result object if an error did not occur. + * See {@link SyncMember} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DatabaseBlobAuditingPolicies - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface DatabaseBlobAuditingPolicies { + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a database's blob auditing policy. + * Deletes a sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -9113,8 +15392,13 @@ export interface DatabaseBlobAuditingPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database for which the blob - * audit policy is defined. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. * * @param {object} [options] Optional Parameters. * @@ -9123,14 +15407,14 @@ export interface DatabaseBlobAuditingPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a database's blob auditing policy. + * Deletes a sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -9138,8 +15422,13 @@ export interface DatabaseBlobAuditingPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database for which the blob - * audit policy is defined. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. * * @param {object} [options] Optional Parameters. * @@ -9153,7 +15442,7 @@ export interface DatabaseBlobAuditingPolicies { * * {Promise} A promise is returned. * - * @resolve {DatabaseBlobAuditingPolicy} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9161,21 +15450,19 @@ export interface DatabaseBlobAuditingPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DatabaseBlobAuditingPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseBlobAuditingPolicy} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a database's blob auditing policy. + * Updates an existing sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -9183,34 +15470,40 @@ export interface DatabaseBlobAuditingPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database for which the blob - * auditing policy will be defined. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {object} parameters The database blob auditing policy. + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. * - * @param {string} parameters.state Specifies the state of the policy. If state - * is Enabled, storageEndpoint and storageAccountAccessKey are required. - * Possible values include: 'Enabled', 'Disabled' + * @param {string} syncMemberName The name of the sync member. * - * @param {string} [parameters.storageEndpoint] Specifies the blob storage - * endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is - * Enabled, storageEndpoint is required. + * @param {object} parameters The requested sync member resource state. * - * @param {string} [parameters.storageAccountAccessKey] Specifies the - * identifier key of the auditing storage account. If state is Enabled, - * storageAccountAccessKey is required. + * @param {string} [parameters.databaseType] Database type of the sync member. + * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' * - * @param {number} [parameters.retentionDays] Specifies the number of days to - * keep in the audit logs. + * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent + * in the sync member. * - * @param {array} [parameters.auditActionsAndGroups] Specifies the Actions and - * Actions-Groups to audit. + * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the + * sync member. * - * @param {uuid} [parameters.storageAccountSubscriptionId] Specifies the blob - * storage subscription Id. + * @param {string} [parameters.serverName] Server name of the member database + * in the sync member * - * @param {boolean} [parameters.isStorageSecondaryKeyInUse] Specifies whether - * storageAccountAccessKey value is the storage’s secondary key. + * @param {string} [parameters.databaseName] Database name of the member + * database in the sync member. + * + * @param {string} [parameters.userName] User name of the member database in + * the sync member. + * + * @param {string} [parameters.password] Password of the member database in the + * sync member. + * + * @param {string} [parameters.syncDirection] Sync direction of the sync + * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', + * 'OneWayHubToMember' * * @param {object} [options] Optional Parameters. * @@ -9219,14 +15512,14 @@ export interface DatabaseBlobAuditingPolicies { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseBlobAuditingPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a database's blob auditing policy. + * Updates an existing sync member. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -9234,34 +15527,40 @@ export interface DatabaseBlobAuditingPolicies { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database for which the blob - * auditing policy will be defined. + * @param {string} databaseName The name of the database on which the sync + * group is hosted. * - * @param {object} parameters The database blob auditing policy. + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. * - * @param {string} parameters.state Specifies the state of the policy. If state - * is Enabled, storageEndpoint and storageAccountAccessKey are required. - * Possible values include: 'Enabled', 'Disabled' + * @param {string} syncMemberName The name of the sync member. * - * @param {string} [parameters.storageEndpoint] Specifies the blob storage - * endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is - * Enabled, storageEndpoint is required. + * @param {object} parameters The requested sync member resource state. * - * @param {string} [parameters.storageAccountAccessKey] Specifies the - * identifier key of the auditing storage account. If state is Enabled, - * storageAccountAccessKey is required. + * @param {string} [parameters.databaseType] Database type of the sync member. + * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' * - * @param {number} [parameters.retentionDays] Specifies the number of days to - * keep in the audit logs. + * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent + * in the sync member. * - * @param {array} [parameters.auditActionsAndGroups] Specifies the Actions and - * Actions-Groups to audit. + * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the + * sync member. * - * @param {uuid} [parameters.storageAccountSubscriptionId] Specifies the blob - * storage subscription Id. + * @param {string} [parameters.serverName] Server name of the member database + * in the sync member * - * @param {boolean} [parameters.isStorageSecondaryKeyInUse] Specifies whether - * storageAccountAccessKey value is the storage’s secondary key. + * @param {string} [parameters.databaseName] Database name of the member + * database in the sync member. + * + * @param {string} [parameters.userName] User name of the member database in + * the sync member. + * + * @param {string} [parameters.password] Password of the member database in the + * sync member. + * + * @param {string} [parameters.syncDirection] Sync direction of the sync + * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', + * 'OneWayHubToMember' * * @param {object} [options] Optional Parameters. * @@ -9275,7 +15574,7 @@ export interface DatabaseBlobAuditingPolicies { * * {Promise} A promise is returned. * - * @resolve {DatabaseBlobAuditingPolicy} - The deserialized result object. + * @resolve {SyncMember} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9283,30 +15582,20 @@ export interface DatabaseBlobAuditingPolicies { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DatabaseBlobAuditingPolicy} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseBlobAuditingPolicy} for more - * information. + * {SyncMember} [result] - The deserialized result object if an error did not occur. + * See {@link SyncMember} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseBlobAuditingPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseBlobAuditingPolicy, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.DatabaseBlobAuditingPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * EncryptionProtectors - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface EncryptionProtectors { + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of server encryption protectors + * Refreshes a sync member database schema. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -9314,6 +15603,14 @@ export interface EncryptionProtectors { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -9321,14 +15618,14 @@ export interface EncryptionProtectors { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginRefreshMemberSchemaWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of server encryption protectors + * Refreshes a sync member database schema. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -9336,6 +15633,14 @@ export interface EncryptionProtectors { * * @param {string} serverName The name of the server. * + * @param {string} databaseName The name of the database on which the sync + * group is hosted. + * + * @param {string} syncGroupName The name of the sync group on which the sync + * member is hosted. + * + * @param {string} syncMemberName The name of the sync member. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -9348,7 +15653,7 @@ export interface EncryptionProtectors { * * {Promise} A promise is returned. * - * @resolve {EncryptionProtectorListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9356,27 +15661,22 @@ export interface EncryptionProtectors { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {EncryptionProtectorListResult} [result] - The deserialized result object if an error did not occur. - * See {@link EncryptionProtectorListResult} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginRefreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginRefreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; + beginRefreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a server encryption protector. - * - * @param {string} 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. + * Lists sync members in the given sync group. * - * @param {string} serverName The name of the server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -9385,20 +15685,17 @@ export interface EncryptionProtectors { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listBySyncGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a server encryption protector. - * - * @param {string} 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. + * Lists sync members in the given sync group. * - * @param {string} serverName The name of the server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -9412,7 +15709,7 @@ export interface EncryptionProtectors { * * {Promise} A promise is returned. * - * @resolve {EncryptionProtector} - The deserialized result object. + * @resolve {SyncMemberListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9420,38 +15717,23 @@ export interface EncryptionProtectors { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {EncryptionProtector} [result] - The deserialized result object if an error did not occur. - * See {@link EncryptionProtector} for more information. + * {SyncMemberListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncMemberListResult} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listBySyncGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listBySyncGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listBySyncGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing encryption protector. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {object} parameters The requested encryption protector resource - * state. - * - * @param {string} [parameters.kind] Kind of encryption protector. This is - * metadata used for the Azure portal experience. - * - * @param {string} [parameters.serverKeyName] The name of the server key. + * Gets a sync member database schema. * - * @param {string} parameters.serverKeyType The encryption protector type like - * 'ServiceManaged', 'AzureKeyVault'. Possible values include: - * 'ServiceManaged', 'AzureKeyVault' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -9460,32 +15742,17 @@ export interface EncryptionProtectors { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listMemberSchemasNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates an existing encryption protector. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {object} parameters The requested encryption protector resource - * state. - * - * @param {string} [parameters.kind] Kind of encryption protector. This is - * metadata used for the Azure portal experience. - * - * @param {string} [parameters.serverKeyName] The name of the server key. + * Gets a sync member database schema. * - * @param {string} parameters.serverKeyType The encryption protector type like - * 'ServiceManaged', 'AzureKeyVault'. Possible values include: - * 'ServiceManaged', 'AzureKeyVault' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -9499,7 +15766,7 @@ export interface EncryptionProtectors { * * {Promise} A promise is returned. * - * @resolve {EncryptionProtector} - The deserialized result object. + * @resolve {SyncFullSchemaPropertiesListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9507,38 +15774,33 @@ export interface EncryptionProtectors { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {EncryptionProtector} [result] - The deserialized result object if an error did not occur. - * See {@link EncryptionProtector} for more information. + * {SyncFullSchemaPropertiesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SyncFullSchemaPropertiesListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listMemberSchemasNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listMemberSchemasNext(nextPageLink: string, callback: ServiceCallback): void; + listMemberSchemasNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SubscriptionUsages + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface SubscriptionUsages { /** - * Updates an existing encryption protector. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets all subscription usage metrics in a given location. * - * @param {object} parameters The requested encryption protector resource - * state. - * - * @param {string} [parameters.kind] Kind of encryption protector. This is - * metadata used for the Azure portal experience. - * - * @param {string} [parameters.serverKeyName] The name of the server key. - * - * @param {string} parameters.serverKeyType The encryption protector type like - * 'ServiceManaged', 'AzureKeyVault'. Possible values include: - * 'ServiceManaged', 'AzureKeyVault' + * @param {string} locationName The name of the region where the resource is + * located. * * @param {object} [options] Optional Parameters. * @@ -9547,32 +15809,17 @@ export interface EncryptionProtectors { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByLocationWithHttpOperationResponse(locationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates an existing encryption protector. + * Gets all subscription usage metrics in a given location. * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {object} parameters The requested encryption protector resource - * state. - * - * @param {string} [parameters.kind] Kind of encryption protector. This is - * metadata used for the Azure portal experience. - * - * @param {string} [parameters.serverKeyName] The name of the server key. - * - * @param {string} parameters.serverKeyType The encryption protector type like - * 'ServiceManaged', 'AzureKeyVault'. Possible values include: - * 'ServiceManaged', 'AzureKeyVault' + * @param {string} locationName The name of the region where the resource is + * located. * * @param {object} [options] Optional Parameters. * @@ -9586,7 +15833,7 @@ export interface EncryptionProtectors { * * {Promise} A promise is returned. * - * @resolve {EncryptionProtector} - The deserialized result object. + * @resolve {SubscriptionUsageListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9594,23 +15841,26 @@ export interface EncryptionProtectors { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {EncryptionProtector} [result] - The deserialized result object if an error did not occur. - * See {@link EncryptionProtector} for more information. + * {SubscriptionUsageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SubscriptionUsageListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, parameters: models.EncryptionProtector, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByLocation(locationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByLocation(locationName: string, callback: ServiceCallback): void; + listByLocation(locationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of server encryption protectors + * Gets a subscription usage metric. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} usageName Name of usage metric to return. * * @param {object} [options] Optional Parameters. * @@ -9619,17 +15869,19 @@ export interface EncryptionProtectors { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(locationName: string, usageName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of server encryption protectors + * Gets a subscription usage metric. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} usageName Name of usage metric to return. * * @param {object} [options] Optional Parameters. * @@ -9643,7 +15895,7 @@ export interface EncryptionProtectors { * * {Promise} A promise is returned. * - * @resolve {EncryptionProtectorListResult} - The deserialized result object. + * @resolve {SubscriptionUsage} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9651,39 +15903,23 @@ export interface EncryptionProtectors { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {EncryptionProtectorListResult} [result] - The deserialized result object if an error did not occur. - * See {@link EncryptionProtectorListResult} for more - * information. + * {SubscriptionUsage} [result] - The deserialized result object if an error did not occur. + * See {@link SubscriptionUsage} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServerNext(nextPageLink: string, callback: ServiceCallback): void; - listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * FailoverGroups - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface FailoverGroups { + get(locationName: string, usageName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(locationName: string, usageName: string, callback: ServiceCallback): void; + get(locationName: string, usageName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a failover group. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server containing the failover - * group. + * Gets all subscription usage metrics in a given location. * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -9692,23 +15928,17 @@ export interface FailoverGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByLocationNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a failover group. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server containing the failover - * group. + * Gets all subscription usage metrics in a given location. * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -9722,7 +15952,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroup} - The deserialized result object. + * @resolve {SubscriptionUsageListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9730,60 +15960,38 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroup} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroup} for more information. + * {SubscriptionUsageListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SubscriptionUsageListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByLocationNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByLocationNext(nextPageLink: string, callback: ServiceCallback): void; + listByLocationNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VirtualNetworkRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface VirtualNetworkRules { /** - * Creates or updates a failover group. + * Gets a virtual network rule. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. - * - * @param {string} failoverGroupName The name of the failover group. - * - * @param {object} parameters The failover group parameters. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {object} parameters.readWriteEndpoint Read-write endpoint of the - * failover group instance. - * - * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy - * of the read-write endpoint for the failover group. If failoverPolicy is - * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible - * values include: 'Manual', 'Automatic' - * - * @param {number} - * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace - * period before failover with data loss is attempted for the read-write - * endpoint. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. - * - * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the - * failover group instance. - * - * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy - * of the read-only endpoint for the failover group. Possible values include: - * 'Disabled', 'Enabled' - * - * @param {array} parameters.partnerServers List of partner server information - * for the failover group. + * @param {string} serverName The name of the server. * - * @param {array} [parameters.databases] List of databases in the failover - * group. + * @param {string} virtualNetworkRuleName The name of the virtual network rule. * * @param {object} [options] Optional Parameters. * @@ -9792,54 +16000,22 @@ export interface FailoverGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a failover group. + * Gets a virtual network rule. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. - * - * @param {string} failoverGroupName The name of the failover group. - * - * @param {object} parameters The failover group parameters. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {object} parameters.readWriteEndpoint Read-write endpoint of the - * failover group instance. - * - * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy - * of the read-write endpoint for the failover group. If failoverPolicy is - * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible - * values include: 'Manual', 'Automatic' - * - * @param {number} - * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace - * period before failover with data loss is attempted for the read-write - * endpoint. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. - * - * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the - * failover group instance. - * - * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy - * of the read-only endpoint for the failover group. Possible values include: - * 'Disabled', 'Enabled' - * - * @param {array} parameters.partnerServers List of partner server information - * for the failover group. + * @param {string} serverName The name of the server. * - * @param {array} [parameters.databases] List of databases in the failover - * group. + * @param {string} virtualNetworkRuleName The name of the virtual network rule. * * @param {object} [options] Optional Parameters. * @@ -9853,7 +16029,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroup} - The deserialized result object. + * @resolve {VirtualNetworkRule} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9861,29 +16037,37 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroup} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroup} for more information. + * {VirtualNetworkRule} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkRule} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a failover group. + * Creates or updates an existing virtual network rule. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} serverName The name of the server. * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * + * @param {object} parameters The requested virtual Network Rule Resource + * state. + * + * @param {string} parameters.virtualNetworkSubnetId The ARM resource id of the + * virtual network subnet. + * + * @param {boolean} [parameters.ignoreMissingVnetServiceEndpoint] Create + * firewall rule before the virtual network has vnet service endpoint enabled. * * @param {object} [options] Optional Parameters. * @@ -9892,23 +16076,31 @@ export interface FailoverGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a failover group. + * Creates or updates an existing virtual network rule. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} serverName The name of the server. * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * + * @param {object} parameters The requested virtual Network Rule Resource + * state. + * + * @param {string} parameters.virtualNetworkSubnetId The ARM resource id of the + * virtual network subnet. + * + * @param {boolean} [parameters.ignoreMissingVnetServiceEndpoint] Create + * firewall rule before the virtual network has vnet service endpoint enabled. * * @param {object} [options] Optional Parameters. * @@ -9922,7 +16114,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {VirtualNetworkRule} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -9930,56 +16122,28 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {VirtualNetworkRule} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkRule} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates a failover group. + * Deletes the virtual network rule with the given name. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. - * - * @param {string} failoverGroupName The name of the failover group. - * - * @param {object} parameters The failover group parameters. - * - * @param {object} [parameters.readWriteEndpoint] Read-write endpoint of the - * failover group instance. - * - * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy - * of the read-write endpoint for the failover group. If failoverPolicy is - * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible - * values include: 'Manual', 'Automatic' - * - * @param {number} - * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace - * period before failover with data loss is attempted for the read-write - * endpoint. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. - * - * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the - * failover group instance. - * - * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy - * of the read-only endpoint for the failover group. Possible values include: - * 'Disabled', 'Enabled' - * - * @param {array} [parameters.databases] List of databases in the failover - * group. + * @param {string} serverName The name of the server. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} virtualNetworkRuleName The name of the virtual network rule. * * @param {object} [options] Optional Parameters. * @@ -9988,51 +16152,22 @@ export interface FailoverGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates a failover group. + * Deletes the virtual network rule with the given name. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. - * - * @param {string} failoverGroupName The name of the failover group. - * - * @param {object} parameters The failover group parameters. - * - * @param {object} [parameters.readWriteEndpoint] Read-write endpoint of the - * failover group instance. - * - * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy - * of the read-write endpoint for the failover group. If failoverPolicy is - * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible - * values include: 'Manual', 'Automatic' - * - * @param {number} - * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace - * period before failover with data loss is attempted for the read-write - * endpoint. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. - * - * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the - * failover group instance. - * - * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy - * of the read-only endpoint for the failover group. Possible values include: - * 'Disabled', 'Enabled' - * - * @param {array} [parameters.databases] List of databases in the failover - * group. + * @param {string} serverName The name of the server. * - * @param {object} [parameters.tags] Resource tags. + * @param {string} virtualNetworkRuleName The name of the virtual network rule. * * @param {object} [options] Optional Parameters. * @@ -10046,7 +16181,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroup} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10054,27 +16189,25 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroup} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroup} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, callback: ServiceCallback): void; - update(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists the failover groups in a server. + * Gets a list of virtual network rules in a server. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} serverName The name of the server. * * @param {object} [options] Optional Parameters. * @@ -10083,21 +16216,20 @@ export interface FailoverGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists the failover groups in a server. + * Gets a list of virtual network rules in a server. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} serverName The name of the server. * * @param {object} [options] Optional Parameters. * @@ -10111,7 +16243,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroupListResult} - The deserialized result object. + * @resolve {VirtualNetworkRuleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10119,30 +16251,38 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroupListResult} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroupListResult} for more + * {VirtualNetworkRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkRuleListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Fails over from the current primary server to this server. + * Creates or updates an existing virtual network rule. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} serverName The name of the server. * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * + * @param {object} parameters The requested virtual Network Rule Resource + * state. + * + * @param {string} parameters.virtualNetworkSubnetId The ARM resource id of the + * virtual network subnet. + * + * @param {boolean} [parameters.ignoreMissingVnetServiceEndpoint] Create + * firewall rule before the virtual network has vnet service endpoint enabled. * * @param {object} [options] Optional Parameters. * @@ -10151,23 +16291,31 @@ export interface FailoverGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - failoverWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Fails over from the current primary server to this server. + * Creates or updates an existing virtual network rule. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} serverName The name of the server. * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * + * @param {object} parameters The requested virtual Network Rule Resource + * state. + * + * @param {string} parameters.virtualNetworkSubnetId The ARM resource id of the + * virtual network subnet. + * + * @param {boolean} [parameters.ignoreMissingVnetServiceEndpoint] Create + * firewall rule before the virtual network has vnet service endpoint enabled. * * @param {object} [options] Optional Parameters. * @@ -10181,7 +16329,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroup} - The deserialized result object. + * @resolve {VirtualNetworkRule} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10189,30 +16337,28 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroup} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroup} for more information. + * {VirtualNetworkRule} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkRule} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - failover(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - failover(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; - failover(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Fails over from the current primary server to this server. This operation - * might result in data loss. + * Deletes the virtual network rule with the given name. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} serverName The name of the server. * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} virtualNetworkRuleName The name of the virtual network rule. * * @param {object} [options] Optional Parameters. * @@ -10221,24 +16367,22 @@ export interface FailoverGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - forceFailoverAllowDataLossWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Fails over from the current primary server to this server. This operation - * might result in data loss. + * Deletes the virtual network rule with the given name. * * @param {string} 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. * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} serverName The name of the server. * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} virtualNetworkRuleName The name of the virtual network rule. * * @param {object} [options] Optional Parameters. * @@ -10252,7 +16396,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroup} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10260,60 +16404,22 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroup} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroup} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - forceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - forceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; - forceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a failover group. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server containing the failover - * group. - * - * @param {string} failoverGroupName The name of the failover group. - * - * @param {object} parameters The failover group parameters. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {object} parameters.readWriteEndpoint Read-write endpoint of the - * failover group instance. - * - * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy - * of the read-write endpoint for the failover group. If failoverPolicy is - * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible - * values include: 'Manual', 'Automatic' - * - * @param {number} - * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace - * period before failover with data loss is attempted for the read-write - * endpoint. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. - * - * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the - * failover group instance. - * - * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy - * of the read-only endpoint for the failover group. Possible values include: - * 'Disabled', 'Enabled' - * - * @param {array} parameters.partnerServers List of partner server information - * for the failover group. + * Gets a list of virtual network rules in a server. * - * @param {array} [parameters.databases] List of databases in the failover - * group. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -10322,54 +16428,17 @@ export interface FailoverGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a failover group. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server containing the failover - * group. - * - * @param {string} failoverGroupName The name of the failover group. - * - * @param {object} parameters The failover group parameters. - * - * @param {object} [parameters.tags] Resource tags. - * - * @param {object} parameters.readWriteEndpoint Read-write endpoint of the - * failover group instance. - * - * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy - * of the read-write endpoint for the failover group. If failoverPolicy is - * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible - * values include: 'Manual', 'Automatic' - * - * @param {number} - * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace - * period before failover with data loss is attempted for the read-write - * endpoint. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. - * - * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the - * failover group instance. - * - * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy - * of the read-only endpoint for the failover group. Possible values include: - * 'Disabled', 'Enabled' - * - * @param {array} parameters.partnerServers List of partner server information - * for the failover group. + * Gets a list of virtual network rules in a server. * - * @param {array} [parameters.databases] List of databases in the failover - * group. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -10383,7 +16452,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroup} - The deserialized result object. + * @resolve {VirtualNetworkRuleListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10391,29 +16460,38 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroup} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroup} for more information. + * {VirtualNetworkRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkRuleListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServerNext(nextPageLink: string, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LongTermRetentionBackups + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface LongTermRetentionBackups { /** - * Deletes a failover group. + * Gets a long term retention backup. * - * @param {string} 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. + * @param {string} locationName The location of the database. * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} longTermRetentionServerName * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. * * @param {object} [options] Optional Parameters. * @@ -10422,23 +16500,22 @@ export interface FailoverGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a failover group. + * Gets a long term retention backup. * - * @param {string} 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. + * @param {string} locationName The location of the database. * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} longTermRetentionServerName * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. * * @param {object} [options] Optional Parameters. * @@ -10452,7 +16529,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {LongTermRetentionBackup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10460,56 +16537,29 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {LongTermRetentionBackup} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackup} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, callback: ServiceCallback): void; + get(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates a failover group. + * Deletes a long term retention backup. * - * @param {string} 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. - * - * @param {string} serverName The name of the server containing the failover - * group. - * - * @param {string} failoverGroupName The name of the failover group. - * - * @param {object} parameters The failover group parameters. - * - * @param {object} [parameters.readWriteEndpoint] Read-write endpoint of the - * failover group instance. - * - * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy - * of the read-write endpoint for the failover group. If failoverPolicy is - * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible - * values include: 'Manual', 'Automatic' - * - * @param {number} - * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace - * period before failover with data loss is attempted for the read-write - * endpoint. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. + * @param {string} locationName The location of the database * - * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the - * failover group instance. - * - * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy - * of the read-only endpoint for the failover group. Possible values include: - * 'Disabled', 'Enabled' + * @param {string} longTermRetentionServerName * - * @param {array} [parameters.databases] List of databases in the failover - * group. + * @param {string} longTermRetentionDatabaseName * - * @param {object} [parameters.tags] Resource tags. + * @param {string} backupName The backup name. * * @param {object} [options] Optional Parameters. * @@ -10518,51 +16568,22 @@ export interface FailoverGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates a failover group. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server containing the failover - * group. - * - * @param {string} failoverGroupName The name of the failover group. - * - * @param {object} parameters The failover group parameters. + * Deletes a long term retention backup. * - * @param {object} [parameters.readWriteEndpoint] Read-write endpoint of the - * failover group instance. - * - * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy - * of the read-write endpoint for the failover group. If failoverPolicy is - * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible - * values include: 'Manual', 'Automatic' - * - * @param {number} - * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace - * period before failover with data loss is attempted for the read-write - * endpoint. If failoverPolicy is Automatic then - * failoverWithDataLossGracePeriodMinutes is required. - * - * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the - * failover group instance. + * @param {string} locationName The location of the database * - * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy - * of the read-only endpoint for the failover group. Possible values include: - * 'Disabled', 'Enabled' + * @param {string} longTermRetentionServerName * - * @param {array} [parameters.databases] List of databases in the failover - * group. + * @param {string} longTermRetentionDatabaseName * - * @param {object} [parameters.tags] Resource tags. + * @param {string} backupName The backup name. * * @param {object} [options] Optional Parameters. * @@ -10576,7 +16597,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroup} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10584,57 +16605,64 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroup} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroup} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, callback: ServiceCallback): void; - beginUpdate(resourceGroupName: string, serverName: string, failoverGroupName: string, parameters: models.FailoverGroupUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, callback: ServiceCallback): void; + deleteMethod(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Fails over from the current primary server to this server. + * Lists all long term retention backups for a database. * - * @param {string} 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. + * @param {string} locationName The location of the database * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} longTermRetentionServerName * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} longTermRetentionDatabaseName * * @param {object} [options] Optional Parameters. * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginFailoverWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseWithHttpOperationResponse(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, options?: { onlyLatestPerDatabase? : boolean, databaseState? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Fails over from the current primary server to this server. + * Lists all long term retention backups for a database. * - * @param {string} 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. + * @param {string} locationName The location of the database * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {string} longTermRetentionServerName * - * @param {string} failoverGroupName The name of the failover group. + * @param {string} longTermRetentionDatabaseName * * @param {object} [options] Optional Parameters. * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -10645,7 +16673,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroup} - The deserialized result object. + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10653,58 +16681,57 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroup} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroup} for more information. + * {LongTermRetentionBackupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginFailover(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginFailover(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; - beginFailover(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabase(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, options?: { onlyLatestPerDatabase? : boolean, databaseState? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, callback: ServiceCallback): void; + listByDatabase(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, options: { onlyLatestPerDatabase? : boolean, databaseState? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Fails over from the current primary server to this server. This operation - * might result in data loss. + * Lists the long term retention backups for a given location. * - * @param {string} 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. + * @param {string} locationName The location of the database * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {object} [options] Optional Parameters. * - * @param {string} failoverGroupName The name of the failover group. + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. * - * @param {object} [options] Optional Parameters. + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginForceFailoverAllowDataLossWithHttpOperationResponse(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByLocationWithHttpOperationResponse(locationName: string, options?: { onlyLatestPerDatabase? : boolean, databaseState? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Fails over from the current primary server to this server. This operation - * might result in data loss. + * Lists the long term retention backups for a given location. * - * @param {string} 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. + * @param {string} locationName The location of the database * - * @param {string} serverName The name of the server containing the failover - * group. + * @param {object} [options] Optional Parameters. * - * @param {string} failoverGroupName The name of the failover group. + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. * - * @param {object} [options] Optional Parameters. + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' * * @param {object} [options.customHeaders] Headers that will be added to the * request @@ -10716,7 +16743,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroup} - The deserialized result object. + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10724,45 +16751,62 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroup} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroup} for more information. + * {LongTermRetentionBackupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginForceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginForceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, callback: ServiceCallback): void; - beginForceFailoverAllowDataLoss(resourceGroupName: string, serverName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByLocation(locationName: string, options?: { onlyLatestPerDatabase? : boolean, databaseState? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByLocation(locationName: string, callback: ServiceCallback): void; + listByLocation(locationName: string, options: { onlyLatestPerDatabase? : boolean, databaseState? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists the failover groups in a server. + * Lists the long term retention backups for a given server. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName * * @param {object} [options] Optional Parameters. * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerWithHttpOperationResponse(locationName: string, longTermRetentionServerName: string, options?: { onlyLatestPerDatabase? : boolean, databaseState? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists the failover groups in a server. + * Lists the long term retention backups for a given server. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName * * @param {object} [options] Optional Parameters. * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -10773,7 +16817,7 @@ export interface FailoverGroups { * * {Promise} A promise is returned. * - * @resolve {FailoverGroupListResult} - The deserialized result object. + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10781,30 +16825,29 @@ export interface FailoverGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {FailoverGroupListResult} [result] - The deserialized result object if an error did not occur. - * See {@link FailoverGroupListResult} for more + * {LongTermRetentionBackupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServerNext(nextPageLink: string, callback: ServiceCallback): void; - listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * Operations - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface Operations { + listByServer(locationName: string, longTermRetentionServerName: string, options?: { onlyLatestPerDatabase? : boolean, databaseState? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(locationName: string, longTermRetentionServerName: string, callback: ServiceCallback): void; + listByServer(locationName: string, longTermRetentionServerName: string, options: { onlyLatestPerDatabase? : boolean, databaseState? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists all of the available SQL Rest API operations. + * Deletes a long term retention backup. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. * * @param {object} [options] Optional Parameters. * @@ -10813,14 +16856,22 @@ export interface Operations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all of the available SQL Rest API operations. + * Deletes a long term retention backup. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. * * @param {object} [options] Optional Parameters. * @@ -10834,7 +16885,7 @@ export interface Operations { * * {Promise} A promise is returned. * - * @resolve {OperationListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10842,20 +16893,19 @@ export interface Operations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {OperationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link OperationListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - list(callback: ServiceCallback): void; - list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, callback: ServiceCallback): void; + beginDeleteMethod(locationName: string, longTermRetentionServerName: string, longTermRetentionDatabaseName: string, backupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists all of the available SQL Rest API operations. + * Lists all long term retention backups for a database. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -10867,14 +16917,14 @@ export interface Operations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists all of the available SQL Rest API operations. + * Lists all long term retention backups for a database. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -10891,7 +16941,7 @@ export interface Operations { * * {Promise} A promise is returned. * - * @resolve {OperationListResult} - The deserialized result object. + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10899,35 +16949,24 @@ export interface Operations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {OperationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link OperationListResult} for more information. + * {LongTermRetentionBackupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listNext(nextPageLink: string, callback: ServiceCallback): void; - listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * ServerKeys - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface ServerKeys { + listByDatabaseNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabaseNext(nextPageLink: string, callback: ServiceCallback): void; + listByDatabaseNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of server keys. - * - * @param {string} 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. + * Lists the long term retention backups for a given location. * - * @param {string} serverName The name of the server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -10936,20 +16975,17 @@ export interface ServerKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByLocationNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of server keys. - * - * @param {string} 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. + * Lists the long term retention backups for a given location. * - * @param {string} serverName The name of the server. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -10963,7 +16999,7 @@ export interface ServerKeys { * * {Promise} A promise is returned. * - * @resolve {ServerKeyListResult} - The deserialized result object. + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -10971,28 +17007,24 @@ export interface ServerKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerKeyListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServerKeyListResult} for more information. + * {LongTermRetentionBackupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByLocationNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByLocationNext(nextPageLink: string, callback: ServiceCallback): void; + listByLocationNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a server key. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Lists the long term retention backups for a given server. * - * @param {string} keyName The name of the server key to be retrieved. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -11001,22 +17033,17 @@ export interface ServerKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a server key. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Lists the long term retention backups for a given server. * - * @param {string} keyName The name of the server key to be retrieved. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -11030,7 +17057,7 @@ export interface ServerKeys { * * {Promise} A promise is returned. * - * @resolve {ServerKey} - The deserialized result object. + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11038,20 +17065,30 @@ export interface ServerKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerKey} [result] - The deserialized result object if an error did not occur. - * See {@link ServerKey} for more information. + * {LongTermRetentionBackupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, keyName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServerNext(nextPageLink: string, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * BackupLongTermRetentionPolicies + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface BackupLongTermRetentionPolicies { /** - * Creates or updates a server key. + * Gets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -11059,27 +17096,7 @@ export interface ServerKeys { * * @param {string} serverName The name of the server. * - * @param {string} keyName The name of the server key to be operated on - * (updated or created). The key name is required to be in the format of - * 'vault_key_version'. For example, if the keyId is - * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, - * then the server key name should be formatted as: - * YourVaultName_YourKeyName_01234567890123456789012345678901 - * - * @param {object} parameters The requested server key resource state. - * - * @param {string} [parameters.kind] Kind of encryption protector. This is - * metadata used for the Azure portal experience. - * - * @param {string} parameters.serverKeyType The server key type like - * 'ServiceManaged', 'AzureKeyVault'. Possible values include: - * 'ServiceManaged', 'AzureKeyVault' - * - * @param {string} [parameters.uri] The URI of the server key. - * - * @param {string} [parameters.thumbprint] Thumbprint of the server key. - * - * @param {date} [parameters.creationDate] The server key creation date. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -11088,14 +17105,14 @@ export interface ServerKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a server key. + * Gets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -11103,27 +17120,7 @@ export interface ServerKeys { * * @param {string} serverName The name of the server. * - * @param {string} keyName The name of the server key to be operated on - * (updated or created). The key name is required to be in the format of - * 'vault_key_version'. For example, if the keyId is - * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, - * then the server key name should be formatted as: - * YourVaultName_YourKeyName_01234567890123456789012345678901 - * - * @param {object} parameters The requested server key resource state. - * - * @param {string} [parameters.kind] Kind of encryption protector. This is - * metadata used for the Azure portal experience. - * - * @param {string} parameters.serverKeyType The server key type like - * 'ServiceManaged', 'AzureKeyVault'. Possible values include: - * 'ServiceManaged', 'AzureKeyVault' - * - * @param {string} [parameters.uri] The URI of the server key. - * - * @param {string} [parameters.thumbprint] Thumbprint of the server key. - * - * @param {date} [parameters.creationDate] The server key creation date. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -11137,7 +17134,7 @@ export interface ServerKeys { * * {Promise} A promise is returned. * - * @resolve {ServerKey} - The deserialized result object. + * @resolve {BackupLongTermRetentionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11145,20 +17142,21 @@ export interface ServerKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerKey} [result] - The deserialized result object if an error did not occur. - * See {@link ServerKey} for more information. + * {BackupLongTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link BackupLongTermRetentionPolicy} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the server key with the given name. + * Sets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -11166,7 +17164,21 @@ export interface ServerKeys { * * @param {string} serverName The name of the server. * - * @param {string} keyName The name of the server key to be deleted. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The long term retention policy info. + * + * @param {string} [parameters.weeklyRetention] The weekly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {string} [parameters.monthlyRetention] The montly retention policy + * for an LTR backup in an ISO 8601 format. + * + * @param {string} [parameters.yearlyRetention] The yearly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {number} [parameters.weekOfYear] The week of year to take the yearly + * backup in an ISO 8601 format. * * @param {object} [options] Optional Parameters. * @@ -11175,14 +17187,14 @@ export interface ServerKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the server key with the given name. + * Sets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -11190,7 +17202,21 @@ export interface ServerKeys { * * @param {string} serverName The name of the server. * - * @param {string} keyName The name of the server key to be deleted. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The long term retention policy info. + * + * @param {string} [parameters.weeklyRetention] The weekly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {string} [parameters.monthlyRetention] The montly retention policy + * for an LTR backup in an ISO 8601 format. + * + * @param {string} [parameters.yearlyRetention] The yearly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {number} [parameters.weekOfYear] The week of year to take the yearly + * backup in an ISO 8601 format. * * @param {object} [options] Optional Parameters. * @@ -11204,7 +17230,7 @@ export interface ServerKeys { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {BackupLongTermRetentionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11212,19 +17238,21 @@ export interface ServerKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {BackupLongTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link BackupLongTermRetentionPolicy} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, keyName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a server key. + * Gets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -11232,27 +17260,7 @@ export interface ServerKeys { * * @param {string} serverName The name of the server. * - * @param {string} keyName The name of the server key to be operated on - * (updated or created). The key name is required to be in the format of - * 'vault_key_version'. For example, if the keyId is - * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, - * then the server key name should be formatted as: - * YourVaultName_YourKeyName_01234567890123456789012345678901 - * - * @param {object} parameters The requested server key resource state. - * - * @param {string} [parameters.kind] Kind of encryption protector. This is - * metadata used for the Azure portal experience. - * - * @param {string} parameters.serverKeyType The server key type like - * 'ServiceManaged', 'AzureKeyVault'. Possible values include: - * 'ServiceManaged', 'AzureKeyVault' - * - * @param {string} [parameters.uri] The URI of the server key. - * - * @param {string} [parameters.thumbprint] Thumbprint of the server key. - * - * @param {date} [parameters.creationDate] The server key creation date. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -11261,14 +17269,14 @@ export interface ServerKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a server key. + * Gets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -11276,27 +17284,7 @@ export interface ServerKeys { * * @param {string} serverName The name of the server. * - * @param {string} keyName The name of the server key to be operated on - * (updated or created). The key name is required to be in the format of - * 'vault_key_version'. For example, if the keyId is - * https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, - * then the server key name should be formatted as: - * YourVaultName_YourKeyName_01234567890123456789012345678901 - * - * @param {object} parameters The requested server key resource state. - * - * @param {string} [parameters.kind] Kind of encryption protector. This is - * metadata used for the Azure portal experience. - * - * @param {string} parameters.serverKeyType The server key type like - * 'ServiceManaged', 'AzureKeyVault'. Possible values include: - * 'ServiceManaged', 'AzureKeyVault' - * - * @param {string} [parameters.uri] The URI of the server key. - * - * @param {string} [parameters.thumbprint] Thumbprint of the server key. - * - * @param {date} [parameters.creationDate] The server key creation date. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -11310,7 +17298,7 @@ export interface ServerKeys { * * {Promise} A promise is returned. * - * @resolve {ServerKey} - The deserialized result object. + * @resolve {BackupLongTermRetentionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11318,20 +17306,21 @@ export interface ServerKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerKey} [result] - The deserialized result object if an error did not occur. - * See {@link ServerKey} for more information. + * {BackupLongTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link BackupLongTermRetentionPolicy} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, keyName: string, parameters: models.ServerKey, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the server key with the given name. + * Sets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -11339,7 +17328,21 @@ export interface ServerKeys { * * @param {string} serverName The name of the server. * - * @param {string} keyName The name of the server key to be deleted. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The long term retention policy info. + * + * @param {string} [parameters.weeklyRetention] The weekly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {string} [parameters.monthlyRetention] The montly retention policy + * for an LTR backup in an ISO 8601 format. + * + * @param {string} [parameters.yearlyRetention] The yearly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {number} [parameters.weekOfYear] The week of year to take the yearly + * backup in an ISO 8601 format. * * @param {object} [options] Optional Parameters. * @@ -11348,14 +17351,14 @@ export interface ServerKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the server key with the given name. + * Sets a database's long term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -11363,7 +17366,21 @@ export interface ServerKeys { * * @param {string} serverName The name of the server. * - * @param {string} keyName The name of the server key to be deleted. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The long term retention policy info. + * + * @param {string} [parameters.weeklyRetention] The weekly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {string} [parameters.monthlyRetention] The montly retention policy + * for an LTR backup in an ISO 8601 format. + * + * @param {string} [parameters.yearlyRetention] The yearly retention policy for + * an LTR backup in an ISO 8601 format. + * + * @param {number} [parameters.weekOfYear] The week of year to take the yearly + * backup in an ISO 8601 format. * * @param {object} [options] Optional Parameters. * @@ -11377,7 +17394,7 @@ export interface ServerKeys { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {BackupLongTermRetentionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11385,22 +17402,41 @@ export interface ServerKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {BackupLongTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link BackupLongTermRetentionPolicy} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, serverName: string, keyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, serverName: string, keyName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, serverName: string, keyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.BackupLongTermRetentionPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ManagedDatabases + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ManagedDatabases { /** - * Gets a list of server keys. + * Completes the restore operation on a managed database. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {uuid} operationId Management operation id that this request tries to + * complete. + * + * @param {object} parameters The definition for completing the restore of this + * managed database. + * + * @param {string} parameters.lastBackupName The last backup name to apply * * @param {object} [options] Optional Parameters. * @@ -11409,17 +17445,25 @@ export interface ServerKeys { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + completeRestoreWithHttpOperationResponse(locationName: string, operationId: string, parameters: models.CompleteDatabaseRestoreDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of server keys. + * Completes the restore operation on a managed database. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {uuid} operationId Management operation id that this request tries to + * complete. + * + * @param {object} parameters The definition for completing the restore of this + * managed database. + * + * @param {string} parameters.lastBackupName The last backup name to apply * * @param {object} [options] Optional Parameters. * @@ -11433,7 +17477,7 @@ export interface ServerKeys { * * {Promise} A promise is returned. * - * @resolve {ServerKeyListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11441,38 +17485,25 @@ export interface ServerKeys { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {ServerKeyListResult} [result] - The deserialized result object if an error did not occur. - * See {@link ServerKeyListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServerNext(nextPageLink: string, callback: ServiceCallback): void; - listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * SyncAgents - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface SyncAgents { + completeRestore(locationName: string, operationId: string, parameters: models.CompleteDatabaseRestoreDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + completeRestore(locationName: string, operationId: string, parameters: models.CompleteDatabaseRestoreDefinition, callback: ServiceCallback): void; + completeRestore(locationName: string, operationId: string, parameters: models.CompleteDatabaseRestoreDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a sync agent. + * Gets a list of managed databases. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. - * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} managedInstanceName The name of the managed instance. * * @param {object} [options] Optional Parameters. * @@ -11481,23 +17512,20 @@ export interface SyncAgents { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByInstanceWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a sync agent. + * Gets a list of managed databases. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. - * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} managedInstanceName The name of the managed instance. * * @param {object} [options] Optional Parameters. * @@ -11511,7 +17539,7 @@ export interface SyncAgents { * * {Promise} A promise is returned. * - * @resolve {SyncAgent} - The deserialized result object. + * @resolve {ManagedDatabaseListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11519,34 +17547,29 @@ export interface SyncAgents { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncAgent} [result] - The deserialized result object if an error did not occur. - * See {@link SyncAgent} for more information. + * {ManagedDatabaseListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabaseListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, syncAgentName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, syncAgentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByInstance(resourceGroupName: string, managedInstanceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByInstance(resourceGroupName: string, managedInstanceName: string, callback: ServiceCallback): void; + listByInstance(resourceGroupName: string, managedInstanceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a sync agent. + * Gets a managed database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. - * - * @param {string} syncAgentName The name of the sync agent. - * - * @param {object} parameters The requested sync agent resource state. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync agent. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -11555,28 +17578,22 @@ export interface SyncAgents { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a sync agent. + * Gets a managed database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. - * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {object} parameters The requested sync agent resource state. - * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync agent. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -11590,7 +17607,7 @@ export interface SyncAgents { * * {Promise} A promise is returned. * - * @resolve {SyncAgent} - The deserialized result object. + * @resolve {ManagedDatabase} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11598,29 +17615,64 @@ export interface SyncAgents { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncAgent} [result] - The deserialized result object if an error did not occur. - * See {@link SyncAgent} for more information. + * {ManagedDatabase} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. - */ - createOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + */ + get(resourceGroupName: string, managedInstanceName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, managedInstanceName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, managedInstanceName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a sync agent. + * Creates a new database or updates an existing database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -11629,23 +17681,58 @@ export interface SyncAgents { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabase, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a sync agent. + * Creates a new database or updates an existing database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -11659,7 +17746,7 @@ export interface SyncAgents { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ManagedDatabase} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11667,26 +17754,28 @@ export interface SyncAgents { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ManagedDatabase} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabase, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabase, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabase, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists sync agents in a server. + * Deletes the managed database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -11695,21 +17784,22 @@ export interface SyncAgents { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists sync agents in a server. + * Deletes the managed database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -11723,7 +17813,7 @@ export interface SyncAgents { * * {Promise} A promise is returned. * - * @resolve {SyncAgentListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11731,29 +17821,61 @@ export interface SyncAgents { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncAgentListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncAgentListResult} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, managedInstanceName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, managedInstanceName: string, databaseName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, managedInstanceName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Generates a sync agent key. + * Updates an existing database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -11762,23 +17884,56 @@ export interface SyncAgents { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - generateKeyWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Generates a sync agent key. + * Updates an existing database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -11792,7 +17947,7 @@ export interface SyncAgents { * * {Promise} A promise is returned. * - * @resolve {SyncAgentKeyProperties} - The deserialized result object. + * @resolve {ManagedDatabase} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11800,30 +17955,31 @@ export interface SyncAgents { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncAgentKeyProperties} [result] - The deserialized result object if an error did not occur. - * See {@link SyncAgentKeyProperties} for more - * information. + * {ManagedDatabase} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - generateKey(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - generateKey(resourceGroupName: string, serverName: string, syncAgentName: string, callback: ServiceCallback): void; - generateKey(resourceGroupName: string, serverName: string, syncAgentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseUpdate, callback: ServiceCallback): void; + update(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists databases linked to a sync agent. + * Completes the restore operation on a managed database. * - * @param {string} 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. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {uuid} operationId Management operation id that this request tries to + * complete. * - * @param {string} syncAgentName The name of the sync agent. + * @param {object} parameters The definition for completing the restore of this + * managed database. + * + * @param {string} parameters.lastBackupName The last backup name to apply * * @param {object} [options] Optional Parameters. * @@ -11832,23 +17988,25 @@ export interface SyncAgents { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listLinkedDatabasesWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCompleteRestoreWithHttpOperationResponse(locationName: string, operationId: string, parameters: models.CompleteDatabaseRestoreDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists databases linked to a sync agent. + * Completes the restore operation on a managed database. * - * @param {string} 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. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {uuid} operationId Management operation id that this request tries to + * complete. * - * @param {string} syncAgentName The name of the sync agent. + * @param {object} parameters The definition for completing the restore of this + * managed database. + * + * @param {string} parameters.lastBackupName The last backup name to apply * * @param {object} [options] Optional Parameters. * @@ -11862,7 +18020,7 @@ export interface SyncAgents { * * {Promise} A promise is returned. * - * @resolve {SyncAgentLinkedDatabaseListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11870,35 +18028,63 @@ export interface SyncAgents { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncAgentLinkedDatabaseListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncAgentLinkedDatabaseListResult} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listLinkedDatabases(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listLinkedDatabases(resourceGroupName: string, serverName: string, syncAgentName: string, callback: ServiceCallback): void; - listLinkedDatabases(resourceGroupName: string, serverName: string, syncAgentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCompleteRestore(locationName: string, operationId: string, parameters: models.CompleteDatabaseRestoreDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCompleteRestore(locationName: string, operationId: string, parameters: models.CompleteDatabaseRestoreDefinition, callback: ServiceCallback): void; + beginCompleteRestore(locationName: string, operationId: string, parameters: models.CompleteDatabaseRestoreDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a sync agent. + * Creates a new database or updates an existing database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} databaseName The name of the database. * - * @param {object} parameters The requested sync agent resource state. + * @param {object} parameters The requested database resource state. * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync agent. + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -11907,28 +18093,58 @@ export interface SyncAgents { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabase, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a sync agent. + * Creates a new database or updates an existing database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} databaseName The name of the database. * - * @param {object} parameters The requested sync agent resource state. + * @param {object} parameters The requested database resource state. * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync agent. + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. * * @param {object} [options] Optional Parameters. * @@ -11942,7 +18158,7 @@ export interface SyncAgents { * * {Promise} A promise is returned. * - * @resolve {SyncAgent} - The deserialized result object. + * @resolve {ManagedDatabase} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -11950,29 +18166,28 @@ export interface SyncAgents { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncAgent} [result] - The deserialized result object if an error did not occur. - * See {@link SyncAgent} for more information. + * {ManagedDatabase} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, syncAgentName: string, parameters: models.SyncAgent, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabase, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabase, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabase, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a sync agent. + * Deletes the managed database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -11985,19 +18200,18 @@ export interface SyncAgents { * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a sync agent. + * Deletes the managed database. * * @param {string} 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. * - * @param {string} serverName The name of the server on which the sync agent is - * hosted. + * @param {string} managedInstanceName The name of the managed instance. * - * @param {string} syncAgentName The name of the sync agent. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -12025,16 +18239,55 @@ export interface SyncAgents { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, serverName: string, syncAgentName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, managedInstanceName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, managedInstanceName: string, databaseName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, managedInstanceName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists sync agents in a server. + * Updates an existing database. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -12043,17 +18296,56 @@ export interface SyncAgents { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateWithHttpOperationResponse(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists sync agents in a server. + * Updates an existing database. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. * * @param {object} [options] Optional Parameters. * @@ -12067,7 +18359,7 @@ export interface SyncAgents { * * {Promise} A promise is returned. * - * @resolve {SyncAgentListResult} - The deserialized result object. + * @resolve {ManagedDatabase} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -12075,20 +18367,20 @@ export interface SyncAgents { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncAgentListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncAgentListResult} for more information. + * {ManagedDatabase} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServerNext(nextPageLink: string, callback: ServiceCallback): void; - listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseUpdate, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseUpdate, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, managedInstanceName: string, databaseName: string, parameters: models.ManagedDatabaseUpdate, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists databases linked to a sync agent. + * Gets a list of managed databases. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -12100,14 +18392,14 @@ export interface SyncAgents { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listLinkedDatabasesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByInstanceNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists databases linked to a sync agent. + * Gets a list of managed databases. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -12124,7 +18416,7 @@ export interface SyncAgents { * * {Promise} A promise is returned. * - * @resolve {SyncAgentLinkedDatabaseListResult} - The deserialized result object. + * @resolve {ManagedDatabaseListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -12132,33 +18424,36 @@ export interface SyncAgents { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncAgentLinkedDatabaseListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncAgentLinkedDatabaseListResult} for more + * {ManagedDatabaseListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabaseListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listLinkedDatabasesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listLinkedDatabasesNext(nextPageLink: string, callback: ServiceCallback): void; - listLinkedDatabasesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByInstanceNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByInstanceNext(nextPageLink: string, callback: ServiceCallback): void; + listByInstanceNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * SyncGroups + * ServerAutomaticTuningOperations * __NOTE__: An instance of this class is automatically created for an * instance of the SqlManagementClient. */ -export interface SyncGroups { +export interface ServerAutomaticTuningOperations { /** - * Gets a collection of sync database ids. + * Retrieves server automatic tuning options. * - * @param {string} locationName The name of the region where the resource is - * located. + * @param {string} 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. + * + * @param {string} serverName The name of the server. * * @param {object} [options] Optional Parameters. * @@ -12167,17 +18462,20 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listSyncDatabaseIdsWithHttpOperationResponse(locationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a collection of sync database ids. + * Retrieves server automatic tuning options. * - * @param {string} locationName The name of the region where the resource is - * located. + * @param {string} 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. + * + * @param {string} serverName The name of the server. * * @param {object} [options] Optional Parameters. * @@ -12191,7 +18489,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncDatabaseIdListResult} - The deserialized result object. + * @resolve {ServerAutomaticTuning} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -12199,21 +18497,20 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncDatabaseIdListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncDatabaseIdListResult} for more - * information. + * {ServerAutomaticTuning} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAutomaticTuning} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listSyncDatabaseIds(locationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listSyncDatabaseIds(locationName: string, callback: ServiceCallback): void; - listSyncDatabaseIds(locationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Refreshes a hub database schema. + * Update automatic tuning options on server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -12221,10 +18518,12 @@ export interface SyncGroups { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {object} parameters The requested automatic tuning resource state. * - * @param {string} syncGroupName The name of the sync group. + * @param {string} [parameters.desiredState] Automatic tuning desired state. + * Possible values include: 'Custom', 'Auto', 'Unspecified' + * + * @param {object} [parameters.options] Automatic tuning options definition. * * @param {object} [options] Optional Parameters. * @@ -12233,14 +18532,14 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - refreshHubSchemaWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, parameters: models.ServerAutomaticTuning, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Refreshes a hub database schema. + * Update automatic tuning options on server. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -12248,10 +18547,12 @@ export interface SyncGroups { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {object} parameters The requested automatic tuning resource state. * - * @param {string} syncGroupName The name of the sync group. + * @param {string} [parameters.desiredState] Automatic tuning desired state. + * Possible values include: 'Custom', 'Auto', 'Unspecified' + * + * @param {object} [parameters.options] Automatic tuning options definition. * * @param {object} [options] Optional Parameters. * @@ -12265,7 +18566,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ServerAutomaticTuning} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -12273,30 +18574,38 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ServerAutomaticTuning} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAutomaticTuning} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - refreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - refreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; - refreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, parameters: models.ServerAutomaticTuning, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serverName: string, parameters: models.ServerAutomaticTuning, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, parameters: models.ServerAutomaticTuning, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ServerDnsAliases + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ServerDnsAliases { /** - * Gets a collection of hub database schemas. + * Gets a server DNS alias. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} syncGroupName The name of the sync group. + * @param {string} dnsAliasName The name of the server DNS alias. * * @param {object} [options] Optional Parameters. * @@ -12305,25 +18614,23 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listHubSchemasWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, dnsAliasName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a collection of hub database schemas. + * Gets a server DNS alias. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} syncGroupName The name of the sync group. + * @param {string} dnsAliasName The name of the server DNS alias. * * @param {object} [options] Optional Parameters. * @@ -12337,7 +18644,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncFullSchemaPropertiesListResult} - The deserialized result object. + * @resolve {ServerDnsAlias} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -12345,82 +18652,57 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncFullSchemaPropertiesListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncFullSchemaPropertiesListResult} for more - * information. + * {ServerDnsAlias} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAlias} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listHubSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listHubSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; - listHubSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, dnsAliasName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, dnsAliasName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, dnsAliasName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a collection of sync group logs. + * Creates a server dns alias. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. - * - * @param {string} startTime Get logs generated after this time. - * - * @param {string} endTime Get logs generated before this time. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} type The types of logs to retrieve. Possible values include: - * 'All', 'Error', 'Warning', 'Success' + * @param {string} dnsAliasName The name of the server DNS alias. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.continuationToken] The continuation token for this - * operation. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listLogsWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, startTime: string, endTime: string, type: string, options?: { continuationToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, dnsAliasName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a collection of sync group logs. + * Creates a server dns alias. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. - * - * @param {string} startTime Get logs generated after this time. - * - * @param {string} endTime Get logs generated before this time. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} type The types of logs to retrieve. Possible values include: - * 'All', 'Error', 'Warning', 'Success' + * @param {string} dnsAliasName The name of the server DNS alias. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.continuationToken] The continuation token for this - * operation. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -12431,7 +18713,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncGroupLogListResult} - The deserialized result object. + * @resolve {ServerDnsAlias} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -12439,32 +18721,29 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncGroupLogListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncGroupLogListResult} for more - * information. + * {ServerDnsAlias} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAlias} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listLogs(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, startTime: string, endTime: string, type: string, options?: { continuationToken? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - listLogs(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, startTime: string, endTime: string, type: string, callback: ServiceCallback): void; - listLogs(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, startTime: string, endTime: string, type: string, options: { continuationToken? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, dnsAliasName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, dnsAliasName: string, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, dnsAliasName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Cancels a sync group synchronization. + * Deletes the server DNS alias with the given name. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} syncGroupName The name of the sync group. + * @param {string} dnsAliasName The name of the server DNS alias. * * @param {object} [options] Optional Parameters. * @@ -12477,21 +18756,19 @@ export interface SyncGroups { * * @reject {Error|ServiceError} - The error object. */ - cancelSyncWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, dnsAliasName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Cancels a sync group synchronization. + * Deletes the server DNS alias with the given name. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} syncGroupName The name of the sync group. + * @param {string} dnsAliasName The name of the server DNS alias. * * @param {object} [options] Optional Parameters. * @@ -12519,24 +18796,20 @@ export interface SyncGroups { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - cancelSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - cancelSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; - cancelSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, dnsAliasName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, dnsAliasName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, dnsAliasName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Triggers a sync group synchronization. + * Gets a list of server DNS aliases for a server. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. + * @param {string} serverName The name of the server that the alias is pointing + * to. * * @param {object} [options] Optional Parameters. * @@ -12545,25 +18818,21 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - triggerSyncWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Triggers a sync group synchronization. + * Gets a list of server DNS aliases for a server. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. + * @param {string} serverName The name of the server that the alias is pointing + * to. * * @param {object} [options] Optional Parameters. * @@ -12577,7 +18846,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ServerDnsAliasListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -12585,30 +18854,35 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ServerDnsAliasListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAliasListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - triggerSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - triggerSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; - triggerSync(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; + listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a sync group. + * Acquires server DNS alias from another server. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} dnsAliasName The name of the server dns alias. * - * @param {string} syncGroupName The name of the sync group. + * @param {object} parameters + * + * @param {string} [parameters.oldServerDnsAliasId] The id of the server alias + * that will be acquired to point to this server instead. * * @param {object} [options] Optional Parameters. * @@ -12617,25 +18891,28 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + acquireWithHttpOperationResponse(resourceGroupName: string, serverName: string, dnsAliasName: string, parameters: models.ServerDnsAliasAcquisition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a sync group. + * Acquires server DNS alias from another server. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} dnsAliasName The name of the server dns alias. * - * @param {string} syncGroupName The name of the sync group. + * @param {object} parameters + * + * @param {string} [parameters.oldServerDnsAliasId] The id of the server alias + * that will be acquired to point to this server instead. * * @param {object} [options] Optional Parameters. * @@ -12649,7 +18926,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncGroup} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -12657,55 +18934,28 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncGroup} [result] - The deserialized result object if an error did not occur. - * See {@link SyncGroup} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + acquire(resourceGroupName: string, serverName: string, dnsAliasName: string, parameters: models.ServerDnsAliasAcquisition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + acquire(resourceGroupName: string, serverName: string, dnsAliasName: string, parameters: models.ServerDnsAliasAcquisition, callback: ServiceCallback): void; + acquire(resourceGroupName: string, serverName: string, dnsAliasName: string, parameters: models.ServerDnsAliasAcquisition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a sync group. + * Creates a server dns alias. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. - * - * @param {object} parameters The requested sync group resource state. - * - * @param {number} [parameters.interval] Sync interval of the sync group. - * - * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution - * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' - * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync group. - * - * @param {string} [parameters.hubDatabaseUserName] User name for the sync - * group hub database credential. - * - * @param {string} [parameters.hubDatabasePassword] Password for the sync group - * hub database credential. - * - * @param {object} [parameters.schema] Sync schema of the sync group. - * - * @param {array} [parameters.schema.tables] List of tables in sync group - * schema. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync - * member where the schema is from. + * @param {string} dnsAliasName The name of the server DNS alias. * * @param {object} [options] Optional Parameters. * @@ -12714,49 +18964,23 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, dnsAliasName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a sync group. + * Creates a server dns alias. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. - * - * @param {object} parameters The requested sync group resource state. - * - * @param {number} [parameters.interval] Sync interval of the sync group. - * - * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution - * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' - * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync group. - * - * @param {string} [parameters.hubDatabaseUserName] User name for the sync - * group hub database credential. - * - * @param {string} [parameters.hubDatabasePassword] Password for the sync group - * hub database credential. - * - * @param {object} [parameters.schema] Sync schema of the sync group. - * - * @param {array} [parameters.schema.tables] List of tables in sync group - * schema. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync - * member where the schema is from. + * @param {string} dnsAliasName The name of the server DNS alias. * * @param {object} [options] Optional Parameters. * @@ -12770,7 +18994,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncGroup} - The deserialized result object. + * @resolve {ServerDnsAlias} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -12778,31 +19002,29 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncGroup} [result] - The deserialized result object if an error did not occur. - * See {@link SyncGroup} for more information. + * {ServerDnsAlias} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAlias} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, dnsAliasName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, dnsAliasName: string, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, dnsAliasName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a sync group. + * Deletes the server DNS alias with the given name. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. * * @param {object} [options] Optional Parameters. * @@ -12815,21 +19037,19 @@ export interface SyncGroups { * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, dnsAliasName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a sync group. + * Deletes the server DNS alias with the given name. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {string} syncGroupName The name of the sync group. + * @param {string} dnsAliasName The name of the server DNS alias. * * @param {object} [options] Optional Parameters. * @@ -12857,48 +19077,27 @@ export interface SyncGroups { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, dnsAliasName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, serverName: string, dnsAliasName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, serverName: string, dnsAliasName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates a sync group. + * Acquires server DNS alias from another server. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. - * - * @param {object} parameters The requested sync group resource state. - * - * @param {number} [parameters.interval] Sync interval of the sync group. - * - * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution - * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' - * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync group. - * - * @param {string} [parameters.hubDatabaseUserName] User name for the sync - * group hub database credential. - * - * @param {string} [parameters.hubDatabasePassword] Password for the sync group - * hub database credential. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {object} [parameters.schema] Sync schema of the sync group. + * @param {string} dnsAliasName The name of the server dns alias. * - * @param {array} [parameters.schema.tables] List of tables in sync group - * schema. + * @param {object} parameters * - * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync - * member where the schema is from. + * @param {string} [parameters.oldServerDnsAliasId] The id of the server alias + * that will be acquired to point to this server instead. * * @param {object} [options] Optional Parameters. * @@ -12907,49 +19106,28 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginAcquireWithHttpOperationResponse(resourceGroupName: string, serverName: string, dnsAliasName: string, parameters: models.ServerDnsAliasAcquisition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates a sync group. + * Acquires server DNS alias from another server. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. - * - * @param {object} parameters The requested sync group resource state. - * - * @param {number} [parameters.interval] Sync interval of the sync group. - * - * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution - * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' - * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync group. - * - * @param {string} [parameters.hubDatabaseUserName] User name for the sync - * group hub database credential. - * - * @param {string} [parameters.hubDatabasePassword] Password for the sync group - * hub database credential. + * @param {string} serverName The name of the server that the alias is pointing + * to. * - * @param {object} [parameters.schema] Sync schema of the sync group. + * @param {string} dnsAliasName The name of the server dns alias. * - * @param {array} [parameters.schema.tables] List of tables in sync group - * schema. + * @param {object} parameters * - * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync - * member where the schema is from. + * @param {string} [parameters.oldServerDnsAliasId] The id of the server alias + * that will be acquired to point to this server instead. * * @param {object} [options] Optional Parameters. * @@ -12963,7 +19141,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncGroup} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -12971,29 +19149,22 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncGroup} [result] - The deserialized result object if an error did not occur. - * See {@link SyncGroup} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, callback: ServiceCallback): void; - update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginAcquire(resourceGroupName: string, serverName: string, dnsAliasName: string, parameters: models.ServerDnsAliasAcquisition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginAcquire(resourceGroupName: string, serverName: string, dnsAliasName: string, parameters: models.ServerDnsAliasAcquisition, callback: ServiceCallback): void; + beginAcquire(resourceGroupName: string, serverName: string, dnsAliasName: string, parameters: models.ServerDnsAliasAcquisition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists sync groups under a hub database. + * Gets a list of server DNS aliases for a server. * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -13002,23 +19173,17 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists sync groups under a hub database. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. + * Gets a list of server DNS aliases for a server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -13032,7 +19197,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncGroupListResult} - The deserialized result object. + * @resolve {ServerDnsAliasListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13040,20 +19205,30 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncGroupListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncGroupListResult} for more information. + * {ServerDnsAliasListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAliasListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByServerNext(nextPageLink: string, callback: ServiceCallback): void; + listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RestorePoints + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface RestorePoints { /** - * Refreshes a hub database schema. + * Gets a list of database restore points. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13061,10 +19236,7 @@ export interface SyncGroups { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -13073,14 +19245,14 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginRefreshHubSchemaWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Refreshes a hub database schema. + * Gets a list of database restore points. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13088,10 +19260,7 @@ export interface SyncGroups { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -13105,7 +19274,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {RestorePointListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13113,19 +19282,21 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {RestorePointListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePointListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginRefreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginRefreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; - beginRefreshHubSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a sync group. + * Creates a restore point for a data warehouse. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13133,34 +19304,13 @@ export interface SyncGroups { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. - * - * @param {object} parameters The requested sync group resource state. - * - * @param {number} [parameters.interval] Sync interval of the sync group. - * - * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution - * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' - * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync group. - * - * @param {string} [parameters.hubDatabaseUserName] User name for the sync - * group hub database credential. - * - * @param {string} [parameters.hubDatabasePassword] Password for the sync group - * hub database credential. - * - * @param {object} [parameters.schema] Sync schema of the sync group. + * @param {string} databaseName The name of the database. * - * @param {array} [parameters.schema.tables] List of tables in sync group - * schema. + * @param {object} parameters The definition for creating the restore point of + * this database. * - * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync - * member where the schema is from. + * @param {string} parameters.restorePointLabel The restore point label to + * apply * * @param {object} [options] Optional Parameters. * @@ -13169,14 +19319,14 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.CreateDatabaseRestorePointDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a sync group. + * Creates a restore point for a data warehouse. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13184,34 +19334,13 @@ export interface SyncGroups { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. - * - * @param {object} parameters The requested sync group resource state. - * - * @param {number} [parameters.interval] Sync interval of the sync group. - * - * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution - * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' - * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync group. - * - * @param {string} [parameters.hubDatabaseUserName] User name for the sync - * group hub database credential. - * - * @param {string} [parameters.hubDatabasePassword] Password for the sync group - * hub database credential. - * - * @param {object} [parameters.schema] Sync schema of the sync group. + * @param {string} databaseName The name of the database. * - * @param {array} [parameters.schema.tables] List of tables in sync group - * schema. + * @param {object} parameters The definition for creating the restore point of + * this database. * - * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync - * member where the schema is from. + * @param {string} parameters.restorePointLabel The restore point label to + * apply * * @param {object} [options] Optional Parameters. * @@ -13225,7 +19354,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncGroup} - The deserialized result object. + * @resolve {RestorePoint} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13233,20 +19362,20 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncGroup} [result] - The deserialized result object if an error did not occur. - * See {@link SyncGroup} for more information. + * {RestorePoint} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePoint} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + create(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.CreateDatabaseRestorePointDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.CreateDatabaseRestorePointDefinition, callback: ServiceCallback): void; + create(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.CreateDatabaseRestorePointDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes a sync group. + * Gets a restore point. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13254,10 +19383,9 @@ export interface SyncGroups { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} databaseName The name of the database. * - * @param {string} syncGroupName The name of the sync group. + * @param {string} restorePointName The name of the restore point. * * @param {object} [options] Optional Parameters. * @@ -13266,14 +19394,14 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, restorePointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a sync group. + * Gets a restore point. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13281,10 +19409,9 @@ export interface SyncGroups { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} databaseName The name of the database. * - * @param {string} syncGroupName The name of the sync group. + * @param {string} restorePointName The name of the restore point. * * @param {object} [options] Optional Parameters. * @@ -13298,7 +19425,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {RestorePoint} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13306,19 +19433,20 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {RestorePoint} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePoint} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, restorePointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, restorePointName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, restorePointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates a sync group. + * Deletes a restore point. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13326,34 +19454,9 @@ export interface SyncGroups { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. - * - * @param {object} parameters The requested sync group resource state. - * - * @param {number} [parameters.interval] Sync interval of the sync group. - * - * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution - * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' - * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync group. - * - * @param {string} [parameters.hubDatabaseUserName] User name for the sync - * group hub database credential. - * - * @param {string} [parameters.hubDatabasePassword] Password for the sync group - * hub database credential. - * - * @param {object} [parameters.schema] Sync schema of the sync group. - * - * @param {array} [parameters.schema.tables] List of tables in sync group - * schema. + * @param {string} databaseName The name of the database. * - * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync - * member where the schema is from. + * @param {string} restorePointName The name of the restore point. * * @param {object} [options] Optional Parameters. * @@ -13362,14 +19465,14 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, restorePointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates a sync group. + * Deletes a restore point. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13377,34 +19480,9 @@ export interface SyncGroups { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. - * - * @param {object} parameters The requested sync group resource state. - * - * @param {number} [parameters.interval] Sync interval of the sync group. - * - * @param {string} [parameters.conflictResolutionPolicy] Conflict resolution - * policy of the sync group. Possible values include: 'HubWin', 'MemberWin' - * - * @param {string} [parameters.syncDatabaseId] ARM resource id of the sync - * database in the sync group. - * - * @param {string} [parameters.hubDatabaseUserName] User name for the sync - * group hub database credential. - * - * @param {string} [parameters.hubDatabasePassword] Password for the sync group - * hub database credential. - * - * @param {object} [parameters.schema] Sync schema of the sync group. - * - * @param {array} [parameters.schema.tables] List of tables in sync group - * schema. + * @param {string} databaseName The name of the database. * - * @param {string} [parameters.schema.masterSyncMemberName] Name of master sync - * member where the schema is from. + * @param {string} restorePointName The name of the restore point. * * @param {object} [options] Optional Parameters. * @@ -13418,7 +19496,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncGroup} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13426,23 +19504,33 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncGroup} [result] - The deserialized result object if an error did not occur. - * See {@link SyncGroup} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, callback: ServiceCallback): void; - beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, parameters: models.SyncGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, restorePointName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, restorePointName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, restorePointName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a collection of sync database ids. + * Creates a restore point for a data warehouse. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The definition for creating the restore point of + * this database. + * + * @param {string} parameters.restorePointLabel The restore point label to + * apply * * @param {object} [options] Optional Parameters. * @@ -13451,17 +19539,28 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listSyncDatabaseIdsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.CreateDatabaseRestorePointDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a collection of sync database ids. + * Creates a restore point for a data warehouse. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The definition for creating the restore point of + * this database. + * + * @param {string} parameters.restorePointLabel The restore point label to + * apply * * @param {object} [options] Optional Parameters. * @@ -13475,7 +19574,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncDatabaseIdListResult} - The deserialized result object. + * @resolve {RestorePoint} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13483,24 +19582,39 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncDatabaseIdListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncDatabaseIdListResult} for more - * information. + * {RestorePoint} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePoint} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listSyncDatabaseIdsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listSyncDatabaseIdsNext(nextPageLink: string, callback: ServiceCallback): void; - listSyncDatabaseIdsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.CreateDatabaseRestorePointDefinition, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.CreateDatabaseRestorePointDefinition, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.CreateDatabaseRestorePointDefinition, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DatabaseOperations + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface DatabaseOperations { /** - * Gets a collection of hub database schemas. + * Cancels the asynchronous operation on the database. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {uuid} operationId The operation identifier. * * @param {object} [options] Optional Parameters. * @@ -13509,17 +19623,24 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listHubSchemasNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + cancelWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, operationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a collection of hub database schemas. + * Cancels the asynchronous operation on the database. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {uuid} operationId The operation identifier. * * @param {object} [options] Optional Parameters. * @@ -13533,7 +19654,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncFullSchemaPropertiesListResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13541,24 +19662,27 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncFullSchemaPropertiesListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncFullSchemaPropertiesListResult} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listHubSchemasNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listHubSchemasNext(nextPageLink: string, callback: ServiceCallback): void; - listHubSchemasNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + cancel(resourceGroupName: string, serverName: string, databaseName: string, operationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + cancel(resourceGroupName: string, serverName: string, databaseName: string, operationId: string, callback: ServiceCallback): void; + cancel(resourceGroupName: string, serverName: string, databaseName: string, operationId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a collection of sync group logs. + * Gets a list of operations performed on the database. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -13567,17 +19691,22 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listLogsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a collection of sync group logs. + * Gets a list of operations performed on the database. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -13591,7 +19720,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncGroupLogListResult} - The deserialized result object. + * @resolve {DatabaseOperationListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13599,21 +19728,21 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncGroupLogListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncGroupLogListResult} for more + * {DatabaseOperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseOperationListResult} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listLogsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listLogsNext(nextPageLink: string, callback: ServiceCallback): void; - listLogsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists sync groups under a hub database. + * Gets a list of operations performed on the database. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -13625,14 +19754,14 @@ export interface SyncGroups { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByDatabaseNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists sync groups under a hub database. + * Gets a list of operations performed on the database. * * @param {string} nextPageLink The NextLink from the previous successful call * to List operation. @@ -13649,7 +19778,7 @@ export interface SyncGroups { * * {Promise} A promise is returned. * - * @resolve {SyncGroupListResult} - The deserialized result object. + * @resolve {DatabaseOperationListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13657,29 +19786,30 @@ export interface SyncGroups { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncGroupListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncGroupListResult} for more information. + * {DatabaseOperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseOperationListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByDatabaseNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByDatabaseNext(nextPageLink: string, callback: ServiceCallback): void; - listByDatabaseNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabaseNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabaseNext(nextPageLink: string, callback: ServiceCallback): void; + listByDatabaseNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** * @class - * SyncMembers + * ElasticPoolOperations * __NOTE__: An instance of this class is automatically created for an * instance of the SqlManagementClient. */ -export interface SyncMembers { +export interface ElasticPoolOperations { /** - * Gets a sync member. + * Cancels the asynchronous operation on the elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13687,13 +19817,9 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {string} elasticPoolName * - * @param {string} syncMemberName The name of the sync member. + * @param {uuid} operationId The operation identifier. * * @param {object} [options] Optional Parameters. * @@ -13702,14 +19828,14 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + cancelWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, operationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a sync member. + * Cancels the asynchronous operation on the elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13717,13 +19843,9 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {string} elasticPoolName * - * @param {string} syncMemberName The name of the sync member. + * @param {uuid} operationId The operation identifier. * * @param {object} [options] Optional Parameters. * @@ -13737,7 +19859,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {SyncMember} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13745,20 +19867,19 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncMember} [result] - The deserialized result object if an error did not occur. - * See {@link SyncMember} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + cancel(resourceGroupName: string, serverName: string, elasticPoolName: string, operationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + cancel(resourceGroupName: string, serverName: string, elasticPoolName: string, operationId: string, callback: ServiceCallback): void; + cancel(resourceGroupName: string, serverName: string, elasticPoolName: string, operationId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a sync member. + * Gets a list of operations performed on the elastic pool. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13766,40 +19887,70 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} elasticPoolName * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {object} [options] Optional Parameters. * - * @param {string} syncMemberName The name of the sync member. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {object} parameters The requested sync member resource state. + * @returns {Promise} A promise is returned * - * @param {string} [parameters.databaseType] Database type of the sync member. - * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent - * in the sync member. + * @reject {Error|ServiceError} - The error object. + */ + listByElasticPoolWithHttpOperationResponse(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a list of operations performed on the elastic pool. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} elasticPoolName + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ElasticPoolOperationListResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. * - * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the - * sync member. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [parameters.serverName] Server name of the member database - * in the sync member + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [parameters.databaseName] Database name of the member - * database in the sync member. + * {ElasticPoolOperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolOperationListResult} for more + * information. * - * @param {string} [parameters.userName] User name of the member database in - * the sync member. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [parameters.password] Password of the member database in the - * sync member. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, callback: ServiceCallback): void; + listByElasticPool(resourceGroupName: string, serverName: string, elasticPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a list of operations performed on the elastic pool. * - * @param {string} [parameters.syncDirection] Sync direction of the sync - * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', - * 'OneWayHubToMember' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -13808,58 +19959,97 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByElasticPoolNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a sync member. + * Gets a list of operations performed on the elastic pool. * - * @param {string} 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. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * - * @param {string} serverName The name of the server. + * @param {object} [options] Optional Parameters. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @param {string} syncMemberName The name of the sync member. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @param {object} parameters The requested sync member resource state. + * {Promise} A promise is returned. * - * @param {string} [parameters.databaseType] Database type of the sync member. - * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * @resolve {ElasticPoolOperationListResult} - The deserialized result object. * - * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent - * in the sync member. + * @reject {Error|ServiceError} - The error object. * - * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the - * sync member. + * {ServiceCallback} optionalCallback(err, result, request, response) * - * @param {string} [parameters.serverName] Server name of the member database - * in the sync member + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * @param {string} [parameters.databaseName] Database name of the member - * database in the sync member. + * {ElasticPoolOperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ElasticPoolOperationListResult} for more + * information. * - * @param {string} [parameters.userName] User name of the member database in - * the sync member. + * {WebResource} [request] - The HTTP Request object if an error did not occur. * - * @param {string} [parameters.password] Password of the member database in the - * sync member. + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByElasticPoolNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByElasticPoolNext(nextPageLink: string, callback: ServiceCallback): void; + listByElasticPoolNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Capabilities + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface Capabilities { + + + /** + * Gets the subscription capabilities available for the specified location. * - * @param {string} [parameters.syncDirection] Sync direction of the sync - * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', - * 'OneWayHubToMember' + * @param {string} locationName The location name whose capabilities are + * retrieved. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.include] If specified, restricts the response to + * only include the selected item. Possible values include: + * 'supportedEditions', 'supportedElasticPoolEditions', + * 'supportedManagedInstanceVersions' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByLocationWithHttpOperationResponse(locationName: string, options?: { include? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the subscription capabilities available for the specified location. + * + * @param {string} locationName The location name whose capabilities are + * retrieved. * * @param {object} [options] Optional Parameters. * + * @param {string} [options.include] If specified, restricts the response to + * only include the selected item. Possible values include: + * 'supportedEditions', 'supportedElasticPoolEditions', + * 'supportedManagedInstanceVersions' + * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -13870,7 +20060,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {SyncMember} - The deserialized result object. + * @resolve {LocationCapabilities} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13878,20 +20068,29 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncMember} [result] - The deserialized result object if an error did not occur. - * See {@link SyncMember} for more information. + * {LocationCapabilities} [result] - The deserialized result object if an error did not occur. + * See {@link LocationCapabilities} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByLocation(locationName: string, options?: { include? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listByLocation(locationName: string, callback: ServiceCallback): void; + listByLocation(locationName: string, options: { include? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DatabaseVulnerabilityAssessmentScans + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface DatabaseVulnerabilityAssessmentScans { /** - * Deletes a sync member. + * Gets a vulnerability assessment scan record of a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13899,13 +20098,10 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {string} databaseName The name of the database. * - * @param {string} syncMemberName The name of the sync member. + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. * * @param {object} [options] Optional Parameters. * @@ -13914,14 +20110,14 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a sync member. + * Gets a vulnerability assessment scan record of a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13929,13 +20125,10 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {string} databaseName The name of the database. * - * @param {string} syncMemberName The name of the sync member. + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. * * @param {object} [options] Optional Parameters. * @@ -13949,7 +20142,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {VulnerabilityAssessmentScanRecord} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -13957,19 +20150,21 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {VulnerabilityAssessmentScanRecord} [result] - The deserialized result object if an error did not occur. + * See {@link VulnerabilityAssessmentScanRecord} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing sync member. + * Executes a Vulnerability Assessment database scan. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -13977,40 +20172,10 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. - * - * @param {string} syncMemberName The name of the sync member. - * - * @param {object} parameters The requested sync member resource state. - * - * @param {string} [parameters.databaseType] Database type of the sync member. - * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' - * - * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent - * in the sync member. - * - * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the - * sync member. - * - * @param {string} [parameters.serverName] Server name of the member database - * in the sync member - * - * @param {string} [parameters.databaseName] Database name of the member - * database in the sync member. - * - * @param {string} [parameters.userName] User name of the member database in - * the sync member. - * - * @param {string} [parameters.password] Password of the member database in the - * sync member. + * @param {string} databaseName The name of the database. * - * @param {string} [parameters.syncDirection] Sync direction of the sync - * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', - * 'OneWayHubToMember' + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. * * @param {object} [options] Optional Parameters. * @@ -14019,14 +20184,14 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + executeWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Updates an existing sync member. + * Executes a Vulnerability Assessment database scan. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -14034,40 +20199,10 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. - * - * @param {string} syncMemberName The name of the sync member. - * - * @param {object} parameters The requested sync member resource state. - * - * @param {string} [parameters.databaseType] Database type of the sync member. - * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' - * - * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent - * in the sync member. - * - * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the - * sync member. - * - * @param {string} [parameters.serverName] Server name of the member database - * in the sync member - * - * @param {string} [parameters.databaseName] Database name of the member - * database in the sync member. - * - * @param {string} [parameters.userName] User name of the member database in - * the sync member. - * - * @param {string} [parameters.password] Password of the member database in the - * sync member. + * @param {string} databaseName The name of the database. * - * @param {string} [parameters.syncDirection] Sync direction of the sync - * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', - * 'OneWayHubToMember' + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. * * @param {object} [options] Optional Parameters. * @@ -14081,7 +20216,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {SyncMember} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -14089,20 +20224,19 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncMember} [result] - The deserialized result object if an error did not occur. - * See {@link SyncMember} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, callback: ServiceCallback): void; - update(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + execute(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + execute(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, callback: ServiceCallback): void; + execute(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists sync members in the given sync group. + * Lists the vulnerability assessment scans of a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -14110,10 +20244,7 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -14122,14 +20253,14 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listBySyncGroupWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists sync members in the given sync group. + * Lists the vulnerability assessment scans of a database. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -14137,10 +20268,7 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -14154,7 +20282,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {SyncMemberListResult} - The deserialized result object. + * @resolve {VulnerabilityAssessmentScanRecordListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -14162,20 +20290,22 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncMemberListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncMemberListResult} for more information. + * {VulnerabilityAssessmentScanRecordListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VulnerabilityAssessmentScanRecordListResult} + * for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listBySyncGroup(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBySyncGroup(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, callback: ServiceCallback): void; - listBySyncGroup(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a sync member database schema. + * Convert an existing scan result to a human readable format. If already + * exists nothing happens * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -14183,13 +20313,9 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {string} databaseName The name of the scanned database. * - * @param {string} syncMemberName The name of the sync member. + * @param {string} scanId The vulnerability assessment scan Id. * * @param {object} [options] Optional Parameters. * @@ -14198,14 +20324,15 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listMemberSchemasWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + exportMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a sync member database schema. + * Convert an existing scan result to a human readable format. If already + * exists nothing happens * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -14213,13 +20340,9 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {string} databaseName The name of the scanned database. * - * @param {string} syncMemberName The name of the sync member. + * @param {string} scanId The vulnerability assessment scan Id. * * @param {object} [options] Optional Parameters. * @@ -14233,7 +20356,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {SyncFullSchemaPropertiesListResult} - The deserialized result object. + * @resolve {DatabaseVulnerabilityAssessmentScansExport} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -14241,21 +20364,21 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncFullSchemaPropertiesListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncFullSchemaPropertiesListResult} for more - * information. + * {DatabaseVulnerabilityAssessmentScansExport} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseVulnerabilityAssessmentScansExport} + * for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listMemberSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listMemberSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; - listMemberSchemas(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + exportMethod(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + exportMethod(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, callback: ServiceCallback): void; + exportMethod(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Refreshes a sync member database schema. + * Executes a Vulnerability Assessment database scan. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -14263,13 +20386,10 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {string} databaseName The name of the database. * - * @param {string} syncMemberName The name of the sync member. + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. * * @param {object} [options] Optional Parameters. * @@ -14282,10 +20402,10 @@ export interface SyncMembers { * * @reject {Error|ServiceError} - The error object. */ - refreshMemberSchemaWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginExecuteWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Refreshes a sync member database schema. + * Executes a Vulnerability Assessment database scan. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -14293,13 +20413,10 @@ export interface SyncMembers { * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {string} databaseName The name of the database. * - * @param {string} syncMemberName The name of the sync member. + * @param {string} scanId The vulnerability assessment scan Id of the scan to + * retrieve. * * @param {object} [options] Optional Parameters. * @@ -14327,54 +20444,16 @@ export interface SyncMembers { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - refreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - refreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; - refreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginExecute(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginExecute(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, callback: ServiceCallback): void; + beginExecute(resourceGroupName: string, serverName: string, databaseName: string, scanId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates a sync member. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. - * - * @param {string} syncMemberName The name of the sync member. - * - * @param {object} parameters The requested sync member resource state. - * - * @param {string} [parameters.databaseType] Database type of the sync member. - * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' - * - * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent - * in the sync member. - * - * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the - * sync member. - * - * @param {string} [parameters.serverName] Server name of the member database - * in the sync member - * - * @param {string} [parameters.databaseName] Database name of the member - * database in the sync member. - * - * @param {string} [parameters.userName] User name of the member database in - * the sync member. + * Lists the vulnerability assessment scans of a database. * - * @param {string} [parameters.password] Password of the member database in the - * sync member. - * - * @param {string} [parameters.syncDirection] Sync direction of the sync - * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', - * 'OneWayHubToMember' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -14383,55 +20462,17 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByDatabaseNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates a sync member. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. - * - * @param {string} syncMemberName The name of the sync member. - * - * @param {object} parameters The requested sync member resource state. - * - * @param {string} [parameters.databaseType] Database type of the sync member. - * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' - * - * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent - * in the sync member. - * - * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the - * sync member. - * - * @param {string} [parameters.serverName] Server name of the member database - * in the sync member - * - * @param {string} [parameters.databaseName] Database name of the member - * database in the sync member. - * - * @param {string} [parameters.userName] User name of the member database in - * the sync member. - * - * @param {string} [parameters.password] Password of the member database in the - * sync member. + * Lists the vulnerability assessment scans of a database. * - * @param {string} [parameters.syncDirection] Sync direction of the sync - * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', - * 'OneWayHubToMember' + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -14445,7 +20486,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {SyncMember} - The deserialized result object. + * @resolve {VulnerabilityAssessmentScanRecordListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -14453,34 +20494,39 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncMember} [result] - The deserialized result object if an error did not occur. - * See {@link SyncMember} for more information. + * {VulnerabilityAssessmentScanRecordListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VulnerabilityAssessmentScanRecordListResult} + * for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByDatabaseNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByDatabaseNext(nextPageLink: string, callback: ServiceCallback): void; + listByDatabaseNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * InstanceFailoverGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface InstanceFailoverGroups { /** - * Deletes a sync member. + * Gets a failover group. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {string} syncMemberName The name of the sync member. + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -14489,28 +20535,23 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes a sync member. + * Gets a failover group. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {string} syncMemberName The name of the sync member. + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -14524,7 +20565,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {InstanceFailoverGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -14532,117 +20573,181 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {InstanceFailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, locationName: string, failoverGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, locationName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Updates an existing sync member. + * Creates or updates a failover group. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. + * @param {string} failoverGroupName The name of the failover group. * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. + * @param {object} parameters The failover group parameters. * - * @param {string} syncMemberName The name of the sync member. + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. * - * @param {object} parameters The requested sync member resource state. + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' * - * @param {string} [parameters.databaseType] Database type of the sync member. - * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. * - * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent - * in the sync member. + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. * - * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the - * sync member. + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' * - * @param {string} [parameters.serverName] Server name of the member database - * in the sync member + * @param {array} parameters.partnerRegions Partner region information for the + * failover group. * - * @param {string} [parameters.databaseName] Database name of the member - * database in the sync member. + * @param {array} parameters.managedInstancePairs List of managed instance + * pairs in the failover group. * - * @param {string} [parameters.userName] User name of the member database in - * the sync member. + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, locationName: string, failoverGroupName: string, parameters: models.InstanceFailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' * - * @param {string} [parameters.password] Password of the member database in the - * sync member. + * @param {array} parameters.partnerRegions Partner region information for the + * failover group. * - * @param {string} [parameters.syncDirection] Sync direction of the sync - * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', - * 'OneWayHubToMember' + * @param {array} parameters.managedInstancePairs List of managed instance + * pairs in the failover group. * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the * request * - * @returns {Promise} A promise is returned + * @param {ServiceCallback} [optionalCallback] - The optional callback. * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. * - * @reject {Error|ServiceError} - The error object. + * {Promise} A promise is returned. + * + * @resolve {InstanceFailoverGroup} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {InstanceFailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdate(resourceGroupName: string, locationName: string, failoverGroupName: string, parameters: models.InstanceFailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, locationName: string, failoverGroupName: string, parameters: models.InstanceFailoverGroup, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, locationName: string, failoverGroupName: string, parameters: models.InstanceFailoverGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** - * Updates an existing sync member. + * Deletes a failover group. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. - * - * @param {string} syncMemberName The name of the sync member. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {object} parameters The requested sync member resource state. + * @param {string} failoverGroupName The name of the failover group. * - * @param {string} [parameters.databaseType] Database type of the sync member. - * Possible values include: 'AzureSqlDatabase', 'SqlServerDatabase' + * @param {object} [options] Optional Parameters. * - * @param {string} [parameters.syncAgentId] ARM resource id of the sync agent - * in the sync member. + * @param {object} [options.customHeaders] Headers that will be added to the + * request * - * @param {uuid} [parameters.sqlServerDatabaseId] SQL Server database id of the - * sync member. + * @returns {Promise} A promise is returned * - * @param {string} [parameters.serverName] Server name of the member database - * in the sync member + * @resolve {HttpOperationResponse} - The deserialized result object. * - * @param {string} [parameters.databaseName] Database name of the member - * database in the sync member. + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a failover group. * - * @param {string} [parameters.userName] User name of the member database in - * the sync member. + * @param {string} 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. * - * @param {string} [parameters.password] Password of the member database in the - * sync member. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {string} [parameters.syncDirection] Sync direction of the sync - * member. Possible values include: 'Bidirectional', 'OneWayMemberToHub', - * 'OneWayHubToMember' + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -14656,7 +20761,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {SyncMember} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -14664,34 +20769,26 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncMember} [result] - The deserialized result object if an error did not occur. - * See {@link SyncMember} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, callback: ServiceCallback): void; - beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, parameters: models.SyncMember, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, locationName: string, failoverGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, locationName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Refreshes a sync member database schema. + * Lists the failover groups in a location. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. - * - * @param {string} syncMemberName The name of the sync member. + * @param {string} locationName The name of the region where the resource is + * located. * * @param {object} [options] Optional Parameters. * @@ -14700,28 +20797,21 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginRefreshMemberSchemaWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByLocationWithHttpOperationResponse(resourceGroupName: string, locationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Refreshes a sync member database schema. + * Lists the failover groups in a location. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database on which the sync - * group is hosted. - * - * @param {string} syncGroupName The name of the sync group on which the sync - * member is hosted. - * - * @param {string} syncMemberName The name of the sync member. + * @param {string} locationName The name of the region where the resource is + * located. * * @param {object} [options] Optional Parameters. * @@ -14735,7 +20825,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {InstanceFailoverGroupListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -14743,22 +20833,31 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {InstanceFailoverGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroupListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginRefreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginRefreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, callback: ServiceCallback): void; - beginRefreshMemberSchema(resourceGroupName: string, serverName: string, databaseName: string, syncGroupName: string, syncMemberName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByLocation(resourceGroupName: string, locationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByLocation(resourceGroupName: string, locationName: string, callback: ServiceCallback): void; + listByLocation(resourceGroupName: string, locationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Lists sync members in the given sync group. + * Fails over from the current primary managed instance to this managed + * instance. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -14767,17 +20866,24 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listBySyncGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + failoverWithHttpOperationResponse(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Lists sync members in the given sync group. + * Fails over from the current primary managed instance to this managed + * instance. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -14791,7 +20897,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {SyncMemberListResult} - The deserialized result object. + * @resolve {InstanceFailoverGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -14799,23 +20905,30 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncMemberListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncMemberListResult} for more information. + * {InstanceFailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listBySyncGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listBySyncGroupNext(nextPageLink: string, callback: ServiceCallback): void; - listBySyncGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + failover(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + failover(resourceGroupName: string, locationName: string, failoverGroupName: string, callback: ServiceCallback): void; + failover(resourceGroupName: string, locationName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a sync member database schema. + * Fails over from the current primary managed instance to this managed + * instance. This operation might result in data loss. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -14824,17 +20937,24 @@ export interface SyncMembers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listMemberSchemasNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + forceFailoverAllowDataLossWithHttpOperationResponse(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a sync member database schema. + * Fails over from the current primary managed instance to this managed + * instance. This operation might result in data loss. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -14848,7 +20968,7 @@ export interface SyncMembers { * * {Promise} A promise is returned. * - * @resolve {SyncFullSchemaPropertiesListResult} - The deserialized result object. + * @resolve {InstanceFailoverGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -14856,38 +20976,58 @@ export interface SyncMembers { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {SyncFullSchemaPropertiesListResult} [result] - The deserialized result object if an error did not occur. - * See {@link SyncFullSchemaPropertiesListResult} for more - * information. + * {InstanceFailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listMemberSchemasNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listMemberSchemasNext(nextPageLink: string, callback: ServiceCallback): void; - listMemberSchemasNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * VirtualNetworkRules - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface VirtualNetworkRules { + forceFailoverAllowDataLoss(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + forceFailoverAllowDataLoss(resourceGroupName: string, locationName: string, failoverGroupName: string, callback: ServiceCallback): void; + forceFailoverAllowDataLoss(resourceGroupName: string, locationName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a virtual network rule. + * Creates or updates a failover group. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerRegions Partner region information for the + * failover group. + * + * @param {array} parameters.managedInstancePairs List of managed instance + * pairs in the failover group. * * @param {object} [options] Optional Parameters. * @@ -14896,22 +21036,52 @@ export interface VirtualNetworkRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - getWithHttpOperationResponse(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, locationName: string, failoverGroupName: string, parameters: models.InstanceFailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a virtual network rule. + * Creates or updates a failover group. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerRegions Partner region information for the + * failover group. + * + * @param {array} parameters.managedInstancePairs List of managed instance + * pairs in the failover group. * * @param {object} [options] Optional Parameters. * @@ -14925,7 +21095,7 @@ export interface VirtualNetworkRules { * * {Promise} A promise is returned. * - * @resolve {VirtualNetworkRule} - The deserialized result object. + * @resolve {InstanceFailoverGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -14933,37 +21103,29 @@ export interface VirtualNetworkRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {VirtualNetworkRule} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkRule} for more information. - * + * {InstanceFailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - get(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - get(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, callback: ServiceCallback): void; - get(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, locationName: string, failoverGroupName: string, parameters: models.InstanceFailoverGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, locationName: string, failoverGroupName: string, parameters: models.InstanceFailoverGroup, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, locationName: string, failoverGroupName: string, parameters: models.InstanceFailoverGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates an existing virtual network rule. + * Deletes a failover group. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} virtualNetworkRuleName The name of the virtual network rule. - * - * @param {object} parameters The requested virtual Network Rule Resource - * state. - * - * @param {string} parameters.virtualNetworkSubnetId The ARM resource id of the - * virtual network subnet. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {boolean} [parameters.ignoreMissingVnetServiceEndpoint] Create - * firewall rule before the virtual network has vnet service endpoint enabled. + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -14972,31 +21134,23 @@ export interface VirtualNetworkRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates an existing virtual network rule. + * Deletes a failover group. * * @param {string} 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. * - * @param {string} serverName The name of the server. - * - * @param {string} virtualNetworkRuleName The name of the virtual network rule. - * - * @param {object} parameters The requested virtual Network Rule Resource - * state. - * - * @param {string} parameters.virtualNetworkSubnetId The ARM resource id of the - * virtual network subnet. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {boolean} [parameters.ignoreMissingVnetServiceEndpoint] Create - * firewall rule before the virtual network has vnet service endpoint enabled. + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -15010,7 +21164,7 @@ export interface VirtualNetworkRules { * * {Promise} A promise is returned. * - * @resolve {VirtualNetworkRule} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -15018,28 +21172,29 @@ export interface VirtualNetworkRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {VirtualNetworkRule} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkRule} for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - createOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - createOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, callback: ServiceCallback): void; - createOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, locationName: string, failoverGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, locationName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Deletes the virtual network rule with the given name. + * Fails over from the current primary managed instance to this managed + * instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -15048,22 +21203,24 @@ export interface VirtualNetworkRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - deleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginFailoverWithHttpOperationResponse(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the virtual network rule with the given name. + * Fails over from the current primary managed instance to this managed + * instance. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} locationName The name of the region where the resource is + * located. * - * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -15077,7 +21234,7 @@ export interface VirtualNetworkRules { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {InstanceFailoverGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -15085,25 +21242,30 @@ export interface VirtualNetworkRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {InstanceFailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - deleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - deleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, callback: ServiceCallback): void; - deleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginFailover(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginFailover(resourceGroupName: string, locationName: string, failoverGroupName: string, callback: ServiceCallback): void; + beginFailover(resourceGroupName: string, locationName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of virtual network rules in a server. + * Fails over from the current primary managed instance to this managed + * instance. This operation might result in data loss. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -15112,20 +21274,24 @@ export interface VirtualNetworkRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerWithHttpOperationResponse(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginForceFailoverAllowDataLossWithHttpOperationResponse(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of virtual network rules in a server. + * Fails over from the current primary managed instance to this managed + * instance. This operation might result in data loss. * * @param {string} 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. * - * @param {string} serverName The name of the server. + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. * * @param {object} [options] Optional Parameters. * @@ -15139,7 +21305,7 @@ export interface VirtualNetworkRules { * * {Promise} A promise is returned. * - * @resolve {VirtualNetworkRuleListResult} - The deserialized result object. + * @resolve {InstanceFailoverGroup} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -15147,38 +21313,23 @@ export interface VirtualNetworkRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {VirtualNetworkRuleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkRuleListResult} for more - * information. + * {InstanceFailoverGroup} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServer(resourceGroupName: string, serverName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServer(resourceGroupName: string, serverName: string, callback: ServiceCallback): void; - listByServer(resourceGroupName: string, serverName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginForceFailoverAllowDataLoss(resourceGroupName: string, locationName: string, failoverGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginForceFailoverAllowDataLoss(resourceGroupName: string, locationName: string, failoverGroupName: string, callback: ServiceCallback): void; + beginForceFailoverAllowDataLoss(resourceGroupName: string, locationName: string, failoverGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Creates or updates an existing virtual network rule. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * Lists the failover groups in a location. * - * @param {object} parameters The requested virtual Network Rule Resource - * state. - * - * @param {string} parameters.virtualNetworkSubnetId The ARM resource id of the - * virtual network subnet. - * - * @param {boolean} [parameters.ignoreMissingVnetServiceEndpoint] Create - * firewall rule before the virtual network has vnet service endpoint enabled. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -15187,31 +21338,17 @@ export interface VirtualNetworkRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + listByLocationNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Creates or updates an existing virtual network rule. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} virtualNetworkRuleName The name of the virtual network rule. - * - * @param {object} parameters The requested virtual Network Rule Resource - * state. + * Lists the failover groups in a location. * - * @param {string} parameters.virtualNetworkSubnetId The ARM resource id of the - * virtual network subnet. - * - * @param {boolean} [parameters.ignoreMissingVnetServiceEndpoint] Create - * firewall rule before the virtual network has vnet service endpoint enabled. + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. * * @param {object} [options] Optional Parameters. * @@ -15225,7 +21362,7 @@ export interface VirtualNetworkRules { * * {Promise} A promise is returned. * - * @resolve {VirtualNetworkRule} - The deserialized result object. + * @resolve {InstanceFailoverGroupListResult} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -15233,20 +21370,30 @@ export interface VirtualNetworkRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {VirtualNetworkRule} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkRule} for more information. + * {InstanceFailoverGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroupListResult} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginCreateOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, callback: ServiceCallback): void; - beginCreateOrUpdate(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, parameters: models.VirtualNetworkRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + listByLocationNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByLocationNext(nextPageLink: string, callback: ServiceCallback): void; + listByLocationNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ShortTermRetentionPolicies + * __NOTE__: An instance of this class is automatically created for an + * instance of the SqlManagementClient. + */ +export interface ShortTermRetentionPolicies { /** - * Deletes the virtual network rule with the given name. + * Gets a database's short term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -15254,7 +21401,7 @@ export interface VirtualNetworkRules { * * @param {string} serverName The name of the server. * - * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -15263,14 +21410,14 @@ export interface VirtualNetworkRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + getWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Deletes the virtual network rule with the given name. + * Gets a database's short term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -15278,7 +21425,7 @@ export interface VirtualNetworkRules { * * @param {string} serverName The name of the server. * - * @param {string} virtualNetworkRuleName The name of the virtual network rule. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -15292,7 +21439,7 @@ export interface VirtualNetworkRules { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ShortTermRetentionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -15300,22 +21447,34 @@ export interface VirtualNetworkRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ShortTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - beginDeleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginDeleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, callback: ServiceCallback): void; - beginDeleteMethod(resourceGroupName: string, serverName: string, virtualNetworkRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of virtual network rules in a server. + * Updates a database's short term retention policy. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. * * @param {object} [options] Optional Parameters. * @@ -15324,17 +21483,27 @@ export interface VirtualNetworkRules { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByServerNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of virtual network rules in a server. + * Updates a database's short term retention policy. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. * * @param {object} [options] Optional Parameters. * @@ -15348,7 +21517,7 @@ export interface VirtualNetworkRules { * * {Promise} A promise is returned. * - * @resolve {VirtualNetworkRuleListResult} - The deserialized result object. + * @resolve {ShortTermRetentionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -15356,30 +21525,21 @@ export interface VirtualNetworkRules { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {VirtualNetworkRuleListResult} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkRuleListResult} for more + * {ShortTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByServerNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByServerNext(nextPageLink: string, callback: ServiceCallback): void; - listByServerNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; -} - -/** - * @class - * DatabaseOperations - * __NOTE__: An instance of this class is automatically created for an - * instance of the SqlManagementClient. - */ -export interface DatabaseOperations { + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Cancels the asynchronous operation on the database. + * Updates a database's short term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -15389,7 +21549,10 @@ export interface DatabaseOperations { * * @param {string} databaseName The name of the database. * - * @param {uuid} operationId The operation identifier. + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. * * @param {object} [options] Optional Parameters. * @@ -15398,14 +21561,14 @@ export interface DatabaseOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - cancelWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, operationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Cancels the asynchronous operation on the database. + * Updates a database's short term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -15415,7 +21578,10 @@ export interface DatabaseOperations { * * @param {string} databaseName The name of the database. * - * @param {uuid} operationId The operation identifier. + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. * * @param {object} [options] Optional Parameters. * @@ -15429,7 +21595,7 @@ export interface DatabaseOperations { * * {Promise} A promise is returned. * - * @resolve {null} - The deserialized result object. + * @resolve {ShortTermRetentionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -15437,19 +21603,21 @@ export interface DatabaseOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {null} [result] - The deserialized result object if an error did not occur. + * {ShortTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - cancel(resourceGroupName: string, serverName: string, databaseName: string, operationId: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - cancel(resourceGroupName: string, serverName: string, databaseName: string, operationId: string, callback: ServiceCallback): void; - cancel(resourceGroupName: string, serverName: string, databaseName: string, operationId: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, callback: ServiceCallback): void; + update(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of operations performed on the database. + * Updates a database's short term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -15459,6 +21627,11 @@ export interface DatabaseOperations { * * @param {string} databaseName The name of the database. * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -15466,14 +21639,14 @@ export interface DatabaseOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByDatabaseWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of operations performed on the database. + * Updates a database's short term retention policy. * * @param {string} resourceGroupName The name of the resource group that * contains the resource. You can obtain this value from the Azure Resource @@ -15483,6 +21656,11 @@ export interface DatabaseOperations { * * @param {string} databaseName The name of the database. * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -15495,7 +21673,7 @@ export interface DatabaseOperations { * * {Promise} A promise is returned. * - * @resolve {DatabaseOperationListResult} - The deserialized result object. + * @resolve {ShortTermRetentionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -15503,24 +21681,34 @@ export interface DatabaseOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DatabaseOperationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseOperationListResult} for more + * {ShortTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, callback: ServiceCallback): void; - listByDatabase(resourceGroupName: string, serverName: string, databaseName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** - * Gets a list of operations performed on the database. + * Updates a database's short term retention policy. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. * * @param {object} [options] Optional Parameters. * @@ -15529,17 +21717,27 @@ export interface DatabaseOperations { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - listByDatabaseNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateWithHttpOperationResponse(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets a list of operations performed on the database. + * Updates a database's short term retention policy. * - * @param {string} nextPageLink The NextLink from the previous successful call - * to List operation. + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. * * @param {object} [options] Optional Parameters. * @@ -15553,7 +21751,7 @@ export interface DatabaseOperations { * * {Promise} A promise is returned. * - * @resolve {DatabaseOperationListResult} - The deserialized result object. + * @resolve {ShortTermRetentionPolicy} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -15561,15 +21759,15 @@ export interface DatabaseOperations { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {DatabaseOperationListResult} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseOperationListResult} for more + * {ShortTermRetentionPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more * information. * * {WebResource} [request] - The HTTP Request object if an error did not occur. * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - listByDatabaseNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - listByDatabaseNext(nextPageLink: string, callback: ServiceCallback): void; - listByDatabaseNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, serverName: string, databaseName: string, parameters: models.ShortTermRetentionPolicy, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } diff --git a/lib/services/sqlManagement2/lib/operations/index.js b/lib/services/sqlManagement2/lib/operations/index.js index 604e407dcc..2acaf94c6e 100644 --- a/lib/services/sqlManagement2/lib/operations/index.js +++ b/lib/services/sqlManagement2/lib/operations/index.js @@ -14,12 +14,9 @@ 'use strict'; -exports.BackupLongTermRetentionPolicies = require('./backupLongTermRetentionPolicies'); -exports.BackupLongTermRetentionVaults = require('./backupLongTermRetentionVaults'); -exports.RestorePoints = require('./restorePoints'); exports.RecoverableDatabases = require('./recoverableDatabases'); exports.RestorableDroppedDatabases = require('./restorableDroppedDatabases'); -exports.Capabilities = require('./capabilities'); +exports.Servers = require('./servers'); exports.ServerConnectionPolicies = require('./serverConnectionPolicies'); exports.DatabaseThreatDetectionPolicies = require('./databaseThreatDetectionPolicies'); exports.DataMaskingPolicies = require('./dataMaskingPolicies'); @@ -28,26 +25,39 @@ exports.FirewallRules = require('./firewallRules'); exports.GeoBackupPolicies = require('./geoBackupPolicies'); exports.Databases = require('./databases'); exports.ElasticPools = require('./elasticPools'); +exports.RecommendedElasticPools = require('./recommendedElasticPools'); exports.ReplicationLinks = require('./replicationLinks'); exports.ServerAzureADAdministrators = require('./serverAzureADAdministrators'); exports.ServerCommunicationLinks = require('./serverCommunicationLinks'); exports.ServiceObjectives = require('./serviceObjectives'); -exports.Servers = require('./servers'); exports.ElasticPoolActivities = require('./elasticPoolActivities'); exports.ElasticPoolDatabaseActivities = require('./elasticPoolDatabaseActivities'); -exports.RecommendedElasticPools = require('./recommendedElasticPools'); exports.ServiceTierAdvisors = require('./serviceTierAdvisors'); exports.TransparentDataEncryptions = require('./transparentDataEncryptions'); exports.TransparentDataEncryptionActivities = require('./transparentDataEncryptionActivities'); exports.ServerUsages = require('./serverUsages'); exports.DatabaseUsages = require('./databaseUsages'); exports.DatabaseBlobAuditingPolicies = require('./databaseBlobAuditingPolicies'); +exports.DatabaseAutomaticTuningOperations = require('./databaseAutomaticTuningOperations'); exports.EncryptionProtectors = require('./encryptionProtectors'); exports.FailoverGroups = require('./failoverGroups'); +exports.ManagedInstances = require('./managedInstances'); exports.Operations = require('./operations'); exports.ServerKeys = require('./serverKeys'); exports.SyncAgents = require('./syncAgents'); exports.SyncGroups = require('./syncGroups'); exports.SyncMembers = require('./syncMembers'); +exports.SubscriptionUsages = require('./subscriptionUsages'); exports.VirtualNetworkRules = require('./virtualNetworkRules'); +exports.LongTermRetentionBackups = require('./longTermRetentionBackups'); +exports.BackupLongTermRetentionPolicies = require('./backupLongTermRetentionPolicies'); +exports.ManagedDatabases = require('./managedDatabases'); +exports.ServerAutomaticTuningOperations = require('./serverAutomaticTuningOperations'); +exports.ServerDnsAliases = require('./serverDnsAliases'); +exports.RestorePoints = require('./restorePoints'); exports.DatabaseOperations = require('./databaseOperations'); +exports.ElasticPoolOperations = require('./elasticPoolOperations'); +exports.Capabilities = require('./capabilities'); +exports.DatabaseVulnerabilityAssessmentScans = require('./databaseVulnerabilityAssessmentScans'); +exports.InstanceFailoverGroups = require('./instanceFailoverGroups'); +exports.ShortTermRetentionPolicies = require('./shortTermRetentionPolicies'); diff --git a/lib/services/sqlManagement2/lib/operations/instanceFailoverGroups.js b/lib/services/sqlManagement2/lib/operations/instanceFailoverGroups.js new file mode 100644 index 0000000000..963a57ef7e --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/instanceFailoverGroups.js @@ -0,0 +1,2634 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, locationName, failoverGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (failoverGroupName === null || failoverGroupName === undefined || typeof failoverGroupName.valueOf() !== 'string') { + throw new Error('failoverGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{failoverGroupName}', encodeURIComponent(failoverGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InstanceFailoverGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerRegions Partner region information for the + * failover group. + * + * @param {array} parameters.managedInstancePairs List of managed instance + * pairs in the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InstanceFailoverGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, locationName, failoverGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, locationName, failoverGroupName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists the failover groups in a location. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByLocation(resourceGroupName, locationName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InstanceFailoverGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Fails over from the current primary managed instance to this managed + * instance. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _failover(resourceGroupName, locationName, failoverGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginFailover(resourceGroupName, locationName, failoverGroupName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InstanceFailoverGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Fails over from the current primary managed instance to this managed + * instance. This operation might result in data loss. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginForceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InstanceFailoverGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerRegions Partner region information for the + * failover group. + * + * @param {array} parameters.managedInstancePairs List of managed instance + * pairs in the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (failoverGroupName === null || failoverGroupName === undefined || typeof failoverGroupName.valueOf() !== 'string') { + throw new Error('failoverGroupName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{failoverGroupName}', encodeURIComponent(failoverGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['InstanceFailoverGroup']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InstanceFailoverGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InstanceFailoverGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, locationName, failoverGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (failoverGroupName === null || failoverGroupName === undefined || typeof failoverGroupName.valueOf() !== 'string') { + throw new Error('failoverGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{failoverGroupName}', encodeURIComponent(failoverGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Fails over from the current primary managed instance to this managed + * instance. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginFailover(resourceGroupName, locationName, failoverGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (failoverGroupName === null || failoverGroupName === undefined || typeof failoverGroupName.valueOf() !== 'string') { + throw new Error('failoverGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/failover'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{failoverGroupName}', encodeURIComponent(failoverGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InstanceFailoverGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Fails over from the current primary managed instance to this managed + * instance. This operation might result in data loss. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginForceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (failoverGroupName === null || failoverGroupName === undefined || typeof failoverGroupName.valueOf() !== 'string') { + throw new Error('failoverGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/instanceFailoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{failoverGroupName}', encodeURIComponent(failoverGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InstanceFailoverGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the failover groups in a location. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByLocationNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InstanceFailoverGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a InstanceFailoverGroups. */ +class InstanceFailoverGroups { + /** + * Create a InstanceFailoverGroups. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listByLocation = _listByLocation; + this._failover = _failover; + this._forceFailoverAllowDataLoss = _forceFailoverAllowDataLoss; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginFailover = _beginFailover; + this._beginForceFailoverAllowDataLoss = _beginForceFailoverAllowDataLoss; + this._listByLocationNext = _listByLocationNext; + } + + /** + * Gets a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, locationName, failoverGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InstanceFailoverGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, locationName, failoverGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, locationName, failoverGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerRegions Partner region information for the + * failover group. + * + * @param {array} parameters.managedInstancePairs List of managed instance + * pairs in the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, locationName, failoverGroupName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerRegions Partner region information for the + * failover group. + * + * @param {array} parameters.managedInstancePairs List of managed instance + * pairs in the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InstanceFailoverGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, optionalCallback); + } + } + + /** + * Deletes a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, locationName, failoverGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, locationName, failoverGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, locationName, failoverGroupName, options, optionalCallback); + } + } + + /** + * Lists the failover groups in a location. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByLocationWithHttpOperationResponse(resourceGroupName, locationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByLocation(resourceGroupName, locationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the failover groups in a location. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InstanceFailoverGroupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByLocation(resourceGroupName, locationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByLocation(resourceGroupName, locationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByLocation(resourceGroupName, locationName, options, optionalCallback); + } + } + + /** + * Fails over from the current primary managed instance to this managed + * instance. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + failoverWithHttpOperationResponse(resourceGroupName, locationName, failoverGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._failover(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Fails over from the current primary managed instance to this managed + * instance. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InstanceFailoverGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + failover(resourceGroupName, locationName, failoverGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._failover(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._failover(resourceGroupName, locationName, failoverGroupName, options, optionalCallback); + } + } + + /** + * Fails over from the current primary managed instance to this managed + * instance. This operation might result in data loss. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + forceFailoverAllowDataLossWithHttpOperationResponse(resourceGroupName, locationName, failoverGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Fails over from the current primary managed instance to this managed + * instance. This operation might result in data loss. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InstanceFailoverGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._forceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerRegions Partner region information for the + * failover group. + * + * @param {array} parameters.managedInstancePairs List of managed instance + * pairs in the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, locationName, failoverGroupName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} parameters The failover group parameters. + * + * @param {object} parameters.readWriteEndpoint Read-write endpoint of the + * failover group instance. + * + * @param {string} parameters.readWriteEndpoint.failoverPolicy Failover policy + * of the read-write endpoint for the failover group. If failoverPolicy is + * Automatic then failoverWithDataLossGracePeriodMinutes is required. Possible + * values include: 'Manual', 'Automatic' + * + * @param {number} + * [parameters.readWriteEndpoint.failoverWithDataLossGracePeriodMinutes] Grace + * period before failover with data loss is attempted for the read-write + * endpoint. If failoverPolicy is Automatic then + * failoverWithDataLossGracePeriodMinutes is required. + * + * @param {object} [parameters.readOnlyEndpoint] Read-only endpoint of the + * failover group instance. + * + * @param {string} [parameters.readOnlyEndpoint.failoverPolicy] Failover policy + * of the read-only endpoint for the failover group. Possible values include: + * 'Disabled', 'Enabled' + * + * @param {array} parameters.partnerRegions Partner region information for the + * failover group. + * + * @param {array} parameters.managedInstancePairs List of managed instance + * pairs in the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InstanceFailoverGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, locationName, failoverGroupName, parameters, options, optionalCallback); + } + } + + /** + * Deletes a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, locationName, failoverGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a failover group. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, locationName, failoverGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, locationName, failoverGroupName, options, optionalCallback); + } + } + + /** + * Fails over from the current primary managed instance to this managed + * instance. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginFailoverWithHttpOperationResponse(resourceGroupName, locationName, failoverGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginFailover(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Fails over from the current primary managed instance to this managed + * instance. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InstanceFailoverGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginFailover(resourceGroupName, locationName, failoverGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginFailover(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginFailover(resourceGroupName, locationName, failoverGroupName, options, optionalCallback); + } + } + + /** + * Fails over from the current primary managed instance to this managed + * instance. This operation might result in data loss. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginForceFailoverAllowDataLossWithHttpOperationResponse(resourceGroupName, locationName, failoverGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginForceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Fails over from the current primary managed instance to this managed + * instance. This operation might result in data loss. + * + * @param {string} 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. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} failoverGroupName The name of the failover group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InstanceFailoverGroup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginForceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginForceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginForceFailoverAllowDataLoss(resourceGroupName, locationName, failoverGroupName, options, optionalCallback); + } + } + + /** + * Lists the failover groups in a location. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByLocationNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByLocationNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the failover groups in a location. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InstanceFailoverGroupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InstanceFailoverGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByLocationNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByLocationNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByLocationNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = InstanceFailoverGroups; diff --git a/lib/services/sqlManagement2/lib/operations/longTermRetentionBackups.js b/lib/services/sqlManagement2/lib/operations/longTermRetentionBackups.js new file mode 100644 index 0000000000..39ad67fada --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/longTermRetentionBackups.js @@ -0,0 +1,2116 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets a long term retention backup. + * + * @param {string} locationName The location of the database. + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackup} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (longTermRetentionServerName === null || longTermRetentionServerName === undefined || typeof longTermRetentionServerName.valueOf() !== 'string') { + throw new Error('longTermRetentionServerName cannot be null or undefined and it must be of type string.'); + } + if (longTermRetentionDatabaseName === null || longTermRetentionDatabaseName === undefined || typeof longTermRetentionDatabaseName.valueOf() !== 'string') { + throw new Error('longTermRetentionDatabaseName cannot be null or undefined and it must be of type string.'); + } + if (backupName === null || backupName === undefined || typeof backupName.valueOf() !== 'string') { + throw new Error('backupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{longTermRetentionServerName}', encodeURIComponent(longTermRetentionServerName)); + requestUrl = requestUrl.replace('{longTermRetentionDatabaseName}', encodeURIComponent(longTermRetentionDatabaseName)); + requestUrl = requestUrl.replace('{backupName}', encodeURIComponent(backupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LongTermRetentionBackup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Deletes a long term retention backup. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists all long term retention backups for a database. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let onlyLatestPerDatabase = (options && options.onlyLatestPerDatabase !== undefined) ? options.onlyLatestPerDatabase : undefined; + let databaseState = (options && options.databaseState !== undefined) ? options.databaseState : undefined; + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (longTermRetentionServerName === null || longTermRetentionServerName === undefined || typeof longTermRetentionServerName.valueOf() !== 'string') { + throw new Error('longTermRetentionServerName cannot be null or undefined and it must be of type string.'); + } + if (longTermRetentionDatabaseName === null || longTermRetentionDatabaseName === undefined || typeof longTermRetentionDatabaseName.valueOf() !== 'string') { + throw new Error('longTermRetentionDatabaseName cannot be null or undefined and it must be of type string.'); + } + if (onlyLatestPerDatabase !== null && onlyLatestPerDatabase !== undefined && typeof onlyLatestPerDatabase !== 'boolean') { + throw new Error('onlyLatestPerDatabase must be of type boolean.'); + } + if (databaseState !== null && databaseState !== undefined && typeof databaseState.valueOf() !== 'string') { + throw new Error('databaseState must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{longTermRetentionServerName}', encodeURIComponent(longTermRetentionServerName)); + requestUrl = requestUrl.replace('{longTermRetentionDatabaseName}', encodeURIComponent(longTermRetentionDatabaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (onlyLatestPerDatabase !== null && onlyLatestPerDatabase !== undefined) { + queryParameters.push('onlyLatestPerDatabase=' + encodeURIComponent(onlyLatestPerDatabase.toString())); + } + if (databaseState !== null && databaseState !== undefined) { + queryParameters.push('databaseState=' + encodeURIComponent(databaseState)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LongTermRetentionBackupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the long term retention backups for a given location. + * + * @param {string} locationName The location of the database + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByLocation(locationName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let onlyLatestPerDatabase = (options && options.onlyLatestPerDatabase !== undefined) ? options.onlyLatestPerDatabase : undefined; + let databaseState = (options && options.databaseState !== undefined) ? options.databaseState : undefined; + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (onlyLatestPerDatabase !== null && onlyLatestPerDatabase !== undefined && typeof onlyLatestPerDatabase !== 'boolean') { + throw new Error('onlyLatestPerDatabase must be of type boolean.'); + } + if (databaseState !== null && databaseState !== undefined && typeof databaseState.valueOf() !== 'string') { + throw new Error('databaseState must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionBackups'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (onlyLatestPerDatabase !== null && onlyLatestPerDatabase !== undefined) { + queryParameters.push('onlyLatestPerDatabase=' + encodeURIComponent(onlyLatestPerDatabase.toString())); + } + if (databaseState !== null && databaseState !== undefined) { + queryParameters.push('databaseState=' + encodeURIComponent(databaseState)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LongTermRetentionBackupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the long term retention backups for a given server. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByServer(locationName, longTermRetentionServerName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let onlyLatestPerDatabase = (options && options.onlyLatestPerDatabase !== undefined) ? options.onlyLatestPerDatabase : undefined; + let databaseState = (options && options.databaseState !== undefined) ? options.databaseState : undefined; + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (longTermRetentionServerName === null || longTermRetentionServerName === undefined || typeof longTermRetentionServerName.valueOf() !== 'string') { + throw new Error('longTermRetentionServerName cannot be null or undefined and it must be of type string.'); + } + if (onlyLatestPerDatabase !== null && onlyLatestPerDatabase !== undefined && typeof onlyLatestPerDatabase !== 'boolean') { + throw new Error('onlyLatestPerDatabase must be of type boolean.'); + } + if (databaseState !== null && databaseState !== undefined && typeof databaseState.valueOf() !== 'string') { + throw new Error('databaseState must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionBackups'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{longTermRetentionServerName}', encodeURIComponent(longTermRetentionServerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (onlyLatestPerDatabase !== null && onlyLatestPerDatabase !== undefined) { + queryParameters.push('onlyLatestPerDatabase=' + encodeURIComponent(onlyLatestPerDatabase.toString())); + } + if (databaseState !== null && databaseState !== undefined) { + queryParameters.push('databaseState=' + encodeURIComponent(databaseState)); + } + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LongTermRetentionBackupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a long term retention backup. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (longTermRetentionServerName === null || longTermRetentionServerName === undefined || typeof longTermRetentionServerName.valueOf() !== 'string') { + throw new Error('longTermRetentionServerName cannot be null or undefined and it must be of type string.'); + } + if (longTermRetentionDatabaseName === null || longTermRetentionDatabaseName === undefined || typeof longTermRetentionDatabaseName.valueOf() !== 'string') { + throw new Error('longTermRetentionDatabaseName cannot be null or undefined and it must be of type string.'); + } + if (backupName === null || backupName === undefined || typeof backupName.valueOf() !== 'string') { + throw new Error('backupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName}'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{longTermRetentionServerName}', encodeURIComponent(longTermRetentionServerName)); + requestUrl = requestUrl.replace('{longTermRetentionDatabaseName}', encodeURIComponent(longTermRetentionDatabaseName)); + requestUrl = requestUrl.replace('{backupName}', encodeURIComponent(backupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all long term retention backups for a database. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByDatabaseNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LongTermRetentionBackupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the long term retention backups for a given location. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByLocationNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LongTermRetentionBackupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists the long term retention backups for a given server. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByServerNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LongTermRetentionBackupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a LongTermRetentionBackups. */ +class LongTermRetentionBackups { + /** + * Create a LongTermRetentionBackups. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._listByDatabase = _listByDatabase; + this._listByLocation = _listByLocation; + this._listByServer = _listByServer; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByDatabaseNext = _listByDatabaseNext; + this._listByLocationNext = _listByLocationNext; + this._listByServerNext = _listByServerNext; + } + + /** + * Gets a long term retention backup. + * + * @param {string} locationName The location of the database. + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a long term retention backup. + * + * @param {string} locationName The location of the database. + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LongTermRetentionBackup} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackup} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, optionalCallback); + } + } + + /** + * Deletes a long term retention backup. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a long term retention backup. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, optionalCallback); + } + } + + /** + * Lists all long term retention backups for a database. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDatabaseWithHttpOperationResponse(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDatabase(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, options, optionalCallback); + } + } + + /** + * Lists the long term retention backups for a given location. + * + * @param {string} locationName The location of the database + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByLocationWithHttpOperationResponse(locationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByLocation(locationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param {string} locationName The location of the database + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByLocation(locationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByLocation(locationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByLocation(locationName, options, optionalCallback); + } + } + + /** + * Lists the long term retention backups for a given server. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServerWithHttpOperationResponse(locationName, longTermRetentionServerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServer(locationName, longTermRetentionServerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {object} [options] Optional Parameters. + * + * @param {boolean} [options.onlyLatestPerDatabase] Whether or not to only get + * the latest backup for each database. + * + * @param {string} [options.databaseState] Whether to query against just live + * databases, just deleted databases, or all databases. Possible values + * include: 'All', 'Live', 'Deleted' + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(locationName, longTermRetentionServerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByServer(locationName, longTermRetentionServerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServer(locationName, longTermRetentionServerName, options, optionalCallback); + } + } + + /** + * Deletes a long term retention backup. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a long term retention backup. + * + * @param {string} locationName The location of the database + * + * @param {string} longTermRetentionServerName + * + * @param {string} longTermRetentionDatabaseName + * + * @param {string} backupName The backup name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, options, optionalCallback); + } + } + + /** + * Lists all long term retention backups for a database. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDatabaseNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDatabaseNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all long term retention backups for a database. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabaseNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDatabaseNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDatabaseNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists the long term retention backups for a given location. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByLocationNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByLocationNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the long term retention backups for a given location. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByLocationNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByLocationNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByLocationNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists the long term retention backups for a given server. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServerNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServerNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the long term retention backups for a given server. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LongTermRetentionBackupListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LongTermRetentionBackupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByServerNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByServerNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServerNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LongTermRetentionBackups; diff --git a/lib/services/sqlManagement2/lib/operations/managedDatabases.js b/lib/services/sqlManagement2/lib/operations/managedDatabases.js new file mode 100644 index 0000000000..4f1c1c5fe0 --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/managedDatabases.js @@ -0,0 +1,2851 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Completes the restore operation on a managed database. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {uuid} operationId Management operation id that this request tries to + * complete. + * + * @param {object} parameters The definition for completing the restore of this + * managed database. + * + * @param {string} parameters.lastBackupName The last backup name to apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _completeRestore(locationName, operationId, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCompleteRestore(locationName, operationId, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets a list of managed databases. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabaseListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByInstance(resourceGroupName, managedInstanceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedDatabaseListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a managed database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, managedInstanceName, databaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedDatabase']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a new database or updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedDatabase']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes the managed database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, managedInstanceName, databaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, managedInstanceName, databaseName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, managedInstanceName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedDatabase']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Completes the restore operation on a managed database. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {uuid} operationId Management operation id that this request tries to + * complete. + * + * @param {object} parameters The definition for completing the restore of this + * managed database. + * + * @param {string} parameters.lastBackupName The last backup name to apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCompleteRestore(locationName, operationId, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (operationId === null || operationId === undefined || typeof operationId.valueOf() !== 'string' || !msRest.isValidUuid(operationId)) { + throw new Error('operationId cannot be null or undefined and it must be of type string and must be a valid uuid.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/managedDatabaseRestoreAzureAsyncOperation/{operationId}/completeRestore'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{operationId}', encodeURIComponent(operationId.toString())); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CompleteDatabaseRestoreDefinition']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a new database or updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ManagedDatabase']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedDatabase']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedDatabase']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the managed database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, managedInstanceName, databaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/databases/{databaseName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ManagedDatabaseUpdate']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedDatabase']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a list of managed databases. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabaseListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByInstanceNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedDatabaseListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ManagedDatabases. */ +class ManagedDatabases { + /** + * Create a ManagedDatabases. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._completeRestore = _completeRestore; + this._listByInstance = _listByInstance; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._beginCompleteRestore = _beginCompleteRestore; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdate = _beginUpdate; + this._listByInstanceNext = _listByInstanceNext; + } + + /** + * Completes the restore operation on a managed database. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {uuid} operationId Management operation id that this request tries to + * complete. + * + * @param {object} parameters The definition for completing the restore of this + * managed database. + * + * @param {string} parameters.lastBackupName The last backup name to apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + completeRestoreWithHttpOperationResponse(locationName, operationId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._completeRestore(locationName, operationId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Completes the restore operation on a managed database. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {uuid} operationId Management operation id that this request tries to + * complete. + * + * @param {object} parameters The definition for completing the restore of this + * managed database. + * + * @param {string} parameters.lastBackupName The last backup name to apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + completeRestore(locationName, operationId, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._completeRestore(locationName, operationId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._completeRestore(locationName, operationId, parameters, options, optionalCallback); + } + } + + /** + * Gets a list of managed databases. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByInstanceWithHttpOperationResponse(resourceGroupName, managedInstanceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByInstance(resourceGroupName, managedInstanceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of managed databases. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedDatabaseListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabaseListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByInstance(resourceGroupName, managedInstanceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByInstance(resourceGroupName, managedInstanceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByInstance(resourceGroupName, managedInstanceName, options, optionalCallback); + } + } + + /** + * Gets a managed database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, managedInstanceName, databaseName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, managedInstanceName, databaseName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a managed database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedDatabase} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, managedInstanceName, databaseName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, managedInstanceName, databaseName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, managedInstanceName, databaseName, options, optionalCallback); + } + } + + /** + * Creates a new database or updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, managedInstanceName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new database or updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedDatabase} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the managed database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, managedInstanceName, databaseName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, managedInstanceName, databaseName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the managed database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, managedInstanceName, databaseName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, managedInstanceName, databaseName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, managedInstanceName, databaseName, options, optionalCallback); + } + } + + /** + * Updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, managedInstanceName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, managedInstanceName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedDatabase} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, managedInstanceName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, managedInstanceName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, managedInstanceName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Completes the restore operation on a managed database. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {uuid} operationId Management operation id that this request tries to + * complete. + * + * @param {object} parameters The definition for completing the restore of this + * managed database. + * + * @param {string} parameters.lastBackupName The last backup name to apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCompleteRestoreWithHttpOperationResponse(locationName, operationId, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCompleteRestore(locationName, operationId, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Completes the restore operation on a managed database. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {uuid} operationId Management operation id that this request tries to + * complete. + * + * @param {object} parameters The definition for completing the restore of this + * managed database. + * + * @param {string} parameters.lastBackupName The last backup name to apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCompleteRestore(locationName, operationId, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCompleteRestore(locationName, operationId, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCompleteRestore(locationName, operationId, parameters, options, optionalCallback); + } + } + + /** + * Creates a new database or updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, managedInstanceName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a new database or updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedDatabase} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the managed database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, managedInstanceName, databaseName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, managedInstanceName, databaseName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the managed database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, managedInstanceName, databaseName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, managedInstanceName, databaseName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, managedInstanceName, databaseName, options, optionalCallback); + } + } + + /** + * Updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, managedInstanceName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an existing database. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The requested database resource state. + * + * @param {string} [parameters.collation] Collation of the managed database. + * + * @param {date} [parameters.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. + * + * @param {string} [parameters.catalogCollation] Collation of the metadata + * catalog. Possible values include: 'DATABASE_DEFAULT', + * 'SQL_Latin1_General_CP1_CI_AS' + * + * @param {string} [parameters.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. Possible values include: + * 'Default', 'RestoreExternalBackup', 'PointInTimeRestore' + * + * @param {string} [parameters.storageContainerUri] Conditional. If createMode + * is RestoreExternalBackup, this value is required. Specifies the uri of the + * storage container where backups for this restore are stored. + * + * @param {string} [parameters.sourceDatabaseId] The resource identifier of the + * source database associated with create operation of this database. + * + * @param {string} [parameters.storageContainerSasToken] Conditional. If + * createMode is RestoreExternalBackup, this value is required. Specifies the + * storage container sas token. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedDatabase} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabase} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, managedInstanceName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Gets a list of managed databases. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByInstanceNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByInstanceNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of managed databases. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedDatabaseListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedDatabaseListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByInstanceNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByInstanceNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByInstanceNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ManagedDatabases; diff --git a/lib/services/sqlManagement2/lib/operations/managedInstances.js b/lib/services/sqlManagement2/lib/operations/managedInstances.js new file mode 100644 index 0000000000..97150b9f7a --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/managedInstances.js @@ -0,0 +1,2862 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets a list of all managed instances in the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-05-01-preview'; + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedInstanceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a list of managed instances in a resource group. + * + * @param {string} 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. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-05-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedInstanceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, managedInstanceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-05-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedInstance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the managed instance. + * + * @param {string} [parameters.identity.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' + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, managedInstanceName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, managedInstanceName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedInstance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, managedInstanceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, managedInstanceName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, managedInstanceName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, managedInstanceName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedInstance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates or updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the managed instance. + * + * @param {string} [parameters.identity.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' + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, managedInstanceName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-05-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ManagedInstance']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedInstance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedInstance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, managedInstanceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-05-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, managedInstanceName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-05-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (managedInstanceName === null || managedInstanceName === undefined || typeof managedInstanceName.valueOf() !== 'string') { + throw new Error('managedInstanceName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{managedInstanceName}', encodeURIComponent(managedInstanceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ManagedInstanceUpdate']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedInstance']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a list of all managed instances in the subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedInstanceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a list of managed instances in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ManagedInstanceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ManagedInstances. */ +class ManagedInstances { + /** + * Create a ManagedInstances. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._update = _update; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdate = _beginUpdate; + this._listNext = _listNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedInstanceListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param {string} 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. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param {string} 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. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedInstanceListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, managedInstanceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, managedInstanceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedInstance} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, managedInstanceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, managedInstanceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, managedInstanceName, options, optionalCallback); + } + } + + /** + * Creates or updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the managed instance. + * + * @param {string} [parameters.identity.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' + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, managedInstanceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, managedInstanceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the managed instance. + * + * @param {string} [parameters.identity.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' + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedInstance} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, managedInstanceName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, managedInstanceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, managedInstanceName, parameters, options, optionalCallback); + } + } + + /** + * Deletes a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, managedInstanceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, managedInstanceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, managedInstanceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, managedInstanceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, managedInstanceName, options, optionalCallback); + } + } + + /** + * Updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, managedInstanceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, managedInstanceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedInstance} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, managedInstanceName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, managedInstanceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, managedInstanceName, parameters, options, optionalCallback); + } + } + + /** + * Creates or updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the managed instance. + * + * @param {string} [parameters.identity.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' + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, managedInstanceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, managedInstanceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.identity] The Azure Active Directory identity of + * the managed instance. + * + * @param {string} [parameters.identity.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' + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {string} parameters.location Resource location. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedInstance} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, managedInstanceName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, managedInstanceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, managedInstanceName, parameters, options, optionalCallback); + } + } + + /** + * Deletes a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, managedInstanceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, managedInstanceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, managedInstanceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, managedInstanceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, managedInstanceName, options, optionalCallback); + } + } + + /** + * Updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, managedInstanceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, managedInstanceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a managed instance. + * + * @param {string} 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. + * + * @param {string} managedInstanceName The name of the managed instance. + * + * @param {object} parameters The requested managed instance resource state. + * + * @param {object} [parameters.sku] Managed instance sku + * + * @param {string} parameters.sku.name The name of the SKU, typically, a letter + * + Number code, e.g. P3. + * + * @param {string} [parameters.sku.tier] The tier of the particular SKU, e.g. + * Basic, Premium. + * + * @param {string} [parameters.sku.size] Size of the particular SKU + * + * @param {string} [parameters.sku.family] If the service has different + * generations of hardware, for the same SKU, then that can be captured here. + * + * @param {number} [parameters.sku.capacity] Capacity of the particular SKU. + * + * @param {string} [parameters.administratorLogin] Administrator username for + * the managed instance. Can only be specified when the managed instance is + * being created (and is required for creation). + * + * @param {string} [parameters.administratorLoginPassword] The administrator + * login password (required for managed instance creation). + * + * @param {string} [parameters.subnetId] Subnet resource ID for the managed + * instance. + * + * @param {string} [parameters.licenseType] The license type. Possible values + * are 'LicenseIncluded' and 'BasePrice'. + * + * @param {number} [parameters.vCores] The number of VCores. + * + * @param {number} [parameters.storageSizeInGB] The maximum storage size in GB. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedInstance} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstance} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, managedInstanceName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, managedInstanceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, managedInstanceName, parameters, options, optionalCallback); + } + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of all managed instances in the subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedInstanceListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of managed instances in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ManagedInstanceListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ManagedInstanceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ManagedInstances; diff --git a/lib/services/sqlManagement2/lib/operations/replicationLinks.js b/lib/services/sqlManagement2/lib/operations/replicationLinks.js index c728ae73a3..c0895596f9 100644 --- a/lib/services/sqlManagement2/lib/operations/replicationLinks.js +++ b/lib/services/sqlManagement2/lib/operations/replicationLinks.js @@ -713,7 +713,7 @@ function _beginFailover(resourceGroupName, serverName, databaseName, linkId, opt return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204 && statusCode !== 202) { + if (statusCode !== 202 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -854,7 +854,7 @@ function _beginFailoverAllowDataLoss(resourceGroupName, serverName, databaseName return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 204 && statusCode !== 202) { + if (statusCode !== 202 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); diff --git a/lib/services/sqlManagement2/lib/operations/restorePoints.js b/lib/services/sqlManagement2/lib/operations/restorePoints.js index 894ccdc7cf..7c1928a3fe 100644 --- a/lib/services/sqlManagement2/lib/operations/restorePoints.js +++ b/lib/services/sqlManagement2/lib/operations/restorePoints.js @@ -23,8 +23,7 @@ const WebResource = msRest.WebResource; * * @param {string} serverName The name of the server. * - * @param {string} databaseName The name of the database to get available - * restore points. + * @param {string} databaseName The name of the database. * * @param {object} [options] Optional Parameters. * @@ -55,12 +54,9 @@ function _listByDatabase(resourceGroupName, serverName, databaseName, options, c if (!callback) { throw new Error('callback cannot be null.'); } - let apiVersion = '2014-04-01'; + let apiVersion = '2017-03-01-preview'; // Validate try { - if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { - throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); - } if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); } @@ -70,6 +66,9 @@ function _listByDatabase(resourceGroupName, serverName, databaseName, options, c if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { throw new Error('databaseName cannot be null or undefined and it must be of type string.'); } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); } @@ -80,10 +79,10 @@ function _listByDatabase(resourceGroupName, serverName, databaseName, options, c // Construct URL let baseUrl = this.client.baseUri; let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints'; - requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { @@ -167,111 +166,1095 @@ function _listByDatabase(resourceGroupName, serverName, databaseName, options, c }); } -/** Class representing a RestorePoints. */ -class RestorePoints { - /** - * Create a RestorePoints. - * @param {SqlManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._listByDatabase = _listByDatabase; + +/** + * Creates a restore point for a data warehouse. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The definition for creating the restore point of + * this database. + * + * @param {string} parameters.restorePointLabel The restore point label to + * apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _create(resourceGroupName, serverName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; } - /** - * Gets a list of database restore points. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to get available - * restore points. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error} - The error object. - */ - listByDatabaseWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._listByDatabase(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreate(resourceGroupName, serverName, databaseName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RestorePoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); }); + }); +} + +/** + * Gets a restore point. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} restorePointName The name of the restore point. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, serverName, databaseName, restorePointName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (restorePointName === null || restorePointName === undefined || typeof restorePointName.valueOf() !== 'string') { + throw new Error('restorePointName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); } - /** - * Gets a list of database restore points. - * - * @param {string} 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. - * - * @param {string} serverName The name of the server. - * - * @param {string} databaseName The name of the database to get available - * restore points. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} [optionalCallback] - The optional callback. - * - * @returns {function|Promise} If a callback was passed as the last parameter - * then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned - * - * @resolve {RestorePointListResult} - The deserialized result object. - * - * @reject {Error} - The error object. - * - * {function} optionalCallback(err, result, request, response) - * - * {Error} err - The Error object if an error occurred, null otherwise. - * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link RestorePointListResult} for more - * information. - * - * {object} [request] - The HTTP Request object if an error did not occur. - * - * {stream} [response] - The HTTP Response stream if an error did not occur. - */ - listByDatabase(resourceGroupName, serverName, databaseName, options, optionalCallback) { - let client = this.client; - let self = this; - if (!optionalCallback && typeof options === 'function') { - optionalCallback = options; - options = null; + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{restorePointName}', encodeURIComponent(restorePointName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } } - if (!optionalCallback) { - return new Promise((resolve, reject) => { - self._listByDatabase(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listByDatabase(resourceGroupName, serverName, databaseName, options, optionalCallback); + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RestorePoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a restore point. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} restorePointName The name of the restore point. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serverName, databaseName, restorePointName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (restorePointName === null || restorePointName === undefined || typeof restorePointName.valueOf() !== 'string') { + throw new Error('restorePointName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints/{restorePointName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{restorePointName}', encodeURIComponent(restorePointName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates a restore point for a data warehouse. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The definition for creating the restore point of + * this database. + * + * @param {string} parameters.restorePointLabel The restore point label to + * apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreate(resourceGroupName, serverName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/restorePoints'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['CreateDatabaseRestorePointDefinition']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RestorePoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RestorePoint']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a RestorePoints. */ +class RestorePoints { + /** + * Create a RestorePoints. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByDatabase = _listByDatabase; + this._create = _create; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._beginCreate = _beginCreate; + } + + /** + * Gets a list of database restore points. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByDatabaseWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByDatabase(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of database restore points. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RestorePointListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePointListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByDatabase(resourceGroupName, serverName, databaseName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByDatabase(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByDatabase(resourceGroupName, serverName, databaseName, options, optionalCallback); + } + } + + /** + * Creates a restore point for a data warehouse. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The definition for creating the restore point of + * this database. + * + * @param {string} parameters.restorePointLabel The restore point label to + * apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The definition for creating the restore point of + * this database. + * + * @param {string} parameters.restorePointLabel The restore point label to + * apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RestorePoint} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + create(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._create(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Gets a restore point. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} restorePointName The name of the restore point. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, serverName, databaseName, restorePointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, databaseName, restorePointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a restore point. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} restorePointName The name of the restore point. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RestorePoint} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, serverName, databaseName, restorePointName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, databaseName, restorePointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serverName, databaseName, restorePointName, options, optionalCallback); + } + } + + /** + * Deletes a restore point. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} restorePointName The name of the restore point. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, serverName, databaseName, restorePointName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serverName, databaseName, restorePointName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a restore point. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {string} restorePointName The name of the restore point. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, serverName, databaseName, restorePointName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serverName, databaseName, restorePointName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, serverName, databaseName, restorePointName, options, optionalCallback); + } + } + + /** + * Creates a restore point for a data warehouse. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The definition for creating the restore point of + * this database. + * + * @param {string} parameters.restorePointLabel The restore point label to + * apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a restore point for a data warehouse. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The definition for creating the restore point of + * this database. + * + * @param {string} parameters.restorePointLabel The restore point label to + * apply + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RestorePoint} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RestorePoint} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); } } diff --git a/lib/services/sqlManagement2/lib/operations/serverAutomaticTuningOperations.js b/lib/services/sqlManagement2/lib/operations/serverAutomaticTuningOperations.js new file mode 100644 index 0000000000..80b3344111 --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/serverAutomaticTuningOperations.js @@ -0,0 +1,539 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Retrieves server automatic tuning options. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAutomaticTuning} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, serverName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServerAutomaticTuning']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Update automatic tuning options on server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The requested automatic tuning resource state. + * + * @param {string} [parameters.desiredState] Automatic tuning desired state. + * Possible values include: 'Custom', 'Auto', 'Unspecified' + * + * @param {object} [parameters.options] Automatic tuning options definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAutomaticTuning} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, serverName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/automaticTuning/current'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ServerAutomaticTuning']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServerAutomaticTuning']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ServerAutomaticTuningOperations. */ +class ServerAutomaticTuningOperations { + /** + * Create a ServerAutomaticTuningOperations. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._update = _update; + } + + /** + * Retrieves server automatic tuning options. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, serverName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves server automatic tuning options. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ServerAutomaticTuning} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAutomaticTuning} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, serverName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serverName, options, optionalCallback); + } + } + + /** + * Update automatic tuning options on server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The requested automatic tuning resource state. + * + * @param {string} [parameters.desiredState] Automatic tuning desired state. + * Possible values include: 'Custom', 'Auto', 'Unspecified' + * + * @param {object} [parameters.options] Automatic tuning options definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, serverName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, serverName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update automatic tuning options on server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {object} parameters The requested automatic tuning resource state. + * + * @param {string} [parameters.desiredState] Automatic tuning desired state. + * Possible values include: 'Custom', 'Auto', 'Unspecified' + * + * @param {object} [parameters.options] Automatic tuning options definition. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ServerAutomaticTuning} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerAutomaticTuning} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, serverName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, serverName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, serverName, parameters, options, optionalCallback); + } + } + +} + +module.exports = ServerAutomaticTuningOperations; diff --git a/lib/services/sqlManagement2/lib/operations/serverAzureADAdministrators.js b/lib/services/sqlManagement2/lib/operations/serverAzureADAdministrators.js index bf172a7edf..10775ded7e 100644 --- a/lib/services/sqlManagement2/lib/operations/serverAzureADAdministrators.js +++ b/lib/services/sqlManagement2/lib/operations/serverAzureADAdministrators.js @@ -793,7 +793,7 @@ function _beginDeleteMethod(resourceGroupName, serverName, options, callback) { return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 202 && statusCode !== 204 && statusCode !== 200) { + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); @@ -822,7 +822,7 @@ function _beginDeleteMethod(resourceGroupName, serverName, options, callback) { let result = null; if (responseBody === '') responseBody = null; // Deserialize Response - if (statusCode === 202) { + if (statusCode === 200) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -839,7 +839,7 @@ function _beginDeleteMethod(resourceGroupName, serverName, options, callback) { } } // Deserialize Response - if (statusCode === 204) { + if (statusCode === 202) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); @@ -856,7 +856,7 @@ function _beginDeleteMethod(resourceGroupName, serverName, options, callback) { } } // Deserialize Response - if (statusCode === 200) { + if (statusCode === 204) { let parsedResponse = null; try { parsedResponse = JSON.parse(responseBody); diff --git a/lib/services/sqlManagement2/lib/operations/serverDnsAliases.js b/lib/services/sqlManagement2/lib/operations/serverDnsAliases.js new file mode 100644 index 0000000000..9ca87bf521 --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/serverDnsAliases.js @@ -0,0 +1,2014 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets a server DNS alias. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAlias} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, serverName, dnsAliasName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (dnsAliasName === null || dnsAliasName === undefined || typeof dnsAliasName.valueOf() !== 'string') { + throw new Error('dnsAliasName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{dnsAliasName}', encodeURIComponent(dnsAliasName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServerDnsAlias']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates a server dns alias. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAlias} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, serverName, dnsAliasName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, serverName, dnsAliasName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServerDnsAlias']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Deletes the server DNS alias with the given name. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, serverName, dnsAliasName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, serverName, dnsAliasName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets a list of server DNS aliases for a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAliasListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByServer(resourceGroupName, serverName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServerDnsAliasListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Acquires server DNS alias from another server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server dns alias. + * + * @param {object} parameters + * + * @param {string} [parameters.oldServerDnsAliasId] The id of the server alias + * that will be acquired to point to this server instead. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _acquire(resourceGroupName, serverName, dnsAliasName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginAcquire(resourceGroupName, serverName, dnsAliasName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates a server dns alias. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAlias} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, serverName, dnsAliasName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (dnsAliasName === null || dnsAliasName === undefined || typeof dnsAliasName.valueOf() !== 'string') { + throw new Error('dnsAliasName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{dnsAliasName}', encodeURIComponent(dnsAliasName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServerDnsAlias']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServerDnsAlias']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the server DNS alias with the given name. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, serverName, dnsAliasName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (dnsAliasName === null || dnsAliasName === undefined || typeof dnsAliasName.valueOf() !== 'string') { + throw new Error('dnsAliasName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{dnsAliasName}', encodeURIComponent(dnsAliasName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Acquires server DNS alias from another server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server dns alias. + * + * @param {object} parameters + * + * @param {string} [parameters.oldServerDnsAliasId] The id of the server alias + * that will be acquired to point to this server instead. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginAcquire(resourceGroupName, serverName, dnsAliasName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2017-03-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (dnsAliasName === null || dnsAliasName === undefined || typeof dnsAliasName.valueOf() !== 'string') { + throw new Error('dnsAliasName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/dnsAliases/{dnsAliasName}/acquire'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{dnsAliasName}', encodeURIComponent(dnsAliasName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ServerDnsAliasAcquisition']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a list of server DNS aliases for a server. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAliasListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByServerNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ServerDnsAliasListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ServerDnsAliases. */ +class ServerDnsAliases { + /** + * Create a ServerDnsAliases. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listByServer = _listByServer; + this._acquire = _acquire; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginAcquire = _beginAcquire; + this._listByServerNext = _listByServerNext; + } + + /** + * Gets a server DNS alias. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, serverName, dnsAliasName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, dnsAliasName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a server DNS alias. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ServerDnsAlias} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAlias} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, serverName, dnsAliasName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, dnsAliasName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serverName, dnsAliasName, options, optionalCallback); + } + } + + /** + * Creates a server dns alias. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, serverName, dnsAliasName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, serverName, dnsAliasName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a server dns alias. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ServerDnsAlias} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAlias} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, serverName, dnsAliasName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, serverName, dnsAliasName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, serverName, dnsAliasName, options, optionalCallback); + } + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, serverName, dnsAliasName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serverName, dnsAliasName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, serverName, dnsAliasName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, serverName, dnsAliasName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, serverName, dnsAliasName, options, optionalCallback); + } + } + + /** + * Gets a list of server DNS aliases for a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServerWithHttpOperationResponse(resourceGroupName, serverName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of server DNS aliases for a server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ServerDnsAliasListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAliasListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByServer(resourceGroupName, serverName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByServer(resourceGroupName, serverName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServer(resourceGroupName, serverName, options, optionalCallback); + } + } + + /** + * Acquires server DNS alias from another server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server dns alias. + * + * @param {object} parameters + * + * @param {string} [parameters.oldServerDnsAliasId] The id of the server alias + * that will be acquired to point to this server instead. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + acquireWithHttpOperationResponse(resourceGroupName, serverName, dnsAliasName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._acquire(resourceGroupName, serverName, dnsAliasName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Acquires server DNS alias from another server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server dns alias. + * + * @param {object} parameters + * + * @param {string} [parameters.oldServerDnsAliasId] The id of the server alias + * that will be acquired to point to this server instead. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + acquire(resourceGroupName, serverName, dnsAliasName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._acquire(resourceGroupName, serverName, dnsAliasName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._acquire(resourceGroupName, serverName, dnsAliasName, parameters, options, optionalCallback); + } + } + + /** + * Creates a server dns alias. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, serverName, dnsAliasName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, serverName, dnsAliasName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a server dns alias. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ServerDnsAlias} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAlias} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, serverName, dnsAliasName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, serverName, dnsAliasName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, serverName, dnsAliasName, options, optionalCallback); + } + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, serverName, dnsAliasName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, serverName, dnsAliasName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the server DNS alias with the given name. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server DNS alias. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, serverName, dnsAliasName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, serverName, dnsAliasName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, serverName, dnsAliasName, options, optionalCallback); + } + } + + /** + * Acquires server DNS alias from another server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server dns alias. + * + * @param {object} parameters + * + * @param {string} [parameters.oldServerDnsAliasId] The id of the server alias + * that will be acquired to point to this server instead. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginAcquireWithHttpOperationResponse(resourceGroupName, serverName, dnsAliasName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginAcquire(resourceGroupName, serverName, dnsAliasName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Acquires server DNS alias from another server. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server that the alias is pointing + * to. + * + * @param {string} dnsAliasName The name of the server dns alias. + * + * @param {object} parameters + * + * @param {string} [parameters.oldServerDnsAliasId] The id of the server alias + * that will be acquired to point to this server instead. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginAcquire(resourceGroupName, serverName, dnsAliasName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginAcquire(resourceGroupName, serverName, dnsAliasName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginAcquire(resourceGroupName, serverName, dnsAliasName, parameters, options, optionalCallback); + } + } + + /** + * Gets a list of server DNS aliases for a server. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByServerNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByServerNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a list of server DNS aliases for a server. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ServerDnsAliasListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ServerDnsAliasListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByServerNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByServerNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByServerNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ServerDnsAliases; diff --git a/lib/services/sqlManagement2/lib/operations/serverKeys.js b/lib/services/sqlManagement2/lib/operations/serverKeys.js index 2562ae3491..54772dd044 100644 --- a/lib/services/sqlManagement2/lib/operations/serverKeys.js +++ b/lib/services/sqlManagement2/lib/operations/serverKeys.js @@ -617,7 +617,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, keyName, parameters return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202 && statusCode !== 201) { + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); diff --git a/lib/services/sqlManagement2/lib/operations/servers.js b/lib/services/sqlManagement2/lib/operations/servers.js index 7950917757..7d1ed28aff 100644 --- a/lib/services/sqlManagement2/lib/operations/servers.js +++ b/lib/services/sqlManagement2/lib/operations/servers.js @@ -980,7 +980,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, parameters, options return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202 && statusCode !== 201) { + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); diff --git a/lib/services/sqlManagement2/lib/operations/shortTermRetentionPolicies.js b/lib/services/sqlManagement2/lib/operations/shortTermRetentionPolicies.js new file mode 100644 index 0000000000..1d94f15d13 --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/shortTermRetentionPolicies.js @@ -0,0 +1,1231 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, serverName, databaseName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let policyName = 'default'; + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{policyName}', encodeURIComponent(policyName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ShortTermRetentionPolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ShortTermRetentionPolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _update(resourceGroupName, serverName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ShortTermRetentionPolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let policyName = 'default'; + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{policyName}', encodeURIComponent(policyName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ShortTermRetentionPolicy']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ShortTermRetentionPolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let policyName = 'default'; + let apiVersion = '2017-10-01-preview'; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (serverName === null || serverName === undefined || typeof serverName.valueOf() !== 'string') { + throw new Error('serverName cannot be null or undefined and it must be of type string.'); + } + if (databaseName === null || databaseName === undefined || typeof databaseName.valueOf() !== 'string') { + throw new Error('databaseName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/backupShortTermRetentionPolicies/{policyName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{serverName}', encodeURIComponent(serverName)); + requestUrl = requestUrl.replace('{databaseName}', encodeURIComponent(databaseName)); + requestUrl = requestUrl.replace('{policyName}', encodeURIComponent(policyName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ShortTermRetentionPolicy']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ShortTermRetentionPolicy']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ShortTermRetentionPolicies. */ +class ShortTermRetentionPolicies { + /** + * Create a ShortTermRetentionPolicies. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdate = _beginUpdate; + } + + /** + * Gets a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, serverName, databaseName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ShortTermRetentionPolicy} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, serverName, databaseName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, serverName, databaseName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, serverName, databaseName, options, optionalCallback); + } + } + + /** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ShortTermRetentionPolicy} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ShortTermRetentionPolicy} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + update(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._update(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ShortTermRetentionPolicy} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + } + } + + /** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, serverName, databaseName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a database's short term retention policy. + * + * @param {string} 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. + * + * @param {string} serverName The name of the server. + * + * @param {string} databaseName The name of the database. + * + * @param {object} parameters The short term retention policy info. + * + * @param {number} [parameters.retentionDays] The backup retention period in + * days. This is how many days Point-in-Time Restore will be supported. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ShortTermRetentionPolicy} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ShortTermRetentionPolicy} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, serverName, databaseName, parameters, options, optionalCallback); + } + } + +} + +module.exports = ShortTermRetentionPolicies; diff --git a/lib/services/sqlManagement2/lib/operations/subscriptionUsages.js b/lib/services/sqlManagement2/lib/operations/subscriptionUsages.js new file mode 100644 index 0000000000..829b0b17e0 --- /dev/null +++ b/lib/services/sqlManagement2/lib/operations/subscriptionUsages.js @@ -0,0 +1,701 @@ +/* + * 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. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all subscription usage metrics in a given location. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SubscriptionUsageListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByLocation(locationName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-05-01-preview'; + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SubscriptionUsageListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets a subscription usage metric. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} usageName Name of usage metric to return. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SubscriptionUsage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(locationName, usageName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + let apiVersion = '2015-05-01-preview'; + // Validate + try { + if (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName cannot be null or undefined and it must be of type string.'); + } + if (usageName === null || usageName === undefined || typeof usageName.valueOf() !== 'string') { + throw new Error('usageName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Sql/locations/{locationName}/usages/{usageName}'; + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + requestUrl = requestUrl.replace('{usageName}', encodeURIComponent(usageName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SubscriptionUsage']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all subscription usage metrics in a given location. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SubscriptionUsageListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByLocationNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SubscriptionUsageListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a SubscriptionUsages. */ +class SubscriptionUsages { + /** + * Create a SubscriptionUsages. + * @param {SqlManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._listByLocation = _listByLocation; + this._get = _get; + this._listByLocationNext = _listByLocationNext; + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByLocationWithHttpOperationResponse(locationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByLocation(locationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SubscriptionUsageListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SubscriptionUsageListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByLocation(locationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByLocation(locationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByLocation(locationName, options, optionalCallback); + } + } + + /** + * Gets a subscription usage metric. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} usageName Name of usage metric to return. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(locationName, usageName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(locationName, usageName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a subscription usage metric. + * + * @param {string} locationName The name of the region where the resource is + * located. + * + * @param {string} usageName Name of usage metric to return. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SubscriptionUsage} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SubscriptionUsage} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(locationName, usageName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(locationName, usageName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(locationName, usageName, options, optionalCallback); + } + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByLocationNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByLocationNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all subscription usage metrics in a given location. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SubscriptionUsageListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SubscriptionUsageListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByLocationNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByLocationNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByLocationNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = SubscriptionUsages; diff --git a/lib/services/sqlManagement2/lib/operations/syncAgents.js b/lib/services/sqlManagement2/lib/operations/syncAgents.js index 825cd5596d..2bf8c1b449 100644 --- a/lib/services/sqlManagement2/lib/operations/syncAgents.js +++ b/lib/services/sqlManagement2/lib/operations/syncAgents.js @@ -898,7 +898,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, syncAgentName, para return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202 && statusCode !== 201) { + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); diff --git a/lib/services/sqlManagement2/lib/operations/syncGroups.js b/lib/services/sqlManagement2/lib/operations/syncGroups.js index c5c13b03aa..3f3931980e 100644 --- a/lib/services/sqlManagement2/lib/operations/syncGroups.js +++ b/lib/services/sqlManagement2/lib/operations/syncGroups.js @@ -1737,7 +1737,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, syncG return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202 && statusCode !== 201) { + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); diff --git a/lib/services/sqlManagement2/lib/operations/syncMembers.js b/lib/services/sqlManagement2/lib/operations/syncMembers.js index b15b34186e..bdafcb363a 100644 --- a/lib/services/sqlManagement2/lib/operations/syncMembers.js +++ b/lib/services/sqlManagement2/lib/operations/syncMembers.js @@ -1038,7 +1038,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, databaseName, syncG return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202 && statusCode !== 201) { + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); diff --git a/lib/services/sqlManagement2/lib/operations/virtualNetworkRules.js b/lib/services/sqlManagement2/lib/operations/virtualNetworkRules.js index c6662e454e..8fc3de45e4 100644 --- a/lib/services/sqlManagement2/lib/operations/virtualNetworkRules.js +++ b/lib/services/sqlManagement2/lib/operations/virtualNetworkRules.js @@ -596,7 +596,7 @@ function _beginCreateOrUpdate(resourceGroupName, serverName, virtualNetworkRuleN return callback(err); } let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202 && statusCode !== 201) { + if (statusCode !== 200 && statusCode !== 201 && statusCode !== 202) { let error = new Error(responseBody); error.statusCode = response.statusCode; error.request = msRest.stripRequest(httpRequest); diff --git a/lib/services/sqlManagement2/lib/sqlManagementClient.d.ts b/lib/services/sqlManagement2/lib/sqlManagementClient.d.ts index e61fdb8712..61b01b928c 100644 --- a/lib/services/sqlManagement2/lib/sqlManagementClient.d.ts +++ b/lib/services/sqlManagement2/lib/sqlManagementClient.d.ts @@ -10,9 +10,10 @@ import { ServiceClientCredentials } from 'ms-rest'; import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; import * as operations from "./operations"; -declare class SqlManagementClient extends AzureServiceClient { +export default class SqlManagementClient extends AzureServiceClient { /** * Initializes a new instance of the SqlManagementClient class. * @constructor @@ -53,12 +54,9 @@ declare class SqlManagementClient extends AzureServiceClient { generateClientRequestId: boolean; // Operation groups - backupLongTermRetentionPolicies: operations.BackupLongTermRetentionPolicies; - backupLongTermRetentionVaults: operations.BackupLongTermRetentionVaults; - restorePoints: operations.RestorePoints; recoverableDatabases: operations.RecoverableDatabases; restorableDroppedDatabases: operations.RestorableDroppedDatabases; - capabilities: operations.Capabilities; + servers: operations.Servers; serverConnectionPolicies: operations.ServerConnectionPolicies; databaseThreatDetectionPolicies: operations.DatabaseThreatDetectionPolicies; dataMaskingPolicies: operations.DataMaskingPolicies; @@ -67,29 +65,42 @@ declare class SqlManagementClient extends AzureServiceClient { geoBackupPolicies: operations.GeoBackupPolicies; databases: operations.Databases; elasticPools: operations.ElasticPools; + recommendedElasticPools: operations.RecommendedElasticPools; replicationLinks: operations.ReplicationLinks; serverAzureADAdministrators: operations.ServerAzureADAdministrators; serverCommunicationLinks: operations.ServerCommunicationLinks; serviceObjectives: operations.ServiceObjectives; - servers: operations.Servers; elasticPoolActivities: operations.ElasticPoolActivities; elasticPoolDatabaseActivities: operations.ElasticPoolDatabaseActivities; - recommendedElasticPools: operations.RecommendedElasticPools; serviceTierAdvisors: operations.ServiceTierAdvisors; transparentDataEncryptions: operations.TransparentDataEncryptions; transparentDataEncryptionActivities: operations.TransparentDataEncryptionActivities; serverUsages: operations.ServerUsages; databaseUsages: operations.DatabaseUsages; databaseBlobAuditingPolicies: operations.DatabaseBlobAuditingPolicies; + databaseAutomaticTuningOperations: operations.DatabaseAutomaticTuningOperations; encryptionProtectors: operations.EncryptionProtectors; failoverGroups: operations.FailoverGroups; + managedInstances: operations.ManagedInstances; operations: operations.Operations; serverKeys: operations.ServerKeys; syncAgents: operations.SyncAgents; syncGroups: operations.SyncGroups; syncMembers: operations.SyncMembers; + subscriptionUsages: operations.SubscriptionUsages; virtualNetworkRules: operations.VirtualNetworkRules; + longTermRetentionBackups: operations.LongTermRetentionBackups; + backupLongTermRetentionPolicies: operations.BackupLongTermRetentionPolicies; + managedDatabases: operations.ManagedDatabases; + serverAutomaticTuningOperations: operations.ServerAutomaticTuningOperations; + serverDnsAliases: operations.ServerDnsAliases; + restorePoints: operations.RestorePoints; databaseOperations: operations.DatabaseOperations; + elasticPoolOperations: operations.ElasticPoolOperations; + capabilities: operations.Capabilities; + databaseVulnerabilityAssessmentScans: operations.DatabaseVulnerabilityAssessmentScans; + instanceFailoverGroups: operations.InstanceFailoverGroups; + shortTermRetentionPolicies: operations.ShortTermRetentionPolicies; } -export = SqlManagementClient; +export { SqlManagementClient, models as SqlManagementModels }; diff --git a/lib/services/sqlManagement2/lib/sqlManagementClient.js b/lib/services/sqlManagement2/lib/sqlManagementClient.js index fcbe0c0d25..0c240447cd 100644 --- a/lib/services/sqlManagement2/lib/sqlManagementClient.js +++ b/lib/services/sqlManagement2/lib/sqlManagementClient.js @@ -71,12 +71,9 @@ class SqlManagementClient extends ServiceClient { if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { this.generateClientRequestId = options.generateClientRequestId; } - this.backupLongTermRetentionPolicies = new operations.BackupLongTermRetentionPolicies(this); - this.backupLongTermRetentionVaults = new operations.BackupLongTermRetentionVaults(this); - this.restorePoints = new operations.RestorePoints(this); this.recoverableDatabases = new operations.RecoverableDatabases(this); this.restorableDroppedDatabases = new operations.RestorableDroppedDatabases(this); - this.capabilities = new operations.Capabilities(this); + this.servers = new operations.Servers(this); this.serverConnectionPolicies = new operations.ServerConnectionPolicies(this); this.databaseThreatDetectionPolicies = new operations.DatabaseThreatDetectionPolicies(this); this.dataMaskingPolicies = new operations.DataMaskingPolicies(this); @@ -85,29 +82,42 @@ class SqlManagementClient extends ServiceClient { this.geoBackupPolicies = new operations.GeoBackupPolicies(this); this.databases = new operations.Databases(this); this.elasticPools = new operations.ElasticPools(this); + this.recommendedElasticPools = new operations.RecommendedElasticPools(this); this.replicationLinks = new operations.ReplicationLinks(this); this.serverAzureADAdministrators = new operations.ServerAzureADAdministrators(this); this.serverCommunicationLinks = new operations.ServerCommunicationLinks(this); this.serviceObjectives = new operations.ServiceObjectives(this); - this.servers = new operations.Servers(this); this.elasticPoolActivities = new operations.ElasticPoolActivities(this); this.elasticPoolDatabaseActivities = new operations.ElasticPoolDatabaseActivities(this); - this.recommendedElasticPools = new operations.RecommendedElasticPools(this); this.serviceTierAdvisors = new operations.ServiceTierAdvisors(this); this.transparentDataEncryptions = new operations.TransparentDataEncryptions(this); this.transparentDataEncryptionActivities = new operations.TransparentDataEncryptionActivities(this); this.serverUsages = new operations.ServerUsages(this); this.databaseUsages = new operations.DatabaseUsages(this); this.databaseBlobAuditingPolicies = new operations.DatabaseBlobAuditingPolicies(this); + this.databaseAutomaticTuningOperations = new operations.DatabaseAutomaticTuningOperations(this); this.encryptionProtectors = new operations.EncryptionProtectors(this); this.failoverGroups = new operations.FailoverGroups(this); + this.managedInstances = new operations.ManagedInstances(this); this.operations = new operations.Operations(this); this.serverKeys = new operations.ServerKeys(this); this.syncAgents = new operations.SyncAgents(this); this.syncGroups = new operations.SyncGroups(this); this.syncMembers = new operations.SyncMembers(this); + this.subscriptionUsages = new operations.SubscriptionUsages(this); this.virtualNetworkRules = new operations.VirtualNetworkRules(this); + this.longTermRetentionBackups = new operations.LongTermRetentionBackups(this); + this.backupLongTermRetentionPolicies = new operations.BackupLongTermRetentionPolicies(this); + this.managedDatabases = new operations.ManagedDatabases(this); + this.serverAutomaticTuningOperations = new operations.ServerAutomaticTuningOperations(this); + this.serverDnsAliases = new operations.ServerDnsAliases(this); + this.restorePoints = new operations.RestorePoints(this); this.databaseOperations = new operations.DatabaseOperations(this); + this.elasticPoolOperations = new operations.ElasticPoolOperations(this); + this.capabilities = new operations.Capabilities(this); + this.databaseVulnerabilityAssessmentScans = new operations.DatabaseVulnerabilityAssessmentScans(this); + this.instanceFailoverGroups = new operations.InstanceFailoverGroups(this); + this.shortTermRetentionPolicies = new operations.ShortTermRetentionPolicies(this); this.models = models; msRest.addSerializationMixin(this); } @@ -115,3 +125,6 @@ class SqlManagementClient extends ServiceClient { } module.exports = SqlManagementClient; +module.exports['default'] = SqlManagementClient; +module.exports.SqlManagementClient = SqlManagementClient; +module.exports.SqlManagementModels = models; diff --git a/lib/services/sqlManagement2/package.json b/lib/services/sqlManagement2/package.json index 1686f3a4fe..d5e5b8a331 100644 --- a/lib/services/sqlManagement2/package.json +++ b/lib/services/sqlManagement2/package.json @@ -1,35 +1,22 @@ { "name": "azure-arm-sql", "author": "Microsoft Corporation", - "contributors": [ - "Moore, Jared" - ], - "version": "2.0.0", - "description": "Microsoft Azure SQL Management Client Library for node", - "tags": [ - "azure", - "sdk" - ], - "keywords": [ - "node", - "azure" - ], - "main": "./lib/sqlManagementClient.js", - "types": "./lib/sqlManagementClient.d.ts", - "license": "MIT", + "description": "SqlManagementClient Library with typescript type definitions for node", + "version": "3.0.0", "dependencies": { - "ms-rest": "^2.2.2", - "ms-rest-azure": "^2.3.3" + "ms-rest": "^2.3.2", + "ms-rest-azure": "^2.5.5" }, - "homepage": "http://github.com/Azure/azure-sdk-for-node", + "keywords": [ "node", "azure" ], + "license": "MIT", + "main": "./lib/sqlManagementClient.js", + "types": "./lib/sqlManagementClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", "repository": { "type": "git", - "url": "git@github.com:Azure/azure-sdk-for-node.git" + "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { "url": "http://github.com/Azure/azure-sdk-for-node/issues" - }, - "scripts": { - "test": "npm -s run-script jshint" } }