@@ -58,9 +58,8 @@ public Observable<Map> getClusterCoreSiteRequest(@NotNull final String clusterId
5858 .get (url , null , null , Map .class );
5959 }
6060
61- private Observable <ClusterConfiguration > getClusterConfigurationFromManagementEndpoint (
62- @ NotNull final String clusterId ) {
63- String managementURI = Azure .az (AzureCloud .class ).getOrDefault ().getManagementEndpoint ();
61+ private Observable <ClusterConfiguration > getClusterConfigurationRequest (
62+ @ NotNull final String clusterId , String managementURI ) {
6463 String url = URI .create (managementURI )
6564 .resolve (clusterId .replaceAll ("/+$" , "" ) + "/configurations" ).toString ();
6665 StringEntity entity = new StringEntity ("" , StandardCharsets .UTF_8 );
@@ -70,22 +69,11 @@ private Observable<ClusterConfiguration> getClusterConfigurationFromManagementEn
7069 .post (url , entity , null , null , ClusterConfiguration .class );
7170 }
7271
73- private Observable <ClusterConfiguration > getClusterConfigurationFromResourceManagerEndpoint (
74- @ NotNull final String clusterId ) {
75- String managementURI = Azure .az (AzureCloud .class ).getOrDefault ().getResourceManagerEndpoint ();
76- String url = URI .create (managementURI )
77- .resolve (clusterId .replaceAll ("/+$" , "" ) + "/configurations" ).toString ();
78- StringEntity entity = new StringEntity ("" , StandardCharsets .UTF_8 );
79- entity .setContentType ("application/json" );
80- return getHttp ()
81- .withUuidUserAgent ()
82- .post (url , entity , null , null , ClusterConfiguration .class );
83- }
8472
8573 public Observable <Boolean > isProbeGetConfigurationSucceed (final ClusterRawInfo clusterRawInfo ) {
8674 String clusterId = clusterRawInfo .getId ();
87-
88- return getClusterConfigurationFromResourceManagerEndpoint (clusterId )
75+ String managementURI = Azure . az ( AzureCloud . class ). getOrDefault (). getResourceManagerEndpoint ();
76+ return getClusterConfigurationRequest (clusterId , managementURI )
8977 .map (clusterConfiguration -> {
9078 if (isClusterConfigurationValid (clusterRawInfo , clusterConfiguration )) {
9179 setRoleType (HDInsightUserRoleType .OWNER );
@@ -176,13 +164,14 @@ public com.microsoft.azure.hdinsight.sdk.cluster.ClusterConfiguration getCluster
176164 try {
177165 switch (roleType ) {
178166 case OWNER :
179- return getClusterConfigurationFromManagementEndpoint (clusterId )
167+ String managementURI = Azure .az (AzureCloud .class ).getOrDefault ().getManagementEndpoint ();
168+ return getClusterConfigurationRequest (clusterId ,managementURI )
180169 // As you can see, the response class is
181170 // com.microsoft.azure.hdinsight.sdk.cluster.HDInsightNewAPI.ClusterConfiguration.
182171 // However, if we want to override method getClusterConfiguration, the method return type should be
183172 // com.microsoft.azure.hdinsight.sdk.cluster.ClusterConfiguration.
184173 // Therefore, we need to convert the new API response to old API.
185- .map (ClusterOperationNewAPIImpl ::convertConfigurationToOldAPI )
174+ .map (ClusterOperationNewAPIImpl ::convertConfigurationToOldAPI )
186175 .toBlocking ()
187176 .singleOrDefault (null );
188177 case READER :
0 commit comments