-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
96f5092
Add new powershell cmdlet for cancel pool operation. Added tests for …
payiAzure e8f1c77
update help file for the new cmdlet Stop-AzureRmSqlElasticPoolActivity.
payiAzure 48c69b5
typo and help file update
payiAzure 11aaa3c
address comments. Use 'Get Location' common function in test. Update …
payiAzure cfbbe6e
update Stop-AzureRmSqlElasticPoolActivity.md from remote
payiAzure d8c84ba
Update ChangeLog.md
payiAzure 6ba28ec
add OutputType and implement PassThru for the new added cmdlet
payiAzure b72223a
merge with upstream/preview and resolve conflict
payiAzure f869848
address comments. fix indents and help file update
payiAzure 4afb998
enable piping scenario and test piping scenario
payiAzure f4fca17
address comments on help files
payiAzure 3ed7616
Merge branch 'preview' of https://github.com/Azure/azure-powershell i…
payiAzure ec192f2
address comments. Update helper file, project references, and changel…
payiAzure 5c43815
update package.config for Sql and Sql.Test project to use new version…
payiAzure bcc9e03
merge with azure-powershell preview
payiAzure d118ee9
add record for test TestElasticPoolCancelOperation.json
payiAzure a9eb9fd
update test records for cancel pool operation test
payiAzure 84ddbc9
resolve conflict
payiAzure File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3,332 changes: 3,332 additions & 0 deletions
3,332
....Commands.Sql.Test.ScenarioTests.ElasticPoolCrudTests/TestElasticPoolCancelOperation.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/ResourceManager/Sql/Commands.Sql/Elastic Pools/Cmdlet/StopAzureSqlElasticPoolActivity.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// Copyright Microsoft Corporation | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ---------------------------------------------------------------------------------- | ||
|
||
using Microsoft.Azure.Commands.Sql.ElasticPool.Model; | ||
using System.Collections.Generic; | ||
using System.Management.Automation; | ||
|
||
namespace Microsoft.Azure.Commands.Sql.ElasticPool.Cmdlet | ||
{ | ||
[Cmdlet(VerbsLifecycle.Stop, "AzureRmSqlElasticPoolActivity", SupportsShouldProcess = true), OutputType(typeof(AzureSqlElasticPoolActivityModel))] | ||
public class StopAzureSqlElasticPoolActivity : AzureSqlElasticPoolActivityCmdletBase | ||
{ | ||
/// <summary> | ||
/// Defines whether the cmdlets will successfully returned at the end of its execution | ||
/// </summary> | ||
[Parameter(Mandatory = false)] | ||
public SwitchParameter PassThru { get; set; } | ||
|
||
/// <summary> | ||
/// Gets elastic pool activity | ||
/// </summary> | ||
/// <returns>List of elastic pool activies</returns> | ||
protected override IEnumerable<AzureSqlElasticPoolActivityModel> GetEntity() | ||
{ | ||
return ModelAdapter.GetElasticPoolActivity(this.ResourceGroupName, this.ServerName, this.ElasticPoolName); | ||
} | ||
|
||
/// <summary> | ||
/// No user input to apply to model | ||
/// </summary> | ||
/// <param name="model">Model retrieved from service</param> | ||
/// <returns>The model that was passed in</returns> | ||
protected override IEnumerable<AzureSqlElasticPoolActivityModel> ApplyUserInputToModel(IEnumerable<AzureSqlElasticPoolActivityModel> model) | ||
{ | ||
return model; | ||
} | ||
|
||
/// <summary> | ||
/// No changes to persist to server | ||
/// </summary> | ||
/// <param name="entity">The output of apply user input to model</param> | ||
/// <returns>The input entity</returns> | ||
protected override IEnumerable<AzureSqlElasticPoolActivityModel> PersistChanges(IEnumerable<AzureSqlElasticPoolActivityModel> entity) | ||
{ | ||
return ModelAdapter.CancelElasticPoolActivity(this.ResourceGroupName, this.ServerName, this.ElasticPoolName, this.OperationId); | ||
} | ||
|
||
/// <summary> | ||
/// Returns true if the model object that was constructed by this cmdlet should be written out | ||
/// </summary> | ||
/// <returns>True if the model object should be written out, False otherwise</returns> | ||
protected override bool WriteResult() { return PassThru; } | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 since we always expect this to error out, we should change this to the following:
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'd like to keep it with try-catch for now. We're adding other support services for cancel operations and will update it in future if needed.