in sources/src/main/java/com/google/solutions/jitaccess/apis/clients/CloudIdentityGroupsClient.java [123:148]
private static void translateAndThrowApiException(
@NotNull GoogleJsonResponseException e
) throws AccessException, IOException {
switch (e.getStatusCode()) {
case 400:
throw new IllegalArgumentException("Invalid argument", e);
case 401:
throw new NotAuthenticatedException("Not authenticated", e);
case 403: {
if (e.getDetails() != null) {
var message = e.getDetails().get("message");
if (message instanceof String &&
(((String) message).contains("3005") || ((String) message).contains("3006"))) {
throw new AccessDeniedException("This feature requires a Cloud Identity Premium or Workspace subscription");
}
}
throw new AccessDeniedException(
"The group or membership does not exist in Cloud Identity, or access to Cloud Identity API is denied", e);
}
case 404:
throw new ResourceNotFoundException("The group or membership does not exist", e);
default:
throw (GoogleJsonResponseException)e.fillInStackTrace();
}
}