rx.functions.Func1 Java Examples
The following examples show how to use
rx.functions.Func1.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SyncAgentsInner.java From azure-libraries-for-java with MIT License | 6 votes |
/** * Lists sync agents in a server. * ServiceResponse<PageImpl1<SyncAgentInner>> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. ServiceResponse<PageImpl1<SyncAgentInner>> * @param serverName The name of the server on which the sync agent is hosted. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<SyncAgentInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<SyncAgentInner>>> listByServerSinglePageAsync(final String resourceGroupName, final String serverName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (serverName == null) { throw new IllegalArgumentException("Parameter serverName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2015-05-01-preview"; return service.listByServer(resourceGroupName, serverName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SyncAgentInner>>>>() { @Override public Observable<ServiceResponse<Page<SyncAgentInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl1<SyncAgentInner>> result = listByServerDelegate(response); return Observable.just(new ServiceResponse<Page<SyncAgentInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #2
Source File: ManagedDatabasesInner.java From azure-libraries-for-java with MIT License | 6 votes |
/** * Gets a list of managed databases. * ServiceResponse<PageImpl1<ManagedDatabaseInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ManagedDatabaseInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<ManagedDatabaseInner>>> listByInstanceNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } String nextUrl = String.format("%s", nextPageLink); return service.listByInstanceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ManagedDatabaseInner>>>>() { @Override public Observable<ServiceResponse<Page<ManagedDatabaseInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl1<ManagedDatabaseInner>> result = listByInstanceNextDelegate(response); return Observable.just(new ServiceResponse<Page<ManagedDatabaseInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #3
Source File: ProvidersInner.java From azure-libraries-for-java with MIT License | 6 votes |
/** * Gets all resource providers for a subscription. * ServiceResponse<PageImpl<ProviderInner>> * @param top The number of results to return. If null is passed returns all deployments. ServiceResponse<PageImpl<ProviderInner>> * @param expand The properties to include in the results. For example, use &$expand=metadata in the query string to retrieve resource provider metadata. To include property aliases in response, use $expand=resourceTypes/aliases. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ProviderInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<ProviderInner>>> listSinglePageAsync(final Integer top, final String expand) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.list(this.client.subscriptionId(), top, expand, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ProviderInner>>>>() { @Override public Observable<ServiceResponse<Page<ProviderInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<ProviderInner>> result = listDelegate(response); return Observable.just(new ServiceResponse<Page<ProviderInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #4
Source File: Backpressure.java From rtree-3d with Apache License 2.0 | 6 votes |
private static <S extends Geometry, T> ImmutableStack<NodePosition<T, S>> searchAndReturnStack( final Func1<? super Geometry, Boolean> condition, final Subscriber<? super Entry<T, S>> subscriber, StackAndRequest<NodePosition<T, S>> state) { while (!state.stack.isEmpty()) { NodePosition<T, S> np = state.stack.peek(); if (subscriber.isUnsubscribed()) return ImmutableStack.empty(); else if (state.request <= 0) return state.stack; else if (np.position() == np.node().count()) { // handle after last in node state = StackAndRequest.create(searchAfterLastInNode(state.stack), state.request); } else if (np.node() instanceof NonLeaf) { // handle non-leaf state = StackAndRequest.create(searchNonLeaf(condition, state.stack, np), state.request); } else { // handle leaf state = searchLeaf(condition, subscriber, state, np); } } return state.stack; }
Example #5
Source File: ContainerServicesInner.java From azure-libraries-for-java with MIT License | 6 votes |
/** * Gets a list of container services in the specified subscription. * Gets a list of container services in the specified subscription. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ContainerServiceInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<ContainerServiceInner>>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2017-01-31"; return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ContainerServiceInner>>>>() { @Override public Observable<ServiceResponse<Page<ContainerServiceInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl1<ContainerServiceInner>> result = listDelegate(response); return Observable.just(new ServiceResponse<Page<ContainerServiceInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #6
Source File: WebApplicationFirewallPoliciesInner.java From azure-libraries-for-java with MIT License | 6 votes |
/** * Lists all of the protection policies within a resource group. * ServiceResponse<PageImpl<WebApplicationFirewallPolicyInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<WebApplicationFirewallPolicyInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<WebApplicationFirewallPolicyInner>>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } String nextUrl = String.format("%s", nextPageLink); return service.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<WebApplicationFirewallPolicyInner>>>>() { @Override public Observable<ServiceResponse<Page<WebApplicationFirewallPolicyInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<WebApplicationFirewallPolicyInner>> result = listByResourceGroupNextDelegate(response); return Observable.just(new ServiceResponse<Page<WebApplicationFirewallPolicyInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #7
Source File: GalleryApplicationsInner.java From azure-libraries-for-java with MIT License | 6 votes |
/** * List gallery Application Definitions in a gallery. * ServiceResponse<PageImpl1<GalleryApplicationInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<GalleryApplicationInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<GalleryApplicationInner>>> listByGalleryNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); } String nextUrl = String.format("%s", nextPageLink); return service.listByGalleryNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<GalleryApplicationInner>>>>() { @Override public Observable<ServiceResponse<Page<GalleryApplicationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl1<GalleryApplicationInner>> result = listByGalleryNextDelegate(response); return Observable.just(new ServiceResponse<Page<GalleryApplicationInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #8
Source File: OperationsInner.java From azure-libraries-for-java with MIT License | 6 votes |
/** * Lists all of the available Cosmos DB Resource Provider operations. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<OperationInner>>> listSinglePageAsync() { final String apiVersion = "2019-08-01"; return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<OperationInner>>>>() { @Override public Observable<ServiceResponse<Page<OperationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl1<OperationInner>> result = listDelegate(response); return Observable.just(new ServiceResponse<Page<OperationInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #9
Source File: OperationsInner.java From azure-libraries-for-java with MIT License | 6 votes |
/** * Lists available operations for the Microsoft.BatchAI provider. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<OperationInner>>> listSinglePageAsync() { if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<OperationInner>>>>() { @Override public Observable<ServiceResponse<Page<OperationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<OperationInner>> result = listDelegate(response); return Observable.just(new ServiceResponse<Page<OperationInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #10
Source File: HostNameSslBindingImpl.java From azure-libraries-for-java with MIT License | 6 votes |
@Override public HostNameSslBindingImpl<FluentT, FluentImplT> withExistingKeyVault(final Vault vault) { Observable<AppServiceCertificateOrder> appServiceCertificateOrderObservable = Utils.rootResource(certificateInDefinition .withExistingKeyVault(vault) .createAsync()); final AppServiceManager manager = this.parent().manager(); this.newCertificate = appServiceCertificateOrderObservable .flatMap(new Func1<AppServiceCertificateOrder, Observable<AppServiceCertificate>>() { @Override public Observable<AppServiceCertificate> call(AppServiceCertificateOrder appServiceCertificateOrder) { return Utils.rootResource(manager.certificates().define(appServiceCertificateOrder.name()) .withRegion(parent().regionName()) .withExistingResourceGroup(parent().resourceGroupName()) .withExistingCertificateOrder(appServiceCertificateOrder) .createAsync()); } }); return this; }
Example #11
Source File: WebSiteManagementClientImpl.java From azure-libraries-for-java with MIT License | 6 votes |
/** * List all apps that are assigned to a hostname. * Description for List all apps that are assigned to a hostname. * ServiceResponse<PageImpl<IdentifierInner>> * @param name Name of the object. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<IdentifierInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<IdentifierInner>>> listSiteIdentifiersAssignedToHostNameSinglePageAsync(final String name) { if (this.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); } if (this.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); } NameIdentifierInner nameIdentifier = new NameIdentifierInner(); nameIdentifier.withName(name); return service.listSiteIdentifiersAssignedToHostName(this.subscriptionId(), this.apiVersion(), this.acceptLanguage(), nameIdentifier, this.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<IdentifierInner>>>>() { @Override public Observable<ServiceResponse<Page<IdentifierInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<IdentifierInner>> result = listSiteIdentifiersAssignedToHostNameDelegate(response); return Observable.just(new ServiceResponse<Page<IdentifierInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #12
Source File: PublicIPPrefixesInner.java From azure-libraries-for-java with MIT License | 6 votes |
/** * Gets all the public IP prefixes in a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<PublicIPPrefixInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2019-11-01"; return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<PublicIPPrefixInner>>>>() { @Override public Observable<ServiceResponse<Page<PublicIPPrefixInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<PublicIPPrefixInner>> result = listDelegate(response); return Observable.just(new ServiceResponse<Page<PublicIPPrefixInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #13
Source File: TasksInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Returns a task with extended information that includes all secrets. * * @param resourceGroupName The name of the resource group to which the container registry belongs. * @param registryName The name of the container registry. * @param taskName The name of the container registry task. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the TaskInner object */ public Observable<ServiceResponse<TaskInner>> getDetailsWithServiceResponseAsync(String resourceGroupName, String registryName, String taskName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (registryName == null) { throw new IllegalArgumentException("Parameter registryName is required and cannot be null."); } if (taskName == null) { throw new IllegalArgumentException("Parameter taskName is required and cannot be null."); } final String apiVersion = "2018-09-01"; return service.getDetails(this.client.subscriptionId(), resourceGroupName, registryName, taskName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<TaskInner>>>() { @Override public Observable<ServiceResponse<TaskInner>> call(Response<ResponseBody> response) { try { ServiceResponse<TaskInner> clientResponse = getDetailsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #14
Source File: ManagedInstancesInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Creates or updates a managed instance. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. * @param parameters The requested managed instance resource state. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the ManagedInstanceInner object */ public Observable<ServiceResponse<ManagedInstanceInner>> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (managedInstanceName == null) { throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); final String apiVersion = "2018-06-01-preview"; return service.beginCreateOrUpdate(resourceGroupName, managedInstanceName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ManagedInstanceInner>>>() { @Override public Observable<ServiceResponse<ManagedInstanceInner>> call(Response<ResponseBody> response) { try { ServiceResponse<ManagedInstanceInner> clientResponse = beginCreateOrUpdateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #15
Source File: PolicyDefinitionsInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Gets all the policy definitions for a subscription. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<List<PolicyDefinitionInner>> listAsync(final ListOperationCallback<PolicyDefinitionInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listSinglePageAsync(), new Func1<String, Observable<ServiceResponse<Page<PolicyDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<PolicyDefinitionInner>>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); }
Example #16
Source File: FavoritesAdapter.java From FakeWeather with Apache License 2.0 | 5 votes |
private void setFavorite(FavoritesBusBean item, final boolean isFav) { RxDataBase.getFirst(BusLineDetail.class, "LGUID = ?", item.getLGUID()).map(new Func1<BusLineDetail, Integer>() { @Override public Integer call(BusLineDetail busLineDetail) { ContentValues values = new ContentValues(); values.put("isFavorite", isFav); return DataSupport.updateAll(BusLineDetail.class, values, "LGUID = ?", busLineDetail.getLGUID()); } }).subscribe(); }
Example #17
Source File: ZonesInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone. * * @param resourceGroupName The name of the resource group. * @param zoneName The name of the DNS zone (without a terminating dot). * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> beginDeleteAsync(String resourceGroupName, String zoneName) { return beginDeleteWithServiceResponseAsync(resourceGroupName, zoneName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
Example #18
Source File: TagsInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Gets the names and values of all resource tags that are defined in a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<TagDetailsInner> object */ public Observable<ServiceResponse<Page<TagDetailsInner>>> listWithServiceResponseAsync() { return listSinglePageAsync() .concatMap(new Func1<ServiceResponse<Page<TagDetailsInner>>, Observable<ServiceResponse<Page<TagDetailsInner>>>>() { @Override public Observable<ServiceResponse<Page<TagDetailsInner>>> call(ServiceResponse<Page<TagDetailsInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); }
Example #19
Source File: DiagnosticSettingsImpl.java From azure-libraries-for-java with MIT License | 5 votes |
@Override public Observable<DiagnosticSetting> getAsync(String resourceId, String name) { return this.manager().inner().diagnosticSettings().getAsync(resourceId, name) .map(new Func1<DiagnosticSettingsResourceInner, DiagnosticSetting>() { @Override public DiagnosticSetting call(DiagnosticSettingsResourceInner diagnosticSettingsResourceInner) { return wrapModel(diagnosticSettingsResourceInner); } }); }
Example #20
Source File: CertificatesInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Lists all of the certificates in the specified account. * * @param resourceGroupName The name of the resource group that contains the Batch account. * @param accountName The name of the Batch account. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<CertificateInner> object */ public Observable<ServiceResponse<Page<CertificateInner>>> listByBatchAccountWithServiceResponseAsync(final String resourceGroupName, final String accountName) { return listByBatchAccountSinglePageAsync(resourceGroupName, accountName) .concatMap(new Func1<ServiceResponse<Page<CertificateInner>>, Observable<ServiceResponse<Page<CertificateInner>>>>() { @Override public Observable<ServiceResponse<Page<CertificateInner>>> call(ServiceResponse<Page<CertificateInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByBatchAccountNextWithServiceResponseAsync(nextPageLink)); } }); }
Example #21
Source File: FileSharesInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Lists all shares. * * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @param maxpagesize Optional. Specified maximum number of shares that can be included in the list. * @param filter Optional. When specified, only share names starting with the filter will be listed. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<List<FileShareItemInner>> listAsync(final String resourceGroupName, final String accountName, final String maxpagesize, final String filter, final ListOperationCallback<FileShareItemInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listSinglePageAsync(resourceGroupName, accountName, maxpagesize, filter), new Func1<String, Observable<ServiceResponse<Page<FileShareItemInner>>>>() { @Override public Observable<ServiceResponse<Page<FileShareItemInner>>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); }
Example #22
Source File: RxJavaActivity.java From ClockView with Apache License 2.0 | 5 votes |
public void testRXJAVA(){ // 创建被观察者对象 Observable observable = Observable.create(new Observable.OnSubscribe<String>() { @Override public void call(Subscriber<? super String> subscriber) { subscriber.onNext("Hello world"); subscriber.onCompleted(); } }); //创建观察者对象 Observer<String> observer = new Observer<String>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { } @Override public void onNext(String s) { Toast.makeText(RxJavaActivity.this,s,Toast.LENGTH_SHORT).show(); text_content.setText(s); } }; //被观察者要订阅观察者 observable.map(new Func1<String,String>() { @Override public String call(String o) { return o+", the early bird cathes the worm !"; } }).subscribe(observer); }
Example #23
Source File: PacketCapturesInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Lists all packet capture sessions within the specified resource group. * * @param resourceGroupName The name of the resource group. * @param networkWatcherName The name of the Network Watcher resource. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<PacketCaptureResultInner> object */ public Observable<ServiceResponse<List<PacketCaptureResultInner>>> listWithServiceResponseAsync(String resourceGroupName, String networkWatcherName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (networkWatcherName == null) { throw new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2019-11-01"; return service.list(resourceGroupName, networkWatcherName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<PacketCaptureResultInner>>>>() { @Override public Observable<ServiceResponse<List<PacketCaptureResultInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl1<PacketCaptureResultInner>> result = listDelegate(response); List<PacketCaptureResultInner> items = null; if (result.body() != null) { items = result.body().items(); } ServiceResponse<List<PacketCaptureResultInner>> clientResponse = new ServiceResponse<List<PacketCaptureResultInner>>(items, result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); }
Example #24
Source File: DeploymentOperationsInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Gets all deployments operations for a deployment. * * @param scope The scope of a deployment. * @param deploymentName The name of the deployment. * @param top The number of results to return. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<DeploymentOperationInner> object */ public Observable<Page<DeploymentOperationInner>> listAtScopeAsync(final String scope, final String deploymentName, final Integer top) { return listAtScopeWithServiceResponseAsync(scope, deploymentName, top) .map(new Func1<ServiceResponse<Page<DeploymentOperationInner>>, Page<DeploymentOperationInner>>() { @Override public Page<DeploymentOperationInner> call(ServiceResponse<Page<DeploymentOperationInner>> response) { return response.body(); } }); }
Example #25
Source File: DiagnosticSettingsInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Gets the active diagnostic settings for the specified resource. * * @param resourceUri The identifier of the resource. * @param name The name of the diagnostic setting. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DiagnosticSettingsResourceInner object */ public Observable<DiagnosticSettingsResourceInner> getAsync(String resourceUri, String name) { return getWithServiceResponseAsync(resourceUri, name).map(new Func1<ServiceResponse<DiagnosticSettingsResourceInner>, DiagnosticSettingsResourceInner>() { @Override public DiagnosticSettingsResourceInner call(ServiceResponse<DiagnosticSettingsResourceInner> response) { return response.body(); } }); }
Example #26
Source File: OperationsInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Lists all of the available Network Rest API operations. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<OperationInner> object */ public Observable<Page<OperationInner>> listAsync() { return listWithServiceResponseAsync() .map(new Func1<ServiceResponse<Page<OperationInner>>, Page<OperationInner>>() { @Override public Page<OperationInner> call(ServiceResponse<Page<OperationInner>> response) { return response.body(); } }); }
Example #27
Source File: ExpressRoutePortsLocationsInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Retrieves all ExpressRoutePort peering locations. Does not return available bandwidths for each location. Available bandwidths can only be obtained when retrieving a specific peering location. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<List<ExpressRoutePortsLocationInner>> listAsync(final ListOperationCallback<ExpressRoutePortsLocationInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listSinglePageAsync(), new Func1<String, Observable<ServiceResponse<Page<ExpressRoutePortsLocationInner>>>>() { @Override public Observable<ServiceResponse<Page<ExpressRoutePortsLocationInner>>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); }
Example #28
Source File: QueuesInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Gets the queues within a namespace. * * @param resourceGroupName Name of the Resource group within the Azure subscription. * @param namespaceName The namespace name * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<QueueInner> object */ public Observable<ServiceResponse<Page<QueueInner>>> listByNamespaceWithServiceResponseAsync(final String resourceGroupName, final String namespaceName) { return listByNamespaceSinglePageAsync(resourceGroupName, namespaceName) .concatMap(new Func1<ServiceResponse<Page<QueueInner>>, Observable<ServiceResponse<Page<QueueInner>>>>() { @Override public Observable<ServiceResponse<Page<QueueInner>>> call(ServiceResponse<Page<QueueInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByNamespaceNextWithServiceResponseAsync(nextPageLink)); } }); }
Example #29
Source File: ProvidersInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Get available application frameworks and their versions. * Description for Get available application frameworks and their versions. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<List<ApplicationStackResourceInner>> getAvailableStacksAsync(final ListOperationCallback<ApplicationStackResourceInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( getAvailableStacksSinglePageAsync(), new Func1<String, Observable<ServiceResponse<Page<ApplicationStackResourceInner>>>>() { @Override public Observable<ServiceResponse<Page<ApplicationStackResourceInner>>> call(String nextPageLink) { return getAvailableStacksNextSinglePageAsync(nextPageLink); } }, serviceCallback); }
Example #30
Source File: ProfilesInner.java From azure-libraries-for-java with MIT License | 5 votes |
/** * Deletes a Traffic Manager profile. * * @param resourceGroupName The name of the resource group containing the Traffic Manager profile to be deleted. * @param profileName The name of the Traffic Manager profile to be deleted. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DeleteOperationResultInner object */ public Observable<ServiceResponse<DeleteOperationResultInner>> deleteWithServiceResponseAsync(String resourceGroupName, String profileName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (profileName == null) { throw new IllegalArgumentException("Parameter profileName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.delete(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<DeleteOperationResultInner>>>() { @Override public Observable<ServiceResponse<DeleteOperationResultInner>> call(Response<ResponseBody> response) { try { ServiceResponse<DeleteOperationResultInner> clientResponse = deleteDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); }