-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add Azure DevCenter SDK #31300
Add Azure DevCenter SDK #31300
Conversation
API change check APIView has identified API level changes in this PR and created following API reviews. |
…smiller/azure-sdk-for-java into chrismiller/devcenter-java
...devcenter/src/samples/java/com/azure/developer/devcenter/generated/DevBoxesCreateDevBox.java
Show resolved
Hide resolved
...er/azure-developer-devcenter/src/main/java/com/azure/developer/devcenter/DevBoxesClient.java
Show resolved
Hide resolved
...er/azure-developer-devcenter/src/main/java/com/azure/developer/devcenter/DevBoxesClient.java
Show resolved
Hide resolved
I am basically good with the PR. Wait one or two days on @haolingdong-msft 's input, and Alan's input on DELETE LRO. |
@Generated private static final String[] DEFAULT_SCOPES = new String[] {"https://devcenter.azure.com/.default"}; | ||
|
||
@Generated | ||
private final Map<String, String> properties = CoreUtils.getProperties("azure-developer-devcenter.properties"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For @weidongxu-microsoft, we should make this static as the resource shouldn't change during runtime and doesn't need to be parsed every time constructing a builder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Generated | ||
@Override | ||
public EnvironmentsClientBuilder pipeline(HttpPipeline pipeline) { | ||
this.pipeline = pipeline; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For @weidongxu-microsoft, for pipeline
and httpClient
we should update this to copy what the hand-written builders do with logging a debug message if the HttpPipeline, or HttpClient, is set to null after being configured as there is a chance that it is a bug in user code:
if (this.pipeline != null && pipeline == null) {
logger.info("HttpPipeline is being set to 'null' when it was previously configured.");
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Generated | ||
@Override | ||
public EnvironmentsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { | ||
pipelinePolicies.add(customPolicy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For @weidongxu-microsoft, customPolicy
needs to be checked for being non-null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (httpLogOptions == null) { | ||
httpLogOptions = new HttpLogOptions(); | ||
} | ||
if (clientOptions == null) { | ||
clientOptions = new ClientOptions(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For @weidongxu-microsoft, these should be updated to use local variables instead of mutating the builder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, these are ancient code that I've not really pay attention when reviewing. Thx for pointing out.
policies.addAll( | ||
this.pipelinePolicies.stream() | ||
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) | ||
.collect(Collectors.toList())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For @weidongxu-microsoft, minor nit as I've seen this elsewhere in generated code, we can flip this to something more performant. Right now, this will create a List to be used by addAll
which many times converts the list back to an array. In the builder this won't be too bad as there is lower usage and it's not a hot path but in other places it could be:
this.pipelinePolicies().stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
.forEach(p -> policies.add(p));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Alan Zimmer <[email protected]>
Great thanks for Alan's detailed review. I've logged the codegen issues. I will let Shanghai team to pick them up as these are relatively simple to fix. We should be able to complete them before Nov. and DevCenter's GA version should be without these issues. Chris, please check Alan's feedback on doc, and see if it can be improved. |
...rc/test/java/com/azure/developer/devcenter/generated/EnvironmentsUpdateEnvironmentTests.java
Show resolved
Hide resolved
@Generated private static final String[] DEFAULT_SCOPES = new String[] {"https://devcenter.azure.com/.default"}; | ||
|
||
@Generated | ||
private final Map<String, String> properties = CoreUtils.getProperties("azure-developer-devcenter.properties"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Generated | ||
@Override | ||
public EnvironmentsClientBuilder pipeline(HttpPipeline pipeline) { | ||
this.pipeline = pipeline; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Generated | ||
@Override | ||
public EnvironmentsClientBuilder addPolicy(HttpPipelinePolicy customPolicy) { | ||
pipelinePolicies.add(customPolicy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
policies.addAll( | ||
this.pipelinePolicies.stream() | ||
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) | ||
.collect(Collectors.toList())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (httpLogOptions == null) { | ||
httpLogOptions = new HttpLogOptions(); | ||
} | ||
if (clientOptions == null) { | ||
clientOptions = new ClientOptions(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, these are ancient code that I've not really pay attention when reviewing. Thx for pointing out.
...er/azure-developer-devcenter/src/main/java/com/azure/developer/devcenter/DevBoxesClient.java
Show resolved
Hide resolved
/azp run java - devcenter - ci |
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Please add an informative description that covers that changes made by the pull request and link all relevant issues.
Adds the initial public preview SDK for the Azure DevCenter service.
Azure/azure-sdk#4702
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines