-
Notifications
You must be signed in to change notification settings - Fork 4k
Add new cmdlet, update commands.Sql and tests for 'List database operation' and 'List/Cancel elastic pool operation' #5762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…it and make changes to elastic pool activities
|
||
return resp.Select((activity) => | ||
var resp = from activity in activityResp | ||
join operation in operationResp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@@ -189,6 +239,27 @@ internal IList<AzureSqlDatabaseActivityModel> ListElasticPoolDatabaseActivity(st | |||
}).ToList(); | |||
} | |||
|
|||
/// <summary> | |||
/// Cancel teh elastic pool activity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo : "teh"
/// No user input to apply to model | ||
/// </summary> | ||
/// <param name="model">Model retrieved from service</param> | ||
/// <returns>The model that wa passed in</returns> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo : "wa"
@@ -0,0 +1 @@ | |||
---external help file: Microsoft.Azure.Commands.Sql.dll-Help.xmlModule Name: AzureRM.Sqlonline version:schema: 2.0.0---# Stop-AzureRmSqlElasticPoolActivity## SYNOPSIS{{Fill in the Synopsis}}## SYNTAX```Stop-AzureRmSqlElasticPoolActivity [-ServerName] <String> [-ElasticPoolName] <String> [-OperationId <Guid>] [-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]```## DESCRIPTIONThe **Stop-AzureRmSqlElasticPoolActivity** cmdlet cancels the asynchronous updates operation on the elastic pool.## EXAMPLES### Example 1: Cancel the asynchronous updates operation on the elastic pool```PS C:\> Stop-AzureRmSqlElasticPoolActivity -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -ElasticPoolName "ElasticPool01" -OperationId af97005d-9243-4f8a-844e-402d1cc855f5```OperationId : af97005d-9243-4f8a-844e-402d1cc855f5ServerName : Server01DatabaseName : ElasticPool01State : CANCELLEDOperation : UpdateLogicalElasticPoolErrorCode :ErrorMessage :ErrorSeverity :StartTime : 10/15/2017 02:49:42 PMEndTime : 10/15/2017 02:49:43 PMPercentComplete : ```This command cancels the asynchronous updates operation on the elastic pool.## PARAMETERS### -DefaultProfileThe credentials, account, tenant, and subscription used for communication with Azure.```yamlType: IAzureContextContainerParameter Sets: (All)Aliases: AzureRmContext, AzureCredentialRequired: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False```### -ElasticPoolNameThe name of the Azure SQL Elastic Pool.```yamlType: StringParameter Sets: (All)Aliases:Required: TruePosition: 2Default value: NoneAccept pipeline input: True (ByPropertyName)Accept wildcard characters: False```### -OperationIdThe ID of the operation to retrieve.```yamlType: GuidParameter Sets: (All)Aliases:Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: True (ByPropertyName)Accept wildcard characters: False```### -ResourceGroupNameThe name of the resource group.```yamlType: StringParameter Sets: (All)Aliases:Required: TruePosition: 0Default value: NoneAccept pipeline input: True (ByPropertyName)Accept wildcard characters: False```### -ServerNameThe name of the Azure SQL Server the Elastic Pool is in.```yamlType: StringParameter Sets: (All)Aliases:Required: TruePosition: 1Default value: NoneAccept pipeline input: True (ByPropertyName)Accept wildcard characters: False```### -ConfirmPrompts you for confirmation before running the cmdlet.```yamlType: SwitchParameterParameter Sets: (All)Aliases: cfRequired: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False```### -WhatIfShows what would happen if the cmdlet runs.The cmdlet is not run.```yamlType: SwitchParameterParameter Sets: (All)Aliases: wiRequired: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False```### CommonParametersThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).## INPUTS### System.StringSystem.Nullable`1[[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]## OUTPUTS### System.Object## NOTES## RELATED LINKS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Synopsis is empty : "{{Fill in the Synopsis}}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@payiAzure a few comments to take a look at. Also, please make sure to update the Sql change log with a snippet that reflects the changes being made in this PR?
@@ -0,0 +1 @@ | |||
---external help file: Microsoft.Azure.Commands.Sql.dll-Help.xmlModule Name: AzureRM.Sqlonline version:schema: 2.0.0---# Stop-AzureRmSqlElasticPoolActivity## SYNOPSISCancels the asynchronous updates operation on the elastic pool.## SYNTAX```Stop-AzureRmSqlElasticPoolActivity [-ServerName] <String> [-ElasticPoolName] <String> [-OperationId <Guid>] [-ResourceGroupName] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]```## DESCRIPTIONThe **Stop-AzureRmSqlElasticPoolActivity** cmdlet cancels the asynchronous updates operation on the elastic pool.## EXAMPLES### Example 1: Cancel the asynchronous updates operation on the elastic pool```PS C:\> Stop-AzureRmSqlElasticPoolActivity -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -ElasticPoolName "ElasticPool01" -OperationId af97005d-9243-4f8a-844e-402d1cc855f5```OperationId : af97005d-9243-4f8a-844e-402d1cc855f5ServerName : Server01DatabaseName : ElasticPool01State : CANCELLEDOperation : UpdateLogicalElasticPoolErrorCode :ErrorMessage :ErrorSeverity :StartTime : 10/15/2017 02:49:42 PMEndTime : 10/15/2017 02:49:43 PMPercentComplete : ```This command cancels the asynchronous updates operation on the elastic pool.## PARAMETERS### -DefaultProfileThe credentials, account, tenant, and subscription used for communication with Azure.```yamlType: IAzureContextContainerParameter Sets: (All)Aliases: AzureRmContext, AzureCredentialRequired: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False```### -ElasticPoolNameThe name of the Azure SQL Elastic Pool.```yamlType: StringParameter Sets: (All)Aliases:Required: TruePosition: 2Default value: NoneAccept pipeline input: True (ByPropertyName)Accept wildcard characters: False```### -OperationIdThe ID of the operation to retrieve.```yamlType: GuidParameter Sets: (All)Aliases:Required: FalsePosition: NamedDefault value: NoneAccept pipeline input: True (ByPropertyName)Accept wildcard characters: False```### -ResourceGroupNameThe name of the resource group.```yamlType: StringParameter Sets: (All)Aliases:Required: TruePosition: 0Default value: NoneAccept pipeline input: True (ByPropertyName)Accept wildcard characters: False```### -ServerNameThe name of the Azure SQL Server the Elastic Pool is in.```yamlType: StringParameter Sets: (All)Aliases:Required: TruePosition: 1Default value: NoneAccept pipeline input: True (ByPropertyName)Accept wildcard characters: False```### -ConfirmPrompts you for confirmation before running the cmdlet.```yamlType: SwitchParameterParameter Sets: (All)Aliases: cfRequired: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False```### -WhatIfShows what would happen if the cmdlet runs.The cmdlet is not run.```yamlType: SwitchParameterParameter Sets: (All)Aliases: wiRequired: FalsePosition: NamedDefault value: NoneAccept pipeline input: FalseAccept wildcard characters: False```### CommonParametersThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).## INPUTS### System.StringSystem.Nullable`1[[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]## OUTPUTS### System.Object## NOTES## RELATED LINKS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@payiAzure there's something wrong with how this file is encoded -- it's all on one line and there are a ton of red ^M
characters in this file. Would you mind ensuring that this is using UTF-8 encoding?
Using GitHub to edit this file, it appears there are a few encoding characters on the first line of the file that you can remove.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cormacpayne updated this md file, should have correct format now.
namespace Microsoft.Azure.Commands.Sql.ElasticPool.Cmdlet | ||
{ | ||
[Cmdlet(VerbsLifecycle.Stop, "AzureRmSqlElasticPoolActivity", SupportsShouldProcess = true)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@payiAzure nit: remove this blank line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cormacpayne removed in the new commit.
|
||
namespace Microsoft.Azure.Commands.Sql.ElasticPool.Cmdlet | ||
{ | ||
[Cmdlet(VerbsLifecycle.Stop, "AzureRmSqlElasticPoolActivity", SupportsShouldProcess = true)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@payiAzure please add an OutputType
to this cmdlet -- if this cmdlet does not return any output, then you should implement the PassThru
parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cormacpayne I'm not clear about what is the PassThru parameter and how to implement it? can you please point me to any example?
Since I just follow one existing command to implement this similar one. "StopAzureSqlDatabaseActivity.cs"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cormacpayne .Add OutputType and implement the PassThru parameter.
function Test-ListAndCancelElasticPoolOperation | ||
{ | ||
# Setup | ||
$location = "southeastasia"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@payiAzure please avoid hard-coding locations in tests -- this potentially makes it difficult for other users to re-record this test who might not have access to the resources in the provided location. We recommend using the Get-Location
function in our test common code to get a location that works for the user re-recording the test.
|
||
try | ||
{ | ||
$activityCancel = Stop-AzureRmSqlElasticPoolActivity -ResourceGroupName $ep.ResourceGroupName -ServerName $ep.ServerName -ElasticPoolName $ep.ElasticPoolName -OperationId $epactivityId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@payiAzure just to be sure, should this command always error out? If not, then we should add some asserts over the returned $activityCancel
object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, in the test, it will always error out since the previous update operation makes the pool in an state that is not available in cancel.
78b2b26
to
cfbbe6e
Compare
@@ -189,7 +189,8 @@ CmdletsToExport = 'Get-AzureRmSqlDatabaseTransparentDataEncryption', | |||
'Remove-AzureRmSqlServerVirtualNetworkRule', | |||
'Stop-AzureRmSqlDatabaseActivity', 'Get-AzureRmSqlServerDnsAlias', | |||
'Remove-AzureRmSqlServerDnsAlias', 'New-AzureRmSqlServerDnsAlias', | |||
'Set-AzureRmSqlServerDnsAlias' | |||
'Set-AzureRmSqlServerDnsAlias', | |||
'Stop-AzureRmSqlElasticPoolActivity' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: fix indentation here
Communicator.CancelOperation(resourceGroupName, serverName, elasticPoolName, operationId.Value); | ||
|
||
// After Cancel event is fired, state will be in 'CancelInProgress' for a while but should expect to finish in a minute | ||
return GetElasticPoolActivity(resourceGroupName, serverName, elasticPoolName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
# Stop-AzureRmSqlElasticPoolActivity | ||
|
||
## SYNOPSIS | ||
Cancels the asynchronous updates operation on the elastic pool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cancels an asynchronous update operation on an elastic pool.
``` | ||
|
||
## DESCRIPTION | ||
The **Stop-AzureRmSqlElasticPoolActivity** cmdlet cancels the asynchronous updates operation on the elastic pool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... cancels an asynchronous update operation on an elastic pool.
PercentComplete : | ||
``` | ||
|
||
This command cancels the asynchronous updates operation on the elastic pool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaredmoo , comments addressed in the new commit.
|
||
### Example 1: Cancel the asynchronous updates operation on the elastic pool | ||
``` | ||
PS C:\> Stop-AzureRmSqlElasticPoolActivity -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -ElasticPoolName "ElasticPool01" -OperationId af97005d-9243-4f8a-844e-402d1cc855f5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quotes not needed
…nto azure-powershell-br1
@cormacpayne Can you please review this again? I have addressed the comments. I add the help url in the help file, but not sure why the build check still fail here. I can build from local. |
@payiAzure would you mind taking a look at the merge conflicts? Also, the build is failing because the |
@cormacpayne Fix the merge conflict issue and the build failure issues. Could you please take a review? Thank you! |
rerun on demand here: https://azuresdkci.westus2.cloudapp.azure.com/job/powershell-demand/683/ |
new on-demand run here: https://azuresdkci.westus2.cloudapp.azure.com/job/powershell-demand/684/ |
Description
The Changes in the PR is made from local .NET SDK binaries. Will update this PR after the corresponding .NET SDK is published.
The changes included in the PR:
Add new cmdlet: Stop-AureRmSqlElasticPoolActivity -ResourceGroupName -ServerName -ElasticPoolName -OperationId
Update the AzureSqlDatabaseActivityModel and AzureSqlElasticPoolActivityModel. When user try to get the database/elasticPool operations, the returned information of the operation will also include the new fields:
estimated completion time of the operation;
detail operation description;
mark to indicate if the operation can be cancelled.
Add test for the new added cmdlet.
Checklist
CONTRIBUTING.md
platyPS
module