Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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> requiredResourceAccess;

/**
* Get the application ID.
*
Expand Down Expand Up @@ -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> 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> requiredResourceAccess) {
this.requiredResourceAccess = requiredResourceAccess;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ interface ApplicationsService {
@POST("{tenantID}/applications/{applicationObjectId}/$links/owners")
Observable<Response<ResponseBody>> 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<Response<ResponseBody>> 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<Response<ResponseBody>> listKeyCredentials(@Path("applicationObjectId") String applicationObjectId, @Path("tenantID") String tenantID, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
Expand Down Expand Up @@ -863,6 +867,91 @@ private ServiceResponse<Void> addOwnerDelegate(Response<ResponseBody> 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<Void> removeOwnerAsync(String applicationObjectId, String ownerObjectId, final ServiceCallback<Void> 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<Void> removeOwnerAsync(String applicationObjectId, String ownerObjectId) {
return removeOwnerWithServiceResponseAsync(applicationObjectId, ownerObjectId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> 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<ServiceResponse<Void>> 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<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = removeOwnerDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

private ServiceResponse<Void> removeOwnerDelegate(Response<ResponseBody> response) throws GraphErrorException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<Void, GraphErrorException>newInstance(this.client.serializerAdapter())
.register(204, new TypeToken<Void>() { }.getType())
.registerError(GraphErrorException.class)
.build(response);
}

/**
* Get the keyCredentials associated with an application.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ interface GroupsService {
@POST("{tenantID}/groups/{objectId}/$links/owners")
Observable<Response<ResponseBody>> 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<Response<ResponseBody>> 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<Response<ResponseBody>> listNext(@Url String nextUrl, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
Expand Down Expand Up @@ -1238,6 +1242,91 @@ private ServiceResponse<Void> addOwnerDelegate(Response<ResponseBody> 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<Void> removeOwnerAsync(String objectId, String ownerObjectId, final ServiceCallback<Void> 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<Void> removeOwnerAsync(String objectId, String ownerObjectId) {
return removeOwnerWithServiceResponseAsync(objectId, ownerObjectId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> 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<ServiceResponse<Void>> 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<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = removeOwnerDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

private ServiceResponse<Void> removeOwnerDelegate(Response<ResponseBody> response) throws GraphErrorException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<Void, GraphErrorException>newInstance(this.client.serializerAdapter())
.register(204, new TypeToken<Void>() { }.getType())
.registerError(GraphErrorException.class)
.build(response);
}

/**
* Gets a list of groups for the current tenant.
*
Expand Down