Skip to content

Commit

Permalink
Add MinIO admin client functionality (#1221)
Browse files Browse the repository at this point in the history
Co-authored-by: Minio Trusted <trusted@minio.io>
  • Loading branch information
Sam-Kramer and minio-trusted committed Sep 16, 2021
1 parent 9d5b365 commit c21b24c
Show file tree
Hide file tree
Showing 20 changed files with 1,645 additions and 336 deletions.
55 changes: 55 additions & 0 deletions admin/src/main/java/io/minio/admin/AddPolicyArgs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
* (C) 2015-2021 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.minio.admin;

import io.minio.BaseArgs;
import io.minio.ListBucketsArgs;

public class AddPolicyArgs extends BaseArgs {

protected String policyName;
protected String policyString;

public String policyName() {
return policyName;
}

public String policyString() {
return policyString;
}

public static AddPolicyArgs.Builder builder() {
return new AddPolicyArgs.Builder();
}

/** Argument builder of {@link ListBucketsArgs}. */
public static final class Builder extends BaseArgs.Builder<AddPolicyArgs.Builder, AddPolicyArgs> {
@Override
protected void validate(AddPolicyArgs args) {}

public AddPolicyArgs.Builder policyName(String policyName) {
this.operations.add(args -> args.policyName = policyName);
return this;
}

public AddPolicyArgs.Builder policyString(String policyString) {
this.operations.add(args -> args.policyString = policyString);
return this;
}
}
}
62 changes: 62 additions & 0 deletions admin/src/main/java/io/minio/admin/AddUserArgs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage,
* (C) 2015-2021 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.minio.admin;

import io.minio.BaseArgs;
import io.minio.ListBucketsArgs;

public class AddUserArgs extends BaseArgs {

protected String accessKey;
protected String secretKey;

public String accessKey() {
return accessKey;
}

public String secretKey() {
return secretKey;
}

public static AddUserArgs.Builder builder() {
return new AddUserArgs.Builder();
}

/** Argument builder of {@link ListBucketsArgs}. */
public static final class Builder extends BaseArgs.Builder<AddUserArgs.Builder, AddUserArgs> {
@Override
protected void validate(AddUserArgs args) {}

public AddUserArgs.Builder accessKey(String accessKey) {
this.operations.add(args -> args.accessKey = accessKey);
return this;
}

public AddUserArgs.Builder secretKey(String secretKey) {
this.operations.add(args -> args.secretKey = secretKey);
return this;
}
}

public UserInfo toUserInfo() {
UserInfo userInfo = new UserInfo();
userInfo.setSecretKey(secretKey());
userInfo.setStatus(UserInfo.STATUS_ENABLED);
return userInfo;
}
}
Loading

0 comments on commit c21b24c

Please sign in to comment.