The runtime libraries for AutoRest generated Java clients.
Перейти к файлу
Weidong Xu 4d645daa59
Merge pull request #719 from weidongxu-microsoft/readme-discourage-use
update readme to recommend libs on azure-sdk-for-java
2024-04-19 09:11:04 +08:00
azure-android-client-authentication Enabled license header check in check style 2017-02-08 15:27:49 -08:00
azure-arm-client-runtime [maven-release-plugin] prepare for next development iteration 2021-08-09 21:28:57 -07:00
azure-client-authentication [maven-release-plugin] prepare for next development iteration 2021-08-09 21:28:57 -07:00
azure-client-runtime Handle cases where `ExpressionEvaluationDetails#targetValue` is not an array 2022-02-21 15:56:15 +01:00
build-tools [maven-release-plugin] prepare for next development iteration 2021-08-09 21:28:57 -07:00
client-runtime [maven-release-plugin] prepare for next development iteration 2021-08-09 21:28:57 -07:00
.gitignore Add support of LRO for postOrDelete. (#636) 2019-10-07 16:15:48 -07:00
.travis.yml Remove subtree checks in travis 2016-07-22 17:04:43 -07:00
ChangeLog.txt Update change log and readme 2018-02-01 14:22:00 -08:00
LICENSE Initial commit 2016-04-15 18:01:29 -07:00
README.md update 2024-04-18 13:44:16 +08:00
SECURITY.md Microsoft mandatory file 2022-10-18 18:17:55 +00:00
bundler.properties Removing exclude from bundler.properties 2019-04-17 18:12:36 -07:00
pom.xml [maven-release-plugin] prepare for next development iteration 2021-08-09 21:28:57 -07:00

README.md

It is highly recommended to use the new Azure SDK for Java

The AutoRest Client Runtime for Java library was used as a dependency of older Azure client libraries.

If you find that this library is included in dependencies though another Azure client library, please see whether there is new Azure client library available here.

If you are directly using this library, please consider using new azure-core libraries, or azure-identity libraries.

AutoRest Client Runtime for Java

The runtime libraries for AutoRest generated Java clients.

Usage

Prerequisites

  • JDK 1.7

Download

<dependency>
  <groupId>com.microsoft.rest</groupId>
  <artifactId>client-runtime</artifactId>
  <version>1.7.13</version>
</dependency>

<dependency>
  <groupId>com.microsoft.azure</groupId>
  <artifactId>azure-client-runtime</artifactId>
  <version>1.7.13</version>
</dependency>

<dependency>
  <groupId>com.microsoft.azure</groupId>
  <artifactId>azure-client-authentication</artifactId>
  <version>1.7.13</version>
</dependency>

Create a RestClient

// For Java generator
RestClient simpleClient = new RestClient.Builder()
    .withBaseUrl("http://localhost")
    .withResponseBuilderFactory(new ServiceResponseBuilder.Factory())
  	.withSerializerAdapter(new JacksonAdapter())
  	.build();
AutoRestJavaClient client1 = new AutoRestJavaClientImpl(simpleClient);

// For Azure.Java generator
RestClient azureClient = new RestClient.Builder()
    .withBaseUrl(AzureEnvironment.Azure, Endpoint.RESOURCE_MANAGER)
    .withResponseBuilderFactory(new AzureResponseBuilder.Factory())
  	.withSerializerAdapter(new AzureJacksonAdapter())
    .withCredentials(AzureCliCredentials.create())
  	.build();
FooServiceClient client2 = new FooServiceClientImpl(azureClient);

// For Azure SDK users
Azure azure = Azure.authenticate(azureClient).withDefaultSubscription();

Components

client-runtime

This is the generic runtime. Add this package as a dependency if you are using Java generator in AutoRest. This package depends on Retrofit, OkHttp, Jackson, RxJava for making and processing REST requests.

azure-client-runtime

This is the runtime with Azure specific customizations. Add this package as a dependency if you are using Azure.Java or Azure.Java.Fluent generator in AutoRest.

This combination provides a set of Azure specific behaviors, including long running operations, special handling of HEAD operations, and paginated list() calls.

azure-client-authentication (beta)

This package provides access to Active Directory authentication on JDK using OrgId or application ID / secret combinations. There are currently 3 types of authentication provided:

  • Service principal authentication: ApplicationTokenCredentials
  • Username / password login without multi-factor auth: UserTokenCredentials
  • Use the credentials logged in Azure CLI: AzureCliCredentials

azure-android-client-authentication (beta)

This package provides access to Active Directory authentication on Android. You can login with Microsoft accounts, OrgId, with or without multi-factor auth.

Build

To build this repository, you will need maven 2.0+ and gradle 1.6+. Maven is used for Java SDK when it's used as a submodule in there. Gradle is used for AutoRest when it's used as a submodule in there.

Contributing

This repository is for runtime & authentication specifically. For issues in the generated code, please report in AutoRest. For bugs in the Azure SDK, please report in Azure SDK for Java. If you are unsure, please file here and state that clearly in the issue. Pull requests are welcomed with clear Javadocs.