-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[Az.ServiceFabric] Add cmdlets Invoke-AzServiceFabricDeallocateManagedNodeType, Invoke-AzServiceFabricRedeployManagedNodeType, Start-AzServiceFabricManagedNodeType #28499
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 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fabb1ed
initial rename
iliu816 e5fadb0
Add Invoke-AzServiceFabricReimageManagedNodeType;
iliu816 744181a
mark nodeName as non-mandatory for restart, redeploy, and reimage
iliu816 a1672c0
update test recording
iliu816 8717cfa
changelog
iliu816 fce2192
Merge branch 'main' into user/iliu/editNTActions
iliu816 f0b7560
cr review: add newlines, add more examples
iliu816 eb26b0a
nit: spelling and passthru parameter description
iliu816 2723a89
Merge branch 'main' into user/iliu/editNTActions
iliu816 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
6,670 changes: 4,169 additions & 2,501 deletions
6,670
...ceFabric.Test.ScenarioTests.ServiceFabricManagedClustersTests/TestNodeTypeOperations.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
89 changes: 89 additions & 0 deletions
89
...bric/Commands/ManagedClusters/NodeTypes/InvokeAzServiceFabricDeallocateManagedNodeType.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,89 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // 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 System; | ||
| using System.Management.Automation; | ||
| using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; | ||
| using Microsoft.Azure.Commands.ServiceFabric.Common; | ||
| using Microsoft.Azure.Management.ServiceFabricManagedClusters.Models; | ||
|
|
||
| namespace Microsoft.Azure.Commands.ServiceFabric.Commands | ||
| { | ||
| [Cmdlet(VerbsLifecycle.Invoke, ResourceManager.Common.AzureRMConstants.AzurePrefix + Constants.ServiceFabricPrefix + "DeallocateManagedNodeType", SupportsShouldProcess = true), OutputType(typeof(bool))] | ||
| public class InvokeAzServiceFabricDeallocateManagedNodeType : ServiceFabricManagedCmdletBase | ||
| { | ||
| #region Params | ||
|
|
||
| #region Common params | ||
|
|
||
| [Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specify the name of the resource group.")] | ||
| [ResourceGroupCompleter] | ||
| [ValidateNotNullOrEmpty()] | ||
| public string ResourceGroupName { get; set; } | ||
|
|
||
| [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specify the name of the cluster.")] | ||
| [ResourceNameCompleter(Constants.ManagedClustersFullType, nameof(ResourceGroupName))] | ||
| [ValidateNotNullOrEmpty()] | ||
| public string ClusterName { get; set; } | ||
|
|
||
| [Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specify the name of the node type.")] | ||
| [ValidateNotNullOrEmpty()] | ||
| [Alias("NodeTypeName")] | ||
| public string Name { get; set; } | ||
|
|
||
| #endregion | ||
|
|
||
| [Parameter(Mandatory = true, HelpMessage = "List of node names for the operation.")] | ||
| [ValidateNotNullOrEmpty()] | ||
| public string[] NodeName { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false)] | ||
| public SwitchParameter PassThru { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background and return a Job to track progress.")] | ||
| public SwitchParameter AsJob { get; set; } | ||
|
|
||
| #endregion | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| if (ShouldProcess(target: this.Name, action: string.Format("Deallocate node(s) {0}, from node type {1} on cluster {2}", string.Join(", ", this.NodeName), this.Name, this.ClusterName))) | ||
| { | ||
| try | ||
| { | ||
| var actionParams = new NodeTypeActionParameters(nodes: this.NodeName); | ||
| var beginRequestResponse = this.SfrpMcClient.NodeTypes.BeginDeallocateWithHttpMessagesAsync( | ||
| this.ResourceGroupName, | ||
| this.ClusterName, | ||
| this.Name, | ||
| actionParams).GetAwaiter().GetResult(); | ||
|
|
||
| this.PollLongRunningOperation(beginRequestResponse); | ||
|
|
||
| if (this.PassThru) | ||
| { | ||
| WriteObject(true); | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| PrintSdkExceptionDetail(ex); | ||
| throw; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
95 changes: 95 additions & 0 deletions
95
...Fabric/Commands/ManagedClusters/NodeTypes/InvokeAzServiceFabricRedeployManagedNodeType.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,95 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // 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 System; | ||
| using System.Management.Automation; | ||
| using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; | ||
| using Microsoft.Azure.Commands.ServiceFabric.Common; | ||
| using Microsoft.Azure.Management.ServiceFabricManagedClusters.Models; | ||
|
|
||
| namespace Microsoft.Azure.Commands.ServiceFabric.Commands | ||
| { | ||
| [Cmdlet(VerbsLifecycle.Invoke, ResourceManager.Common.AzureRMConstants.AzurePrefix + Constants.ServiceFabricPrefix + "RedeployManagedNodeType", SupportsShouldProcess = true), OutputType(typeof(bool))] | ||
| public class InvokeAzServiceFabricRedeployManagedNodeType : ServiceFabricManagedCmdletBase | ||
| { | ||
| #region Params | ||
|
|
||
| #region Common params | ||
|
|
||
| [Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specify the name of the resource group.")] | ||
| [ResourceGroupCompleter] | ||
| [ValidateNotNullOrEmpty()] | ||
| public string ResourceGroupName { get; set; } | ||
|
|
||
| [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specify the name of the cluster.")] | ||
| [ResourceNameCompleter(Constants.ManagedClustersFullType, nameof(ResourceGroupName))] | ||
| [ValidateNotNullOrEmpty()] | ||
| public string ClusterName { get; set; } | ||
|
|
||
| [Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specify the name of the node type.")] | ||
| [ValidateNotNullOrEmpty()] | ||
| [Alias("NodeTypeName")] | ||
| public string Name { get; set; } | ||
|
|
||
| #endregion | ||
|
|
||
| [Parameter(Mandatory = false, HelpMessage = "List of node names for the operation.")] | ||
| public string[] NodeName { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false, HelpMessage = "Specify the update type. Valid values are 'Default' and 'ByUpgradeDomain'.")] | ||
| public string UpdateType { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false, | ||
| HelpMessage = "Using this flag will force the nodes to redeploy even if service fabric is unable to disable the nodes.")] | ||
| public SwitchParameter ForceRedeploy { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false)] | ||
| public SwitchParameter PassThru { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background and return a Job to track progress.")] | ||
| public SwitchParameter AsJob { get; set; } | ||
|
|
||
| #endregion | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| if (ShouldProcess(target: this.Name, action: string.Format("Redeploy node(s) {0}, from node type {1} on cluster {2} with update type {3}", (this.NodeName == null)? String.Empty : string.Join(", ", this.NodeName), this.Name, this.ClusterName, this.UpdateType ?? "Default"))) | ||
| { | ||
| try | ||
| { | ||
| var actionParams = new NodeTypeActionParameters(nodes: this.NodeName, updateType: this.UpdateType, force: this.ForceRedeploy.IsPresent); | ||
| var beginRequestResponse = this.SfrpMcClient.NodeTypes.BeginRedeployWithHttpMessagesAsync( | ||
| this.ResourceGroupName, | ||
| this.ClusterName, | ||
| this.Name, | ||
| actionParams).GetAwaiter().GetResult(); | ||
|
|
||
| this.PollLongRunningOperation(beginRequestResponse); | ||
|
|
||
| if (this.PassThru) | ||
| { | ||
| WriteObject(true); | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| PrintSdkExceptionDetail(ex); | ||
| throw; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
96 changes: 96 additions & 0 deletions
96
...eFabric/Commands/ManagedClusters/NodeTypes/InvokeAzServiceFabricReimageManagedNodeType.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,96 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // 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.ResourceManager.Common.ArgumentCompleters; | ||
| using Microsoft.Azure.Commands.ServiceFabric.Common; | ||
| using Microsoft.Azure.Commands.ServiceFabric.Models; | ||
| using Microsoft.Azure.Management.ServiceFabricManagedClusters.Models; | ||
| using System; | ||
| using System.Management.Automation; | ||
|
|
||
| namespace Microsoft.Azure.Commands.ServiceFabric.Commands | ||
| { | ||
| [Cmdlet(VerbsLifecycle.Invoke, ResourceManager.Common.AzureRMConstants.AzurePrefix + Constants.ServiceFabricPrefix + "ReimageManagedNodeType", SupportsShouldProcess = true), OutputType(typeof(bool))] | ||
| public class InvokeAzServiceFabricReimageManagedNodeType : ServiceFabricManagedCmdletBase | ||
| { | ||
| #region Params | ||
|
|
||
| #region Common params | ||
|
|
||
| [Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specify the name of the resource group.")] | ||
| [ResourceGroupCompleter] | ||
| [ValidateNotNullOrEmpty()] | ||
| public string ResourceGroupName { get; set; } | ||
|
|
||
| [Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specify the name of the cluster.")] | ||
| [ResourceNameCompleter(Constants.ManagedClustersFullType, nameof(ResourceGroupName))] | ||
| [ValidateNotNullOrEmpty()] | ||
| public string ClusterName { get; set; } | ||
|
|
||
| [Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, | ||
| HelpMessage = "Specify the name of the node type.")] | ||
| [ValidateNotNullOrEmpty()] | ||
| [Alias("NodeTypeName")] | ||
| public string Name { get; set; } | ||
|
|
||
| #endregion | ||
|
|
||
| [Parameter(Mandatory = false, HelpMessage = "List of node names for the operation.")] | ||
| public string[] NodeName { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false, HelpMessage = "Specify the update type. Valid values are 'Default' and 'ByUpgradeDomain'.")] | ||
| public string UpdateType { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false, | ||
| HelpMessage = "Using this flag will force the nodes to reimage even if service fabric is unable to disable the nodes.")] | ||
| public SwitchParameter ForceReimage { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false)] | ||
| public SwitchParameter PassThru { get; set; } | ||
|
|
||
| [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background and return a Job to track progress.")] | ||
| public SwitchParameter AsJob { get; set; } | ||
|
|
||
| #endregion | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| if (ShouldProcess(target: this.Name, action: string.Format("Reimage node(s) {0}, from node type {1} on cluster {2} with update type {3}", (this.NodeName == null) ? String.Empty : string.Join(", ", this.NodeName), this.Name, this.ClusterName, this.UpdateType ?? "Default"))) | ||
| { | ||
| try | ||
| { | ||
| var actionParams = new NodeTypeActionParameters(nodes: this.NodeName, updateType: this.UpdateType, force: this.ForceReimage.IsPresent); | ||
| var beginRequestResponse = this.SfrpMcClient.NodeTypes.BeginReimageWithHttpMessagesAsync( | ||
| this.ResourceGroupName, | ||
| this.ClusterName, | ||
| this.Name, | ||
| actionParams).GetAwaiter().GetResult(); | ||
|
|
||
| this.PollLongRunningOperation(beginRequestResponse); | ||
|
|
||
| if (this.PassThru) | ||
| { | ||
| WriteObject(true); | ||
| } | ||
| } | ||
| catch (Exception ex) | ||
| { | ||
| PrintSdkExceptionDetail(ex); | ||
| throw; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.