com.microsoft.rest.ServiceResponse Java Examples

The following examples show how to use com.microsoft.rest.ServiceResponse. 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: UsagesInner.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Gets the current usage information as well as limits for Batch AI resources for given subscription.
 *
ServiceResponse<PageImpl<UsageInner>> * @param location The location for which resource usage is queried.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the PagedList&lt;UsageInner&gt; object wrapped in {@link ServiceResponse} if successful.
 */
public Observable<ServiceResponse<Page<UsageInner>>> listSinglePageAsync(final String location) {
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    if (location == null) {
        throw new IllegalArgumentException("Parameter location 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(), location, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<UsageInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<UsageInner>>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<PageImpl<UsageInner>> result = listDelegate(response);
                    return Observable.just(new ServiceResponse<Page<UsageInner>>(result.body(), result.response()));
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #2
Source File: NatGatewaysInner.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Creates or updates a nat gateway.
 *
 * @param resourceGroupName The name of the resource group.
 * @param natGatewayName The name of the nat gateway.
 * @param parameters Parameters supplied to the create or update nat gateway operation.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<NatGatewayInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String natGatewayName, NatGatewayInner parameters) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (natGatewayName == null) {
        throw new IllegalArgumentException("Parameter natGatewayName 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 = "2019-11-01";
    Observable<Response<ResponseBody>> observable = service.createOrUpdate(resourceGroupName, natGatewayName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<NatGatewayInner>() { }.getType());
}
 
Example #3
Source File: DeletedWebAppsInner.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Get all deleted apps for a subscription at location.
 * Description for Get all deleted apps for a subscription at location.
 *
ServiceResponse<PageImpl<DeletedSiteInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the PagedList&lt;DeletedSiteInner&gt; object wrapped in {@link ServiceResponse} if successful.
 */
public Observable<ServiceResponse<Page<DeletedSiteInner>>> listByLocationNextSinglePageAsync(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.listByLocationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<DeletedSiteInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<DeletedSiteInner>>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<PageImpl<DeletedSiteInner>> result = listByLocationNextDelegate(response);
                    return Observable.just(new ServiceResponse<Page<DeletedSiteInner>>(result.body(), result.response()));
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #4
Source File: DeploymentOperationsInner.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Gets a deployments operation.
 *
 * @param deploymentName The name of the deployment.
 * @param operationId The ID of the operation to get.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the DeploymentOperationInner object
 */
public Observable<ServiceResponse<DeploymentOperationInner>> getAtTenantScopeWithServiceResponseAsync(String deploymentName, String operationId) {
    if (deploymentName == null) {
        throw new IllegalArgumentException("Parameter deploymentName is required and cannot be null.");
    }
    if (operationId == null) {
        throw new IllegalArgumentException("Parameter operationId 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.getAtTenantScope(deploymentName, operationId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<DeploymentOperationInner>>>() {
            @Override
            public Observable<ServiceResponse<DeploymentOperationInner>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<DeploymentOperationInner> clientResponse = getAtTenantScopeDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #5
Source File: VirtualNetworkGatewayConnectionsInner.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider.
 *
 * @param resourceGroupName The name of the resource group.
 * @param virtualNetworkGatewayConnectionName The virtual network gateway connection reset shared key Name.
 * @param keyLength The virtual network connection reset shared key length, should between 1 and 128.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable for the request
 */
public Observable<ServiceResponse<ConnectionResetSharedKeyInner>> resetSharedKeyWithServiceResponseAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, int keyLength) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (virtualNetworkGatewayConnectionName == null) {
        throw new IllegalArgumentException("Parameter virtualNetworkGatewayConnectionName 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";
    ConnectionResetSharedKeyInner parameters = new ConnectionResetSharedKeyInner();
    parameters.withKeyLength(keyLength);
    Observable<Response<ResponseBody>> observable = service.resetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken<ConnectionResetSharedKeyInner>() { }.getType());
}
 
Example #6
Source File: NetworkSecurityGroupsInner.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Gets the specified network security group.
 *
 * @param resourceGroupName The name of the resource group.
 * @param networkSecurityGroupName The name of the network security group.
 * @param expand Expands referenced resources.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the NetworkSecurityGroupInner object
 */
public Observable<ServiceResponse<NetworkSecurityGroupInner>> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String networkSecurityGroupName, String expand) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (networkSecurityGroupName == null) {
        throw new IllegalArgumentException("Parameter networkSecurityGroupName 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.getByResourceGroup(resourceGroupName, networkSecurityGroupName, this.client.subscriptionId(), apiVersion, expand, this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<NetworkSecurityGroupInner>>>() {
            @Override
            public Observable<ServiceResponse<NetworkSecurityGroupInner>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<NetworkSecurityGroupInner> clientResponse = getByResourceGroupDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #7
Source File: DeletedWebAppsInner.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Get all deleted apps for a subscription.
 * Description for Get all deleted apps for a subscription.
 *
ServiceResponse<PageImpl<DeletedSiteInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the PagedList&lt;DeletedSiteInner&gt; object wrapped in {@link ServiceResponse} if successful.
 */
public Observable<ServiceResponse<Page<DeletedSiteInner>>> listNextSinglePageAsync(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.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<DeletedSiteInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<DeletedSiteInner>>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<PageImpl<DeletedSiteInner>> result = listNextDelegate(response);
                    return Observable.just(new ServiceResponse<Page<DeletedSiteInner>>(result.body(), result.response()));
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #8
Source File: TagsInner.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Gets the names and values of all resource tags that are defined in a subscription.
 *
ServiceResponse<PageImpl<TagDetailsInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the PagedList&lt;TagDetailsInner&gt; object wrapped in {@link ServiceResponse} if successful.
 */
public Observable<ServiceResponse<Page<TagDetailsInner>>> listNextSinglePageAsync(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.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<TagDetailsInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<TagDetailsInner>>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<PageImpl<TagDetailsInner>> result = listNextDelegate(response);
                    return Observable.just(new ServiceResponse<Page<TagDetailsInner>>(result.body(), result.response()));
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #9
Source File: RegistriesInner.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Lists the policies for the specified container registry.
 *
 * @param resourceGroupName The name of the resource group to which the container registry belongs.
 * @param registryName The name of the container registry.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the RegistryPoliciesInner object
 */
public Observable<ServiceResponse<RegistryPoliciesInner>> listPoliciesWithServiceResponseAsync(String resourceGroupName, String registryName) {
    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.");
    }
    final String apiVersion = "2017-10-01";
    return service.listPolicies(this.client.subscriptionId(), resourceGroupName, registryName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RegistryPoliciesInner>>>() {
            @Override
            public Observable<ServiceResponse<RegistryPoliciesInner>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<RegistryPoliciesInner> clientResponse = listPoliciesDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #10
Source File: ExpressRouteCircuitsInner.java    From azure-libraries-for-java with MIT License 6 votes vote down vote up
/**
 * Gets all the express route circuits in a subscription.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the PagedList&lt;ExpressRouteCircuitInner&gt; object wrapped in {@link ServiceResponse} if successful.
 */
public Observable<ServiceResponse<Page<ExpressRouteCircuitInner>>> 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<ExpressRouteCircuitInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<ExpressRouteCircuitInner>>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<PageImpl<ExpressRouteCircuitInner>> result = listDelegate(response);
                    return Observable.just(new ServiceResponse<Page<ExpressRouteCircuitInner>>(result.body(), result.response()));
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #11
Source File: TopicsInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Gets all the topics in a namespace.
 *
 * @param resourceGroupName Name of the Resource group within the Azure subscription.
 * @param namespaceName The namespace name
 * @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<TopicInner>> listByNamespaceAsync(final String resourceGroupName, final String namespaceName, final ListOperationCallback<TopicInner> serviceCallback) {
    return AzureServiceFuture.fromPageResponse(
        listByNamespaceSinglePageAsync(resourceGroupName, namespaceName),
        new Func1<String, Observable<ServiceResponse<Page<TopicInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<TopicInner>>> call(String nextPageLink) {
                return listByNamespaceNextSinglePageAsync(nextPageLink);
            }
        },
        serviceCallback);
}
 
Example #12
Source File: FirewallRulesInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Gets all firewall rules in the specified redis cache.
 *
 * @param resourceGroupName The name of the resource group.
 * @param cacheName The name of the Redis cache.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;RedisFirewallRuleInner&gt; object
 */
public Observable<ServiceResponse<Page<RedisFirewallRuleInner>>> listByRedisResourceWithServiceResponseAsync(final String resourceGroupName, final String cacheName) {
    return listByRedisResourceSinglePageAsync(resourceGroupName, cacheName)
        .concatMap(new Func1<ServiceResponse<Page<RedisFirewallRuleInner>>, Observable<ServiceResponse<Page<RedisFirewallRuleInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<RedisFirewallRuleInner>>> call(ServiceResponse<Page<RedisFirewallRuleInner>> page) {
                String nextPageLink = page.body().nextPageLink();
                if (nextPageLink == null) {
                    return Observable.just(page);
                }
                return Observable.just(page).concatWith(listByRedisResourceNextWithServiceResponseAsync(nextPageLink));
            }
        });
}
 
Example #13
Source File: VirtualMachineScaleSetVMsInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
 *
 * @param resourceGroupName The name of the resource group.
 * @param vmScaleSetName The name of the VM scale set.
 * @param instanceId The instance ID of the virtual machine.
 * @param skipShutdown The parameter to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this flag is false if not specified
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the {@link ServiceResponse} object if successful.
 */
public Observable<ServiceResponse<Void>> beginPowerOffWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId, Boolean skipShutdown) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (vmScaleSetName == null) {
        throw new IllegalArgumentException("Parameter vmScaleSetName is required and cannot be null.");
    }
    if (instanceId == null) {
        throw new IllegalArgumentException("Parameter instanceId 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-12-01";
    return service.beginPowerOff(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), skipShutdown, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
            @Override
            public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<Void> clientResponse = beginPowerOffDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #14
Source File: ManagedClustersInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Gets a list of managed clusters in the specified subscription.
 * Gets a list of managed clusters in the specified subscription. The operation returns properties of each managed cluster.
 *
 * @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<ManagedClusterInner>> listAsync(final ListOperationCallback<ManagedClusterInner> serviceCallback) {
    return AzureServiceFuture.fromPageResponse(
        listSinglePageAsync(),
        new Func1<String, Observable<ServiceResponse<Page<ManagedClusterInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<ManagedClusterInner>>> call(String nextPageLink) {
                return listNextSinglePageAsync(nextPageLink);
            }
        },
        serviceCallback);
}
 
Example #15
Source File: VirtualNetworksInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Updates a virtual network tags.
 *
 * @param resourceGroupName The name of the resource group.
 * @param virtualNetworkName The name of the virtual network.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the VirtualNetworkInner object
 */
public Observable<ServiceResponse<VirtualNetworkInner>> updateTagsWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName) {
    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 (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    final String apiVersion = "2019-11-01";
    final Map<String, String> tags = null;
    TagsObject parameters = new TagsObject();
    parameters.withTags(null);
    return service.updateTags(resourceGroupName, virtualNetworkName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VirtualNetworkInner>>>() {
            @Override
            public Observable<ServiceResponse<VirtualNetworkInner>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<VirtualNetworkInner> clientResponse = updateTagsDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #16
Source File: WebSiteManagementClientImpl.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules.
 * Description for Verifies if this VNET is compatible with an App Service Environment by analyzing the Network Security Group rules.
 *
 * @param parameters VNET information
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the VnetValidationFailureDetailsInner object
 */
public Observable<VnetValidationFailureDetailsInner> verifyHostingEnvironmentVnetAsync(VnetParameters parameters) {
    return verifyHostingEnvironmentVnetWithServiceResponseAsync(parameters).map(new Func1<ServiceResponse<VnetValidationFailureDetailsInner>, VnetValidationFailureDetailsInner>() {
        @Override
        public VnetValidationFailureDetailsInner call(ServiceResponse<VnetValidationFailureDetailsInner> response) {
            return response.body();
        }
    });
}
 
Example #17
Source File: ResourceUsagesInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Check the quota and actual usage of the CDN profiles under the given 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<ResourceUsageInner>> listAsync(final ListOperationCallback<ResourceUsageInner> serviceCallback) {
    return AzureServiceFuture.fromPageResponse(
        listSinglePageAsync(),
        new Func1<String, Observable<ServiceResponse<Page<ResourceUsageInner>>>>() {
            @Override
            public Observable<ServiceResponse<Page<ResourceUsageInner>>> call(String nextPageLink) {
                return listNextSinglePageAsync(nextPageLink);
            }
        },
        serviceCallback);
}
 
Example #18
Source File: SyncAgentsInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
private ServiceResponse<SyncAgentInner> beginCreateOrUpdateDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
    return this.client.restClient().responseBuilderFactory().<SyncAgentInner, CloudException>newInstance(this.client.serializerAdapter())
            .register(200, new TypeToken<SyncAgentInner>() { }.getType())
            .register(201, new TypeToken<SyncAgentInner>() { }.getType())
            .register(202, new TypeToken<Void>() { }.getType())
            .registerError(CloudException.class)
            .build(response);
}
 
Example #19
Source File: GalleryImageVersionsInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * List gallery Image Versions in a gallery Image Definition.
 *
 * @param resourceGroupName The name of the resource group.
 * @param galleryName The name of the Shared Image Gallery in which the Image Definition resides.
 * @param galleryImageName The name of the Shared Image Gallery Image Definition from which the Image Versions are to be listed.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;GalleryImageVersionInner&gt; object
 */
public Observable<Page<GalleryImageVersionInner>> listByGalleryImageAsync(final String resourceGroupName, final String galleryName, final String galleryImageName) {
    return listByGalleryImageWithServiceResponseAsync(resourceGroupName, galleryName, galleryImageName)
        .map(new Func1<ServiceResponse<Page<GalleryImageVersionInner>>, Page<GalleryImageVersionInner>>() {
            @Override
            public Page<GalleryImageVersionInner> call(ServiceResponse<Page<GalleryImageVersionInner>> response) {
                return response.body();
            }
        });
}
 
Example #20
Source File: DomainsInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Get all domains in a resource group.
 * Description for Get all domains in a resource group.
 *
 * @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;DomainInner&gt; object
 */
public Observable<Page<DomainInner>> listByResourceGroupNextAsync(final String nextPageLink) {
    return listByResourceGroupNextWithServiceResponseAsync(nextPageLink)
        .map(new Func1<ServiceResponse<Page<DomainInner>>, Page<DomainInner>>() {
            @Override
            public Page<DomainInner> call(ServiceResponse<Page<DomainInner>> response) {
                return response.body();
            }
        });
}
 
Example #21
Source File: PublicIPPrefixesInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Updates public IP prefix tags.
 *
 * @param resourceGroupName The name of the resource group.
 * @param publicIpPrefixName The name of the public IP prefix.
 * @param tags Resource tags.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PublicIPPrefixInner object
 */
public Observable<ServiceResponse<PublicIPPrefixInner>> updateTagsWithServiceResponseAsync(String resourceGroupName, String publicIpPrefixName, Map<String, String> tags) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (publicIpPrefixName == null) {
        throw new IllegalArgumentException("Parameter publicIpPrefixName is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    Validator.validate(tags);
    final String apiVersion = "2019-11-01";
    TagsObject parameters = new TagsObject();
    parameters.withTags(tags);
    return service.updateTags(resourceGroupName, publicIpPrefixName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PublicIPPrefixInner>>>() {
            @Override
            public Observable<ServiceResponse<PublicIPPrefixInner>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<PublicIPPrefixInner> clientResponse = updateTagsDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #22
Source File: OperationsInner.java    From azure-libraries-for-java with 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 #23
Source File: ManagedDatabaseVulnerabilityAssessmentScansInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Lists the vulnerability assessment scans of a database.
 *
 * @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;VulnerabilityAssessmentScanRecordInner&gt; object
 */
public Observable<Page<VulnerabilityAssessmentScanRecordInner>> listByDatabaseNextAsync(final String nextPageLink) {
    return listByDatabaseNextWithServiceResponseAsync(nextPageLink)
        .map(new Func1<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>, Page<VulnerabilityAssessmentScanRecordInner>>() {
            @Override
            public Page<VulnerabilityAssessmentScanRecordInner> call(ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>> response) {
                return response.body();
            }
        });
}
 
Example #24
Source File: NetworkProfilesInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Gets all network profiles in a resource group.
 *
 * @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;NetworkProfileInner&gt; object
 */
public Observable<Page<NetworkProfileInner>> listByResourceGroupNextAsync(final String nextPageLink) {
    return listByResourceGroupNextWithServiceResponseAsync(nextPageLink)
        .map(new Func1<ServiceResponse<Page<NetworkProfileInner>>, Page<NetworkProfileInner>>() {
            @Override
            public Page<NetworkProfileInner> call(ServiceResponse<Page<NetworkProfileInner>> response) {
                return response.body();
            }
        });
}
 
Example #25
Source File: ManagedDatabaseVulnerabilityAssessmentsInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Lists the vulnerability assessments of a managed database.
 *
 * @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 databaseName The name of the database for which the vulnerability assessment is defined.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;DatabaseVulnerabilityAssessmentInner&gt; object
 */
public Observable<Page<DatabaseVulnerabilityAssessmentInner>> listByDatabaseAsync(final String resourceGroupName, final String managedInstanceName, final String databaseName) {
    return listByDatabaseWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName)
        .map(new Func1<ServiceResponse<Page<DatabaseVulnerabilityAssessmentInner>>, Page<DatabaseVulnerabilityAssessmentInner>>() {
            @Override
            public Page<DatabaseVulnerabilityAssessmentInner> call(ServiceResponse<Page<DatabaseVulnerabilityAssessmentInner>> response) {
                return response.body();
            }
        });
}
 
Example #26
Source File: DiskEncryptionSetsInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Lists all the disk encryption sets under a subscription.
 *
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the PagedList&lt;DiskEncryptionSetInner&gt; object
 */
public Observable<Page<DiskEncryptionSetInner>> listAsync() {
    return listWithServiceResponseAsync()
        .map(new Func1<ServiceResponse<Page<DiskEncryptionSetInner>>, Page<DiskEncryptionSetInner>>() {
            @Override
            public Page<DiskEncryptionSetInner> call(ServiceResponse<Page<DiskEncryptionSetInner>> response) {
                return response.body();
            }
        });
}
 
Example #27
Source File: ExpressRouteCircuitsInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Gets information about the specified express route circuit.
 *
 * @param resourceGroupName The name of the resource group.
 * @param circuitName The name of express route circuit.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the ExpressRouteCircuitInner object
 */
public Observable<ExpressRouteCircuitInner> getByResourceGroupAsync(String resourceGroupName, String circuitName) {
    return getByResourceGroupWithServiceResponseAsync(resourceGroupName, circuitName).map(new Func1<ServiceResponse<ExpressRouteCircuitInner>, ExpressRouteCircuitInner>() {
        @Override
        public ExpressRouteCircuitInner call(ServiceResponse<ExpressRouteCircuitInner> response) {
            return response.body();
        }
    });
}
 
Example #28
Source File: VpnServerConfigurationsInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Updates VpnServerConfiguration tags.
 *
 * @param resourceGroupName The resource group name of the VpnServerConfiguration.
 * @param vpnServerConfigurationName The name of the VpnServerConfiguration being updated.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the VpnServerConfigurationInner object
 */
public Observable<ServiceResponse<VpnServerConfigurationInner>> updateTagsWithServiceResponseAsync(String resourceGroupName, String vpnServerConfigurationName) {
    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 (vpnServerConfigurationName == null) {
        throw new IllegalArgumentException("Parameter vpnServerConfigurationName is required and cannot be null.");
    }
    final String apiVersion = "2019-11-01";
    final Map<String, String> tags = null;
    TagsObject vpnServerConfigurationParameters = new TagsObject();
    vpnServerConfigurationParameters.withTags(null);
    return service.updateTags(this.client.subscriptionId(), resourceGroupName, vpnServerConfigurationName, apiVersion, this.client.acceptLanguage(), vpnServerConfigurationParameters, this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VpnServerConfigurationInner>>>() {
            @Override
            public Observable<ServiceResponse<VpnServerConfigurationInner>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<VpnServerConfigurationInner> clientResponse = updateTagsDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #29
Source File: ContainerServicesInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Creates or updates a container service.
 * Creates or updates a container service with the specified configuration of orchestrator, masters, and agents.
 *
 * @param resourceGroupName The name of the resource group.
 * @param containerServiceName The name of the container service in the specified subscription and resource group.
 * @param parameters Parameters supplied to the Create or Update a Container Service operation.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the ContainerServiceInner object
 */
public Observable<ServiceResponse<ContainerServiceInner>> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (containerServiceName == null) {
        throw new IllegalArgumentException("Parameter containerServiceName 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 = "2017-01-31";
    return service.beginCreateOrUpdate(resourceGroupName, containerServiceName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ContainerServiceInner>>>() {
            @Override
            public Observable<ServiceResponse<ContainerServiceInner>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<ContainerServiceInner> clientResponse = beginCreateOrUpdateDelegate(response);
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}
 
Example #30
Source File: MongoDBResourcesInner.java    From azure-libraries-for-java with MIT License 5 votes vote down vote up
/**
 * Lists the MongoDB collection under an existing Azure Cosmos DB database account.
 *
 * @param resourceGroupName Name of an Azure resource group.
 * @param accountName Cosmos DB database account name.
 * @param databaseName Cosmos DB database name.
 * @throws IllegalArgumentException thrown if parameters fail the validation
 * @return the observable to the List&lt;MongoDBCollectionGetResultsInner&gt; object
 */
public Observable<ServiceResponse<List<MongoDBCollectionGetResultsInner>>> listMongoDBCollectionsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) {
    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 (accountName == null) {
        throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
    }
    if (databaseName == null) {
        throw new IllegalArgumentException("Parameter databaseName is required and cannot be null.");
    }
    final String apiVersion = "2019-08-01";
    return service.listMongoDBCollections(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
        .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<MongoDBCollectionGetResultsInner>>>>() {
            @Override
            public Observable<ServiceResponse<List<MongoDBCollectionGetResultsInner>>> call(Response<ResponseBody> response) {
                try {
                    ServiceResponse<PageImpl<MongoDBCollectionGetResultsInner>> result = listMongoDBCollectionsDelegate(response);
                    List<MongoDBCollectionGetResultsInner> items = null;
                    if (result.body() != null) {
                        items = result.body().items();
                    }
                    ServiceResponse<List<MongoDBCollectionGetResultsInner>> clientResponse = new ServiceResponse<List<MongoDBCollectionGetResultsInner>>(items, result.response());
                    return Observable.just(clientResponse);
                } catch (Throwable t) {
                    return Observable.error(t);
                }
            }
        });
}