From c41b1f36385755990f0312b11d9747d7430dfd0a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 30 Aug 2018 21:35:59 +0000 Subject: [PATCH 1/9] Generated from 4f1bc64b5cf55e3d88c78d226a55096011c19183 Fix Broken restore --- .../ApplicationListResultInner.java | 70 ++++++ .../implementation/ApplicationsInner.java | 82 +++++++ .../DeletedApplicationsInner.java | 216 ++++++++++++++++++ .../GraphRbacManagementClientImpl.java | 14 ++ 4 files changed, 382 insertions(+) create mode 100644 azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationListResultInner.java create mode 100644 azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationListResultInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationListResultInner.java new file mode 100644 index 000000000000..23b2ef85a172 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationListResultInner.java @@ -0,0 +1,70 @@ +/** + * 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.graphrbac.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Application list operation result. + */ +public class ApplicationListResultInner { + /** + * A collection of applications. + */ + @JsonProperty(value = "value") + private List value; + + /** + * The URL to get the next set of results. + */ + @JsonProperty(value = "odata\\.nextLink") + private String odatanextLink; + + /** + * Get a collection of applications. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set a collection of applications. + * + * @param value the value value to set + * @return the ApplicationListResultInner object itself. + */ + public ApplicationListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the URL to get the next set of results. + * + * @return the odatanextLink value + */ + public String odatanextLink() { + return this.odatanextLink; + } + + /** + * Set the URL to get the next set of results. + * + * @param odatanextLink the odatanextLink value to set + * @return the ApplicationListResultInner object itself. + */ + public ApplicationListResultInner withOdatanextLink(String odatanextLink) { + this.odatanextLink = odatanextLink; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java index 6018e33ac36f..18408dc1bc1f 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java @@ -75,6 +75,10 @@ interface ApplicationsService { @GET("{tenantID}/applications") Observable> list(@Path("tenantID") String tenantID, @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.graphrbac.Applications hardDelete" }) + @HTTP(path = "{tenantID}/deletedApplications/{applicationObjectId}", method = "DELETE", hasBody = true) + Observable> hardDelete(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @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.graphrbac.Applications delete" }) @HTTP(path = "{tenantID}/applications/{applicationObjectId}", method = "DELETE", hasBody = true) Observable> delete(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -410,6 +414,84 @@ private ServiceResponse> listDelegate(Response hardDeleteAsync(String applicationObjectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(hardDeleteWithServiceResponseAsync(applicationObjectId), serviceCallback); + } + + /** + * Hard-delete an application. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable hardDeleteAsync(String applicationObjectId) { + return hardDeleteWithServiceResponseAsync(applicationObjectId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Hard-delete an application. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> hardDeleteWithServiceResponseAsync(String applicationObjectId) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.hardDelete(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = hardDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse hardDeleteDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + /** * Delete an application. * diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java new file mode 100644 index 000000000000..993096a8cafe --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java @@ -0,0 +1,216 @@ +/** + * 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.graphrbac.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.graphrbac.GraphErrorException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DeletedApplications. + */ +public class DeletedApplicationsInner { + /** The Retrofit service to perform REST calls. */ + private DeletedApplicationsService service; + /** The service client containing this operation class. */ + private GraphRbacManagementClientImpl client; + + /** + * Initializes an instance of DeletedApplicationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DeletedApplicationsInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { + this.service = retrofit.create(DeletedApplicationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DeletedApplications to be + * used by Retrofit to perform actually REST calls. + */ + interface DeletedApplicationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.DeletedApplications restore" }) + @POST("{tenantID}/deletedApplications/{objectId}/restore") + Observable> restore(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.DeletedApplications get" }) + @GET("{tenantID}/deletedApplications") + Observable> get(@Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Restores the deleted application in the directory. + * + * @param objectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws GraphErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationInner object if successful. + */ + public ApplicationInner restore(String objectId) { + return restoreWithServiceResponseAsync(objectId).toBlocking().single().body(); + } + + /** + * Restores the deleted application in the directory. + * + * @param objectId Application object ID. + * @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 restoreAsync(String objectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(restoreWithServiceResponseAsync(objectId), serviceCallback); + } + + /** + * Restores the deleted application in the directory. + * + * @param objectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable restoreAsync(String objectId) { + return restoreWithServiceResponseAsync(objectId).map(new Func1, ApplicationInner>() { + @Override + public ApplicationInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Restores the deleted application in the directory. + * + * @param objectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationInner object + */ + public Observable> restoreWithServiceResponseAsync(String objectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.restore(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = restoreDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse restoreDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Gets a list of deleted applications in the directory. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws GraphErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ApplicationListResultInner object if successful. + */ + public ApplicationListResultInner get() { + return getWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets a list of deleted applications in the directory. + * + * @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(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets a list of deleted applications in the directory. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationListResultInner object + */ + public Observable getAsync() { + return getWithServiceResponseAsync().map(new Func1, ApplicationListResultInner>() { + @Override + public ApplicationListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a list of deleted applications in the directory. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ApplicationListResultInner object + */ + public Observable> getWithServiceResponseAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.get(this.client.tenantID(), this.client.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 GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java index 9dce606ca9a9..ddaeb489d50c 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java @@ -158,6 +158,19 @@ public ApplicationsInner applications() { return this.applications; } + /** + * The DeletedApplicationsInner object to access its operations. + */ + private DeletedApplicationsInner deletedApplications; + + /** + * Gets the DeletedApplicationsInner object to access its operations. + * @return the DeletedApplicationsInner object. + */ + public DeletedApplicationsInner deletedApplications() { + return this.deletedApplications; + } + /** * The GroupsInner object to access its operations. */ @@ -260,6 +273,7 @@ protected void initialize() { this.generateClientRequestId = true; this.objects = new ObjectsInner(restClient().retrofit(), this); this.applications = new ApplicationsInner(restClient().retrofit(), this); + this.deletedApplications = new DeletedApplicationsInner(restClient().retrofit(), this); this.groups = new GroupsInner(restClient().retrofit(), this); this.servicePrincipals = new ServicePrincipalsInner(restClient().retrofit(), this); this.users = new UsersInner(restClient().retrofit(), this); From f9166a9d241392cca0bea659ddf1dc4b659b7d41 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 30 Aug 2018 21:38:17 +0000 Subject: [PATCH 2/9] Generated from 4f1bc64b5cf55e3d88c78d226a55096011c19183 Fix Broken restore --- .../implementation/ApplicationsInner.java | 82 ------------------ .../DeletedApplicationsInner.java | 83 +++++++++++++++++++ 2 files changed, 83 insertions(+), 82 deletions(-) diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java index 18408dc1bc1f..6018e33ac36f 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java @@ -75,10 +75,6 @@ interface ApplicationsService { @GET("{tenantID}/applications") Observable> list(@Path("tenantID") String tenantID, @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.graphrbac.Applications hardDelete" }) - @HTTP(path = "{tenantID}/deletedApplications/{applicationObjectId}", method = "DELETE", hasBody = true) - Observable> hardDelete(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @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.graphrbac.Applications delete" }) @HTTP(path = "{tenantID}/applications/{applicationObjectId}", method = "DELETE", hasBody = true) Observable> delete(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -414,84 +410,6 @@ private ServiceResponse> listDelegate(Response hardDeleteAsync(String applicationObjectId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(hardDeleteWithServiceResponseAsync(applicationObjectId), serviceCallback); - } - - /** - * Hard-delete an application. - * - * @param applicationObjectId Application object ID. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. - */ - public Observable hardDeleteAsync(String applicationObjectId) { - return hardDeleteWithServiceResponseAsync(applicationObjectId).map(new Func1, Void>() { - @Override - public Void call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Hard-delete an application. - * - * @param applicationObjectId Application object ID. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the {@link ServiceResponse} object if successful. - */ - public Observable> hardDeleteWithServiceResponseAsync(String applicationObjectId) { - if (applicationObjectId == null) { - throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); - } - if (this.client.tenantID() == null) { - throw new IllegalArgumentException("Parameter this.client.tenantID() 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.hardDelete(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = hardDeleteDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse hardDeleteDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(204, new TypeToken() { }.getType()) - .registerError(GraphErrorException.class) - .build(response); - } - /** * Delete an application. * diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java index 993096a8cafe..485c0cc90f93 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java @@ -19,6 +19,7 @@ import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; +import retrofit2.http.HTTP; import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.Query; @@ -60,6 +61,10 @@ interface DeletedApplicationsService { @GET("{tenantID}/deletedApplications") Observable> get(@Path("tenantID") String tenantID, @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.graphrbac.DeletedApplications hardDelete" }) + @HTTP(path = "{tenantID}/deletedApplications/{applicationObjectId}", method = "DELETE", hasBody = true) + Observable> hardDelete(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -213,4 +218,82 @@ private ServiceResponse getDelegate(Response hardDeleteAsync(String applicationObjectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(hardDeleteWithServiceResponseAsync(applicationObjectId), serviceCallback); + } + + /** + * Hard-delete an application. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable hardDeleteAsync(String applicationObjectId) { + return hardDeleteWithServiceResponseAsync(applicationObjectId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Hard-delete an application. + * + * @param applicationObjectId Application object ID. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> hardDeleteWithServiceResponseAsync(String applicationObjectId) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.hardDelete(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = hardDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse hardDeleteDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + } From 8c9357be1ec042f666fe636eb6dd8844db8b3098 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 31 Aug 2018 10:25:03 +0000 Subject: [PATCH 3/9] Generated from 38da2338b7f2a290829acc0a0cd49cf1edc4cc0b Backward compat for ApplicationAddOwnerParameter --- .../azure/graphrbac/AddOwnerParameters.java | 74 +++++++ .../microsoft/azure/graphrbac/AppRole.java | 182 +++++++++++++++ .../ApplicationAddOwnerParameters.java | 62 +----- .../implementation/ADGroupInner.java | 53 +++++ .../implementation/ApplicationInner.java | 28 +++ .../DirectoryObjectListResultInner.java | 44 ++++ .../GraphRbacManagementClientImpl.java | 28 ++- .../graphrbac/implementation/GroupsInner.java | 183 +++++++++++++++ .../implementation/ObjectsInner.java | 152 ++++++------- .../implementation/ServicePrincipalInner.java | 28 +++ .../implementation/SignedInUsersInner.java | 208 ++++++++++++++++++ 11 files changed, 899 insertions(+), 143 deletions(-) create mode 100644 azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/AddOwnerParameters.java create mode 100644 azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/AppRole.java create mode 100644 azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DirectoryObjectListResultInner.java create mode 100644 azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/AddOwnerParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/AddOwnerParameters.java new file mode 100644 index 000000000000..755e4d86ec3c --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/AddOwnerParameters.java @@ -0,0 +1,74 @@ +/** + * 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.graphrbac; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for adding a owner to an application. + */ +public class AddOwnerParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * A owner object URL, such as + * "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", + * where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and + * "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner + * (user, application, servicePrincipal, group) to be added. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the AddOwnerParameters object itself. + */ + public AddOwnerParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get a owner object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner (user, application, servicePrincipal, group) to be added. + * + * @return the url value + */ + public String url() { + return this.url; + } + + /** + * Set a owner object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner (user, application, servicePrincipal, group) to be added. + * + * @param url the url value to set + * @return the AddOwnerParameters object itself. + */ + public AddOwnerParameters withUrl(String url) { + this.url = url; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/AppRole.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/AppRole.java new file mode 100644 index 000000000000..3ff323c3ccf9 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/AppRole.java @@ -0,0 +1,182 @@ +/** + * 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.graphrbac; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The AppRole model. + */ +public class AppRole { + /** + * Unique role identifier inside the appRoles collection. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Specifies whether this app role definition can be assigned to users and + * groups by setting to 'User', or to other applications (that are + * accessing this application in daemon service scenarios) by setting to + * 'Application', or to both. + */ + @JsonProperty(value = "allowedMemberTypes") + private List allowedMemberTypes; + + /** + * Permission help text that appears in the admin app assignment and + * consent experiences. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Display name for the permission that appears in the admin consent and + * app assignment experiences. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * When creating or updating a role definition, this must be set to true + * (which is the default). To delete a role, this must first be set to + * false. At that point, in a subsequent call, this role may be removed. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /** + * Specifies the value of the roles claim that the application should + * expect in the authentication and access tokens. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get unique role identifier inside the appRoles collection. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set unique role identifier inside the appRoles collection. + * + * @param id the id value to set + * @return the AppRole object itself. + */ + public AppRole withId(String id) { + this.id = id; + return this; + } + + /** + * Get specifies whether this app role definition can be assigned to users and groups by setting to 'User', or to other applications (that are accessing this application in daemon service scenarios) by setting to 'Application', or to both. + * + * @return the allowedMemberTypes value + */ + public List allowedMemberTypes() { + return this.allowedMemberTypes; + } + + /** + * Set specifies whether this app role definition can be assigned to users and groups by setting to 'User', or to other applications (that are accessing this application in daemon service scenarios) by setting to 'Application', or to both. + * + * @param allowedMemberTypes the allowedMemberTypes value to set + * @return the AppRole object itself. + */ + public AppRole withAllowedMemberTypes(List allowedMemberTypes) { + this.allowedMemberTypes = allowedMemberTypes; + return this; + } + + /** + * Get permission help text that appears in the admin app assignment and consent experiences. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set permission help text that appears in the admin app assignment and consent experiences. + * + * @param description the description value to set + * @return the AppRole object itself. + */ + public AppRole withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get display name for the permission that appears in the admin consent and app assignment experiences. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set display name for the permission that appears in the admin consent and app assignment experiences. + * + * @param displayName the displayName value to set + * @return the AppRole object itself. + */ + public AppRole withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get when creating or updating a role definition, this must be set to true (which is the default). To delete a role, this must first be set to false. At that point, in a subsequent call, this role may be removed. + * + * @return the isEnabled value + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set when creating or updating a role definition, this must be set to true (which is the default). To delete a role, this must first be set to false. At that point, in a subsequent call, this role may be removed. + * + * @param isEnabled the isEnabled value to set + * @return the AppRole object itself. + */ + public AppRole withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get specifies the value of the roles claim that the application should expect in the authentication and access tokens. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set specifies the value of the roles claim that the application should expect in the authentication and access tokens. + * + * @param value the value value to set + * @return the AppRole object itself. + */ + public AppRole withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationAddOwnerParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationAddOwnerParameters.java index e02bc2f0ddf3..1203f07434bd 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationAddOwnerParameters.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationAddOwnerParameters.java @@ -8,67 +8,9 @@ package com.microsoft.azure.graphrbac; -import java.util.Map; -import com.fasterxml.jackson.annotation.JsonProperty; /** - * Request parameters for adding a owner to an application. + * The ApplicationAddOwnerParameters model. */ -public class ApplicationAddOwnerParameters { - /** - * Unmatched properties from the message are deserialized this collection. - */ - @JsonProperty(value = "") - private Map additionalProperties; - - /** - * A owner object URL, such as - * "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", - * where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and - * "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner - * (user, application, servicePrincipal, group) to be added. - */ - @JsonProperty(value = "url", required = true) - private String url; - - /** - * Get unmatched properties from the message are deserialized this collection. - * - * @return the additionalProperties value - */ - public Map additionalProperties() { - return this.additionalProperties; - } - - /** - * Set unmatched properties from the message are deserialized this collection. - * - * @param additionalProperties the additionalProperties value to set - * @return the ApplicationAddOwnerParameters object itself. - */ - public ApplicationAddOwnerParameters withAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * Get a owner object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner (user, application, servicePrincipal, group) to be added. - * - * @return the url value - */ - public String url() { - return this.url; - } - - /** - * Set a owner object URL, such as "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner (user, application, servicePrincipal, group) to be added. - * - * @param url the url value to set - * @return the ApplicationAddOwnerParameters object itself. - */ - public ApplicationAddOwnerParameters withUrl(String url) { - this.url = url; - return this; - } - +public class ApplicationAddOwnerParameters extends AddOwnerParameters { } diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ADGroupInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ADGroupInner.java index b3bd9f764736..0346d1aefc4e 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ADGroupInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ADGroupInner.java @@ -24,6 +24,19 @@ public class ADGroupInner extends DirectoryObjectInner { @JsonProperty(value = "displayName") private String displayName; + /** + * Whether the group is mail-enabled. Must be false. This is because only + * pure security groups can be created using the Graph API. + */ + @JsonProperty(value = "mailEnabled") + private Boolean mailEnabled; + + /** + * The mail alias for the group. + */ + @JsonProperty(value = "mailNickname") + private String mailNickname; + /** * Whether the group is security-enable. */ @@ -56,6 +69,46 @@ public ADGroupInner withDisplayName(String displayName) { return this; } + /** + * Get whether the group is mail-enabled. Must be false. This is because only pure security groups can be created using the Graph API. + * + * @return the mailEnabled value + */ + public Boolean mailEnabled() { + return this.mailEnabled; + } + + /** + * Set whether the group is mail-enabled. Must be false. This is because only pure security groups can be created using the Graph API. + * + * @param mailEnabled the mailEnabled value to set + * @return the ADGroupInner object itself. + */ + public ADGroupInner withMailEnabled(Boolean mailEnabled) { + this.mailEnabled = mailEnabled; + return this; + } + + /** + * Get the mail alias for the group. + * + * @return the mailNickname value + */ + public String mailNickname() { + return this.mailNickname; + } + + /** + * Set the mail alias for the group. + * + * @param mailNickname the mailNickname value to set + * @return the ADGroupInner object itself. + */ + public ADGroupInner withMailNickname(String mailNickname) { + this.mailNickname = mailNickname; + return this; + } + /** * Get whether the group is security-enable. * diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationInner.java index 9d44bf0bb89a..5979e0d7bf34 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationInner.java @@ -9,6 +9,7 @@ package com.microsoft.azure.graphrbac.implementation; import java.util.List; +import com.microsoft.azure.graphrbac.AppRole; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -25,6 +26,13 @@ public class ApplicationInner extends DirectoryObjectInner { @JsonProperty(value = "appId") private String appId; + /** + * The collection of application roles that an application may declare. + * These roles can be assigned to users, groups or service principals. + */ + @JsonProperty(value = "appRoles") + private List appRoles; + /** * The application permissions. */ @@ -87,6 +95,26 @@ public ApplicationInner withAppId(String appId) { return this; } + /** + * Get the collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + * + * @return the appRoles value + */ + public List appRoles() { + return this.appRoles; + } + + /** + * Set the collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + * + * @param appRoles the appRoles value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withAppRoles(List appRoles) { + this.appRoles = appRoles; + return this; + } + /** * Get the application permissions. * diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DirectoryObjectListResultInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DirectoryObjectListResultInner.java new file mode 100644 index 000000000000..ea02a1064ef9 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DirectoryObjectListResultInner.java @@ -0,0 +1,44 @@ +/** + * 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.graphrbac.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * DirectoryObject list operation result. + */ +public class DirectoryObjectListResultInner { + /** + * A collection of DirectoryObject. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get a collection of DirectoryObject. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set a collection of DirectoryObject. + * + * @param value the value value to set + * @return the DirectoryObjectListResultInner object itself. + */ + public DirectoryObjectListResultInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java index ddaeb489d50c..4e9eca5ba4a9 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GraphRbacManagementClientImpl.java @@ -133,16 +133,16 @@ public GraphRbacManagementClientImpl withGenerateClientRequestId(boolean generat } /** - * The ObjectsInner object to access its operations. + * The SignedInUsersInner object to access its operations. */ - private ObjectsInner objects; + private SignedInUsersInner signedInUsers; /** - * Gets the ObjectsInner object to access its operations. - * @return the ObjectsInner object. + * Gets the SignedInUsersInner object to access its operations. + * @return the SignedInUsersInner object. */ - public ObjectsInner objects() { - return this.objects; + public SignedInUsersInner signedInUsers() { + return this.signedInUsers; } /** @@ -210,6 +210,19 @@ public UsersInner users() { return this.users; } + /** + * The ObjectsInner object to access its operations. + */ + private ObjectsInner objects; + + /** + * Gets the ObjectsInner object to access its operations. + * @return the ObjectsInner object. + */ + public ObjectsInner objects() { + return this.objects; + } + /** * The DomainsInner object to access its operations. */ @@ -271,12 +284,13 @@ protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; - this.objects = new ObjectsInner(restClient().retrofit(), this); + this.signedInUsers = new SignedInUsersInner(restClient().retrofit(), this); this.applications = new ApplicationsInner(restClient().retrofit(), this); this.deletedApplications = new DeletedApplicationsInner(restClient().retrofit(), this); this.groups = new GroupsInner(restClient().retrofit(), this); this.servicePrincipals = new ServicePrincipalsInner(restClient().retrofit(), this); this.users = new UsersInner(restClient().retrofit(), this); + this.objects = new ObjectsInner(restClient().retrofit(), this); this.domains = new DomainsInner(restClient().retrofit(), this); this.oAuth2s = new OAuth2sInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java index 4a3e2c9cb2ce..10497fb65a42 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java @@ -11,6 +11,7 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.graphrbac.AddOwnerParameters; import com.microsoft.azure.graphrbac.CheckGroupMembershipParameters; import com.microsoft.azure.graphrbac.GraphErrorException; import com.microsoft.azure.graphrbac.GroupAddMemberParameters; @@ -101,6 +102,14 @@ interface GroupsService { @POST("{tenantID}/groups/{objectId}/getMemberGroups") Observable> getMemberGroups(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @Body GroupGetMemberGroupsParameters 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.graphrbac.Groups listOwners" }) + @GET("{tenantID}/groups/{objectId}/owners") + Observable> listOwners(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.Groups addOwner" }) + @POST("{tenantID}/groups/{objectId}/$links/owners") + Observable> addOwner(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @Body AddOwnerParameters 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.graphrbac.Groups listNext" }) @GET Observable> listNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -1019,6 +1028,180 @@ private ServiceResponse> getMemberGroupsDelegate(Response listOwners(String objectId) { + return listOwnersWithServiceResponseAsync(objectId).toBlocking().single().body(); + } + + /** + * Directory objects that are owners of the group. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param objectId The object ID of the group for which to get owners. + * @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> listOwnersAsync(String objectId, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listOwnersWithServiceResponseAsync(objectId), serviceCallback); + } + + /** + * Directory objects that are owners of the group. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param objectId The object ID of the group for which to get owners. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DirectoryObjectInner> object + */ + public Observable> listOwnersAsync(String objectId) { + return listOwnersWithServiceResponseAsync(objectId).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Directory objects that are owners of the group. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param objectId The object ID of the group for which to get owners. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DirectoryObjectInner> object + */ + public Observable>> listOwnersWithServiceResponseAsync(String objectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.listOwners(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOwnersDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOwnersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Add an owner to a group. + * + * @param objectId The object ID of the application to which to add the owner. + * @param parameters The URL of the owner object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws GraphErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void addOwner(String objectId, AddOwnerParameters parameters) { + addOwnerWithServiceResponseAsync(objectId, parameters).toBlocking().single().body(); + } + + /** + * Add an owner to a group. + * + * @param objectId The object ID of the application to which to add the owner. + * @param parameters The URL of the owner object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @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 addOwnerAsync(String objectId, AddOwnerParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addOwnerWithServiceResponseAsync(objectId, parameters), serviceCallback); + } + + /** + * Add an owner to a group. + * + * @param objectId The object ID of the application to which to add the owner. + * @param parameters The URL of the owner object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable addOwnerAsync(String objectId, AddOwnerParameters parameters) { + return addOwnerWithServiceResponseAsync(objectId, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Add an owner to a group. + * + * @param objectId The object ID of the application to which to add the owner. + * @param parameters The URL of the owner object, such as https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> addOwnerWithServiceResponseAsync(String objectId, AddOwnerParameters parameters) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.addOwner(objectId, this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addOwnerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addOwnerDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + /** * Gets a list of groups for the current tenant. * diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java index 483cb3d3757f..a5a4945ca4d1 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java @@ -62,92 +62,20 @@ public ObjectsInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { * used by Retrofit to perform actually REST calls. */ interface ObjectsService { - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.Objects getCurrentUser" }) - @GET("{tenantID}/me") - Observable> getCurrentUser(@Path("tenantID") String tenantID, @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.graphrbac.Objects getObjectsByObjectIds" }) @POST("{tenantID}/getObjectsByObjectIds") Observable> getObjectsByObjectIds(@Path("tenantID") String tenantID, @Body GetObjectsParameters 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.graphrbac.Objects getCurrentUser" }) + @GET("{tenantID}/me") + Observable> getCurrentUser(@Path("tenantID") String tenantID, @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.graphrbac.Objects getObjectsByObjectIdsNext" }) @GET Observable> getObjectsByObjectIdsNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } - /** - * Gets the details for the currently logged-in user. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws GraphErrorException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the AADObjectInner object if successful. - */ - public AADObjectInner getCurrentUser() { - return getCurrentUserWithServiceResponseAsync().toBlocking().single().body(); - } - - /** - * Gets the details for the currently logged-in user. - * - * @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 getCurrentUserAsync(final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getCurrentUserWithServiceResponseAsync(), serviceCallback); - } - - /** - * Gets the details for the currently logged-in user. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the AADObjectInner object - */ - public Observable getCurrentUserAsync() { - return getCurrentUserWithServiceResponseAsync().map(new Func1, AADObjectInner>() { - @Override - public AADObjectInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Gets the details for the currently logged-in user. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the AADObjectInner object - */ - public Observable> getCurrentUserWithServiceResponseAsync() { - if (this.client.tenantID() == null) { - throw new IllegalArgumentException("Parameter this.client.tenantID() 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.getCurrentUser(this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = getCurrentUserDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse getCurrentUserDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(GraphErrorException.class) - .build(response); - } - /** * Gets AD group membership for the specified AD object IDs. * @@ -264,6 +192,78 @@ private ServiceResponse> getObjectsByObjectIdsDelegate( .build(response); } + /** + * Gets the details for the currently logged-in user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws GraphErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AADObjectInner object if successful. + */ + public AADObjectInner getCurrentUser() { + return getCurrentUserWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets the details for the currently logged-in user. + * + * @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 getCurrentUserAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCurrentUserWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets the details for the currently logged-in user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AADObjectInner object + */ + public Observable getCurrentUserAsync() { + return getCurrentUserWithServiceResponseAsync().map(new Func1, AADObjectInner>() { + @Override + public AADObjectInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the details for the currently logged-in user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AADObjectInner object + */ + public Observable> getCurrentUserWithServiceResponseAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.getCurrentUser(this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCurrentUserDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCurrentUserDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + /** * Gets AD group membership for the specified AD object IDs. * diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalInner.java index 8c8e5f9c7568..c151110c013a 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalInner.java @@ -9,6 +9,7 @@ package com.microsoft.azure.graphrbac.implementation; import java.util.List; +import com.microsoft.azure.graphrbac.AppRole; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -31,6 +32,13 @@ public class ServicePrincipalInner extends DirectoryObjectInner { @JsonProperty(value = "appId") private String appId; + /** + * The collection of application roles that an application may declare. + * These roles can be assigned to users, groups or service principals. + */ + @JsonProperty(value = "appRoles") + private List appRoles; + /** * A collection of service principal names. */ @@ -77,6 +85,26 @@ public ServicePrincipalInner withAppId(String appId) { return this; } + /** + * Get the collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + * + * @return the appRoles value + */ + public List appRoles() { + return this.appRoles; + } + + /** + * Set the collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + * + * @param appRoles the appRoles value to set + * @return the ServicePrincipalInner object itself. + */ + public ServicePrincipalInner withAppRoles(List appRoles) { + this.appRoles = appRoles; + return this; + } + /** * Get a collection of service principal names. * diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java new file mode 100644 index 000000000000..e9ed430a67a9 --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java @@ -0,0 +1,208 @@ +/** + * 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.graphrbac.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.graphrbac.GraphErrorException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in SignedInUsers. + */ +public class SignedInUsersInner { + /** The Retrofit service to perform REST calls. */ + private SignedInUsersService service; + /** The service client containing this operation class. */ + private GraphRbacManagementClientImpl client; + + /** + * Initializes an instance of SignedInUsersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SignedInUsersInner(Retrofit retrofit, GraphRbacManagementClientImpl client) { + this.service = retrofit.create(SignedInUsersService.class); + this.client = client; + } + + /** + * The interface defining all the services for SignedInUsers to be + * used by Retrofit to perform actually REST calls. + */ + interface SignedInUsersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.SignedInUsers get" }) + @GET("{tenantID}/me") + Observable> get(@Path("tenantID") String tenantID, @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.graphrbac.SignedInUsers listOwnedObjects" }) + @GET("{tenantID}/me/ownedObjects") + Observable> listOwnedObjects(@Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the details for the currently logged-in user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws GraphErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UserInner object if successful. + */ + public UserInner get() { + return getWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets the details for the currently logged-in user. + * + * @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(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets the details for the currently logged-in user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable getAsync() { + return getWithServiceResponseAsync().map(new Func1, UserInner>() { + @Override + public UserInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the details for the currently logged-in user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UserInner object + */ + public Observable> getWithServiceResponseAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.get(this.client.tenantID(), this.client.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 GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Get the list of directory objects that are owned by the user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws GraphErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DirectoryObjectListResultInner object if successful. + */ + public DirectoryObjectListResultInner listOwnedObjects() { + return listOwnedObjectsWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Get the list of directory objects that are owned by the user. + * + * @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 listOwnedObjectsAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listOwnedObjectsWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get the list of directory objects that are owned by the user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DirectoryObjectListResultInner object + */ + public Observable listOwnedObjectsAsync() { + return listOwnedObjectsWithServiceResponseAsync().map(new Func1, DirectoryObjectListResultInner>() { + @Override + public DirectoryObjectListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the list of directory objects that are owned by the user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DirectoryObjectListResultInner object + */ + public Observable> listOwnedObjectsWithServiceResponseAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() 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.listOwnedObjects(this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listOwnedObjectsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listOwnedObjectsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + +} From b755ae1f5ec5156fc3453e630b6d86927b867e12 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 31 Aug 2018 16:28:45 +0000 Subject: [PATCH 4/9] Generated from cdebe8cf0d91d18108365b4a12041034983e9c93 Fix pageable --- .../implementation/ApplicationsInner.java | 206 +++++++++++++++--- .../graphrbac/implementation/GroupsInner.java | 206 +++++++++++++++--- .../ServicePrincipalsInner.java | 206 +++++++++++++++--- .../implementation/SignedInUsersInner.java | 200 +++++++++++++++-- 4 files changed, 715 insertions(+), 103 deletions(-) diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java index 6018e33ac36f..cacc6e6a1f5e 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java @@ -115,6 +115,10 @@ interface ApplicationsService { @GET Observable> listNext(@Url String nextUrl, @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.graphrbac.Applications listOwnersNext" }) + @GET + Observable> listOwnersNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -661,10 +665,16 @@ private ServiceResponse patchDelegate(Response response) thr * @throws IllegalArgumentException thrown if parameters fail the validation * @throws GraphErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the List<DirectoryObjectInner> object if successful. + * @return the PagedList<DirectoryObjectInner> object if successful. */ - public List listOwners(String applicationObjectId) { - return listOwnersWithServiceResponseAsync(applicationObjectId).toBlocking().single().body(); + public PagedList listOwners(final String applicationObjectId) { + ServiceResponse> response = listOwnersSinglePageAsync(applicationObjectId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -676,8 +686,16 @@ public List listOwners(String applicationObjectId) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listOwnersAsync(String applicationObjectId, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listOwnersWithServiceResponseAsync(applicationObjectId), serviceCallback); + public ServiceFuture> listOwnersAsync(final String applicationObjectId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOwnersSinglePageAsync(applicationObjectId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -686,15 +704,16 @@ public ServiceFuture> listOwnersAsync(String applicat * * @param applicationObjectId The object ID of the application for which to get owners. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<DirectoryObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable> listOwnersAsync(String applicationObjectId) { - return listOwnersWithServiceResponseAsync(applicationObjectId).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.body(); - } - }); + public Observable> listOwnersAsync(final String applicationObjectId) { + return listOwnersWithServiceResponseAsync(applicationObjectId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -703,9 +722,31 @@ public List call(ServiceResponse>> listOwnersWithServiceResponseAsync(String applicationObjectId) { + public Observable>> listOwnersWithServiceResponseAsync(final String applicationObjectId) { + return listOwnersSinglePageAsync(applicationObjectId) + .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(listOwnersNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Directory objects that are owners of the application. + * The owners are a set of non-admin users who are allowed to modify this object. + * + ServiceResponse> * @param applicationObjectId The object ID of the application for which to get owners. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOwnersSinglePageAsync(final String applicationObjectId) { if (applicationObjectId == null) { throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); } @@ -716,17 +757,12 @@ public Observable>> listOwnersWithSer throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listOwners(applicationObjectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listOwnersDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); - return Observable.just(clientResponse); + ServiceResponse> result = listOwnersDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -734,9 +770,9 @@ public Observable>> call(Response> listOwnersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listOwnersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(GraphErrorException.class) .build(response); } @@ -1288,4 +1324,120 @@ private ServiceResponse> listNextDelegate(Response listOwnersNext(final String nextPageLink) { + ServiceResponse> response = listOwnersNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Directory objects that are owners of the application. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listOwnersNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOwnersNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Directory objects that are owners of the application. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @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<DirectoryObjectInner> object + */ + public Observable> listOwnersNextAsync(final String nextPageLink) { + return listOwnersNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Directory objects that are owners of the application. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @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<DirectoryObjectInner> object + */ + public Observable>> listOwnersNextWithServiceResponseAsync(final String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink) + .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(listOwnersNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Directory objects that are owners of the application. + * The owners are a set of non-admin users who are allowed to modify this object. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOwnersNextSinglePageAsync(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.listOwnersNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOwnersNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOwnersNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + } diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java index 10497fb65a42..d26de3ed85f5 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java @@ -118,6 +118,10 @@ interface GroupsService { @GET Observable> getGroupMembersNext(@Url String nextUrl, @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.graphrbac.Groups listOwnersNext" }) + @GET + Observable> listOwnersNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -1036,10 +1040,16 @@ private ServiceResponse> getMemberGroupsDelegate(Response listOwners(String objectId) { - return listOwnersWithServiceResponseAsync(objectId).toBlocking().single().body(); + public PagedList listOwners(final String objectId) { + ServiceResponse> response = listOwnersSinglePageAsync(objectId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -1051,8 +1061,16 @@ public List listOwners(String objectId) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listOwnersAsync(String objectId, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listOwnersWithServiceResponseAsync(objectId), serviceCallback); + public ServiceFuture> listOwnersAsync(final String objectId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOwnersSinglePageAsync(objectId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -1061,15 +1079,16 @@ public ServiceFuture> listOwnersAsync(String objectId * * @param objectId The object ID of the group for which to get owners. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<DirectoryObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable> listOwnersAsync(String objectId) { - return listOwnersWithServiceResponseAsync(objectId).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.body(); - } - }); + public Observable> listOwnersAsync(final String objectId) { + return listOwnersWithServiceResponseAsync(objectId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -1078,9 +1097,31 @@ public List call(ServiceResponse>> listOwnersWithServiceResponseAsync(String objectId) { + public Observable>> listOwnersWithServiceResponseAsync(final String objectId) { + return listOwnersSinglePageAsync(objectId) + .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(listOwnersNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Directory objects that are owners of the group. + * The owners are a set of non-admin users who are allowed to modify this object. + * + ServiceResponse> * @param objectId The object ID of the group for which to get owners. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOwnersSinglePageAsync(final String objectId) { if (objectId == null) { throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); } @@ -1091,17 +1132,12 @@ public Observable>> listOwnersWithSer throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listOwners(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listOwnersDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); - return Observable.just(clientResponse); + ServiceResponse> result = listOwnersDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1109,9 +1145,9 @@ public Observable>> call(Response> listOwnersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listOwnersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(GraphErrorException.class) .build(response); } @@ -1436,4 +1472,120 @@ private ServiceResponse> getGroupMembersNextDelegate(Re .build(response); } + /** + * Directory objects that are owners of the group. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws GraphErrorException 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<DirectoryObjectInner> object if successful. + */ + public PagedList listOwnersNext(final String nextPageLink) { + ServiceResponse> response = listOwnersNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Directory objects that are owners of the group. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listOwnersNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOwnersNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Directory objects that are owners of the group. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @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<DirectoryObjectInner> object + */ + public Observable> listOwnersNextAsync(final String nextPageLink) { + return listOwnersNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Directory objects that are owners of the group. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @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<DirectoryObjectInner> object + */ + public Observable>> listOwnersNextWithServiceResponseAsync(final String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink) + .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(listOwnersNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Directory objects that are owners of the group. + * The owners are a set of non-admin users who are allowed to modify this object. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOwnersNextSinglePageAsync(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.listOwnersNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOwnersNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOwnersNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + } diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java index 9dc9749b099f..f4c529785781 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java @@ -105,6 +105,10 @@ interface ServicePrincipalsService { @GET Observable> listNext(@Url String nextUrl, @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.graphrbac.ServicePrincipals listOwnersNext" }) + @GET + Observable> listOwnersNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -565,10 +569,16 @@ private ServiceResponse getDelegate(Response listOwners(String objectId) { - return listOwnersWithServiceResponseAsync(objectId).toBlocking().single().body(); + public PagedList listOwners(final String objectId) { + ServiceResponse> response = listOwnersSinglePageAsync(objectId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -580,8 +590,16 @@ public List listOwners(String objectId) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listOwnersAsync(String objectId, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listOwnersWithServiceResponseAsync(objectId), serviceCallback); + public ServiceFuture> listOwnersAsync(final String objectId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOwnersSinglePageAsync(objectId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -590,15 +608,16 @@ public ServiceFuture> listOwnersAsync(String objectId * * @param objectId The object ID of the service principal for which to get owners. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<DirectoryObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable> listOwnersAsync(String objectId) { - return listOwnersWithServiceResponseAsync(objectId).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.body(); - } - }); + public Observable> listOwnersAsync(final String objectId) { + return listOwnersWithServiceResponseAsync(objectId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -607,9 +626,31 @@ public List call(ServiceResponse>> listOwnersWithServiceResponseAsync(String objectId) { + public Observable>> listOwnersWithServiceResponseAsync(final String objectId) { + return listOwnersSinglePageAsync(objectId) + .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(listOwnersNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Directory objects that are owners of this service principal. + * The owners are a set of non-admin users who are allowed to modify this object. + * + ServiceResponse> * @param objectId The object ID of the service principal for which to get owners. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOwnersSinglePageAsync(final String objectId) { if (objectId == null) { throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); } @@ -620,17 +661,12 @@ public Observable>> listOwnersWithSer throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listOwners(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listOwnersDelegate(response); - List items = null; - if (result.body() != null) { - items = result.body().items(); - } - ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); - return Observable.just(clientResponse); + ServiceResponse> result = listOwnersDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -638,9 +674,9 @@ public Observable>> call(Response> listOwnersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listOwnersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(GraphErrorException.class) .build(response); } @@ -1106,4 +1142,120 @@ private ServiceResponse> listNextDelegate(Respon .build(response); } + /** + * Directory objects that are owners of this service principal. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws GraphErrorException 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<DirectoryObjectInner> object if successful. + */ + public PagedList listOwnersNext(final String nextPageLink) { + ServiceResponse> response = listOwnersNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Directory objects that are owners of this service principal. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listOwnersNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOwnersNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Directory objects that are owners of this service principal. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @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<DirectoryObjectInner> object + */ + public Observable> listOwnersNextAsync(final String nextPageLink) { + return listOwnersNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Directory objects that are owners of this service principal. + * The owners are a set of non-admin users who are allowed to modify this object. + * + * @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<DirectoryObjectInner> object + */ + public Observable>> listOwnersNextWithServiceResponseAsync(final String nextPageLink) { + return listOwnersNextSinglePageAsync(nextPageLink) + .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(listOwnersNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Directory objects that are owners of this service principal. + * The owners are a set of non-admin users who are allowed to modify this object. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOwnersNextSinglePageAsync(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.listOwnersNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOwnersNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOwnersNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + } diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java index e9ed430a67a9..69c3038c64d9 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java @@ -10,17 +10,23 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.graphrbac.GraphErrorException; +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 java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.Path; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -59,6 +65,10 @@ interface SignedInUsersService { @GET("{tenantID}/me/ownedObjects") Observable> listOwnedObjects(@Path("tenantID") String tenantID, @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.graphrbac.SignedInUsers listOwnedObjectsNext" }) + @GET + Observable> listOwnedObjectsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -139,10 +149,16 @@ private ServiceResponse getDelegate(Response response) * @throws IllegalArgumentException thrown if parameters fail the validation * @throws GraphErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the DirectoryObjectListResultInner object if successful. + * @return the PagedList<DirectoryObjectInner> object if successful. */ - public DirectoryObjectListResultInner listOwnedObjects() { - return listOwnedObjectsWithServiceResponseAsync().toBlocking().single().body(); + public PagedList listOwnedObjects() { + ServiceResponse> response = listOwnedObjectsSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOwnedObjectsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -152,32 +168,61 @@ public DirectoryObjectListResultInner listOwnedObjects() { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture listOwnedObjectsAsync(final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(listOwnedObjectsWithServiceResponseAsync(), serviceCallback); + public ServiceFuture> listOwnedObjectsAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOwnedObjectsSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOwnedObjectsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * Get the list of directory objects that are owned by the user. * * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DirectoryObjectListResultInner object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable listOwnedObjectsAsync() { - return listOwnedObjectsWithServiceResponseAsync().map(new Func1, DirectoryObjectListResultInner>() { - @Override - public DirectoryObjectListResultInner call(ServiceResponse response) { - return response.body(); - } - }); + public Observable> listOwnedObjectsAsync() { + return listOwnedObjectsWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** * Get the list of directory objects that are owned by the user. * * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the DirectoryObjectListResultInner object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable> listOwnedObjectsWithServiceResponseAsync() { + public Observable>> listOwnedObjectsWithServiceResponseAsync() { + return listOwnedObjectsSinglePageAsync() + .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(listOwnedObjectsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the list of directory objects that are owned by the user. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOwnedObjectsSinglePageAsync() { if (this.client.tenantID() == null) { throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); } @@ -185,12 +230,123 @@ public Observable> listOwnedObje throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.listOwnedObjects(this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = listOwnedObjectsDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listOwnedObjectsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listOwnedObjectsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + + /** + * Get the list of directory objects that are owned by the user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws GraphErrorException 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<DirectoryObjectInner> object if successful. + */ + public PagedList listOwnedObjectsNext(final String nextPageLink) { + ServiceResponse> response = listOwnedObjectsNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listOwnedObjectsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get the list of directory objects that are owned by the user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listOwnedObjectsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listOwnedObjectsNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listOwnedObjectsNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get the list of directory objects that are owned by the user. + * + * @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<DirectoryObjectInner> object + */ + public Observable> listOwnedObjectsNextAsync(final String nextPageLink) { + return listOwnedObjectsNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get the list of directory objects that are owned by the user. + * + * @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<DirectoryObjectInner> object + */ + public Observable>> listOwnedObjectsNextWithServiceResponseAsync(final String nextPageLink) { + return listOwnedObjectsNextSinglePageAsync(nextPageLink) + .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(listOwnedObjectsNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get the list of directory objects that are owned by the user. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listOwnedObjectsNextSinglePageAsync(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.listOwnedObjectsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listOwnedObjectsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -198,9 +354,9 @@ public Observable> call(Response }); } - private ServiceResponse listOwnedObjectsDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listOwnedObjectsNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(GraphErrorException.class) .build(response); } From ac1c50bdaf6ec27d9bba83e94ce32cdbc022a08d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sat, 1 Sep 2018 00:59:06 +0000 Subject: [PATCH 5/9] Generated from 3a866e49fbfe1527711a06527c86e3834d049ad8 AppRoles to create/update --- .../ApplicationCreateParameters.java | 27 ++ .../ApplicationUpdateParameters.java | 27 ++ .../DeletedApplicationsInner.java | 314 ++++++++++++++++-- .../implementation/SignedInUsersInner.java | 72 ++-- 4 files changed, 384 insertions(+), 56 deletions(-) diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationCreateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationCreateParameters.java index 7f2dfd632896..3fc739e8ca45 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationCreateParameters.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationCreateParameters.java @@ -24,6 +24,13 @@ public class ApplicationCreateParameters { @JsonProperty(value = "") private Map additionalProperties; + /** + * The collection of application roles that an application may declare. + * These roles can be assigned to users, groups or service principals. + */ + @JsonProperty(value = "appRoles") + private List appRoles; + /** * Whether the application is available to other tenants. */ @@ -101,6 +108,26 @@ public ApplicationCreateParameters withAdditionalProperties(Map return this; } + /** + * Get the collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + * + * @return the appRoles value + */ + public List appRoles() { + return this.appRoles; + } + + /** + * Set the collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + * + * @param appRoles the appRoles value to set + * @return the ApplicationCreateParameters object itself. + */ + public ApplicationCreateParameters withAppRoles(List appRoles) { + this.appRoles = appRoles; + return this; + } + /** * Get whether the application is available to other tenants. * diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationUpdateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationUpdateParameters.java index 5661e937114c..1bb293e76666 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationUpdateParameters.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ApplicationUpdateParameters.java @@ -24,6 +24,13 @@ public class ApplicationUpdateParameters { @JsonProperty(value = "") private Map additionalProperties; + /** + * The collection of application roles that an application may declare. + * These roles can be assigned to users, groups or service principals. + */ + @JsonProperty(value = "appRoles") + private List appRoles; + /** * Whether the application is available to other tenants. */ @@ -101,6 +108,26 @@ public ApplicationUpdateParameters withAdditionalProperties(Map return this; } + /** + * Get the collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + * + * @return the appRoles value + */ + public List appRoles() { + return this.appRoles; + } + + /** + * Set the collection of application roles that an application may declare. These roles can be assigned to users, groups or service principals. + * + * @param appRoles the appRoles value to set + * @return the ApplicationUpdateParameters object itself. + */ + public ApplicationUpdateParameters withAppRoles(List appRoles) { + this.appRoles = appRoles; + return this; + } + /** * Get whether the application is available to other tenants. * diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java index 485c0cc90f93..4940be5f9c18 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/DeletedApplicationsInner.java @@ -10,11 +10,16 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.graphrbac.GraphErrorException; +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 java.io.IOException; +import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.GET; import retrofit2.http.Header; @@ -23,6 +28,7 @@ import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -57,14 +63,18 @@ interface DeletedApplicationsService { @POST("{tenantID}/deletedApplications/{objectId}/restore") Observable> restore(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @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.graphrbac.DeletedApplications get" }) + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.DeletedApplications list" }) @GET("{tenantID}/deletedApplications") - Observable> get(@Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> list(@Path("tenantID") String tenantID, @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.graphrbac.DeletedApplications hardDelete" }) @HTTP(path = "{tenantID}/deletedApplications/{applicationObjectId}", method = "DELETE", hasBody = true) Observable> hardDelete(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @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.graphrbac.DeletedApplications listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -152,10 +162,16 @@ private ServiceResponse restoreDelegate(Response * @throws IllegalArgumentException thrown if parameters fail the validation * @throws GraphErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the ApplicationListResultInner object if successful. + * @return the PagedList<ApplicationInner> object if successful. */ - public ApplicationListResultInner get() { - return getWithServiceResponseAsync().toBlocking().single().body(); + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; } /** @@ -165,45 +181,180 @@ public ApplicationListResultInner get() { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture getAsync(final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getWithServiceResponseAsync(), serviceCallback); + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of deleted applications in the directory. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of deleted applications in the directory. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets a list of deleted applications in the directory. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.list(this.client.tenantID(), filter, this.client.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 a list of deleted applications in the directory. * + * @param filter The filter to apply to the operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ApplicationListResultInner object + * @throws GraphErrorException 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<ApplicationInner> object if successful. */ - public Observable getAsync() { - return getWithServiceResponseAsync().map(new Func1, ApplicationListResultInner>() { + public PagedList list(final String filter) { + ServiceResponse> response = listSinglePageAsync(filter).toBlocking().single(); + return new PagedList(response.body()) { @Override - public ApplicationListResultInner call(ServiceResponse response) { - return response.body(); + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); } - }); + }; + } + + /** + * Gets a list of deleted applications in the directory. + * + * @param filter The filter to apply to the operation. + * @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 String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(filter), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); } /** * Gets a list of deleted applications in the directory. * + * @param filter The filter to apply to the operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ApplicationListResultInner object + * @return the observable to the PagedList<ApplicationInner> object */ - public Observable> getWithServiceResponseAsync() { + public Observable> listAsync(final String filter) { + return listWithServiceResponseAsync(filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of deleted applications in the directory. + * + * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String filter) { + return listSinglePageAsync(filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets a list of deleted applications in the directory. + * + ServiceResponse> * @param filter The filter to apply to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String filter) { if (this.client.tenantID() == null) { throw new IllegalArgumentException("Parameter this.client.tenantID() 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.get(this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + return service.list(this.client.tenantID(), filter, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { @Override - public Observable> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse clientResponse = getDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -211,9 +362,9 @@ public Observable> call(Response getDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(GraphErrorException.class) .build(response); } @@ -296,4 +447,121 @@ private ServiceResponse hardDeleteDelegate(Response response .build(response); } + /** + * Gets a list of deleted applications in the directory. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws GraphErrorException 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<ApplicationInner> object if successful. + */ + public PagedList listNext(final String nextLink) { + ServiceResponse> response = listNextSinglePageAsync(nextLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextLink) { + return listNextSinglePageAsync(nextLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of deleted applications in the directory. + * + * @param nextLink Next link for the list operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextLink), + new Func1>>>() { + @Override + public Observable>> call(String nextLink) { + return listNextSinglePageAsync(nextLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of deleted applications in the directory. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable> listNextAsync(final String nextLink) { + return listNextWithServiceResponseAsync(nextLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of deleted applications in the directory. + * + * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ApplicationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextLink) { + return listNextSinglePageAsync(nextLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextLink)); + } + }); + } + + /** + * Gets a list of deleted applications in the directory. + * + ServiceResponse> * @param nextLink Next link for the list operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ApplicationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextLink) { + if (nextLink == null) { + throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + String nextUrl = String.format("%s/%s", this.client.tenantID(), nextLink); + return service.listNext(nextUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + } diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java index 69c3038c64d9..7ae818cfed7a 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/SignedInUsersInner.java @@ -67,7 +67,7 @@ interface SignedInUsersService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.SignedInUsers listOwnedObjectsNext" }) @GET - Observable> listOwnedObjectsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> listOwnedObjectsNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -155,8 +155,8 @@ public PagedList listOwnedObjects() { ServiceResponse> response = listOwnedObjectsSinglePageAsync().toBlocking().single(); return new PagedList(response.body()) { @Override - public Page nextPage(String nextPageLink) { - return listOwnedObjectsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + public Page nextPage(String nextLink) { + return listOwnedObjectsNextSinglePageAsync(nextLink).toBlocking().single().body(); } }; } @@ -173,8 +173,8 @@ public ServiceFuture> listOwnedObjectsAsync(final Lis listOwnedObjectsSinglePageAsync(), new Func1>>>() { @Override - public Observable>> call(String nextPageLink) { - return listOwnedObjectsNextSinglePageAsync(nextPageLink); + public Observable>> call(String nextLink) { + return listOwnedObjectsNextSinglePageAsync(nextLink); } }, serviceCallback); @@ -207,11 +207,11 @@ public Observable>> listOwnedObjectsW .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listOwnedObjectsNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listOwnedObjectsNextWithServiceResponseAsync(nextLink)); } }); } @@ -253,18 +253,18 @@ private ServiceResponse> listOwnedObjectsDelegate /** * Get the list of directory objects that are owned by the user. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param nextLink Next link for the list operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws GraphErrorException 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<DirectoryObjectInner> object if successful. */ - public PagedList listOwnedObjectsNext(final String nextPageLink) { - ServiceResponse> response = listOwnedObjectsNextSinglePageAsync(nextPageLink).toBlocking().single(); + public PagedList listOwnedObjectsNext(final String nextLink) { + ServiceResponse> response = listOwnedObjectsNextSinglePageAsync(nextLink).toBlocking().single(); return new PagedList(response.body()) { @Override - public Page nextPage(String nextPageLink) { - return listOwnedObjectsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + public Page nextPage(String nextLink) { + return listOwnedObjectsNextSinglePageAsync(nextLink).toBlocking().single().body(); } }; } @@ -272,19 +272,19 @@ public Page nextPage(String nextPageLink) { /** * Get the list of directory objects that are owned by the user. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param nextLink Next link for the list operation. * @param serviceFuture the ServiceFuture object tracking the Retrofit calls * @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> listOwnedObjectsNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + public ServiceFuture> listOwnedObjectsNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( - listOwnedObjectsNextSinglePageAsync(nextPageLink), + listOwnedObjectsNextSinglePageAsync(nextLink), new Func1>>>() { @Override - public Observable>> call(String nextPageLink) { - return listOwnedObjectsNextSinglePageAsync(nextPageLink); + public Observable>> call(String nextLink) { + return listOwnedObjectsNextSinglePageAsync(nextLink); } }, serviceCallback); @@ -293,12 +293,12 @@ public Observable>> call(String nextP /** * Get the list of directory objects that are owned by the user. * - * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param nextLink Next link for the list operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable> listOwnedObjectsNextAsync(final String nextPageLink) { - return listOwnedObjectsNextWithServiceResponseAsync(nextPageLink) + public Observable> listOwnedObjectsNextAsync(final String nextLink) { + return listOwnedObjectsNextWithServiceResponseAsync(nextLink) .map(new Func1>, Page>() { @Override public Page call(ServiceResponse> response) { @@ -310,20 +310,20 @@ public Page call(ServiceResponse>> listOwnedObjectsNextWithServiceResponseAsync(final String nextPageLink) { - return listOwnedObjectsNextSinglePageAsync(nextPageLink) + public Observable>> listOwnedObjectsNextWithServiceResponseAsync(final String nextLink) { + return listOwnedObjectsNextSinglePageAsync(nextLink) .concatMap(new Func1>, Observable>>>() { @Override public Observable>> call(ServiceResponse> page) { - String nextPageLink = page.body().nextPageLink(); - if (nextPageLink == null) { + String nextLink = page.body().nextPageLink(); + if (nextLink == null) { return Observable.just(page); } - return Observable.just(page).concatWith(listOwnedObjectsNextWithServiceResponseAsync(nextPageLink)); + return Observable.just(page).concatWith(listOwnedObjectsNextWithServiceResponseAsync(nextLink)); } }); } @@ -331,16 +331,22 @@ public Observable>> call(ServiceRespo /** * Get the list of directory objects that are owned by the user. * - ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + ServiceResponse> * @param nextLink Next link for the list operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listOwnedObjectsNextSinglePageAsync(final String nextPageLink) { - if (nextPageLink == null) { - throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + public Observable>> listOwnedObjectsNextSinglePageAsync(final String nextLink) { + if (nextLink == null) { + throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); } - String nextUrl = String.format("%s", nextPageLink); - return service.listOwnedObjectsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + String nextUrl = String.format("%s/%s", this.client.tenantID(), nextLink); + return service.listOwnedObjectsNext(nextUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override public Observable>> call(Response response) { From 49bbecb62e0461000c2bc1a4b490c57a5e9e6927 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 5 Sep 2018 17:31:44 +0000 Subject: [PATCH 6/9] Generated from 04d197ad2a8922a79bd2ea253b07aff0175d4f87 Add SP update --- .../ServicePrincipalCreateParameters.java | 258 +++++++++++- .../ServicePrincipalUpdateParameters.java | 387 ++++++++++++++++++ .../ServicePrincipalsInner.java | 85 ++++ 3 files changed, 719 insertions(+), 11 deletions(-) create mode 100644 azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalUpdateParameters.java diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalCreateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalCreateParameters.java index 37c2e2f4fe6b..57c6d963c156 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalCreateParameters.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalCreateParameters.java @@ -24,6 +24,12 @@ public class ServicePrincipalCreateParameters { @JsonProperty(value = "") private Map additionalProperties; + /** + * Whether the account is enabled. + */ + @JsonProperty(value = "accountEnabled") + private Boolean accountEnabled; + /** * application Id. */ @@ -31,10 +37,29 @@ public class ServicePrincipalCreateParameters { private String appId; /** - * Whether the account is enabled. + * Specifies whether an AppRoleAssignment to a user or group is required + * before Azure AD will issue a user or access token to the application. */ - @JsonProperty(value = "accountEnabled", required = true) - private boolean accountEnabled; + @JsonProperty(value = "appRoleAssignmentRequired") + private Boolean appRoleAssignmentRequired; + + /** + * The display name for the service principal. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The errorUrl property. + */ + @JsonProperty(value = "errorUrl") + private String errorUrl; + + /** + * The URL to the homepage of the associated application. + */ + @JsonProperty(value = "homepage") + private String homepage; /** * A collection of KeyCredential objects. @@ -48,6 +73,37 @@ public class ServicePrincipalCreateParameters { @JsonProperty(value = "passwordCredentials") private List passwordCredentials; + /** + * The display name of the tenant in which the associated application is + * specified. + */ + @JsonProperty(value = "publisherName") + private String publisherName; + + /** + * A collection of reply URLs for the service principal. + */ + @JsonProperty(value = "replyUrls") + private List replyUrls; + + /** + * The samlMetadataUrl property. + */ + @JsonProperty(value = "samlMetadataUrl") + private String samlMetadataUrl; + + /** + * A collection of service principal names. + */ + @JsonProperty(value = "servicePrincipalNames") + private List servicePrincipalNames; + + /** + * The tags property. + */ + @JsonProperty(value = "tags") + private List tags; + /** * Get unmatched properties from the message are deserialized this collection. * @@ -68,6 +124,26 @@ public ServicePrincipalCreateParameters withAdditionalProperties(Map replyUrls() { + return this.replyUrls; + } + + /** + * Set a collection of reply URLs for the service principal. + * + * @param replyUrls the replyUrls value to set + * @return the ServicePrincipalCreateParameters object itself. + */ + public ServicePrincipalCreateParameters withReplyUrls(List replyUrls) { + this.replyUrls = replyUrls; + return this; + } + + /** + * Get the samlMetadataUrl value. + * + * @return the samlMetadataUrl value + */ + public String samlMetadataUrl() { + return this.samlMetadataUrl; + } + + /** + * Set the samlMetadataUrl value. + * + * @param samlMetadataUrl the samlMetadataUrl value to set + * @return the ServicePrincipalCreateParameters object itself. + */ + public ServicePrincipalCreateParameters withSamlMetadataUrl(String samlMetadataUrl) { + this.samlMetadataUrl = samlMetadataUrl; + return this; + } + + /** + * Get a collection of service principal names. + * + * @return the servicePrincipalNames value + */ + public List servicePrincipalNames() { + return this.servicePrincipalNames; + } + + /** + * Set a collection of service principal names. + * + * @param servicePrincipalNames the servicePrincipalNames value to set + * @return the ServicePrincipalCreateParameters object itself. + */ + public ServicePrincipalCreateParameters withServicePrincipalNames(List servicePrincipalNames) { + this.servicePrincipalNames = servicePrincipalNames; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public List tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ServicePrincipalCreateParameters object itself. + */ + public ServicePrincipalCreateParameters withTags(List tags) { + this.tags = tags; + return this; + } + } diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalUpdateParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalUpdateParameters.java new file mode 100644 index 000000000000..8268890b65bd --- /dev/null +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/ServicePrincipalUpdateParameters.java @@ -0,0 +1,387 @@ +/** + * 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.graphrbac; + +import java.util.Map; +import java.util.List; +import com.microsoft.azure.graphrbac.implementation.KeyCredentialInner; +import com.microsoft.azure.graphrbac.implementation.PasswordCredentialInner; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters for creating a new service principal. + */ +public class ServicePrincipalUpdateParameters { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Whether the account is enabled. + */ + @JsonProperty(value = "accountEnabled") + private Boolean accountEnabled; + + /** + * application Id. + */ + @JsonProperty(value = "appId") + private String appId; + + /** + * Specifies whether an AppRoleAssignment to a user or group is required + * before Azure AD will issue a user or access token to the application. + */ + @JsonProperty(value = "appRoleAssignmentRequired") + private Boolean appRoleAssignmentRequired; + + /** + * The display name for the service principal. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The errorUrl property. + */ + @JsonProperty(value = "errorUrl") + private String errorUrl; + + /** + * The URL to the homepage of the associated application. + */ + @JsonProperty(value = "homepage") + private String homepage; + + /** + * A collection of KeyCredential objects. + */ + @JsonProperty(value = "keyCredentials") + private List keyCredentials; + + /** + * A collection of PasswordCredential objects. + */ + @JsonProperty(value = "passwordCredentials") + private List passwordCredentials; + + /** + * The display name of the tenant in which the associated application is + * specified. + */ + @JsonProperty(value = "publisherName") + private String publisherName; + + /** + * A collection of reply URLs for the service principal. + */ + @JsonProperty(value = "replyUrls") + private List replyUrls; + + /** + * The samlMetadataUrl property. + */ + @JsonProperty(value = "samlMetadataUrl") + private String samlMetadataUrl; + + /** + * A collection of service principal names. + */ + @JsonProperty(value = "servicePrincipalNames") + private List servicePrincipalNames; + + /** + * The tags property. + */ + @JsonProperty(value = "tags") + private List tags; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get whether the account is enabled. + * + * @return the accountEnabled value + */ + public Boolean accountEnabled() { + return this.accountEnabled; + } + + /** + * Set whether the account is enabled. + * + * @param accountEnabled the accountEnabled value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withAccountEnabled(Boolean accountEnabled) { + this.accountEnabled = accountEnabled; + return this; + } + + /** + * Get application Id. + * + * @return the appId value + */ + public String appId() { + return this.appId; + } + + /** + * Set application Id. + * + * @param appId the appId value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withAppId(String appId) { + this.appId = appId; + return this; + } + + /** + * Get specifies whether an AppRoleAssignment to a user or group is required before Azure AD will issue a user or access token to the application. + * + * @return the appRoleAssignmentRequired value + */ + public Boolean appRoleAssignmentRequired() { + return this.appRoleAssignmentRequired; + } + + /** + * Set specifies whether an AppRoleAssignment to a user or group is required before Azure AD will issue a user or access token to the application. + * + * @param appRoleAssignmentRequired the appRoleAssignmentRequired value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withAppRoleAssignmentRequired(Boolean appRoleAssignmentRequired) { + this.appRoleAssignmentRequired = appRoleAssignmentRequired; + return this; + } + + /** + * Get the display name for the service principal. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name for the service principal. + * + * @param displayName the displayName value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the errorUrl value. + * + * @return the errorUrl value + */ + public String errorUrl() { + return this.errorUrl; + } + + /** + * Set the errorUrl value. + * + * @param errorUrl the errorUrl value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withErrorUrl(String errorUrl) { + this.errorUrl = errorUrl; + return this; + } + + /** + * Get the URL to the homepage of the associated application. + * + * @return the homepage value + */ + public String homepage() { + return this.homepage; + } + + /** + * Set the URL to the homepage of the associated application. + * + * @param homepage the homepage value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withHomepage(String homepage) { + this.homepage = homepage; + return this; + } + + /** + * Get a collection of KeyCredential objects. + * + * @return the keyCredentials value + */ + public List keyCredentials() { + return this.keyCredentials; + } + + /** + * Set a collection of KeyCredential objects. + * + * @param keyCredentials the keyCredentials value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withKeyCredentials(List keyCredentials) { + this.keyCredentials = keyCredentials; + return this; + } + + /** + * Get a collection of PasswordCredential objects. + * + * @return the passwordCredentials value + */ + public List passwordCredentials() { + return this.passwordCredentials; + } + + /** + * Set a collection of PasswordCredential objects. + * + * @param passwordCredentials the passwordCredentials value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withPasswordCredentials(List passwordCredentials) { + this.passwordCredentials = passwordCredentials; + return this; + } + + /** + * Get the display name of the tenant in which the associated application is specified. + * + * @return the publisherName value + */ + public String publisherName() { + return this.publisherName; + } + + /** + * Set the display name of the tenant in which the associated application is specified. + * + * @param publisherName the publisherName value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withPublisherName(String publisherName) { + this.publisherName = publisherName; + return this; + } + + /** + * Get a collection of reply URLs for the service principal. + * + * @return the replyUrls value + */ + public List replyUrls() { + return this.replyUrls; + } + + /** + * Set a collection of reply URLs for the service principal. + * + * @param replyUrls the replyUrls value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withReplyUrls(List replyUrls) { + this.replyUrls = replyUrls; + return this; + } + + /** + * Get the samlMetadataUrl value. + * + * @return the samlMetadataUrl value + */ + public String samlMetadataUrl() { + return this.samlMetadataUrl; + } + + /** + * Set the samlMetadataUrl value. + * + * @param samlMetadataUrl the samlMetadataUrl value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withSamlMetadataUrl(String samlMetadataUrl) { + this.samlMetadataUrl = samlMetadataUrl; + return this; + } + + /** + * Get a collection of service principal names. + * + * @return the servicePrincipalNames value + */ + public List servicePrincipalNames() { + return this.servicePrincipalNames; + } + + /** + * Set a collection of service principal names. + * + * @param servicePrincipalNames the servicePrincipalNames value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withServicePrincipalNames(List servicePrincipalNames) { + this.servicePrincipalNames = servicePrincipalNames; + return this; + } + + /** + * Get the tags value. + * + * @return the tags value + */ + public List tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the ServicePrincipalUpdateParameters object itself. + */ + public ServicePrincipalUpdateParameters withTags(List tags) { + this.tags = tags; + return this; + } + +} diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java index f4c529785781..1874abae8a8e 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java @@ -15,6 +15,7 @@ import com.microsoft.azure.graphrbac.KeyCredentialsUpdateParameters; import com.microsoft.azure.graphrbac.PasswordCredentialsUpdateParameters; import com.microsoft.azure.graphrbac.ServicePrincipalCreateParameters; +import com.microsoft.azure.graphrbac.ServicePrincipalUpdateParameters; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; @@ -69,6 +70,10 @@ interface ServicePrincipalsService { @POST("{tenantID}/servicePrincipals") Observable> create(@Path("tenantID") String tenantID, @Body ServicePrincipalCreateParameters 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.graphrbac.ServicePrincipals update" }) + @PATCH("{tenantID}/servicePrincipals") + Observable> update(@Path("tenantID") String tenantID, @Body ServicePrincipalUpdateParameters 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.graphrbac.ServicePrincipals list" }) @GET("{tenantID}/servicePrincipals") Observable> list(@Path("tenantID") String tenantID, @Query("$filter") String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -191,6 +196,86 @@ private ServiceResponse createDelegate(Response updateAsync(ServicePrincipalUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(parameters), serviceCallback); + } + + /** + * Updates a service principal in the directory. + * + * @param parameters Parameters to update a service principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServicePrincipalInner object + */ + public Observable updateAsync(ServicePrincipalUpdateParameters parameters) { + return updateWithServiceResponseAsync(parameters).map(new Func1, ServicePrincipalInner>() { + @Override + public ServicePrincipalInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a service principal in the directory. + * + * @param parameters Parameters to update a service principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServicePrincipalInner object + */ + public Observable> updateWithServiceResponseAsync(ServicePrincipalUpdateParameters parameters) { + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + /** * Gets a list of service principals from the current tenant. * From a3d0ba29e77877675ca331cf5d247a2678b769e7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 5 Sep 2018 17:35:24 +0000 Subject: [PATCH 7/9] Generated from 48aa8260d0f81091922fd75f5b5f2038f99ca4dc Add SP update --- .../ServicePrincipalsInner.java | 175 +++++++++--------- 1 file changed, 91 insertions(+), 84 deletions(-) diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java index 1874abae8a8e..f083fca0c9a9 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java @@ -70,14 +70,14 @@ interface ServicePrincipalsService { @POST("{tenantID}/servicePrincipals") Observable> create(@Path("tenantID") String tenantID, @Body ServicePrincipalCreateParameters 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.graphrbac.ServicePrincipals update" }) - @PATCH("{tenantID}/servicePrincipals") - Observable> update(@Path("tenantID") String tenantID, @Body ServicePrincipalUpdateParameters 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.graphrbac.ServicePrincipals list" }) @GET("{tenantID}/servicePrincipals") Observable> list(@Path("tenantID") String tenantID, @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.graphrbac.ServicePrincipals update" }) + @PATCH("{tenantID}/servicePrincipals/{objectId}") + Observable> update(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @Body ServicePrincipalUpdateParameters 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.graphrbac.ServicePrincipals delete" }) @HTTP(path = "{tenantID}/servicePrincipals/{objectId}", method = "DELETE", hasBody = true) Observable> delete(@Path("objectId") String objectId, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -196,86 +196,6 @@ private ServiceResponse createDelegate(Response updateAsync(ServicePrincipalUpdateParameters parameters, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateWithServiceResponseAsync(parameters), serviceCallback); - } - - /** - * Updates a service principal in the directory. - * - * @param parameters Parameters to update a service principal. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ServicePrincipalInner object - */ - public Observable updateAsync(ServicePrincipalUpdateParameters parameters) { - return updateWithServiceResponseAsync(parameters).map(new Func1, ServicePrincipalInner>() { - @Override - public ServicePrincipalInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Updates a service principal in the directory. - * - * @param parameters Parameters to update a service principal. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ServicePrincipalInner object - */ - public Observable> updateWithServiceResponseAsync(ServicePrincipalUpdateParameters parameters) { - if (this.client.tenantID() == null) { - throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); - } - if (parameters == null) { - throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); - } - if (this.client.apiVersion() == null) { - throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); - } - Validator.validate(parameters); - return service.update(this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = updateDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse updateDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(201, new TypeToken() { }.getType()) - .registerError(GraphErrorException.class) - .build(response); - } - /** * Gets a list of service principals from the current tenant. * @@ -489,6 +409,93 @@ private ServiceResponse> listDelegate(Response updateAsync(String objectId, ServicePrincipalUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(objectId, parameters), serviceCallback); + } + + /** + * Updates a service principal in the directory. + * + * @param objectId The object ID of the service principal to delete. + * @param parameters Parameters to update a service principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServicePrincipalInner object + */ + public Observable updateAsync(String objectId, ServicePrincipalUpdateParameters parameters) { + return updateWithServiceResponseAsync(objectId, parameters).map(new Func1, ServicePrincipalInner>() { + @Override + public ServicePrincipalInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a service principal in the directory. + * + * @param objectId The object ID of the service principal to delete. + * @param parameters Parameters to update a service principal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ServicePrincipalInner object + */ + public Observable> updateWithServiceResponseAsync(String objectId, ServicePrincipalUpdateParameters parameters) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (this.client.tenantID() == null) { + throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(objectId, this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(GraphErrorException.class) + .build(response); + } + /** * Deletes a service principal from the directory. * From 73e6c6deae8c0c1097f211d35e6afaf499bfc57a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 5 Sep 2018 17:40:03 +0000 Subject: [PATCH 8/9] Generated from f338c565c9b0d1073820c866848e3003e36bd15d Add SP update --- .../ServicePrincipalsInner.java | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java index f083fca0c9a9..3845386358a2 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ServicePrincipalsInner.java @@ -417,10 +417,9 @@ private ServiceResponse> listDelegate(Response updateAsync(String objectId, ServicePrincipalUpdateParameters parameters, final ServiceCallback serviceCallback) { + public ServiceFuture updateAsync(String objectId, ServicePrincipalUpdateParameters parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(objectId, parameters), serviceCallback); } @@ -442,12 +441,12 @@ public ServiceFuture updateAsync(String objectId, Service * @param objectId The object ID of the service principal to delete. * @param parameters Parameters to update a service principal. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ServicePrincipalInner object + * @return the {@link ServiceResponse} object if successful. */ - public Observable updateAsync(String objectId, ServicePrincipalUpdateParameters parameters) { - return updateWithServiceResponseAsync(objectId, parameters).map(new Func1, ServicePrincipalInner>() { + public Observable updateAsync(String objectId, ServicePrincipalUpdateParameters parameters) { + return updateWithServiceResponseAsync(objectId, parameters).map(new Func1, Void>() { @Override - public ServicePrincipalInner call(ServiceResponse response) { + public Void call(ServiceResponse response) { return response.body(); } }); @@ -459,9 +458,9 @@ public ServicePrincipalInner call(ServiceResponse respons * @param objectId The object ID of the service principal to delete. * @param parameters Parameters to update a service principal. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the ServicePrincipalInner object + * @return the {@link ServiceResponse} object if successful. */ - public Observable> updateWithServiceResponseAsync(String objectId, ServicePrincipalUpdateParameters parameters) { + public Observable> updateWithServiceResponseAsync(String objectId, ServicePrincipalUpdateParameters parameters) { if (objectId == null) { throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); } @@ -476,11 +475,11 @@ public Observable> updateWithServiceRespo } Validator.validate(parameters); return service.update(objectId, this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { + .flatMap(new Func1, Observable>>() { @Override - public Observable> call(Response response) { + public Observable> call(Response response) { try { - ServiceResponse clientResponse = updateDelegate(response); + ServiceResponse clientResponse = updateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -489,9 +488,9 @@ public Observable> call(Response updateDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(201, new TypeToken() { }.getType()) + private ServiceResponse updateDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(204, new TypeToken() { }.getType()) .registerError(GraphErrorException.class) .build(response); } From b5e9f0bddac147ec4fafdb5fb41fff170d7f900a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 12 Sep 2018 00:05:19 +0000 Subject: [PATCH 9/9] Generated from 203554316693c183cd5e1c03f4cac598e42c4ed8 Remove incorrect required --- .../azure/graphrbac/GetObjectsParameters.java | 8 +- .../implementation/ApplicationsInner.java | 12 +- .../graphrbac/implementation/GroupsInner.java | 104 +++++----- .../implementation/ObjectsInner.java | 192 ++++++------------ 4 files changed, 119 insertions(+), 197 deletions(-) diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GetObjectsParameters.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GetObjectsParameters.java index 013fbbf3bcbd..7cca1a9057b6 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GetObjectsParameters.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/GetObjectsParameters.java @@ -37,8 +37,8 @@ public class GetObjectsParameters { /** * If true, also searches for object IDs in the partner tenant. */ - @JsonProperty(value = "includeDirectoryObjectReferences", required = true) - private boolean includeDirectoryObjectReferences; + @JsonProperty(value = "includeDirectoryObjectReferences") + private Boolean includeDirectoryObjectReferences; /** * Get unmatched properties from the message are deserialized this collection. @@ -105,7 +105,7 @@ public GetObjectsParameters withTypes(List types) { * * @return the includeDirectoryObjectReferences value */ - public boolean includeDirectoryObjectReferences() { + public Boolean includeDirectoryObjectReferences() { return this.includeDirectoryObjectReferences; } @@ -115,7 +115,7 @@ public boolean includeDirectoryObjectReferences() { * @param includeDirectoryObjectReferences the includeDirectoryObjectReferences value to set * @return the GetObjectsParameters object itself. */ - public GetObjectsParameters withIncludeDirectoryObjectReferences(boolean includeDirectoryObjectReferences) { + public GetObjectsParameters withIncludeDirectoryObjectReferences(Boolean includeDirectoryObjectReferences) { this.includeDirectoryObjectReferences = includeDirectoryObjectReferences; return this; } diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java index cacc6e6a1f5e..1e26a5b1e7dd 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ApplicationsInner.java @@ -11,7 +11,7 @@ import retrofit2.Retrofit; import com.google.common.reflect.TypeToken; import com.microsoft.azure.AzureServiceFuture; -import com.microsoft.azure.graphrbac.ApplicationAddOwnerParameters; +import com.microsoft.azure.graphrbac.AddOwnerParameters; import com.microsoft.azure.graphrbac.ApplicationCreateParameters; import com.microsoft.azure.graphrbac.ApplicationUpdateParameters; import com.microsoft.azure.graphrbac.GraphErrorException; @@ -93,7 +93,7 @@ interface ApplicationsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.graphrbac.Applications addOwner" }) @POST("{tenantID}/applications/{applicationObjectId}/$links/owners") - Observable> addOwner(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Body ApplicationAddOwnerParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> addOwner(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Body AddOwnerParameters 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.graphrbac.Applications listKeyCredentials" }) @GET("{tenantID}/applications/{applicationObjectId}/keyCredentials") @@ -786,7 +786,7 @@ private ServiceResponse> listOwnersDelegate(Respo * @throws GraphErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ - public void addOwner(String applicationObjectId, ApplicationAddOwnerParameters parameters) { + public void addOwner(String applicationObjectId, AddOwnerParameters parameters) { addOwnerWithServiceResponseAsync(applicationObjectId, parameters).toBlocking().single().body(); } @@ -799,7 +799,7 @@ public void addOwner(String applicationObjectId, ApplicationAddOwnerParameters p * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture addOwnerAsync(String applicationObjectId, ApplicationAddOwnerParameters parameters, final ServiceCallback serviceCallback) { + public ServiceFuture addOwnerAsync(String applicationObjectId, AddOwnerParameters parameters, final ServiceCallback serviceCallback) { return ServiceFuture.fromResponse(addOwnerWithServiceResponseAsync(applicationObjectId, parameters), serviceCallback); } @@ -811,7 +811,7 @@ public ServiceFuture addOwnerAsync(String applicationObjectId, Application * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable addOwnerAsync(String applicationObjectId, ApplicationAddOwnerParameters parameters) { + public Observable addOwnerAsync(String applicationObjectId, AddOwnerParameters parameters) { return addOwnerWithServiceResponseAsync(applicationObjectId, parameters).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { @@ -828,7 +828,7 @@ public Void call(ServiceResponse response) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable> addOwnerWithServiceResponseAsync(String applicationObjectId, ApplicationAddOwnerParameters parameters) { + public Observable> addOwnerWithServiceResponseAsync(String applicationObjectId, AddOwnerParameters parameters) { if (applicationObjectId == null) { throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); } diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java index d26de3ed85f5..0235c69f6f00 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/GroupsInner.java @@ -675,13 +675,13 @@ private ServiceResponse> listDelegate(Response getGroupMembers(final String objectId) { - ServiceResponse> response = getGroupMembersSinglePageAsync(objectId).toBlocking().single(); - return new PagedList(response.body()) { + public PagedList getGroupMembers(final String objectId) { + ServiceResponse> response = getGroupMembersSinglePageAsync(objectId).toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextLink) { + public Page nextPage(String nextLink) { return getGroupMembersNextSinglePageAsync(nextLink).toBlocking().single().body(); } }; @@ -695,12 +695,12 @@ public Page nextPage(String nextLink) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> getGroupMembersAsync(final String objectId, final ListOperationCallback serviceCallback) { + public ServiceFuture> getGroupMembersAsync(final String objectId, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( getGroupMembersSinglePageAsync(objectId), - new Func1>>>() { + new Func1>>>() { @Override - public Observable>> call(String nextLink) { + public Observable>> call(String nextLink) { return getGroupMembersNextSinglePageAsync(nextLink); } }, @@ -712,13 +712,13 @@ public Observable>> call(String nextLink) { * * @param objectId The object ID of the group whose members should be retrieved. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<AADObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable> getGroupMembersAsync(final String objectId) { + public Observable> getGroupMembersAsync(final String objectId) { return getGroupMembersWithServiceResponseAsync(objectId) - .map(new Func1>, Page>() { + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); @@ -729,13 +729,13 @@ public Page call(ServiceResponse> response) * * @param objectId The object ID of the group whose members should be retrieved. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<AADObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable>> getGroupMembersWithServiceResponseAsync(final String objectId) { + public Observable>> getGroupMembersWithServiceResponseAsync(final String objectId) { return getGroupMembersSinglePageAsync(objectId) - .concatMap(new Func1>, Observable>>>() { + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextLink = page.body().nextPageLink(); if (nextLink == null) { return Observable.just(page); @@ -748,11 +748,11 @@ public Observable>> call(ServiceResponse> * @param objectId The object ID of the group whose members should be retrieved. + ServiceResponse> * @param objectId The object ID of the group whose members should be retrieved. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<AADObjectInner> object wrapped in {@link ServiceResponse} if successful. + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> getGroupMembersSinglePageAsync(final String objectId) { + public Observable>> getGroupMembersSinglePageAsync(final String objectId) { if (objectId == null) { throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); } @@ -763,12 +763,12 @@ public Observable>> getGroupMembersSinglePa throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } return service.getGroupMembers(objectId, this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = getGroupMembersDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = getGroupMembersDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -776,9 +776,9 @@ public Observable>> call(Response> getGroupMembersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> getGroupMembersDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(GraphErrorException.class) .build(response); } @@ -1362,13 +1362,13 @@ private ServiceResponse> listNextDelegate(Response getGroupMembersNext(final String nextLink) { - ServiceResponse> response = getGroupMembersNextSinglePageAsync(nextLink).toBlocking().single(); - return new PagedList(response.body()) { + public PagedList getGroupMembersNext(final String nextLink) { + ServiceResponse> response = getGroupMembersNextSinglePageAsync(nextLink).toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextLink) { + public Page nextPage(String nextLink) { return getGroupMembersNextSinglePageAsync(nextLink).toBlocking().single().body(); } }; @@ -1383,12 +1383,12 @@ public Page nextPage(String nextLink) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> getGroupMembersNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + public ServiceFuture> getGroupMembersNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( getGroupMembersNextSinglePageAsync(nextLink), - new Func1>>>() { + new Func1>>>() { @Override - public Observable>> call(String nextLink) { + public Observable>> call(String nextLink) { return getGroupMembersNextSinglePageAsync(nextLink); } }, @@ -1400,13 +1400,13 @@ public Observable>> call(String nextLink) { * * @param nextLink Next link for the list operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<AADObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable> getGroupMembersNextAsync(final String nextLink) { + public Observable> getGroupMembersNextAsync(final String nextLink) { return getGroupMembersNextWithServiceResponseAsync(nextLink) - .map(new Func1>, Page>() { + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); @@ -1417,13 +1417,13 @@ public Page call(ServiceResponse> response) * * @param nextLink Next link for the list operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<AADObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable>> getGroupMembersNextWithServiceResponseAsync(final String nextLink) { + public Observable>> getGroupMembersNextWithServiceResponseAsync(final String nextLink) { return getGroupMembersNextSinglePageAsync(nextLink) - .concatMap(new Func1>, Observable>>>() { + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextLink = page.body().nextPageLink(); if (nextLink == null) { return Observable.just(page); @@ -1436,11 +1436,11 @@ public Observable>> call(ServiceResponse> * @param nextLink Next link for the list operation. + ServiceResponse> * @param nextLink Next link for the list operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<AADObjectInner> object wrapped in {@link ServiceResponse} if successful. + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> getGroupMembersNextSinglePageAsync(final String nextLink) { + public Observable>> getGroupMembersNextSinglePageAsync(final String nextLink) { if (nextLink == null) { throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); } @@ -1452,12 +1452,12 @@ public Observable>> getGroupMembersNextSing } String nextUrl = String.format("%s/%s", this.client.tenantID(), nextLink); return service.getGroupMembersNext(nextUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = getGroupMembersNextDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = getGroupMembersNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -1465,9 +1465,9 @@ public Observable>> call(Response> getGroupMembersNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> getGroupMembersNextDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., GraphErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(GraphErrorException.class) .build(response); } diff --git a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java index a5a4945ca4d1..f1dba4bb4c26 100644 --- a/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java +++ b/azure-graphrbac/src/main/java/com/microsoft/azure/graphrbac/implementation/ObjectsInner.java @@ -13,11 +13,9 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.CloudException; import com.microsoft.azure.graphrbac.GetObjectsParameters; -import com.microsoft.azure.graphrbac.GraphErrorException; 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; @@ -66,10 +64,6 @@ interface ObjectsService { @POST("{tenantID}/getObjectsByObjectIds") Observable> getObjectsByObjectIds(@Path("tenantID") String tenantID, @Body GetObjectsParameters 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.graphrbac.Objects getCurrentUser" }) - @GET("{tenantID}/me") - Observable> getCurrentUser(@Path("tenantID") String tenantID, @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.graphrbac.Objects getObjectsByObjectIdsNext" }) @GET Observable> getObjectsByObjectIdsNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -77,38 +71,38 @@ interface ObjectsService { } /** - * Gets AD group membership for the specified AD object IDs. + * Gets the directory objects specified in a list of object IDs. You can also specify which resource collections (users, groups, etc.) should be searched by specifying the optional types parameter. * * @param parameters Objects filtering parameters. * @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<AADObjectInner> object if successful. + * @return the PagedList<DirectoryObjectInner> object if successful. */ - public PagedList getObjectsByObjectIds(final GetObjectsParameters parameters) { - ServiceResponse> response = getObjectsByObjectIdsSinglePageAsync(parameters).toBlocking().single(); - return new PagedList(response.body()) { + public PagedList getObjectsByObjectIds(final GetObjectsParameters parameters) { + ServiceResponse> response = getObjectsByObjectIdsSinglePageAsync(parameters).toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextLink) { + public Page nextPage(String nextLink) { return getObjectsByObjectIdsNextSinglePageAsync(nextLink).toBlocking().single().body(); } }; } /** - * Gets AD group membership for the specified AD object IDs. + * Gets the directory objects specified in a list of object IDs. You can also specify which resource collections (users, groups, etc.) should be searched by specifying the optional types parameter. * * @param parameters Objects filtering parameters. * @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> getObjectsByObjectIdsAsync(final GetObjectsParameters parameters, final ListOperationCallback serviceCallback) { + public ServiceFuture> getObjectsByObjectIdsAsync(final GetObjectsParameters parameters, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( getObjectsByObjectIdsSinglePageAsync(parameters), - new Func1>>>() { + new Func1>>>() { @Override - public Observable>> call(String nextLink) { + public Observable>> call(String nextLink) { return getObjectsByObjectIdsNextSinglePageAsync(nextLink); } }, @@ -116,34 +110,34 @@ public Observable>> call(String nextLink) { } /** - * Gets AD group membership for the specified AD object IDs. + * Gets the directory objects specified in a list of object IDs. You can also specify which resource collections (users, groups, etc.) should be searched by specifying the optional types parameter. * * @param parameters Objects filtering parameters. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<AADObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable> getObjectsByObjectIdsAsync(final GetObjectsParameters parameters) { + public Observable> getObjectsByObjectIdsAsync(final GetObjectsParameters parameters) { return getObjectsByObjectIdsWithServiceResponseAsync(parameters) - .map(new Func1>, Page>() { + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); } /** - * Gets AD group membership for the specified AD object IDs. + * Gets the directory objects specified in a list of object IDs. You can also specify which resource collections (users, groups, etc.) should be searched by specifying the optional types parameter. * * @param parameters Objects filtering parameters. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<AADObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable>> getObjectsByObjectIdsWithServiceResponseAsync(final GetObjectsParameters parameters) { + public Observable>> getObjectsByObjectIdsWithServiceResponseAsync(final GetObjectsParameters parameters) { return getObjectsByObjectIdsSinglePageAsync(parameters) - .concatMap(new Func1>, Observable>>>() { + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextLink = page.body().nextPageLink(); if (nextLink == null) { return Observable.just(page); @@ -154,13 +148,13 @@ public Observable>> call(ServiceResponse> * @param parameters Objects filtering parameters. + ServiceResponse> * @param parameters Objects filtering parameters. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<AADObjectInner> object wrapped in {@link ServiceResponse} if successful. + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> getObjectsByObjectIdsSinglePageAsync(final GetObjectsParameters parameters) { + public Observable>> getObjectsByObjectIdsSinglePageAsync(final GetObjectsParameters parameters) { if (this.client.tenantID() == null) { throw new IllegalArgumentException("Parameter this.client.tenantID() is required and cannot be null."); } @@ -172,12 +166,12 @@ public Observable>> getObjectsByObjectIdsSi } Validator.validate(parameters); return service.getObjectsByObjectIds(this.client.tenantID(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = getObjectsByObjectIdsDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = getObjectsByObjectIdsDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -185,85 +179,13 @@ public Observable>> call(Response> getObjectsByObjectIdsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> getObjectsByObjectIdsDelegate(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 the details for the currently logged-in user. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @throws GraphErrorException thrown if the request is rejected by server - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent - * @return the AADObjectInner object if successful. - */ - public AADObjectInner getCurrentUser() { - return getCurrentUserWithServiceResponseAsync().toBlocking().single().body(); - } - - /** - * Gets the details for the currently logged-in user. - * - * @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 getCurrentUserAsync(final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getCurrentUserWithServiceResponseAsync(), serviceCallback); - } - - /** - * Gets the details for the currently logged-in user. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the AADObjectInner object - */ - public Observable getCurrentUserAsync() { - return getCurrentUserWithServiceResponseAsync().map(new Func1, AADObjectInner>() { - @Override - public AADObjectInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Gets the details for the currently logged-in user. - * - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the AADObjectInner object - */ - public Observable> getCurrentUserWithServiceResponseAsync() { - if (this.client.tenantID() == null) { - throw new IllegalArgumentException("Parameter this.client.tenantID() 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.getCurrentUser(this.client.tenantID(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = getCurrentUserDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse getCurrentUserDelegate(Response response) throws GraphErrorException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .registerError(GraphErrorException.class) - .build(response); - } - /** * Gets AD group membership for the specified AD object IDs. * @@ -271,13 +193,13 @@ private ServiceResponse getCurrentUserDelegate(Response getObjectsByObjectIdsNext(final String nextLink) { - ServiceResponse> response = getObjectsByObjectIdsNextSinglePageAsync(nextLink).toBlocking().single(); - return new PagedList(response.body()) { + public PagedList getObjectsByObjectIdsNext(final String nextLink) { + ServiceResponse> response = getObjectsByObjectIdsNextSinglePageAsync(nextLink).toBlocking().single(); + return new PagedList(response.body()) { @Override - public Page nextPage(String nextLink) { + public Page nextPage(String nextLink) { return getObjectsByObjectIdsNextSinglePageAsync(nextLink).toBlocking().single().body(); } }; @@ -292,12 +214,12 @@ public Page nextPage(String nextLink) { * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> getObjectsByObjectIdsNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + public ServiceFuture> getObjectsByObjectIdsNextAsync(final String nextLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { return AzureServiceFuture.fromPageResponse( getObjectsByObjectIdsNextSinglePageAsync(nextLink), - new Func1>>>() { + new Func1>>>() { @Override - public Observable>> call(String nextLink) { + public Observable>> call(String nextLink) { return getObjectsByObjectIdsNextSinglePageAsync(nextLink); } }, @@ -309,13 +231,13 @@ public Observable>> call(String nextLink) { * * @param nextLink Next link for the list operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<AADObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable> getObjectsByObjectIdsNextAsync(final String nextLink) { + public Observable> getObjectsByObjectIdsNextAsync(final String nextLink) { return getObjectsByObjectIdsNextWithServiceResponseAsync(nextLink) - .map(new Func1>, Page>() { + .map(new Func1>, Page>() { @Override - public Page call(ServiceResponse> response) { + public Page call(ServiceResponse> response) { return response.body(); } }); @@ -326,13 +248,13 @@ public Page call(ServiceResponse> response) * * @param nextLink Next link for the list operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the PagedList<AADObjectInner> object + * @return the observable to the PagedList<DirectoryObjectInner> object */ - public Observable>> getObjectsByObjectIdsNextWithServiceResponseAsync(final String nextLink) { + public Observable>> getObjectsByObjectIdsNextWithServiceResponseAsync(final String nextLink) { return getObjectsByObjectIdsNextSinglePageAsync(nextLink) - .concatMap(new Func1>, Observable>>>() { + .concatMap(new Func1>, Observable>>>() { @Override - public Observable>> call(ServiceResponse> page) { + public Observable>> call(ServiceResponse> page) { String nextLink = page.body().nextPageLink(); if (nextLink == null) { return Observable.just(page); @@ -345,11 +267,11 @@ public Observable>> call(ServiceResponse> * @param nextLink Next link for the list operation. + ServiceResponse> * @param nextLink Next link for the list operation. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the PagedList<AADObjectInner> object wrapped in {@link ServiceResponse} if successful. + * @return the PagedList<DirectoryObjectInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> getObjectsByObjectIdsNextSinglePageAsync(final String nextLink) { + public Observable>> getObjectsByObjectIdsNextSinglePageAsync(final String nextLink) { if (nextLink == null) { throw new IllegalArgumentException("Parameter nextLink is required and cannot be null."); } @@ -361,12 +283,12 @@ public Observable>> getObjectsByObjectIdsNe } String nextUrl = String.format("%s/%s", this.client.tenantID(), nextLink); return service.getObjectsByObjectIdsNext(nextUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = getObjectsByObjectIdsNextDelegate(response); - return Observable.just(new ServiceResponse>(result.body(), result.response())); + ServiceResponse> result = getObjectsByObjectIdsNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -374,9 +296,9 @@ public Observable>> call(Response> getObjectsByObjectIdsNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> getObjectsByObjectIdsNextDelegate(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); }