Skip to content

Commit 02eeee0

Browse files
yuc-Liv-yuchenli
andauthored
[HDInsight] Fix bug and add new parameter. (#26133)
* 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]>
1 parent 4f9e087 commit 02eeee0

File tree

67 files changed

+1482
-481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1482
-481
lines changed

src/HDInsight/HDInsight.Management.Sdk/Generated/ClustersOperations.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ internal ClustersOperations (HDInsightManagementClient client)
7676
/// The resource tags.
7777
/// </param>
7878
/// <param name='identity'>
79-
/// The identity of the cluster, if configured.
79+
/// The identity of the cluster, if configured. Setting this property will
80+
/// override the existing identity configuration of the cluster.
8081
/// </param>
8182
/// <param name='customHeaders'>
8283
/// Headers that will be added to request.

src/HDInsight/HDInsight.Management.Sdk/Generated/IClustersOperations.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public partial interface IClustersOperations
5858
/// The resource tags.
5959
/// </param>
6060
/// <param name='identity'>
61-
/// The identity of the cluster, if configured.
61+
/// The identity of the cluster, if configured. Setting this property will
62+
/// override the existing identity configuration of the cluster.
6263
/// </param>
6364
/// <param name='customHeaders'>
6465
/// The headers that will be added to request.

src/HDInsight/HDInsight.Management.Sdk/Generated/Models/ClusterPatchParameters.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ public ClusterPatchParameters()
2727
/// <param name="tags">The resource tags.
2828
/// </param>
2929

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

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

5253
/// <summary>
53-
/// Gets or sets the identity of the cluster, if configured.
54+
/// Gets or sets the identity of the cluster, if configured. Setting this
55+
/// property will override the existing identity configuration of the cluster.
5456
/// </summary>
5557
[Newtonsoft.Json.JsonProperty(PropertyName = "identity")]
5658
public ClusterIdentity Identity {get; set; }

src/HDInsight/HDInsight.Management.Sdk/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ skip-csproj: true
2929
3030
###
3131
``` yaml
32-
commit: f22b814a1a30517cb6612c8fe071cfbcc64e3a2c
32+
commit: 339220060c53b1f6c04cdfa10dc577a9a961572f
3333
input-file:
3434
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/applications.json
3535
- https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/hdinsight/resource-manager/Microsoft.HDInsight/preview/2024-08-01-preview/cluster.json

src/HDInsight/HDInsight.Test/ScenarioTests/HDInsightClusterTests.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,23 @@ public void TestCreateClusterWithPrivateLinkConfiguration()
118118

119119
[Fact]
120120
[Trait(Category.AcceptanceType, Category.CheckIn)]
121-
public void TestUpdateCluster()
121+
public void TestUpdateClusterTags()
122122
{
123-
TestRunner.RunTestScript("Test-UpdateClusterTagsAndIdentity");
123+
TestRunner.RunTestScript("Test-UpdateClusterTags");
124+
}
125+
126+
[Fact]
127+
[Trait(Category.AcceptanceType, Category.CheckIn)]
128+
public void TestUpdateClusterSystemAssigned()
129+
{
130+
TestRunner.RunTestScript("Test-UpdateClusterSystemAssigned");
131+
}
132+
133+
[Fact]
134+
[Trait(Category.AcceptanceType, Category.CheckIn)]
135+
public void TestUpdateClusterUserAssigned()
136+
{
137+
TestRunner.RunTestScript("Test-UpdateClusterUserAssigned");
124138
}
125139
}
126140
}

src/HDInsight/HDInsight.Test/ScenarioTests/HDInsightClusterTests.ps1

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -534,32 +534,79 @@ function Test-CreateClusterWithPrivateLinkConfiguration{
534534

535535
<#
536536
.SYNOPSIS
537-
Test Update clusterIdentity
537+
Test Update cluster tags
538538
#>
539539

540-
function Test-UpdateClusterTagsAndIdentity{
541-
540+
function Test-UpdateClusterTags{
542541
# Create some resources that will be used throughout test
543542
try
544543
{
545-
$location = "East US"
544+
# prepare parameter for creating parameter
545+
#$params= Prepare-ClusterCreateParameter
546546

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

551550
# Update cluster tags
552-
#$tags = @{"tag1"="value1";"tag2"="value2"}
553-
#Update-AzHDInsightCluster -ResourceGroupName yuchen-ps-test -ClusterName spark51 -Tag @{"Tag1"="Value1"; "Tag2"="Value2"}
551+
$tags = New-Object 'System.Collections.Generic.Dictionary[System.String,System.String]'
552+
$tags.Add('Tag3', 'Value3')
553+
554+
$cluster = Update-AzHDInsightCluster -ResourceGroupName $rg -ClusterName $clusterName -Tag $tags
555+
}
556+
finally
557+
{
558+
# Delete cluster and resource group
559+
# Remove-AzResourceGroup -ResourceGroupName $params.resourceGroupName
560+
}
561+
}
554562

555-
# Update cluster identity
556-
# Update-AzHDInsightCluster -ResourceGroupName yuchen-ps-test -ClusterName spark51 -IdentityType SystemAssigned
563+
<#
564+
.SYNOPSIS
565+
Test Update cluster System Assigned Identity
566+
#>
567+
function Test-UpdateClusterSystemAssigned{
568+
try
569+
{
570+
$rg="yuchen-ps-test"
571+
$clusterName="h1-spark"
557572

558-
# Update cluster identity
559-
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"
573+
$cluster = Update-AzHDInsightCluster -ResourceGroupName $rg -ClusterName $clusterName -IdentityType SystemAssigned
574+
575+
Assert-NotNull $cluster
576+
Assert-AreEqual $cluster.AssignedIdentity.Type SystemAssigned
577+
}
578+
finally
579+
{
580+
# Delete cluster and resource group
581+
# Remove-AzResourceGroup -ResourceGroupName $params.resourceGroupName
582+
}
583+
}
584+
585+
<#
586+
.SYNOPSIS
587+
Test Update cluster User Assigned Identity
588+
#>
589+
function Test-UpdateClusterUserAssigned{
590+
try
591+
{
592+
$rg="yuchen-ps-test"
593+
$clusterName="h1-spark"
594+
595+
# Define the list of Identity IDs
596+
$identityIds = @(
597+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/yuchen-ps-test/providers/microsoft.managedidentity/userassignedidentities/hdi-msi",
598+
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/yuchen-devrp/providers/Microsoft.ManagedIdentity/userAssignedIdentities/hdiwasbmsi"
599+
)
600+
601+
$cluster = Update-AzHDInsightCluster -ResourceGroupName $rg -ClusterName $clusterName -IdentityType UserAssigned -IdentityId $identityIds
602+
603+
Assert-NotNull $cluster
604+
Assert-AreEqual $cluster.AssignedIdentity.Type UserAssigned
560605

561606
}
562607
finally
563608
{
609+
# Delete cluster and resource group
610+
# Remove-AzResourceGroup -ResourceGroupName $params.resourceGroupName
564611
}
565-
}
612+
}

0 commit comments

Comments
 (0)