-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Bala.FA <[email protected]>
- Loading branch information
1 parent
0c736df
commit f6e4164
Showing
21 changed files
with
972 additions
and
29 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
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,66 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 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; | ||
|
||
import io.minio.messages.RestoreRequest; | ||
import java.util.Objects; | ||
|
||
/** Argument class of {@link MinioClient#restoreObject}. */ | ||
public class RestoreObjectArgs extends ObjectVersionArgs { | ||
private RestoreRequest request; | ||
|
||
public RestoreRequest request() { | ||
return request; | ||
} | ||
|
||
public static Builder builder() { | ||
return new Builder(); | ||
} | ||
|
||
/** Argument builder of {@link RestoreObjectArgs}. */ | ||
public static final class Builder extends ObjectVersionArgs.Builder<Builder, RestoreObjectArgs> { | ||
private void validateRequest(RestoreRequest request) { | ||
validateNotNull(request, "request"); | ||
} | ||
|
||
public Builder request(RestoreRequest request) { | ||
validateRequest(request); | ||
operations.add(args -> args.request = request); | ||
return this; | ||
} | ||
|
||
@Override | ||
protected void validate(RestoreObjectArgs args) { | ||
super.validate(args); | ||
validateRequest(args.request()); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof RestoreObjectArgs)) return false; | ||
if (!super.equals(o)) return false; | ||
RestoreObjectArgs that = (RestoreObjectArgs) o; | ||
return Objects.equals(request, that.request); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(super.hashCode(), request); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
api/src/main/java/io/minio/messages/AccessControlList.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,40 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 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.messages; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import javax.annotation.Nonnull; | ||
import org.simpleframework.xml.ElementList; | ||
import org.simpleframework.xml.Root; | ||
|
||
/** Helper class to denote access control list of {@link S3OutputLocation}. */ | ||
@Root(name = "AccessControlList") | ||
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "URF_UNREAD_FIELD") | ||
public class AccessControlList { | ||
@ElementList(name = "Grant", inline = true) | ||
private List<Grant> grants; | ||
|
||
public AccessControlList(@Nonnull List<Grant> grants) { | ||
Objects.requireNonNull(grants, "Grants must not be null"); | ||
if (grants.size() == 0) { | ||
throw new IllegalArgumentException("Grants must not be empty"); | ||
} | ||
this.grants = Collections.unmodifiableList(grants); | ||
} | ||
} |
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,72 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 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.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; | ||
|
||
/** CannedAcl representing retrieval cannedAcl value. */ | ||
@Root(name = "CannedAcl") | ||
@Convert(CannedAcl.CannedAclConverter.class) | ||
public enum CannedAcl { | ||
PRIVATE("private"), | ||
PUBLIC_READ("public-read"), | ||
PUBLIC_READ_WRITE("public-read-write"), | ||
AUTHENTICATED_READ("authenticated-read"), | ||
AWS_EXEC_READ("aws-exec-read"), | ||
BUCKET_OWNER_READ("bucket-owner-read"), | ||
BUCKET_OWNER_FULL_CONTROL("bucket-owner-full-control"); | ||
|
||
private final String value; | ||
|
||
private CannedAcl(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String toString() { | ||
return this.value; | ||
} | ||
|
||
/** Returns CannedAcl of given string. */ | ||
@JsonCreator | ||
public static CannedAcl fromString(String cannedAclString) { | ||
for (CannedAcl cannedAcl : CannedAcl.values()) { | ||
if (cannedAclString.equals(cannedAcl.value)) { | ||
return cannedAcl; | ||
} | ||
} | ||
|
||
throw new IllegalArgumentException("Unknown canned ACL '" + cannedAclString + "'"); | ||
} | ||
|
||
/** XML converter class. */ | ||
public static class CannedAclConverter implements Converter<CannedAcl> { | ||
@Override | ||
public CannedAcl read(InputNode node) throws Exception { | ||
return CannedAcl.fromString(node.getValue()); | ||
} | ||
|
||
@Override | ||
public void write(OutputNode node, CannedAcl cannedAcl) throws Exception { | ||
node.setValue(cannedAcl.toString()); | ||
} | ||
} | ||
} |
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,47 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 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.messages; | ||
|
||
import java.util.Objects; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import org.simpleframework.xml.Element; | ||
import org.simpleframework.xml.Root; | ||
|
||
/** Helper class to denote encryption information of {@link S3OutputLocation}. */ | ||
@Root(name = "Encryption") | ||
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "URF_UNREAD_FIELD") | ||
public class Encryption { | ||
@Element(name = "EncryptionType") | ||
private SseAlgorithm encryptionType; | ||
|
||
@Element(name = "KMSContext", required = false) | ||
private String kmsContext; | ||
|
||
@Element(name = "KMSKeyId", required = false) | ||
private String kmsKeyId; | ||
|
||
public Encryption( | ||
@Nonnull SseAlgorithm encryptionType, | ||
@Nullable String kmsContext, | ||
@Nullable String kmsKeyId) { | ||
this.encryptionType = | ||
Objects.requireNonNull(encryptionType, "Encryption type must not be null"); | ||
this.kmsContext = kmsContext; | ||
this.kmsKeyId = kmsKeyId; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
api/src/main/java/io/minio/messages/GlacierJobParameters.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,34 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 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.messages; | ||
|
||
import java.util.Objects; | ||
import javax.annotation.Nonnull; | ||
import org.simpleframework.xml.Element; | ||
import org.simpleframework.xml.Root; | ||
|
||
/** Helper class to denote S3 Glacier job parameters of {@link RestoreRequest}. */ | ||
@Root(name = "GlacierJobParameters") | ||
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "URF_UNREAD_FIELD") | ||
public class GlacierJobParameters { | ||
@Element(name = "Tier") | ||
private Tier tier; | ||
|
||
public GlacierJobParameters(@Nonnull Tier tier) { | ||
this.tier = Objects.requireNonNull(tier, "Tier must not be null"); | ||
} | ||
} |
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,40 @@ | ||
/* | ||
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 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.messages; | ||
|
||
import javax.annotation.Nullable; | ||
import org.simpleframework.xml.Element; | ||
import org.simpleframework.xml.Root; | ||
|
||
/** Helper class to denote grant information of {@link AccessControlList}. */ | ||
@Root(name = "Grant") | ||
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "URF_UNREAD_FIELD") | ||
public class Grant { | ||
@Element(name = "Grantee", required = false) | ||
private Grantee grantee; | ||
|
||
@Element(name = "Permission", required = false) | ||
private Permission permission; | ||
|
||
public Grant(@Nullable Grantee grantee, @Nullable Permission permission) { | ||
if (grantee == null && permission == null) { | ||
throw new IllegalArgumentException("Either Grantee or Permission must be provided"); | ||
} | ||
this.grantee = grantee; | ||
this.permission = permission; | ||
} | ||
} |
Oops, something went wrong.