Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ServiceFabric/ServiceFabric/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Renamed Remove-AzServiceFabricManagedNodeType parameter sets to use "Remove" instead of "Delete" for consistency with cmdlet name.

## Version 3.7.0
* Updated SF to latest api preview version `2023-11-01-preview`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,72 +20,72 @@

namespace Microsoft.Azure.Commands.ServiceFabric.Commands
{
[Cmdlet(VerbsCommon.Remove, ResourceManager.Common.AzureRMConstants.AzurePrefix + Constants.ServiceFabricPrefix + "ManagedNodeType", DefaultParameterSetName = DeleteNodeTypeByObj, SupportsShouldProcess = true), OutputType(typeof(bool))]
[Cmdlet(VerbsCommon.Remove, ResourceManager.Common.AzureRMConstants.AzurePrefix + Constants.ServiceFabricPrefix + "ManagedNodeType", DefaultParameterSetName = RemoveNodeTypeByObj, SupportsShouldProcess = true), OutputType(typeof(bool))]
public class RemoveAzServiceFabricManagedNodeType : ServiceFabricManagedCmdletBase
{
protected const string DeleteNodeTypeByName = "DeleteNodeTypeByName";
protected const string DeleteNodeTypeByObj = "DeleteNodeTypeByObj";
protected const string DeleteNodeTypeById = "DeleteNodeTypeById";
protected const string RemoveNodeTypeByName = "RemoveNodeTypeByName";
protected const string RemoveNodeTypeByObj = "RemoveNodeTypeByObj";
protected const string RemoveNodeTypeById = "RemoveNodeTypeById";

protected const string DeleteNodeByName = "DeleteNodeByName";
protected const string DeleteNodeByObj = "DeleteNodeByObj";
protected const string DeleteNodeById = "DeleteNodeById";
protected const string RemoveNodeByName = "RemoveNodeByName";
protected const string RemoveNodeByObj = "RemoveNodeByObj";
protected const string RemoveNodeById = "RemoveNodeById";

#region Params

#region Common params

[Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = DeleteNodeTypeByName,
[Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = RemoveNodeTypeByName,
HelpMessage = "Specify the name of the resource group.")]
[Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = DeleteNodeByName,
[Parameter(Mandatory = true, Position = 0, ValueFromPipelineByPropertyName = true, ParameterSetName = RemoveNodeByName,
HelpMessage = "Specify the name of the resource group.")]
[ResourceGroupCompleter]
[ValidateNotNullOrEmpty()]
public string ResourceGroupName { get; set; }

[Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = DeleteNodeTypeByName,
[Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = RemoveNodeTypeByName,
HelpMessage = "Specify the name of the cluster.")]
[Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = DeleteNodeByName,
[Parameter(Mandatory = true, Position = 1, ValueFromPipelineByPropertyName = true, ParameterSetName = RemoveNodeByName,
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, ParameterSetName = DeleteNodeTypeByName,
[Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, ParameterSetName = RemoveNodeTypeByName,
HelpMessage = "Specify the name of the node type.")]
[Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, ParameterSetName = DeleteNodeByName,
[Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, ParameterSetName = RemoveNodeByName,
HelpMessage = "Specify the name of the node type.")]
[ValidateNotNullOrEmpty()]
[Alias("NodeTypeName")]
public string Name { get; set; }

[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = DeleteNodeTypeByObj,
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = RemoveNodeTypeByObj,
HelpMessage = "Node type resource")]
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = DeleteNodeByObj,
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = RemoveNodeByObj,
HelpMessage = "Node type resource")]
[ValidateNotNull]
public PSManagedNodeType InputObject { get; set; }

[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = DeleteNodeTypeById,
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = RemoveNodeTypeById,
HelpMessage = "Node type resource id")]
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = DeleteNodeById,
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ParameterSetName = RemoveNodeById,
HelpMessage = "Node type resource id")]
[ValidateNotNullOrEmpty]
public string ResourceId { get; set; }

#endregion

[Parameter(Mandatory = true, ParameterSetName = DeleteNodeByName, HelpMessage = "List of node names for the operation.")]
[Parameter(Mandatory = true, ParameterSetName = DeleteNodeByObj, HelpMessage = "List of node names for the operation.")]
[Parameter(Mandatory = true, ParameterSetName = DeleteNodeById, HelpMessage = "List of node names for the operation.")]
[Parameter(Mandatory = true, ParameterSetName = RemoveNodeByName, HelpMessage = "List of node names for the operation.")]
[Parameter(Mandatory = true, ParameterSetName = RemoveNodeByObj, HelpMessage = "List of node names for the operation.")]
[Parameter(Mandatory = true, ParameterSetName = RemoveNodeById, HelpMessage = "List of node names for the operation.")]
[ValidateNotNullOrEmpty()]
public string[] NodeName { get; set; }

[Parameter(Mandatory = false, ParameterSetName = DeleteNodeByName,
[Parameter(Mandatory = false, ParameterSetName = RemoveNodeByName,
HelpMessage = "Using this flag will force the removal even if service fabric is unable to disable the nodes. Use with caution as this might cause data loss if stateful workloads are running on the nodes, or might bring the cluster down if there are not enough seed nodes after the opearion.")]
[Parameter(Mandatory = false, ParameterSetName = DeleteNodeByObj,
[Parameter(Mandatory = false, ParameterSetName = RemoveNodeByObj,
HelpMessage = "Using this flag will force the removal even if service fabric is unable to disable the nodes. Use with caution as this might cause data loss if stateful workloads are running on the nodes, or might bring the cluster down if there are not enough seed nodes after the opearion.")]
[Parameter(Mandatory = false, ParameterSetName = DeleteNodeById,
[Parameter(Mandatory = false, ParameterSetName = RemoveNodeById,
HelpMessage = "Using this flag will force the removal even if service fabric is unable to disable the nodes. Use with caution as this might cause data loss if stateful workloads are running on the nodes, or might bring the cluster down if there are not enough seed nodes after the opearion.")]
public SwitchParameter ForceRemoveNode { get; set; }

Expand All @@ -105,10 +105,10 @@ public override void ExecuteCmdlet()
this.SetParams();
switch (ParameterSetName)
{
case DeleteNodeByName:
case DeleteNodeByObj:
case DeleteNodeById:
if (ShouldProcess(target: this.Name, action: string.Format("Delete node(s) {0}, from node type {1} on cluster {2}", string.Join(", ", this.NodeName), this.Name, this.ClusterName)))
case RemoveNodeByName:
case RemoveNodeByObj:
case RemoveNodeById:
if (ShouldProcess(target: this.Name, action: string.Format("Remove node(s) {0}, from node type {1} on cluster {2}", string.Join(", ", this.NodeName), this.Name, this.ClusterName)))
{

var actionParams = new NodeTypeActionParameters(nodes: this.NodeName, force: this.ForceRemoveNode.IsPresent);
Expand All @@ -123,9 +123,9 @@ public override void ExecuteCmdlet()

break;

case DeleteNodeTypeByName:
case DeleteNodeTypeByObj:
case DeleteNodeTypeById:
case RemoveNodeTypeByName:
case RemoveNodeTypeByObj:
case RemoveNodeTypeById:
if (ShouldProcess(target: this.Name, action: string.Format("Remove node type: {0} on cluster {1}, resource group {2}", this.Name, this.ClusterName, this.ResourceGroupName)))
{
var beginRequestResponse = this.SfrpMcClient.NodeTypes.BeginDeleteWithHttpMessagesAsync(
Expand Down Expand Up @@ -155,17 +155,17 @@ private void SetParams()
{
switch (ParameterSetName)
{
case DeleteNodeByObj:
case DeleteNodeTypeByObj:
case RemoveNodeByObj:
case RemoveNodeTypeByObj:
if (string.IsNullOrEmpty(this.InputObject?.Id))
{
throw new ArgumentException("ResourceId is null.");
}

SetParametersByResourceId(this.InputObject.Id);
break;
case DeleteNodeById:
case DeleteNodeTypeById:
case RemoveNodeById:
case RemoveNodeTypeById:
SetParametersByResourceId(this.ResourceId);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,39 @@ Remove the node type or specific nodes within the node type.

## SYNTAX

### DeleteNodeTypeByObj (Default)
### RemoveNodeTypeByObj (Default)
```
Remove-AzServiceFabricManagedNodeType [-InputObject] <PSManagedNodeType> [-PassThru] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### DeleteNodeTypeByName
### RemoveNodeTypeByName
```
Remove-AzServiceFabricManagedNodeType [-ResourceGroupName] <String> [-ClusterName] <String> [-Name] <String>
[-PassThru] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### DeleteNodeByName
### RemoveNodeByName
```
Remove-AzServiceFabricManagedNodeType [-ResourceGroupName] <String> [-ClusterName] <String> [-Name] <String>
-NodeName <String[]> [-ForceRemoveNode] [-PassThru] [-AsJob] [-DefaultProfile <IAzureContextContainer>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### DeleteNodeByObj
### RemoveNodeByObj
```
Remove-AzServiceFabricManagedNodeType [-InputObject] <PSManagedNodeType> -NodeName <String[]>
[-ForceRemoveNode] [-PassThru] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

### DeleteNodeTypeById
### RemoveNodeTypeById
```
Remove-AzServiceFabricManagedNodeType [-ResourceId] <String> [-PassThru] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### DeleteNodeById
### RemoveNodeById
```
Remove-AzServiceFabricManagedNodeType [-ResourceId] <String> -NodeName <String[]> [-ForceRemoveNode]
[-PassThru] [-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
Expand Down Expand Up @@ -121,7 +121,7 @@ Specify the name of the cluster.

```yaml
Type: System.String
Parameter Sets: DeleteNodeTypeByName, DeleteNodeByName
Parameter Sets: RemoveNodeTypeByName, RemoveNodeByName
Aliases:

Required: True
Expand Down Expand Up @@ -152,7 +152,7 @@ Use with caution as this might cause data loss if stateful workloads are running

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: DeleteNodeByName, DeleteNodeByObj, DeleteNodeById
Parameter Sets: RemoveNodeByName, RemoveNodeByObj, RemoveNodeById
Aliases:

Required: False
Expand All @@ -167,7 +167,7 @@ Node type resource

```yaml
Type: Microsoft.Azure.Commands.ServiceFabric.Models.PSManagedNodeType
Parameter Sets: DeleteNodeTypeByObj, DeleteNodeByObj
Parameter Sets: RemoveNodeTypeByObj, RemoveNodeByObj
Aliases:

Required: True
Expand All @@ -182,7 +182,7 @@ Specify the name of the node type.

```yaml
Type: System.String
Parameter Sets: DeleteNodeTypeByName, DeleteNodeByName
Parameter Sets: RemoveNodeTypeByName, RemoveNodeByName
Aliases: NodeTypeName

Required: True
Expand All @@ -197,7 +197,7 @@ List of node names for the operation.

```yaml
Type: System.String[]
Parameter Sets: DeleteNodeByName, DeleteNodeByObj, DeleteNodeById
Parameter Sets: RemoveNodeByName, RemoveNodeByObj, RemoveNodeById
Aliases:

Required: True
Expand Down Expand Up @@ -227,7 +227,7 @@ Specify the name of the resource group.

```yaml
Type: System.String
Parameter Sets: DeleteNodeTypeByName, DeleteNodeByName
Parameter Sets: RemoveNodeTypeByName, RemoveNodeByName
Aliases:

Required: True
Expand All @@ -242,7 +242,7 @@ Node type resource id

```yaml
Type: System.String
Parameter Sets: DeleteNodeTypeById, DeleteNodeById
Parameter Sets: RemoveNodeTypeById, RemoveNodeById
Aliases:

Required: True
Expand Down