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 5979e0d7bf34..a3a19f291e82 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 @@ -10,6 +10,7 @@ import java.util.List; import com.microsoft.azure.graphrbac.AppRole; +import com.microsoft.azure.graphrbac.RequiredResourceAccess; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeName; @@ -75,6 +76,15 @@ public class ApplicationInner extends DirectoryObjectInner { @JsonProperty(value = "oauth2AllowImplicitFlow") private Boolean oauth2AllowImplicitFlow; + /** + * Specifies resources that this application requires access to and the set + * of OAuth permission scopes and application roles that it needs under + * each of those resources. This pre-configuration of required resource + * access drives the consent experience. + */ + @JsonProperty(value = "requiredResourceAccess") + private List requiredResourceAccess; + /** * Get the application ID. * @@ -255,4 +265,24 @@ public ApplicationInner withOauth2AllowImplicitFlow(Boolean oauth2AllowImplicitF return this; } + /** + * Get specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. + * + * @return the requiredResourceAccess value + */ + public List requiredResourceAccess() { + return this.requiredResourceAccess; + } + + /** + * Set specifies resources that this application requires access to and the set of OAuth permission scopes and application roles that it needs under each of those resources. This pre-configuration of required resource access drives the consent experience. + * + * @param requiredResourceAccess the requiredResourceAccess value to set + * @return the ApplicationInner object itself. + */ + public ApplicationInner withRequiredResourceAccess(List requiredResourceAccess) { + this.requiredResourceAccess = requiredResourceAccess; + 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 1e26a5b1e7dd..a52876623d62 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 @@ -95,6 +95,10 @@ interface ApplicationsService { @POST("{tenantID}/applications/{applicationObjectId}/$links/owners") 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 removeOwner" }) + @HTTP(path = "{tenantID}/applications/{applicationObjectId}/$links/owners/{ownerObjectId}", method = "DELETE", hasBody = true) + Observable> removeOwner(@Path("applicationObjectId") String applicationObjectId, @Path("ownerObjectId") String ownerObjectId, @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 listKeyCredentials" }) @GET("{tenantID}/applications/{applicationObjectId}/keyCredentials") Observable> listKeyCredentials(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -863,6 +867,91 @@ private ServiceResponse addOwnerDelegate(Response response) .build(response); } + /** + * Remove a member from owners. + * + * @param applicationObjectId The object ID of the application from which to remove the owner. + * @param ownerObjectId Owner 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 + */ + public void removeOwner(String applicationObjectId, String ownerObjectId) { + removeOwnerWithServiceResponseAsync(applicationObjectId, ownerObjectId).toBlocking().single().body(); + } + + /** + * Remove a member from owners. + * + * @param applicationObjectId The object ID of the application from which to remove the owner. + * @param ownerObjectId Owner 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 removeOwnerAsync(String applicationObjectId, String ownerObjectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(removeOwnerWithServiceResponseAsync(applicationObjectId, ownerObjectId), serviceCallback); + } + + /** + * Remove a member from owners. + * + * @param applicationObjectId The object ID of the application from which to remove the owner. + * @param ownerObjectId Owner object id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable removeOwnerAsync(String applicationObjectId, String ownerObjectId) { + return removeOwnerWithServiceResponseAsync(applicationObjectId, ownerObjectId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Remove a member from owners. + * + * @param applicationObjectId The object ID of the application from which to remove the owner. + * @param ownerObjectId Owner object id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> removeOwnerWithServiceResponseAsync(String applicationObjectId, String ownerObjectId) { + if (applicationObjectId == null) { + throw new IllegalArgumentException("Parameter applicationObjectId is required and cannot be null."); + } + if (ownerObjectId == null) { + throw new IllegalArgumentException("Parameter ownerObjectId 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.removeOwner(applicationObjectId, ownerObjectId, 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 = removeOwnerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse removeOwnerDelegate(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); + } + /** * Get the keyCredentials associated with an application. * 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 0235c69f6f00..dfe85d91da50 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 @@ -110,6 +110,10 @@ interface GroupsService { @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 removeOwner" }) + @HTTP(path = "{tenantID}/groups/{objectId}/$links/owners/{ownerObjectId}", method = "DELETE", hasBody = true) + Observable> removeOwner(@Path("objectId") String objectId, @Path("ownerObjectId") String ownerObjectId, @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 listNext" }) @GET Observable> listNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -1238,6 +1242,91 @@ private ServiceResponse addOwnerDelegate(Response response) .build(response); } + /** + * Remove a member from owners. + * + * @param objectId The object ID of the group from which to remove the owner. + * @param ownerObjectId Owner 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 + */ + public void removeOwner(String objectId, String ownerObjectId) { + removeOwnerWithServiceResponseAsync(objectId, ownerObjectId).toBlocking().single().body(); + } + + /** + * Remove a member from owners. + * + * @param objectId The object ID of the group from which to remove the owner. + * @param ownerObjectId Owner 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 removeOwnerAsync(String objectId, String ownerObjectId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(removeOwnerWithServiceResponseAsync(objectId, ownerObjectId), serviceCallback); + } + + /** + * Remove a member from owners. + * + * @param objectId The object ID of the group from which to remove the owner. + * @param ownerObjectId Owner object id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable removeOwnerAsync(String objectId, String ownerObjectId) { + return removeOwnerWithServiceResponseAsync(objectId, ownerObjectId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Remove a member from owners. + * + * @param objectId The object ID of the group from which to remove the owner. + * @param ownerObjectId Owner object id + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> removeOwnerWithServiceResponseAsync(String objectId, String ownerObjectId) { + if (objectId == null) { + throw new IllegalArgumentException("Parameter objectId is required and cannot be null."); + } + if (ownerObjectId == null) { + throw new IllegalArgumentException("Parameter ownerObjectId 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.removeOwner(objectId, ownerObjectId, 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 = removeOwnerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse removeOwnerDelegate(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. *