com.microsoft.azure.management.graphrbac.implementation.RoleAssignmentsInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-mgmt-graph-rbac Show documentation
Show all versions of azure-mgmt-graph-rbac Show documentation
This package contains Microsoft Azure Graph RBAC Management SDK. This package has been deprecated. A replacement package com.azure.resourcemanager:azure-resourcemanager-authorization is available as of 31-March-2022. We strongly encourage you to upgrade to continue receiving updates. See Migration Guide https://aka.ms/java-track2-migration-guide for guidance on upgrading. Refer to our deprecation policy https://azure.github.io/azure-sdk/policies_support.html for more details.
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.graphrbac.implementation;
import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete;
import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceFuture;
import com.microsoft.azure.CloudException;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.Page;
import com.microsoft.azure.PagedList;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.Validator;
import java.io.IOException;
import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.HTTP;
import retrofit2.http.Path;
import retrofit2.http.PUT;
import retrofit2.http.Query;
import retrofit2.http.Url;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
/**
* An instance of this class provides access to all the operations defined
* in RoleAssignments.
*/
public class RoleAssignmentsInner implements InnerSupportsDelete, InnerSupportsListing {
/** The Retrofit service to perform REST calls. */
private RoleAssignmentsService service;
/** The service client containing this operation class. */
private AuthorizationManagementClientImpl client;
/**
* Initializes an instance of RoleAssignmentsInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public RoleAssignmentsInner(Retrofit retrofit, AuthorizationManagementClientImpl client) {
this.service = retrofit.create(RoleAssignmentsService.class);
this.client = client;
}
/**
* The interface defining all the services for RoleAssignments to be
* used by Retrofit to perform actually REST calls.
*/
interface RoleAssignmentsService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments listForResource" })
@GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments")
Observable> listForResource(@Path("resourceGroupName") String resourceGroupName, @Path("resourceProviderNamespace") String resourceProviderNamespace, @Path(value = "parentResourcePath", encoded = true) String parentResourcePath, @Path(value = "resourceType", encoded = true) String resourceType, @Path("resourceName") String resourceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments listByResourceGroup" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments")
Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments delete" })
@HTTP(path = "{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", method = "DELETE", hasBody = true)
Observable> delete(@Path(value = "scope", encoded = true) String scope, @Path("roleAssignmentName") String roleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments create" })
@PUT("{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}")
Observable> create(@Path(value = "scope", encoded = true) String scope, @Path("roleAssignmentName") String roleAssignmentName, @Body RoleAssignmentCreateParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments get" })
@GET("{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}")
Observable> get(@Path(value = "scope", encoded = true) String scope, @Path("roleAssignmentName") String roleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments deleteById" })
@HTTP(path = "{roleId}", method = "DELETE", hasBody = true)
Observable> deleteById(@Path(value = "roleId", encoded = true) String roleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments createById" })
@PUT("{roleId}")
Observable> createById(@Path(value = "roleId", encoded = true) String roleId, @Body RoleAssignmentCreateParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments getById" })
@GET("{roleId}")
Observable> getById(@Path(value = "roleId", encoded = true) String roleId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments list" })
@GET("subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments")
Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments listForScope" })
@GET("{scope}/providers/Microsoft.Authorization/roleAssignments")
Observable> listForScope(@Path(value = "scope", encoded = true) String scope, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments listForResourceNext" })
@GET
Observable> listForResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments listByResourceGroupNext" })
@GET
Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments listNext" })
@GET
Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.graphrbac.RoleAssignments listForScopeNext" })
@GET
Observable> listForScopeNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
/**
* Gets role assignments for a resource.
*
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type of the resource.
* @param resourceName The name of the resource to get role assignments for.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<RoleAssignmentInner> object if successful.
*/
public PagedList listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) {
ServiceResponse> response = listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName).toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Gets role assignments for a resource.
*
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type of the resource.
* @param resourceName The name of the resource to get role assignments for.
* @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> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName),
new Func1>>>() {
@Override
public Observable>> call(String nextPageLink) {
return listForResourceNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Gets role assignments for a resource.
*
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type of the resource.
* @param resourceName The name of the resource to get role assignments for.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<RoleAssignmentInner> object
*/
public Observable> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) {
return listForResourceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName)
.map(new Func1>, Page>() {
@Override
public Page call(ServiceResponse> response) {
return response.body();
}
});
}
/**
* Gets role assignments for a resource.
*
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type of the resource.
* @param resourceName The name of the resource to get role assignments for.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<RoleAssignmentInner> object
*/
public Observable>> listForResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) {
return listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName)
.concatMap(new Func1>, Observable>>>() {
@Override
public Observable>> call(ServiceResponse> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Gets role assignments for a resource.
*
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type of the resource.
* @param resourceName The name of the resource to get role assignments for.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<RoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable>> listForResourceSinglePageAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceProviderNamespace == null) {
throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.");
}
if (parentResourcePath == null) {
throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.");
}
if (resourceType == null) {
throw new IllegalArgumentException("Parameter resourceType is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName 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 = "2018-01-01-preview";
final String filter = null;
return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>>() {
@Override
public Observable>> call(Response response) {
try {
ServiceResponse> result = listForResourceDelegate(response);
return Observable.just(new ServiceResponse>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Gets role assignments for a resource.
*
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type of the resource.
* @param resourceName The name of the resource to get role assignments for.
* @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<RoleAssignmentInner> object if successful.
*/
public PagedList listForResource(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) {
ServiceResponse> response = listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter).toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
return listForResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Gets role assignments for a resource.
*
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type of the resource.
* @param resourceName The name of the resource to get role assignments for.
* @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @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> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter, final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter),
new Func1>>>() {
@Override
public Observable>> call(String nextPageLink) {
return listForResourceNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Gets role assignments for a resource.
*
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type of the resource.
* @param resourceName The name of the resource to get role assignments for.
* @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<RoleAssignmentInner> object
*/
public Observable> listForResourceAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) {
return listForResourceWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter)
.map(new Func1>, Page>() {
@Override
public Page call(ServiceResponse> response) {
return response.body();
}
});
}
/**
* Gets role assignments for a resource.
*
* @param resourceGroupName The name of the resource group.
* @param resourceProviderNamespace The namespace of the resource provider.
* @param parentResourcePath The parent resource identity.
* @param resourceType The resource type of the resource.
* @param resourceName The name of the resource to get role assignments for.
* @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<RoleAssignmentInner> object
*/
public Observable>> listForResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) {
return listForResourceSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter)
.concatMap(new Func1>, Observable>>>() {
@Override
public Observable>> call(ServiceResponse> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listForResourceNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Gets role assignments for a resource.
*
ServiceResponse> * @param resourceGroupName The name of the resource group.
ServiceResponse> * @param resourceProviderNamespace The namespace of the resource provider.
ServiceResponse> * @param parentResourcePath The parent resource identity.
ServiceResponse> * @param resourceType The resource type of the resource.
ServiceResponse> * @param resourceName The name of the resource to get role assignments for.
ServiceResponse> * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<RoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable>> listForResourceSinglePageAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (resourceProviderNamespace == null) {
throw new IllegalArgumentException("Parameter resourceProviderNamespace is required and cannot be null.");
}
if (parentResourcePath == null) {
throw new IllegalArgumentException("Parameter parentResourcePath is required and cannot be null.");
}
if (resourceType == null) {
throw new IllegalArgumentException("Parameter resourceType is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName 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 = "2018-01-01-preview";
return service.listForResource(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>>() {
@Override
public Observable>> call(Response response) {
try {
ServiceResponse> result = listForResourceDelegate(response);
return Observable.just(new ServiceResponse>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse> listForResourceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Gets role assignments for a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<RoleAssignmentInner> object if successful.
*/
public PagedList listByResourceGroup(final String resourceGroupName) {
ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Gets role assignments for a resource group.
*
* @param resourceGroupName The name of the resource group.
* @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> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listByResourceGroupSinglePageAsync(resourceGroupName),
new Func1>>>() {
@Override
public Observable>> call(String nextPageLink) {
return listByResourceGroupNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Gets role assignments for a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<RoleAssignmentInner> object
*/
public Observable> listByResourceGroupAsync(final String resourceGroupName) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName)
.map(new Func1>, Page>() {
@Override
public Page call(ServiceResponse> response) {
return response.body();
}
});
}
/**
* Gets role assignments for a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<RoleAssignmentInner> object
*/
public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) {
return listByResourceGroupSinglePageAsync(resourceGroupName)
.concatMap(new Func1>, Observable>>>() {
@Override
public Observable>> call(ServiceResponse> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Gets role assignments for a resource group.
*
* @param resourceGroupName The name of the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<RoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName 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 = "2018-01-01-preview";
final String filter = null;
return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>>() {
@Override
public Observable>> call(Response response) {
try {
ServiceResponse> result = listByResourceGroupDelegate(response);
return Observable.just(new ServiceResponse>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Gets role assignments for a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<RoleAssignmentInner> object if successful.
*/
public PagedList listByResourceGroup(final String resourceGroupName, final String filter) {
ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName, filter).toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Gets role assignments for a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @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> listByResourceGroupAsync(final String resourceGroupName, final String filter, final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listByResourceGroupSinglePageAsync(resourceGroupName, filter),
new Func1>>>() {
@Override
public Observable>> call(String nextPageLink) {
return listByResourceGroupNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Gets role assignments for a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<RoleAssignmentInner> object
*/
public Observable> listByResourceGroupAsync(final String resourceGroupName, final String filter) {
return listByResourceGroupWithServiceResponseAsync(resourceGroupName, filter)
.map(new Func1>, Page>() {
@Override
public Page call(ServiceResponse> response) {
return response.body();
}
});
}
/**
* Gets role assignments for a resource group.
*
* @param resourceGroupName The name of the resource group.
* @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<RoleAssignmentInner> object
*/
public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName, final String filter) {
return listByResourceGroupSinglePageAsync(resourceGroupName, filter)
.concatMap(new Func1>, Observable>>>() {
@Override
public Observable>> call(ServiceResponse> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Gets role assignments for a resource group.
*
ServiceResponse> * @param resourceGroupName The name of the resource group.
ServiceResponse> * @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<RoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName, final String filter) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName 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 = "2018-01-01-preview";
return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>>() {
@Override
public Observable>> call(Response response) {
try {
ServiceResponse> result = listByResourceGroupDelegate(response);
return Observable.just(new ServiceResponse>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Deletes a role assignment.
*
* @param scope The scope of the role assignment to delete.
* @param roleAssignmentName The name of the role assignment to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the RoleAssignmentInner object if successful.
*/
public RoleAssignmentInner delete(String scope, String roleAssignmentName) {
return deleteWithServiceResponseAsync(scope, roleAssignmentName).toBlocking().single().body();
}
/**
* Deletes a role assignment.
*
* @param scope The scope of the role assignment to delete.
* @param roleAssignmentName The name of the role assignment to delete.
* @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 deleteAsync(String scope, String roleAssignmentName, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(scope, roleAssignmentName), serviceCallback);
}
/**
* Deletes a role assignment.
*
* @param scope The scope of the role assignment to delete.
* @param roleAssignmentName The name of the role assignment to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable deleteAsync(String scope, String roleAssignmentName) {
return deleteWithServiceResponseAsync(scope, roleAssignmentName).map(new Func1, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Deletes a role assignment.
*
* @param scope The scope of the role assignment to delete.
* @param roleAssignmentName The name of the role assignment to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable> deleteWithServiceResponseAsync(String scope, String roleAssignmentName) {
if (scope == null) {
throw new IllegalArgumentException("Parameter scope is required and cannot be null.");
}
if (roleAssignmentName == null) {
throw new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null.");
}
final String apiVersion = "2018-01-01-preview";
return service.delete(scope, roleAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = deleteDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(200, new TypeToken() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Creates a role assignment.
*
* @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource.
* @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID.
* @param parameters Parameters for the role assignment.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the RoleAssignmentInner object if successful.
*/
public RoleAssignmentInner create(String scope, String roleAssignmentName, RoleAssignmentCreateParametersInner parameters) {
return createWithServiceResponseAsync(scope, roleAssignmentName, parameters).toBlocking().single().body();
}
/**
* Creates a role assignment.
*
* @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource.
* @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID.
* @param parameters Parameters for the role assignment.
* @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 createAsync(String scope, String roleAssignmentName, RoleAssignmentCreateParametersInner parameters, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(createWithServiceResponseAsync(scope, roleAssignmentName, parameters), serviceCallback);
}
/**
* Creates a role assignment.
*
* @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource.
* @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID.
* @param parameters Parameters for the role assignment.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable createAsync(String scope, String roleAssignmentName, RoleAssignmentCreateParametersInner parameters) {
return createWithServiceResponseAsync(scope, roleAssignmentName, parameters).map(new Func1, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Creates a role assignment.
*
* @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource.
* @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID.
* @param parameters Parameters for the role assignment.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable> createWithServiceResponseAsync(String scope, String roleAssignmentName, RoleAssignmentCreateParametersInner parameters) {
if (scope == null) {
throw new IllegalArgumentException("Parameter scope is required and cannot be null.");
}
if (roleAssignmentName == null) {
throw new IllegalArgumentException("Parameter roleAssignmentName 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-01-01-preview";
return service.create(scope, roleAssignmentName, parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = createDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse createDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(201, new TypeToken() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Get the specified role assignment.
*
* @param scope The scope of the role assignment.
* @param roleAssignmentName The name of the role assignment to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the RoleAssignmentInner object if successful.
*/
public RoleAssignmentInner get(String scope, String roleAssignmentName) {
return getWithServiceResponseAsync(scope, roleAssignmentName).toBlocking().single().body();
}
/**
* Get the specified role assignment.
*
* @param scope The scope of the role assignment.
* @param roleAssignmentName The name of the role assignment to get.
* @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 getAsync(String scope, String roleAssignmentName, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(getWithServiceResponseAsync(scope, roleAssignmentName), serviceCallback);
}
/**
* Get the specified role assignment.
*
* @param scope The scope of the role assignment.
* @param roleAssignmentName The name of the role assignment to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable getAsync(String scope, String roleAssignmentName) {
return getWithServiceResponseAsync(scope, roleAssignmentName).map(new Func1, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Get the specified role assignment.
*
* @param scope The scope of the role assignment.
* @param roleAssignmentName The name of the role assignment to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable> getWithServiceResponseAsync(String scope, String roleAssignmentName) {
if (scope == null) {
throw new IllegalArgumentException("Parameter scope is required and cannot be null.");
}
if (roleAssignmentName == null) {
throw new IllegalArgumentException("Parameter roleAssignmentName is required and cannot be null.");
}
final String apiVersion = "2018-01-01-preview";
return service.get(scope, roleAssignmentName, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = getDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(200, new TypeToken() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Deletes a role assignment.
*
* @param roleId The ID of the role assignment to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the RoleAssignmentInner object if successful.
*/
public RoleAssignmentInner deleteById(String roleId) {
return deleteByIdWithServiceResponseAsync(roleId).toBlocking().single().body();
}
/**
* Deletes a role assignment.
*
* @param roleId The ID of the role assignment to delete.
* @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 deleteByIdAsync(String roleId, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(deleteByIdWithServiceResponseAsync(roleId), serviceCallback);
}
/**
* Deletes a role assignment.
*
* @param roleId The ID of the role assignment to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable deleteByIdAsync(String roleId) {
return deleteByIdWithServiceResponseAsync(roleId).map(new Func1, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Deletes a role assignment.
*
* @param roleId The ID of the role assignment to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable> deleteByIdWithServiceResponseAsync(String roleId) {
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
final String apiVersion = "2018-01-01-preview";
return service.deleteById(roleId, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = deleteByIdDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse deleteByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(200, new TypeToken() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Creates a role assignment by ID.
*
* @param roleId The ID of the role assignment to create.
* @param parameters Parameters for the role assignment.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the RoleAssignmentInner object if successful.
*/
public RoleAssignmentInner createById(String roleId, RoleAssignmentCreateParametersInner parameters) {
return createByIdWithServiceResponseAsync(roleId, parameters).toBlocking().single().body();
}
/**
* Creates a role assignment by ID.
*
* @param roleId The ID of the role assignment to create.
* @param parameters Parameters for the role assignment.
* @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 createByIdAsync(String roleId, RoleAssignmentCreateParametersInner parameters, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(createByIdWithServiceResponseAsync(roleId, parameters), serviceCallback);
}
/**
* Creates a role assignment by ID.
*
* @param roleId The ID of the role assignment to create.
* @param parameters Parameters for the role assignment.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable createByIdAsync(String roleId, RoleAssignmentCreateParametersInner parameters) {
return createByIdWithServiceResponseAsync(roleId, parameters).map(new Func1, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Creates a role assignment by ID.
*
* @param roleId The ID of the role assignment to create.
* @param parameters Parameters for the role assignment.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable> createByIdWithServiceResponseAsync(String roleId, RoleAssignmentCreateParametersInner parameters) {
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId 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-01-01-preview";
return service.createById(roleId, parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = createByIdDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse createByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(201, new TypeToken() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Gets a role assignment by ID.
*
* @param roleId The ID of the role assignment to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the RoleAssignmentInner object if successful.
*/
public RoleAssignmentInner getById(String roleId) {
return getByIdWithServiceResponseAsync(roleId).toBlocking().single().body();
}
/**
* Gets a role assignment by ID.
*
* @param roleId The ID of the role assignment to get.
* @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 getByIdAsync(String roleId, final ServiceCallback serviceCallback) {
return ServiceFuture.fromResponse(getByIdWithServiceResponseAsync(roleId), serviceCallback);
}
/**
* Gets a role assignment by ID.
*
* @param roleId The ID of the role assignment to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable getByIdAsync(String roleId) {
return getByIdWithServiceResponseAsync(roleId).map(new Func1, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse response) {
return response.body();
}
});
}
/**
* Gets a role assignment by ID.
*
* @param roleId The ID of the role assignment to get.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RoleAssignmentInner object
*/
public Observable> getByIdWithServiceResponseAsync(String roleId) {
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
final String apiVersion = "2018-01-01-preview";
return service.getById(roleId, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>() {
@Override
public Observable> call(Response response) {
try {
ServiceResponse clientResponse = getByIdDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse getByIdDelegate(Response response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter())
.register(200, new TypeToken() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Gets all role assignments for the subscription.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<RoleAssignmentInner> object if successful.
*/
public PagedList list() {
ServiceResponse> response = listSinglePageAsync().toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Gets all role assignments for the 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> listAsync(final ListOperationCallback serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listSinglePageAsync(),
new Func1>>>() {
@Override
public Observable>> call(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
/**
* Gets all role assignments for the subscription.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<RoleAssignmentInner> object
*/
public Observable> listAsync() {
return listWithServiceResponseAsync()
.map(new Func1>, Page>() {
@Override
public Page call(ServiceResponse> response) {
return response.body();
}
});
}
/**
* Gets all role assignments for the subscription.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<RoleAssignmentInner> object
*/
public Observable>> listWithServiceResponseAsync() {
return listSinglePageAsync()
.concatMap(new Func1>, Observable>>>() {
@Override
public Observable>> call(ServiceResponse> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink));
}
});
}
/**
* Gets all role assignments for the subscription.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<RoleAssignmentInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable>> listSinglePageAsync() {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2018-01-01-preview";
final String filter = null;
return service.list(this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1, Observable>>>() {
@Override
public Observable>> call(Response response) {
try {
ServiceResponse> result = listDelegate(response);
return Observable.just(new ServiceResponse>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Gets all role assignments for the subscription.
*
* @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedList<RoleAssignmentInner> object if successful.
*/
public PagedList list(final String filter) {
ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single();
return new PagedList(response.body()) {
@Override
public Page nextPage(String nextPageLink) {
return listNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
/**
* Gets all role assignments for the subscription.
*
* @param filter The filter to apply on the operation. Use $filter=atScope() to return all role assignments at or above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope for the specified principal.
* @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