Java Code Examples for rx.functions.Func1

The following examples show how to use rx.functions.Func1. These examples are extracted from open source projects. 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 Project: azure-libraries-for-java   Source File: ContainerServicesInner.java    License: MIT License 6 votes vote down vote up
/**
 * 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 2
/**
 * 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&lt;WebApplicationFirewallPolicyInner&gt; 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 3
/**
 * 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&lt;IdentifierInner&gt; 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 4
Source Project: azure-libraries-for-java   Source File: SyncAgentsInner.java    License: MIT License 6 votes vote down vote up
/**
 * 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&lt;SyncAgentInner&gt; 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 5
Source Project: azure-libraries-for-java   Source File: PublicIPPrefixesInner.java    License: MIT License 6 votes vote down vote up
/**
 * Gets all the public IP prefixes in a subscription.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the PagedList&lt;PublicIPPrefixInner&gt; 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 6
Source Project: azure-libraries-for-java   Source File: ProvidersInner.java    License: MIT License 6 votes vote down vote up
/**
 * 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 &amp;$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&lt;ProviderInner&gt; 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 7
Source Project: rtree-3d   Source File: Backpressure.java    License: Apache License 2.0 6 votes vote down vote up
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 8
/**
 * 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&lt;GalleryApplicationInner&gt; 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 9
Source Project: azure-libraries-for-java   Source File: HostNameSslBindingImpl.java    License: MIT License 6 votes vote down vote up
@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 10
Source Project: azure-libraries-for-java   Source File: OperationsInner.java    License: MIT License 6 votes vote down vote up
/**
 * Lists available operations for the Microsoft.BatchAI provider.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the PagedList&lt;OperationInner&gt; 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 11
Source Project: azure-libraries-for-java   Source File: OperationsInner.java    License: MIT License 6 votes vote down vote up
/**
 * Lists all of the available Cosmos DB Resource Provider operations.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the PagedList&lt;OperationInner&gt; 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 12
Source Project: azure-libraries-for-java   Source File: ManagedDatabasesInner.java    License: MIT License 6 votes vote down vote up
/**
 * 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&lt;ManagedDatabaseInner&gt; 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 13
Source Project: azure-libraries-for-java   Source File: ProfilesInner.java    License: MIT License 5 votes vote down vote up
/**
 * 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);
                }
            }
        });
}
 
Example 14
Source Project: azure-libraries-for-java   Source File: AutoscaleSettingsInner.java    License: MIT License 5 votes vote down vote up
/**
 * Lists the autoscale settings for a subscription.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;AutoscaleSettingResourceInner&gt; object
 */
public Observable<Page<AutoscaleSettingResourceInner>> listAsync() {
    return listWithServiceResponseAsync()
        .map(new Func1<ServiceResponse<Page<AutoscaleSettingResourceInner>>, Page<AutoscaleSettingResourceInner>>() {
            @Override
            public Page<AutoscaleSettingResourceInner> call(ServiceResponse<Page<AutoscaleSettingResourceInner>> response) {
                return response.body();
            }
        });
}
 
Example 15
/**
 * Lists all of the application packages in the specified application.
 *
 * @param resourceGroupName The name of the resource group that contains the Batch account.
 * @param accountName The name of the Batch account.
 * @param applicationName The name of the application. This must be unique within the account.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;ApplicationPackageInner&gt; object
 */
public Observable<ServiceResponse<Page<ApplicationPackageInner>>> listWithServiceResponseAsync(final String resourceGroupName, final String accountName, final String applicationName) {
    return listSinglePageAsync(resourceGroupName, accountName, applicationName)
        .concatMap(new Func1<ServiceResponse<Page<ApplicationPackageInner>>, Observable<ServiceResponse<Page<ApplicationPackageInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<ApplicationPackageInner>>> call(ServiceResponse<Page<ApplicationPackageInner>> page) {
                String nextPageLink = page.body().nextPageLink();
                if (nextPageLink == null) {
                    return Observable.just(page);
                }
                return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink));
            }
        });
}
 
Example 16
Source Project: azure-libraries-for-java   Source File: UsagesInner.java    License: MIT License 5 votes vote down vote up
/**
 * Gets all instance pool usage metrics.
 *
 * @param nextPageLink The NextLink from the previous successful call to List operation.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;UsageInner&gt; object
 */
