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

Azure-Core Migration Recipes #44494

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft

Conversation

jairmyree
Copy link
Member

This PR contains the migration recipes and test for the migration of azure-core to clientcore and azure-core-v2.

@github-actions github-actions bot added the Azure SDK Tools Label for tracking issues related to Azure SDK Tools label Mar 4, 2025
@azure-sdk
Copy link
Collaborator

API change check

APIView has identified API level changes in this PR and created following API reviews.

com.azure:azure-openrewrite


public class HttpRequestExample {
public static void main(String... args) {
HttpClient client = new JdkHttpClientBuilder().build();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't right - we shouldn't be changing the customer code from using Netty to using JdkHttpClient

Comment on lines +15 to +20
try {
Response response = client.send(request);
System.out.println("Status code: " + response.getStatusCode());
} catch (IOException e) {
System.err.println("Error occurred: " + e.getMessage());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the try / catch required in vNext?

Comment on lines +14 to +15
HttpHeaders headers = new HttpHeaders();
headers.add(HttpHeaderName.CONTENT_TYPE, "multipart/form-data");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should follow the same pattern as before - HttpHeaders headers = new HttpHeaders().set("Content-Type", "multipart/form-data");

String jsonBody = "{\"key\":\"value\"}";
HttpRequest request = new HttpRequest(HttpMethod.PUT, "https://example.com", headers, jsonBody);

HttpResponse response = client.send(request).block();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These samples are using the async pipeline and blocking. You'll want to make sure you also support the scenario where the sync pipeline was used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure SDK Tools Label for tracking issues related to Azure SDK Tools OpenRewrite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants