-
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
mgmt, appservice redegisn #14890
mgmt, appservice redegisn #14890
Conversation
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])); | ||
} | ||
} |
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.
Added to reduce duplicate code. Plan to move same code from a few other classes to use this as well.
} | ||
} | ||
this.webSiteBase = new WebSiteBaseImpl(inner()); | ||
this.hostNameSslStateMap = new HashMap<>(this.webSiteBase.hostnameSslStates()); |
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.
Why this property remains?
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.
In Update flow, code changes the Map to add new items.
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.
Then should we just use it to save the update items?
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.
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.
...ppservice/src/main/java/com/azure/resourcemanager/appservice/implementation/WebAppsImpl.java
Outdated
Show resolved
Hide resolved
.flatMapDelayError(id -> { | ||
final String resourceGroupName = ResourceUtils.groupFromResourceId(id); | ||
final String name = ResourceUtils.nameFromResourceId(id); | ||
return ReactorMapper.map(deleteByIdAsync.apply(resourceGroupName, name), id); |
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.
I think the deleteByIdAsync should take one string id
rather than two strings (some resource will need more).
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.
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) { |
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 delete operations, do the users need Flux as return type?
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.
I think this is a list of IDs that got deleted. As method with DelayError
, error will be after Flux of IDs.
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.
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() { |
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.
just curious, why name it refresh on a get call?
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.
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.
add track 2 information to authorization RP (Azure#14890)
fix Azure/azure-libraries-for-java#1246