-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add create-user/update-password commands * Fix #19958: Add create user option to openmetadata-ops.sh (cherry picked from commit a41c14c)
- Loading branch information
Showing
3 changed files
with
158 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
openmetadata-spec/src/main/java/org/openmetadata/sdk/exception/UserCreationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.openmetadata.sdk.exception; | ||
|
||
import javax.ws.rs.core.Response; | ||
|
||
public class UserCreationException extends WebServiceException { | ||
private static final String BY_NAME_MESSAGE = "User Creation Exception [%s] due to [%s]."; | ||
private static final String ERROR_TYPE = "USER_CREATION_EXCEPTION"; | ||
|
||
public UserCreationException(String message) { | ||
super(Response.Status.INTERNAL_SERVER_ERROR, ERROR_TYPE, message); | ||
} | ||
|
||
private UserCreationException(Response.Status status, String message) { | ||
super(status, ERROR_TYPE, message); | ||
} | ||
|
||
public UserCreationException(Response.Status status, String errorType, String message) { | ||
super(status, errorType, message); | ||
} | ||
|
||
public static UserCreationException byMessage( | ||
String name, String errorMessage, Response.Status status) { | ||
return new UserCreationException(status, buildMessageByName(name, errorMessage)); | ||
} | ||
|
||
public static UserCreationException byMessage( | ||
String name, String errorType, String errorMessage, Response.Status status) { | ||
return new UserCreationException(status, errorType, buildMessageByName(name, errorMessage)); | ||
} | ||
|
||
public static UserCreationException byMessage(String name, String errorMessage) { | ||
return new UserCreationException( | ||
Response.Status.BAD_REQUEST, buildMessageByName(name, errorMessage)); | ||
} | ||
|
||
private static String buildMessageByName(String name, String errorMessage) { | ||
return String.format(BY_NAME_MESSAGE, name, errorMessage); | ||
} | ||
} |