Skip to content

Commit

Permalink
[HDInsight] Fix bug and add new parameter. (#26133)
Browse files Browse the repository at this point in the history
* Regenerate

* Update help doc

* Update test

* fix a bug and add a param -Tag

* Update test

* Update help doc

* Update changelog.

* Update changelog

* update example

* Update changelog

* Update a example error

* Remove some change

* Update test

* SignatureIssue

* Update SignatureIssue

* Update

* Update

* Update

---------

Co-authored-by: v-yuchenli <[email protected]>
  • Loading branch information
yuc-Li and v-yuchenli authored Nov 1, 2024
1 parent 4f9e087 commit 02eeee0
Show file tree
Hide file tree
Showing 67 changed files with 1,482 additions and 481 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ internal ClustersOperations (HDInsightManagementClient client)
/// The resource tags.
/// </param>
/// <param name='identity'>
/// The identity of the cluster, if configured.
/// The identity of the cluster, if configured. Setting this property will
/// override the existing identity configuration of the cluster.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public partial interface IClustersOperations
/// The resource tags.
/// </param>
/// <param name='identity'>
/// The identity of the cluster, if configured.
/// The identity of the cluster, if configured. Setting this property will
/// override the existing identity configuration of the cluster.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public ClusterPatchParameters()
/// <param name="tags">The resource tags.
/// </param>

/// <param name="identity">The identity of the cluster, if configured.
/// <param name="identity">The identity of the cluster, if configured. Setting this property will
/// override the existing identity configuration of the cluster.
/// </param>
public ClusterPatchParameters(System.Collections.Generic.IDictionary<string, string> tags = default(System.Collections.Generic.IDictionary<string, string>), ClusterIdentity identity = default(ClusterIdentity))

Expand All @@ -50,7 +51,8 @@ public ClusterPatchParameters()
public System.Collections.Generic.IDictionary<string, string> Tags {get; set; }

/// <summary>
/// Gets or sets the identity of the cluster, if configured.
/// Gets or sets the identity of the cluster, if configured. Setting this
/// property will override the existing identity configuration of the cluster.
/// </summary>
[Newtonsoft.Json.JsonProperty(PropertyName = "identity")]
public ClusterIdentity Identity {get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/HDInsight/HDInsight.Management.Sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ skip-csproj: true
###
``` yaml
commit: f22b814a1a30517cb6612c8fe071cfbcc64e3a2c
commit: 339220060c53b1f6c04cdfa10dc577a9a961572f
input-file:
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/applications.json
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/cluster.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,23 @@ public void TestCreateClusterWithPrivateLinkConfiguration()

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestUpdateCluster()
public void TestUpdateClusterTags()
{
TestRunner.RunTestScript("Test-UpdateClusterTagsAndIdentity");
TestRunner.RunTestScript("Test-UpdateClusterTags");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestUpdateClusterSystemAssigned()
{
TestRunner.RunTestScript("Test-UpdateClusterSystemAssigned");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestUpdateClusterUserAssigned()
{
TestRunner.RunTestScript("Test-UpdateClusterUserAssigned");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -534,32 +534,79 @@ function Test-CreateClusterWithPrivateLinkConfiguration{

<#
.SYNOPSIS
Test Update clusterIdentity
Test Update cluster tags
#>

function Test-UpdateClusterTagsAndIdentity{

function Test-UpdateClusterTags{
# Create some resources that will be used throughout test
try
{
$location = "East US"
# prepare parameter for creating parameter
#$params= Prepare-ClusterCreateParameter

# create cluster that will be used throughout test
$cluster = Get-AzHDInsightCluster -ResourceGroupName yuchen-ps-test -ClusterName spark51
Assert-NotNull $cluster
$rg="yuchen-devrp"
$clusterName="yuchen-hadoop-002"

# Update cluster tags
#$tags = @{"tag1"="value1";"tag2"="value2"}
#Update-AzHDInsightCluster -ResourceGroupName yuchen-ps-test -ClusterName spark51 -Tag @{"Tag1"="Value1"; "Tag2"="Value2"}
$tags = New-Object 'System.Collections.Generic.Dictionary[System.String,System.String]'
$tags.Add('Tag3', 'Value3')

$cluster = Update-AzHDInsightCluster -ResourceGroupName $rg -ClusterName $clusterName -Tag $tags
}
finally
{
# Delete cluster and resource group
# Remove-AzResourceGroup -ResourceGroupName $params.resourceGroupName
}
}

# Update cluster identity
# Update-AzHDInsightCluster -ResourceGroupName yuchen-ps-test -ClusterName spark51 -IdentityType SystemAssigned
<#
.SYNOPSIS
Test Update cluster System Assigned Identity
#>
function Test-UpdateClusterSystemAssigned{
try
{
$rg="yuchen-ps-test"
$clusterName="h1-spark"

# Update cluster identity
Update-AzHDInsightCluster -ResourceGroupName yuchen-ps-test -ClusterName spark51 -IdentityType UserAssigned -IdentityId "/subscriptions/964c10bb-8a6c-43bc-83d3-6b318c6c7305/resourceGroups/yuchen-ps-test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/hdi-msi"
$cluster = Update-AzHDInsightCluster -ResourceGroupName $rg -ClusterName $clusterName -IdentityType SystemAssigned

Assert-NotNull $cluster
Assert-AreEqual $cluster.AssignedIdentity.Type SystemAssigned
}
finally
{
# Delete cluster and resource group
# Remove-AzResourceGroup -ResourceGroupName $params.resourceGroupName
}
}

<#
.SYNOPSIS
Test Update cluster User Assigned Identity
#>
function Test-UpdateClusterUserAssigned{
try
{
$rg="yuchen-ps-test"
$clusterName="h1-spark"

# Define the list of Identity IDs
$identityIds = @(
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/yuchen-ps-test/providers/microsoft.managedidentity/userassignedidentities/hdi-msi",
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yuchen-devrp/providers/Microsoft.ManagedIdentity/userAssignedIdentities/hdiwasbmsi"
)

$cluster = Update-AzHDInsightCluster -ResourceGroupName $rg -ClusterName $clusterName -IdentityType UserAssigned -IdentityId $identityIds

Assert-NotNull $cluster
Assert-AreEqual $cluster.AssignedIdentity.Type UserAssigned

}
finally
{
# Delete cluster and resource group
# Remove-AzResourceGroup -ResourceGroupName $params.resourceGroupName
}
}
}
Loading

0 comments on commit 02eeee0

Please sign in to comment.