public class MinioAdminClient extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MinioAdminClient.Builder
Argument builder of
MinioAdminClient. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCannedPolicy(String name,
String policy)
Creates a policy.
|
void |
addUser(String accessKey,
UserInfo.Status status,
String secretKey,
String policyName,
List<String> memberOf)
Adds a user with the specified access and secret key.
|
static MinioAdminClient.Builder |
builder() |
void |
deleteUser(String accessKey)
Deletes a user by it's access key
|
void |
ignoreCertCheck()
Ignores check on server certificate for HTTPS connection.
|
Map<String,String> |
listCannedPolicies()
Lists all configured canned policies.
|
Map<String,UserInfo> |
listUsers()
Obtains a list of all MinIO users.
|
void |
removeCannedPolicy(String name)
Removes canned policy by name.
|
void |
setAppInfo(String name,
String version)
Sets application's name/version to user agent.
|
void |
setPolicy(String userOrGroupName,
boolean isGroup,
String policyName)
Sets a policy to a given user or group.
|
void |
setTimeout(long connectTimeout,
long writeTimeout,
long readTimeout)
Sets HTTP connect, write and read timeouts.
|
void |
traceOff()
Disables HTTP call tracing previously enabled.
|
void |
traceOn(OutputStream traceStream)
Enables HTTP call tracing and written to traceStream.
|
public void addUser(@Nonnull String accessKey, @Nonnull UserInfo.Status status, @Nullable String secretKey, @Nullable String policyName, @Nullable List<String> memberOf) throws NoSuchAlgorithmException, InvalidKeyException, IOException, org.bouncycastle.crypto.InvalidCipherTextException
accessKey - Access key.status - Status.secretKey - Secret key.policyName - Policy name.memberOf - List of group.NoSuchAlgorithmException - thrown to indicate missing of MD5 or SHA-256 digest library.InvalidKeyException - thrown to indicate missing of HMAC SHA-256 library.IOException - thrown to indicate I/O error on MinIO REST operation.org.bouncycastle.crypto.InvalidCipherTextException - thrown to indicate data cannot be encrypted/decrypted.public Map<String,UserInfo> listUsers() throws NoSuchAlgorithmException, InvalidKeyException, IOException, org.bouncycastle.crypto.InvalidCipherTextException
NoSuchAlgorithmException - thrown to indicate missing of MD5 or SHA-256 digest library.InvalidKeyException - thrown to indicate missing of HMAC SHA-256 library.IOException - thrown to indicate I/O error on MinIO REST operation.org.bouncycastle.crypto.InvalidCipherTextException - thrown to indicate data cannot be encrypted/decrypted.public void deleteUser(@Nonnull String accessKey) throws NoSuchAlgorithmException, InvalidKeyException, IOException
accessKey - Access Key.NoSuchAlgorithmException - thrown to indicate missing of MD5 or SHA-256 digest library.InvalidKeyException - thrown to indicate missing of HMAC SHA-256 library.IOException - thrown to indicate I/O error on MinIO REST operation.public void addCannedPolicy(@Nonnull String name, @Nonnull String policy) throws NoSuchAlgorithmException, InvalidKeyException, IOException
Example:
// Assume policyJson contains below JSON string;
// {
// "Statement": [
// {
// "Action": "s3:GetObject",
// "Effect": "Allow",
// "Principal": "*",
// "Resource": "arn:aws:s3:::my-bucketname/myobject*"
// }
// ],
// "Version": "2012-10-17"
// }
//
client.addCannedPolicy("my-policy-name", policyJson);
name - Policy name.policy - Policy as JSON string.NoSuchAlgorithmException - thrown to indicate missing of MD5 or SHA-256 digest library.InvalidKeyException - thrown to indicate missing of HMAC SHA-256 library.IOException - thrown to indicate I/O error on MinIO REST operation.public void setPolicy(@Nonnull String userOrGroupName, boolean isGroup, @Nonnull String policyName) throws NoSuchAlgorithmException, InvalidKeyException, IOException
userOrGroupName - User/Group name.isGroup - Flag to denote userOrGroupName is a group name.policyName - Policy name.NoSuchAlgorithmException - thrown to indicate missing of MD5 or SHA-256 digest library.InvalidKeyException - thrown to indicate missing of HMAC SHA-256 library.IOException - thrown to indicate I/O error on MinIO REST operation.public Map<String,String> listCannedPolicies() throws NoSuchAlgorithmException, InvalidKeyException, IOException
NoSuchAlgorithmException - thrown to indicate missing of MD5 or SHA-256 digest library.InvalidKeyException - thrown to indicate missing of HMAC SHA-256 library.IOException - thrown to indicate I/O error on MinIO REST operation.public void removeCannedPolicy(@Nonnull String name) throws NoSuchAlgorithmException, InvalidKeyException, IOException
name - Policy name.NoSuchAlgorithmException - thrown to indicate missing of MD5 or SHA-256 digest library.InvalidKeyException - thrown to indicate missing of HMAC SHA-256 library.IOException - thrown to indicate I/O error on MinIO REST operation.public void setTimeout(long connectTimeout,
long writeTimeout,
long readTimeout)
Example:
minioClient.setTimeout(TimeUnit.SECONDS.toMillis(10), TimeUnit.SECONDS.toMillis(10),
TimeUnit.SECONDS.toMillis(30));
connectTimeout - HTTP connect timeout in milliseconds.writeTimeout - HTTP write timeout in milliseconds.readTimeout - HTTP read timeout in milliseconds.public void ignoreCertCheck()
throws KeyManagementException,
NoSuchAlgorithmException
Example:
client.ignoreCertCheck();
KeyManagementException - thrown to indicate key management error.NoSuchAlgorithmException - thrown to indicate missing of SSL library.public void setAppInfo(String name, String version)
name - Your application name.version - Your application version.public void traceOn(OutputStream traceStream)
traceStream - OutputStream for writing HTTP call tracing.traceOff()public void traceOff()
throws IOException
IOException - upon connection errortraceOn(java.io.OutputStream)public static MinioAdminClient.Builder builder()