-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
847 additions
and
18 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
api/src/main/java/io/minio/DeleteBucketEncryptionArgs.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,28 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2020 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; | ||
|
||
/** Argument class of MinioClient.deleteBucketEncryption(). */ | ||
public class DeleteBucketEncryptionArgs extends BucketArgs { | ||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
/** Argument builder of {@link DeleteBucketEncryptionArgs}. */ | ||
public static final class Builder | ||
extends BucketArgs.Builder<Builder, DeleteBucketEncryptionArgs> {} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2020 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; | ||
|
||
/** Argument class of MinioClient.getBucketEncryption(). */ | ||
public class GetBucketEncryptionArgs extends BucketArgs { | ||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
/** Argument builder of {@link GetBucketEncryptionArgs}. */ | ||
public static final class Builder extends BucketArgs.Builder<Builder, GetBucketEncryptionArgs> {} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2020 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; | ||
|
||
import io.minio.messages.SseConfiguration; | ||
|
||
/** Argument class of MinioClient.setBucketEncryption(). */ | ||
public class SetBucketEncryptionArgs extends BucketArgs { | ||
private SseConfiguration config; | ||
|
||
public SseConfiguration config() { | ||
return config; | ||
} | ||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
/** Argument builder of {@link SetBucketEncryptionArgs}. */ | ||
public static final class Builder extends BucketArgs.Builder<Builder, SetBucketEncryptionArgs> { | ||
private void validateConfig(SseConfiguration config) { | ||
if (config == null) { | ||
throw new IllegalArgumentException("null server-side encryption configuration"); | ||
} | ||
} | ||
|
||
protected void validate(SetBucketEncryptionArgs args) { | ||
super.validate(args); | ||
validateConfig(args.config); | ||
} | ||
|
||
public Builder config(SseConfiguration config) { | ||
validateConfig(config); | ||
operations.add(args -> args.config = config); | ||
return this; | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
api/src/main/java/io/minio/messages/ApplySseByDefault.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,48 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2020 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.messages; | ||
|
||
import org.simpleframework.xml.Element; | ||
import org.simpleframework.xml.Namespace; | ||
import org.simpleframework.xml.Root; | ||
|
||
/** Helper class to denote default rule information for {@link SseConfiguration}. */ | ||
@Root(name = "ApplyServerSideEncryptionByDefault") | ||
@Namespace(reference = "http://s3.amazonaws.com/doc/2006-03-01/") | ||
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "URF_UNREAD_FIELD") | ||
public class ApplySseByDefault { | ||
@Element(name = "KMSMasterKeyID", required = false) | ||
private String kmsMasterKeyId; | ||
|
||
@Element(name = "SSEAlgorithm") | ||
private SseAlgorithm sseAlgorithm; | ||
|
||
public ApplySseByDefault() {} | ||
|
||
public ApplySseByDefault(String kmsMasterKeyId, SseAlgorithm sseAlgorithm) { | ||
this.kmsMasterKeyId = kmsMasterKeyId; | ||
this.sseAlgorithm = sseAlgorithm; | ||
} | ||
|
||
public String kmsMasterKeyId() { | ||
return this.kmsMasterKeyId; | ||
} | ||
|
||
public SseAlgorithm sseAlgorithm() { | ||
return this.sseAlgorithm; | ||
} | ||
} |
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,67 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2020 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.messages; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import org.simpleframework.xml.Root; | ||
import org.simpleframework.xml.convert.Convert; | ||
import org.simpleframework.xml.convert.Converter; | ||
import org.simpleframework.xml.stream.InputNode; | ||
import org.simpleframework.xml.stream.OutputNode; | ||
|
||
/** Server-side encryption algorithm. */ | ||
@Root(name = "SSEAlgorithm") | ||
@Convert(SseAlgorithm.SseAlgorithmConverter.class) | ||
public enum SseAlgorithm { | ||
AES256("AES256"), | ||
AWS_KMS("aws:kms"); | ||
|
||
private final String value; | ||
|
||
private SseAlgorithm(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String toString() { | ||
return this.value; | ||
} | ||
|
||
/** Returns SseAlgorithm of given string. */ | ||
@JsonCreator | ||
public static SseAlgorithm fromString(String sseAlgorithmString) { | ||
for (SseAlgorithm sa : SseAlgorithm.values()) { | ||
if (sseAlgorithmString.equals(sa.value)) { | ||
return sa; | ||
} | ||
} | ||
|
||
throw new IllegalArgumentException("unknown SSE algorithm '" + sseAlgorithmString + "'"); | ||
} | ||
|
||
/** XML converter class. */ | ||
public static class SseAlgorithmConverter implements Converter<SseAlgorithm> { | ||
@Override | ||
public SseAlgorithm read(InputNode node) throws Exception { | ||
return SseAlgorithm.fromString(node.getValue()); | ||
} | ||
|
||
@Override | ||
public void write(OutputNode node, SseAlgorithm sseAlgorithm) throws Exception { | ||
node.setValue(sseAlgorithm.toString()); | ||
} | ||
} | ||
} |
Oops, something went wrong.