use of com.cloudera.thunderhead.service.usermanagement.UserManagementProto.DeleteGroupResponse in project cloudbreak by hortonworks.
the class UmsClient method deleteGroup.
/**
* Delete user group if it exist.
*
* @param requestId the request ID for the request
* @param accountId the account ID
* @param groupName the newly created group name
*/
public void deleteGroup(String requestId, String accountId, String groupName) {
checkNotNull(requestId, "requestId should not be null.");
checkNotNull(groupName, "groupName should not be null.");
validateAccountIdWithWarning(accountId);
try {
DeleteGroupResponse deleteGroupResponse = newStub(requestId).deleteGroup(DeleteGroupRequest.newBuilder().setAccountId(accountId).setGroupNameOrCrn(groupName).build());
LOGGER.info("User group has been deleted: \nName{} \nResponse: {}.", groupName, deleteGroupResponse.getAllFields());
} catch (StatusRuntimeException e) {
if (e.getStatus().getCode().equals(Status.NOT_FOUND.getCode())) {
LOGGER.info("User group '{}' not found or has already been deleted.", groupName);
} else {
throw e;
}
}
}
Aggregations