public Observable<Page<UsageInner>> listByInstancePoolNextAsync(final String nextPageLink) {
    return listByInstancePoolNextWithServiceResponseAsync(nextPageLink)
        .map(new Func1<ServiceResponse<Page<UsageInner>>, Page<UsageInner>>() {
            @Override
            public Page<UsageInner> call(ServiceResponse<Page<UsageInner>> response) {
                return response.body();
            }
        });
}
 
Example 17
/**
 * Convert an existing scan result to a human readable format. If already exists nothing happens.
 *
 * @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 serverName The name of the server.
 * @param databaseName The name of the scanned database.
 * @param scanId The vulnerability assessment scan Id.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the DatabaseVulnerabilityAssessmentScansExportInner object
 */
public Observable<ServiceResponse<DatabaseVulnerabilityAssessmentScansExportInner>> exportWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String scanId) {
    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 (databaseName == null) {
        throw new IllegalArgumentException("Parameter databaseName is required and cannot be null.");
    }
    if (scanId == null) {
        throw new IllegalArgumentException("Parameter scanId 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 vulnerabilityAssessmentName = "default";
    final String apiVersion = "2017-10-01-preview";
    return service.export(resourceGroupName, serverName, databaseName, vulnerabilityAssessmentName, scanId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<DatabaseVulnerabilityAssessmentScansExportInner>>>() {
            @Override
            public Observable<ServiceResponse<DatabaseVulnerabilityAssessmentScansExportInner>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<DatabaseVulnerabilityAssessmentScansExportInner> clientResponse = exportDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example 18
Source Project: azure-libraries-for-java   Source File: SubnetsInner.java    License: MIT License 5 votes vote down vote up
/**
 * Unprepares a subnet by removing network intent policies.
 *
 * @param resourceGroupName The name of the resource group.
 * @param virtualNetworkName The name of the virtual network.
 * @param subnetName The name of the subnet.
 * @param serviceName The name of the service for which subnet is being unprepared for.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the {@link ServiceResponse} object if successful.
 */
public Observable<ServiceResponse<Void>> beginUnprepareNetworkPoliciesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName, String serviceName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (virtualNetworkName == null) {
        throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.");
    }
    if (subnetName == null) {
        throw new IllegalArgumentException("Parameter subnetName 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";
    UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters = new UnprepareNetworkPoliciesRequest();
    unprepareNetworkPoliciesRequestParameters.withServiceName(serviceName);
    return service.beginUnprepareNetworkPolicies(resourceGroupName, virtualNetworkName, subnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), unprepareNetworkPoliciesRequestParameters, this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
            @Override
            public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<Void> clientResponse = beginUnprepareNetworkPoliciesDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example 19
/**
 * List all ResourceHealthMetadata for all sites in the resource group in the subscription.
 * Description for List all ResourceHealthMetadata for all sites in the resource group in the subscription.
 *
 * @param resourceGroupName Name of the resource group to which the resource belongs.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;ResourceHealthMetadataInner&gt; object
 */
public Observable<Page<ResourceHealthMetadataInner>> listByResourceGroupAsync(final String resourceGroupName) {
    return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
        .map(new Func1<ServiceResponse<Page<ResourceHealthMetadataInner>>, Page<ResourceHealthMetadataInner>>() {
            @Override
            public Page<ResourceHealthMetadataInner> call(ServiceResponse<Page<ResourceHealthMetadataInner>> response) {
                return response.body();
            }
        });
}
 
Example 20
Source Project: azure-libraries-for-java   Source File: NetworkInterfacesInner.java    License: MIT License 5 votes vote down vote up
/**
 * Gets all network interfaces in a subscription.
 *
 * @param nextPageLink The NextLink from the previous successful call to List operation.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;NetworkInterfaceInner&gt; object
 */
public Observable<Page<NetworkInterfaceInner>> listNextAsync(final String nextPageLink) {
    return listNextWithServiceResponseAsync(nextPageLink)
        .map(new Func1<ServiceResponse<Page<NetworkInterfaceInner>>, Page<NetworkInterfaceInner>>() {
            @Override
            public Page<NetworkInterfaceInner> call(ServiceResponse<Page<NetworkInterfaceInner>> response) {
                return response.body();
            }
        });
}
 
Example 21
Source Project: mantis   Source File: AsyncConnection.java    License: Apache License 2.0 5 votes vote down vote up
public AsyncConnection(String host, int port, String id,
                       String slotId,
                       String groupId, Observer<List<byte[]>> subject,
                       Func1<T, Boolean> predicate) {
    this.host = host;
    this.port = port;
    this.id = id;
    this.groupId = groupId;
    this.subject = subject;
    this.predicate = predicate;
    this.slotId = slotId;
}
 
Example 22
Source Project: azure-libraries-for-java   Source File: FeaturesInner.java    License: MIT License 5 votes vote down vote up
/**
 * Gets all the preview features in a provider namespace that are available through AFEC for the subscription.
 *
 * @param resourceProviderNamespace The namespace of the resource provider for getting features.
 * @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<FeatureResultInner>> list1Async(final String resourceProviderNamespace, final ListOperationCallback<FeatureResultInner> serviceCallback) {
    return AzureServiceFuture.fromPageResponse(
        list1SinglePageAsync(resourceProviderNamespace),
        new Func1<String, Observable<ServiceResponse<Page<FeatureResultInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<FeatureResultInner>>> call(String nextPageLink) {
                return list1NextSinglePageAsync(nextPageLink);
            }
        },
        serviceCallback);
}
 
Example 23
@Override
public Observable<ActiveDirectoryObject> listMembersAsync() {
    return manager().inner().groups().getGroupMembersAsync(id())
            .flatMap(new Func1<Page<AADObjectInner>, Observable<AADObjectInner>>() {
                @Override
                public Observable<AADObjectInner> call(Page<AADObjectInner> aadObjectInnerPage) {
                    return Observable.from(aadObjectInnerPage.items());
                }
            }).map(new Func1<AADObjectInner, ActiveDirectoryObject>() {
                @Override
                public ActiveDirectoryObject call(AADObjectInner aadObjectInner) {
                    SerializerAdapter<?> adapter = manager().inner().restClient().serializerAdapter();
                    try {
                        String serialized = adapter.serialize(aadObjectInner);
                        switch (aadObjectInner.objectType()) {
                            case "User":
                                return new ActiveDirectoryUserImpl(adapter.<UserInner>deserialize(serialized, UserInner.class), manager());
                            case "Group":
                                return new ActiveDirectoryGroupImpl(adapter.<ADGroupInner>deserialize(serialized, ADGroupInner.class), manager());
                            case "ServicePrincipal":
                                return new ServicePrincipalImpl(adapter.<ServicePrincipalInner>deserialize(serialized, ServicePrincipalInner.class), manager());
                            case "Application":
                                return new ActiveDirectoryApplicationImpl(adapter.<ApplicationInner>deserialize(serialized, ApplicationInner.class), manager());
                            default:
                                return null;
                        }
                    } catch (IOException e) {
                        throw new RuntimeException(e);
                    }
                }
            });
}
 
Example 24
Source Project: mantis   Source File: PushServer.java    License: Apache License 2.0 5 votes vote down vote up
protected Observable<Void> manageConnection(final DefaultChannelWriter<R> writer, String host, int port,
                                            String groupId, String slotId, String id, final AtomicLong lastWriteTime, final boolean applicationHeartbeats,
                                            final Subscription heartbeatSubscription, boolean applySampling, long samplingRateMSec,
                                            final SerializedSubject<String, String> metaMsgSubject, final Subscription metaMsgSubscription,
                                            Func1<T, Boolean> predicate, final Action0 connectionClosedCallback,
                                            final Counter legacyMsgProcessedCounter, final Counter legacyDroppedWrites,
                                            final Action0 connectionSubscribeCallback) {
    return manageConnectionWithCompression(writer, host, port, groupId, slotId, id, lastWriteTime, applicationHeartbeats, heartbeatSubscription,
            applySampling, samplingRateMSec, null, null, predicate, connectionClosedCallback, legacyMsgProcessedCounter, legacyDroppedWrites, connectionSubscribeCallback, false, false);

}
 
Example 25
Source Project: mantis   Source File: JobSchedulingTracker.java    License: Apache License 2.0 5 votes vote down vote up
public Observable<WorkerIndexChange> startedWorkersPerIndex(int stageNumber) {
    Observable<WorkerIndexChange> workerIndexChanges = workerIndexChanges(stageNumber);
    return workerIndexChanges
            .filter(new Func1<WorkerIndexChange, Boolean>() {
                @Override
                public Boolean call(WorkerIndexChange newWorkerChange) {
                    return (newWorkerChange.getNewState().getState()
                            == MantisJobState.Started);
                }
            });
}
 
Example 26
Source Project: azure-libraries-for-java   Source File: SnapshotsInner.java    License: MIT License 5 votes vote down vote up
/**
 * Lists snapshots under a subscription.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;SnapshotInner&gt; object
 */
public Observable<Page<SnapshotInner>> listAsync() {
    return listWithServiceResponseAsync()
        .map(new Func1<ServiceResponse<Page<SnapshotInner>>, Page<SnapshotInner>>() {
            @Override
            public Page<SnapshotInner> call(ServiceResponse<Page<SnapshotInner>> response) {
                return response.body();
            }
        });
}
 
Example 27
Source Project: azure-libraries-for-java   Source File: OperationsInner.java    License: MIT License 5 votes vote down vote up
/**
 * Lists all of the available Event Hub REST API operations.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;OperationInner&gt; object
 */
public Observable<ServiceResponse<Page<OperationInner>>> listWithServiceResponseAsync() {
    return listSinglePageAsync()
        .concatMap(new Func1<ServiceResponse<Page<OperationInner>>, Observable<ServiceResponse<Page<OperationInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<OperationInner>>> call(ServiceResponse<Page<OperationInner>> page) {
                String nextPageLink = page.body().nextPageLink();
                if (nextPageLink == null) {
                    return Observable.just(page);
                }
                return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink));
            }
        });
}
 
Example 28
/**
 * Lists the failover groups in a location.
 *
 * @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 locationName The name of the region where the resource is located.
 * @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<InstanceFailoverGroupInner>> listByLocationAsync(final String resourceGroupName, final String locationName, final ListOperationCallback<InstanceFailoverGroupInner> serviceCallback) {
    return AzureServiceFuture.fromPageResponse(
        listByLocationSinglePageAsync(resourceGroupName, locationName),
        new Func1<String, Observable<ServiceResponse<Page<InstanceFailoverGroupInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<InstanceFailoverGroupInner>>> call(String nextPageLink) {
                return listByLocationNextSinglePageAsync(nextPageLink);
            }
        },
        serviceCallback);
}
 
Example 29
Source Project: azure-libraries-for-java   Source File: BatchAccountsInner.java    License: MIT License 5 votes vote down vote up
/**
 * Gets information about the Batch accounts associated with the specified resource group.
 *
 * @param resourceGroupName The name of the resource group that contains the Batch account.
 * @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<BatchAccountInner>> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback<BatchAccountInner> serviceCallback) {
    return AzureServiceFuture.fromPageResponse(
        listByResourceGroupSinglePageAsync(resourceGroupName),
        new Func1<String, Observable<ServiceResponse<Page<BatchAccountInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<BatchAccountInner>>> call(String nextPageLink) {
                return listByResourceGroupNextSinglePageAsync(nextPageLink);
            }
        },
        serviceCallback);
}
 
Example 30
/**
 * Gets all of the available subnet delegations for this resource group in this region.
 *
 * @param location The location of the domain name.
 * @param resourceGroupName The name of the resource group.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;AvailableDelegationInner&gt; object
 */
public Observable<Page<AvailableDelegationInner>> listAsync(final String location, final String resourceGroupName) {
    return listWithServiceResponseAsync(location, resourceGroupName)
        .map(new Func1<ServiceResponse<Page<AvailableDelegationInner>>, Page<AvailableDelegationInner>>() {
            @Override
            public Page<AvailableDelegationInner> call(ServiceResponse<Page<AvailableDelegationInner>> response) {
                return response.body();
            }
        });
}