use of rx.functions.Func3 in project azure-sdk-for-java by Azure.
the class CdnEndpointImpl method updateAsync.
@Override
public Observable<CdnEndpoint> updateAsync() {
final CdnEndpointImpl self = this;
EndpointUpdateParametersInner updateInner = new EndpointUpdateParametersInner();
updateInner.withIsHttpAllowed(this.inner().isHttpAllowed()).withIsHttpsAllowed(this.inner().isHttpsAllowed()).withOriginPath(this.inner().originPath()).withOriginHostHeader(this.inner().originHostHeader()).withIsCompressionEnabled(this.inner().isCompressionEnabled()).withContentTypesToCompress(this.inner().contentTypesToCompress()).withGeoFilters(this.inner().geoFilters()).withOptimizationType(this.inner().optimizationType()).withQueryStringCachingBehavior(this.inner().queryStringCachingBehavior()).withTags(this.inner().getTags());
DeepCreatedOrigin originInner = this.inner().origins().get(0);
OriginUpdateParametersInner originParameters = new OriginUpdateParametersInner().withHostName(originInner.hostName()).withHttpPort(originInner.httpPort()).withHttpsPort(originInner.httpsPort());
Observable<OriginInner> originObservable = this.parent().manager().inner().origins().updateAsync(this.parent().resourceGroupName(), this.parent().name(), this.name(), originInner.name(), originParameters);
Observable<CdnEndpoint> endpointObservable = this.parent().manager().inner().endpoints().updateAsync(this.parent().resourceGroupName(), this.parent().name(), this.name(), updateInner).map(new Func1<EndpointInner, CdnEndpoint>() {
@Override
public CdnEndpoint call(EndpointInner inner) {
self.setInner(inner);
return self;
}
});
List<Observable<CustomDomainInner>> customDomainDeleteObservables = new ArrayList<>();
for (CustomDomainInner itemToDelete : this.deletedCustomDomainList) {
customDomainDeleteObservables.add(this.parent().manager().inner().customDomains().deleteAsync(this.parent().resourceGroupName(), this.parent().name(), this.name(), itemToDelete.name()));
}
Observable<CustomDomainInner> deleteObservable = Observable.zip(customDomainDeleteObservables, new FuncN<CustomDomainInner>() {
@Override
public CustomDomainInner call(Object... objects) {
return null;
}
});
return Observable.zip(originObservable, endpointObservable, deleteObservable, new Func3<OriginInner, CdnEndpoint, CustomDomainInner, CdnEndpoint>() {
@Override
public CdnEndpoint call(OriginInner originInner, CdnEndpoint cdnEndpoint, CustomDomainInner customDomain) {
return cdnEndpoint;
}
}).doOnNext(new Action1<CdnEndpoint>() {
@Override
public void call(CdnEndpoint cdnEndpoint) {
self.deletedCustomDomainList.clear();
}
});
}
Aggregations