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

mgmt, appservice redegisn #14890

Merged

Conversation

weidongxu-microsoft
Copy link
Member

@weidongxu-microsoft weidongxu-microsoft commented Sep 8, 2020

Comment on lines 18 to 37
public class BatchDeletionImpl {

@SuppressWarnings({"unchecked", "rawtypes"})
public static Flux<String> deleteByIdsAsync(Collection<String> ids,
BiFunction<String, String, Mono<Void>> deleteByIdAsync) {
if (ids == null || ids.isEmpty()) {
return Flux.empty();
}

Collection<Mono<String>> observables = new ArrayList<>();
for (String id : ids) {
final String resourceGroupName = ResourceUtils.groupFromResourceId(id);
final String name = ResourceUtils.nameFromResourceId(id);
Mono<String> o = ReactorMapper.map(deleteByIdAsync.apply(resourceGroupName, name), id);
observables.add(o);
}

return Flux.mergeDelayError(32, observables.toArray(new Mono[0]));
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Added to reduce duplicate code. Plan to move same code from a few other classes to use this as well.

@weidongxu-microsoft weidongxu-microsoft marked this pull request as ready for review September 8, 2020 05:49
}
}
this.webSiteBase = new WebSiteBaseImpl(inner());
this.hostNameSslStateMap = new HashMap<>(this.webSiteBase.hostnameSslStates());
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this property remains?

Copy link
Member Author

Choose a reason for hiding this comment

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

In Update flow, code changes the Map to add new items.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then should we just use it to save the update items?

Copy link
Member Author

@weidongxu-microsoft weidongxu-microsoft Sep 8, 2020

Choose a reason for hiding this comment

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

Yes. Hence I keep it there. I.e., WebSiteBase init the variable (instead of previous code in this method), then logic remains same as before.

.flatMapDelayError(id -> {
final String resourceGroupName = ResourceUtils.groupFromResourceId(id);
final String name = ResourceUtils.nameFromResourceId(id);
return ReactorMapper.map(deleteByIdAsync.apply(resourceGroupName, name), id);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the deleteByIdAsync should take one string id rather than two strings (some resource will need more).

Copy link
Member Author

@weidongxu-microsoft weidongxu-microsoft Sep 8, 2020

Choose a reason for hiding this comment

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

We can easily overload it with same name, and take Function<String, Mono<Void>> for this case (I actually wrote this signature first, then changed it since most case it is resourceGroupName+name).

@@ -124,4 +134,48 @@ public FunctionAppImpl define(String name) {
public Mono<Void> deleteByResourceGroupAsync(String groupName, String name) {
return this.inner().deleteAsync(groupName, name);
}

@Override
public Flux<String> deleteByIdsAsync(Collection<String> ids) {
Copy link
Contributor

Choose a reason for hiding this comment

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

For delete operations, do the users need Flux as return type?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is a list of IDs that got deleted. As method with DelayError, error will be after Flux of IDs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. So users would get IDs returned, which are success deletion, and errors if applicable returned after all completed.

}

@Override
public Mono<FunctionApp> refreshAsync() {
Copy link
Member

Choose a reason for hiding this comment

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

just curious, why name it refresh on a get call?

Copy link
Member Author

@weidongxu-microsoft weidongxu-microsoft Sep 11, 2020

Choose a reason for hiding this comment

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

To make it like other common resource instance, e.g.FunctionApp, which implement a Refreshable<FunctionApp> https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/model/Refreshable.java, which refresh() method updates itself and return a FunctionApp instance (actually just this).

And here FunctionAppBasic has same refresh() method to update itself, and return a more complete FunctionApp instance.

@weidongxu-microsoft weidongxu-microsoft merged commit 0e694ed into Azure:master Sep 11, 2020
@weidongxu-microsoft weidongxu-microsoft deleted the mgmt_appservice-redegisn branch September 11, 2020 02:05
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-java that referenced this pull request Jun 21, 2021
add track 2 information to authorization RP (Azure#14890)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE REQ] investigate re-design on WebApp/FunctionApp list
4 participants