Azure / Azure/azure-sdk-for-java

[FEATURE REQ] azure-core-v2 for mgmt SDK

Open
#44,264 4 comments 0 reactions 1 assignee Claimed by @XiaofeiCao View on GitHub
ARM ARM - Core Azure.Core.V2 Mgmt
Dominant language
Java
Stars
2.6k
Forks
2.2k
Avg merge
2d 8h
Merged PRs (30d)
178

Description

# Gaps
## azure-core-management-v2
1. [Resource](https://github.com/Azure/azure-sdk-for-java/blob/8ddf6da837a50543dfcb689887fdd6b1dcf0f8cf/sdk/core/azure-core-management/src/main/java/com/azure/core/management/Resource.java#L18)/[ProxyResource](https://github.com/Azure/azure-sdk-for-java/blob/8ddf6da837a50543dfcb689887fdd6b1dcf0f8cf/sdk/core/azure-core-management/src/main/java/com/azure/core/management/ProxyResource.java#L18)/[ManagementError](https://github.com/Azure/azure-sdk-for-java/blob/8ddf6da837a50543dfcb689887fdd6b1dcf0f8cf/sdk/core/azure-core-management/src/main/java/com/azure/core/management/exception/ManagementError.java#L20)
They are parent classes for resource and management errors. Do we still need them in the new v2?
Their properties are shadowed in child classes anyway for azure-json deserialization.
Another use case be type restriction for premium interfaces. Do we need premium interfaces/libs anymore? How about azure-resourcemanager-authorization and azure-resourcemanager-resources?
Guess we could leave these classes out before conclusions are made. Read-only properties are shadowed, and writable properties can be moved upwards to parent classes, which hopefully won't cause breaking changes.
2. [SystemData](https://github.com/Azure/azure-sdk-for-java/blob/8ddf6da837a50543dfcb689887fdd6b1dcf0f8cf/sdk/core/azure-core-management/src/main/java/com/azure/core/management/exception/ManagementError.java#L20)/[AdditionalInfo](https://github.com/Azure/azure-sdk-for-java/blob/8ddf6da837a50543dfcb689887fdd6b1dcf0f8cf/sdk/core/azure-core-management/src/main/java/com/azure/core/management/exception/AdditionalInfo.java#L20)/etc
They are common properties for resources and management errors. We probably still need them to avoid unnecessary additional classes.
3. LRO related. `PollerFactory`, `SyncPoller`, etc.
4. `AzureEnvironment`(`AzureCloud` endpoint mapping), `AzureProfile`, etc.
5. (02/20/2025) Introduce new ManagedIdentity classes

## azure-core-v2
1. No [`@Headers`](https://github.com/XiaofeiCao/typespec/blob/015aadac79e4d1e1c6a0159b924e8846e5e60bd5/packages/http-client-java/generator/http-client-generator-test/src/main/java/tsptest/armstreamstyleserialization/implementation/FishesClientImpl.java#L74) for setting Content-Type for `GET` methods. Does that mean we need to add header parameter in proxy method?
2. ~~`AzureCloud`~~ fixed by https://github.com/Azure/azure-sdk-for-java/pull/44301
3. TokenCredential and BearerTokenAuthenticationPolicy. issue: https://github.com/microsoft/typespec/issues/5910
4. ~~LRO related: `@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)`~~ fixed by https://github.com/Azure/azure-sdk-for-java/pull/44670
5. Model `Azure-AsyncOperation` response body. See [Azure-AsyncOperation Resource format](https://github.com/cloud-and-ai-microsoft/resource-provider-contract/blob/master/v1.0/async-api-reference.md#azure-asyncoperation-resource-format).

## codegen
1. Generate only sync-stack methods(asked Sandeep to contact customer when there's beta release for core-v2).
2. Use `ClassType` instead of Class imports in codegen: https://github.com/microsoft/typespec/blob/9f41c06bf265fd0e0a7cde241cf57d4944355252/packages/http-client-java/generator/http-client-generator-mgmt/src/main/java/com/microsoft/typespec/http/client/generator/mgmt/template/FluentManagerTemplate.java#L91
3. Seems now there's no proxy/client methods with `Context` override. Need to generate them. (02/20/2025, use `RequestContext` instead)
4. New class mapping: a. SimpleResponse -> Response
b. CoreUtils (02/20/2025 No CoreUtils anymore, use direct implementation instead)
5. TokenCredential
6. No strongly typed header Response as `ResponseBase`. https://github.com/Azure/azure-sdk-for-java/issues/42640
7. Model `Azure-AsyncOperation` response body, and return `SyncPoller` for POST operations or operations with only `Azure-AsyncOperation` header.

## Premium libraries migration
If we still provide premium libraries support, for backward compatibility, we need to investigate on the migration effort. This will probably take months.
### 1. Resource creation dependency graph
Previously we use `TaskGroup` for resource creation dependencies. E.g. create Network/Storage before creating VM.
Concurrent task execution uses Reactor model. If we support only sync-stack, we either do
1. For simplicity, remove `TaskGroup` and execute in a sequential fashion. Though this will hurt performance.
2. Rewrite task execution using new thread model. We have some edge cases, and need to investigate on the effort.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.