Skip to content

Commit 1c2c143

Browse files
expose forceDeletion in Fluent API (#1265)
1 parent 81ad882 commit 1c2c143

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/ResourceManagement/ResourceManager/Domain/IResourceGroups.cs

+15
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,20 @@ public interface IResourceGroups :
5151
/// <param name="name">name The name of the resource group to check. The name is case insensitive</param>
5252
/// <returns>true if the resource group exists; false otherwise</returns>
5353
Task<bool> ContainAsync(string name, CancellationToken cancellationToken = default(CancellationToken));
54+
55+
/// <summary>
56+
/// Deletes a resource from Azure, identifying it by its resource name.
57+
/// </summary>
58+
/// <param name="name">the name of the resource to delete</param>
59+
/// <param name="forceDeletionTypes">The resource types you want to force delete. Currently, only the following is supported: Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets</param>
60+
void DeleteByName(string name, string forceDeletionTypes);
61+
62+
/// <summary>
63+
/// Deletes a resource asynchronously from Azure, identifying it by its resource name.
64+
/// </summary>
65+
/// <param name="name">the name of the resource to delete</param>
66+
/// <param name="forceDeletionTypes">The resource types you want to force delete. Currently, only the following is supported: Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets</param>
67+
/// <param name="cancellationToken"></param>
68+
Task DeleteByNameAsync(string name, string forceDeletionTypes, CancellationToken cancellationToken = default(CancellationToken));
5469
}
5570
}

src/ResourceManagement/ResourceManager/ResourceGroup/ResourceGroupsImpl.cs

+10
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,15 @@ public void BeginDeleteByName(string name)
128128
{
129129
await Inner.BeginDeleteAsync(name, null, cancellationToken);
130130
}
131+
132+
public void DeleteByName(string name, string forceDeletionTypes)
133+
{
134+
Extensions.Synchronize(() => DeleteByNameAsync(name, forceDeletionTypes));
135+
}
136+
137+
public async Task DeleteByNameAsync(string name, string forceDeletionTypes, CancellationToken cancellationToken = default(CancellationToken))
138+
{
139+
await Inner.DeleteAsync(name, forceDeletionTypes, cancellationToken);
140+
}
131141
}
132142
}

0 commit comments

Comments
 (0)