Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Automation] Generate Fluent Lite from Swagger specification/hdinsight/resource-manager/Microsoft.HDInsight/HDInsightOnAks/readme.md#package-preview-2024-05 #41598

Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Azure Resource Manager HDInsightContainers client library for Java.

This package contains Microsoft Azure SDK for HDInsightContainers Management SDK. HDInsight Containers Management Client. Package tag package-preview-2023-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
This package contains Microsoft Azure SDK for HDInsightContainers Management SDK. HDInsight Containers Management Client. Package tag package-preview-2024-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

## We'd love to hear your feedback

Expand Down Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-hdinsight-containers</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.3</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen

### Authentication

By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables.
Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package.

- `AZURE_CLIENT_ID` for Azure client ID.
- `AZURE_TENANT_ID` for Azure tenant ID.
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.
Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

With above configuration, `azure` client can be authenticated using the following code:
Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code:

```java
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
Expand Down Expand Up @@ -97,6 +93,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md
[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md
Expand Down
656 changes: 467 additions & 189 deletions sdk/hdinsight/azure-resourcemanager-hdinsight-containers/SAMPLE.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<packaging>jar</packaging>

<name>Microsoft Azure SDK for HDInsightContainers Management</name>
<description>This package contains Microsoft Azure SDK for HDInsightContainers Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. HDInsight Containers Management Client. Package tag package-preview-2023-11.</description>
<description>This package contains Microsoft Azure SDK for HDInsightContainers Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. HDInsight Containers Management Client. Package tag package-preview-2024-05.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand Down Expand Up @@ -48,6 +48,11 @@
<revapi.skip>true</revapi.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-json</artifactId>
<version>1.2.0</version> <!-- {x-version-update;com.azure:azure-json;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
Expand Down Expand Up @@ -82,6 +87,12 @@
<version>5.9.3</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -100,11 +111,5 @@
<version>1.14.12</version> <!-- {x-version-update;testdep_net.bytebuddy:byte-buddy-agent;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import com.azure.core.http.HttpPipelinePosition;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.policy.HttpPolicyProviders;
import com.azure.core.http.policy.RequestIdPolicy;
Expand All @@ -28,19 +28,25 @@
import com.azure.resourcemanager.hdinsight.containers.implementation.AvailableClusterVersionsImpl;
import com.azure.resourcemanager.hdinsight.containers.implementation.ClusterAvailableUpgradesImpl;
import com.azure.resourcemanager.hdinsight.containers.implementation.ClusterJobsImpl;
import com.azure.resourcemanager.hdinsight.containers.implementation.ClusterLibrariesImpl;
import com.azure.resourcemanager.hdinsight.containers.implementation.ClusterPoolAvailableUpgradesImpl;
import com.azure.resourcemanager.hdinsight.containers.implementation.ClusterPoolsImpl;
import com.azure.resourcemanager.hdinsight.containers.implementation.ClusterPoolUpgradeHistoriesImpl;
import com.azure.resourcemanager.hdinsight.containers.implementation.ClustersImpl;
import com.azure.resourcemanager.hdinsight.containers.implementation.ClusterUpgradeHistoriesImpl;
import com.azure.resourcemanager.hdinsight.containers.implementation.HDInsightContainersManagementClientBuilder;
import com.azure.resourcemanager.hdinsight.containers.implementation.LocationsImpl;
import com.azure.resourcemanager.hdinsight.containers.implementation.OperationsImpl;
import com.azure.resourcemanager.hdinsight.containers.models.AvailableClusterPoolVersions;
import com.azure.resourcemanager.hdinsight.containers.models.AvailableClusterVersions;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterAvailableUpgrades;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterJobs;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterLibraries;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterPoolAvailableUpgrades;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterPools;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterPoolUpgradeHistories;
import com.azure.resourcemanager.hdinsight.containers.models.Clusters;
import com.azure.resourcemanager.hdinsight.containers.models.ClusterUpgradeHistories;
import com.azure.resourcemanager.hdinsight.containers.models.Locations;
import com.azure.resourcemanager.hdinsight.containers.models.Operations;
import java.time.Duration;
Expand All @@ -59,10 +65,14 @@ public final class HDInsightContainersManager {

private ClusterPoolAvailableUpgrades clusterPoolAvailableUpgrades;

private ClusterPoolUpgradeHistories clusterPoolUpgradeHistories;

private Clusters clusters;

private ClusterAvailableUpgrades clusterAvailableUpgrades;

private ClusterUpgradeHistories clusterUpgradeHistories;

private ClusterJobs clusterJobs;

private Locations locations;
Expand All @@ -73,14 +83,18 @@ public final class HDInsightContainersManager {

private AvailableClusterVersions availableClusterVersions;

private ClusterLibraries clusterLibraries;

private final HDInsightContainersManagementClient clientObject;

private HDInsightContainersManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
this.clientObject = new HDInsightContainersManagementClientBuilder().pipeline(httpPipeline)
.endpoint(profile.getEnvironment().getResourceManagerEndpoint()).subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval).buildClient();
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
.subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval)
.buildClient();
}

/**
Expand Down Expand Up @@ -231,12 +245,19 @@ public HDInsightContainersManager authenticate(TokenCredential credential, Azure
Objects.requireNonNull(profile, "'profile' cannot be null.");

StringBuilder userAgentBuilder = new StringBuilder();
userAgentBuilder.append("azsdk-java").append("-").append("com.azure.resourcemanager.hdinsight.containers")
.append("/").append("1.0.0-beta.2");
userAgentBuilder.append("azsdk-java")
.append("-")
.append("com.azure.resourcemanager.hdinsight.containers")
.append("/")
.append("1.0.0-beta.3");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (").append(Configuration.getGlobalConfiguration().get("java.version"))
.append("; ").append(Configuration.getGlobalConfiguration().get("os.name")).append("; ")
.append(Configuration.getGlobalConfiguration().get("os.version")).append("; auto-generated)");
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
.append("; ")
.append(Configuration.getGlobalConfiguration().get("os.name"))
.append("; ")
.append(Configuration.getGlobalConfiguration().get("os.version"))
.append("; auto-generated)");
} else {
userAgentBuilder.append(" (auto-generated)");
}
Expand All @@ -255,18 +276,21 @@ public HDInsightContainersManager authenticate(TokenCredential credential, Azure
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new AddHeadersFromContextPolicy());
policies.add(new RequestIdPolicy());
policies.addAll(this.policies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
.collect(Collectors.toList()));
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY).collect(Collectors.toList()));
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.collect(Collectors.toList()));
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient)
.policies(policies.toArray(new HttpPipelinePolicy[0])).build();
.policies(policies.toArray(new HttpPipelinePolicy[0]))
.build();
return new HDInsightContainersManager(httpPipeline, profile, defaultPollInterval);
}
}
Expand Down Expand Up @@ -296,6 +320,19 @@ public ClusterPoolAvailableUpgrades clusterPoolAvailableUpgrades() {
return clusterPoolAvailableUpgrades;
}

/**
* Gets the resource collection API of ClusterPoolUpgradeHistories.
*
* @return Resource collection API of ClusterPoolUpgradeHistories.
*/
public ClusterPoolUpgradeHistories clusterPoolUpgradeHistories() {
if (this.clusterPoolUpgradeHistories == null) {
this.clusterPoolUpgradeHistories
= new ClusterPoolUpgradeHistoriesImpl(clientObject.getClusterPoolUpgradeHistories(), this);
}
return clusterPoolUpgradeHistories;
}

/**
* Gets the resource collection API of Clusters. It manages Cluster.
*
Expand All @@ -321,6 +358,19 @@ public ClusterAvailableUpgrades clusterAvailableUpgrades() {
return clusterAvailableUpgrades;
}

/**
* Gets the resource collection API of ClusterUpgradeHistories.
*
* @return Resource collection API of ClusterUpgradeHistories.
*/
public ClusterUpgradeHistories clusterUpgradeHistories() {
if (this.clusterUpgradeHistories == null) {
this.clusterUpgradeHistories
= new ClusterUpgradeHistoriesImpl(clientObject.getClusterUpgradeHistories(), this);
}
return clusterUpgradeHistories;
}

/**
* Gets the resource collection API of ClusterJobs.
*
Expand Down Expand Up @@ -383,6 +433,18 @@ public AvailableClusterVersions availableClusterVersions() {
return availableClusterVersions;
}

/**
* Gets the resource collection API of ClusterLibraries.
*
* @return Resource collection API of ClusterLibraries.
*/
public ClusterLibraries clusterLibraries() {
if (this.clusterLibraries == null) {
this.clusterLibraries = new ClusterLibrariesImpl(clientObject.getClusterLibraries(), this);
}
return clusterLibraries;
}

/**
* Gets wrapped service client HDInsightContainersManagementClient providing direct access to the underlying
* auto-generated API implementation, based on Azure REST API.
Expand Down
Loading