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 |
addUpdateGroup(String group,
Status groupStatus,
List<String> members)
Adds or updates a group.
|
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 |
clearBucketQuota(String bucketName)
Reset bucket quota
|
void |
deleteUser(String accessKey)
Deletes a user by it's access key
|
long |
getBucketQuota(String bucketName)
get bucket quota size
|
DataUsageInfo |
getDataUsageInfo()
Get server/cluster data usage info
|
GroupInfo |
getGroupInfo(String group)
Obtains group info for a specified MinIO group.
|
UserInfo |
getUserInfo(String accessKey)
Obtains user info for a specified MinIO user.
|
void |
ignoreCertCheck()
Ignores check on server certificate for HTTPS connection.
|
Map<String,String> |
listCannedPolicies()
Lists all configured canned policies.
|
List<String> |
listGroups()
Obtains a list of all MinIO groups.
|
Map<String,UserInfo> |
listUsers()
Obtains a list of all MinIO users.
|
void |
removeCannedPolicy(String name)
Removes canned policy by name.
|
void |
removeGroup(String group)
Removes a group.
|
void |
setAppInfo(String name,
String version)
Sets application's name/version to user agent.
|
void |
setBucketQuota(String bucketName,
long size,
QuotaUnit unit)
set bucket quota size
|
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 UserInfo getUserInfo(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 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 addUpdateGroup(@Nonnull String group, @Nullable Status groupStatus, @Nullable List<String> members) throws NoSuchAlgorithmException, InvalidKeyException, IOException
group - Group name.groupStatus - Status.members - Members 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.public GroupInfo getGroupInfo(String group) throws NoSuchAlgorithmException, InvalidKeyException, IOException
group - Group 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 List<String> listGroups() 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 removeGroup(@Nonnull String group) throws NoSuchAlgorithmException, InvalidKeyException, IOException
group - Group 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 setBucketQuota(@Nonnull String bucketName, long size, @Nonnull QuotaUnit unit) throws IOException, NoSuchAlgorithmException, InvalidKeyException
bucketName - bucketNamesize - the capacity of the bucketunit - the quota unit of the size argumentNoSuchAlgorithmException - 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 long getBucketQuota(String bucketName) throws IOException, NoSuchAlgorithmException, InvalidKeyException
bucketName - bucketNameIOExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionpublic void clearBucketQuota(@Nonnull String bucketName) throws IOException, NoSuchAlgorithmException, InvalidKeyException
bucketName - bucketNameNoSuchAlgorithmException - 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 DataUsageInfo getDataUsageInfo() throws IOException, NoSuchAlgorithmException, InvalidKeyException
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()