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

Add Azure DevCenter SDK #31300

Merged

Conversation

chrissmiller
Copy link
Contributor

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:

  • The pull request does not introduce [breaking changes] (N/A, new service)
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@azure-sdk
Copy link
Collaborator

API change check

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

azure-developer-devcenter

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Oct 13, 2022

I am basically good with the PR.

Wait one or two days on @haolingdong-msft 's input, and Alan's input on DELETE LRO.

sdk/devcenter/azure-developer-devcenter/CHANGELOG.md Outdated Show resolved Hide resolved
sdk/devcenter/azure-developer-devcenter/README.md Outdated Show resolved Hide resolved
sdk/devcenter/azure-developer-devcenter/pom.xml Outdated Show resolved Hide resolved
sdk/devcenter/azure-developer-devcenter/pom.xml Outdated 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");
Copy link
Member

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.

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;
Copy link
Member

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.");
}

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);
Copy link
Member

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

Choose a reason for hiding this comment

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

Comment on lines +275 to +280
if (httpLogOptions == null) {
httpLogOptions = new HttpLogOptions();
}
if (clientOptions == null) {
clientOptions = new ClientOptions();
}
Copy link
Member

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

Choose a reason for hiding this comment

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

Azure/autorest.java#1768

Yeah, these are ancient code that I've not really pay attention when reviewing. Thx for pointing out.

Comment on lines +293 to +296
policies.addAll(
this.pipelinePolicies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
.collect(Collectors.toList()));
Copy link
Member

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));

Choose a reason for hiding this comment

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

@weidongxu-microsoft
Copy link
Member

weidongxu-microsoft commented Oct 14, 2022

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.
Also please solve the conflict.

sdk/devcenter/azure-developer-devcenter/pom.xml Outdated 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");

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;

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);

Choose a reason for hiding this comment

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

Comment on lines +293 to +296
policies.addAll(
this.pipelinePolicies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
.collect(Collectors.toList()));

Choose a reason for hiding this comment

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

Comment on lines +275 to +280
if (httpLogOptions == null) {
httpLogOptions = new HttpLogOptions();
}
if (clientOptions == null) {
clientOptions = new ClientOptions();
}

Choose a reason for hiding this comment

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

Azure/autorest.java#1768

Yeah, these are ancient code that I've not really pay attention when reviewing. Thx for pointing out.

@weidongxu-microsoft
Copy link
Member

/azp run java - devcenter - ci

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@weidongxu-microsoft weidongxu-microsoft merged commit 759494f into Azure:main Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants