Skip to content

Commit d1cb65b

Browse files
authored
Add new APIs (#1619)
Signed-off-by: Bala.FA <bala@minio.io>
1 parent 0f533e8 commit d1cb65b

34 files changed

+2922
-37
lines changed

api/src/main/java/io/minio/BaseArgs.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.Map;
2727
import java.util.Objects;
2828
import java.util.function.Consumer;
29+
import okhttp3.HttpUrl;
2930

3031
/** Base argument class. */
3132
public abstract class BaseArgs {
@@ -42,6 +43,17 @@ public Multimap<String, String> extraQueryParams() {
4243
return extraQueryParams;
4344
}
4445

46+
protected void checkSse(ServerSideEncryption sse, HttpUrl url) {
47+
if (sse == null) {
48+
return;
49+
}
50+
51+
if (sse.tlsRequired() && !url.isHttps()) {
52+
throw new IllegalArgumentException(
53+
sse + " operations must be performed over a secure connection.");
54+
}
55+
}
56+
4557
/** Base builder which builds arguments. */
4658
public abstract static class Builder<B extends Builder<B, A>, A extends BaseArgs> {
4759
protected List<Consumer<A>> operations;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2020 MinIO, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.minio;
18+
19+
/**
20+
* Argument class of {@link MinioAsyncClient#deleteBucketCors} and {@link
21+
* MinioClient#deleteBucketCors}.
22+
*/
23+
public class DeleteBucketCorsArgs extends BucketArgs {
24+
public static Builder builder() {
25+
return new Builder();
26+
}
27+
28+
/** Argument builder of {@link DeleteBucketCorsArgs}. */
29+
public static final class Builder extends BucketArgs.Builder<Builder, DeleteBucketCorsArgs> {}
30+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2020 MinIO, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.minio;
18+
19+
/**
20+
* Argument class of {@link MinioAsyncClient#getBucketCors} and {@link MinioClient#getBucketCors}.
21+
*/
22+
public class GetBucketCorsArgs extends BucketArgs {
23+
public static Builder builder() {
24+
return new Builder();
25+
}
26+
27+
/** Argument builder of {@link GetBucketCorsArgs}. */
28+
public static final class Builder extends BucketArgs.Builder<Builder, GetBucketCorsArgs> {}
29+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2025 MinIO, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.minio;
18+
19+
/** Argument class of {@link MinioAsyncClient#getObjectAcl} and {@link MinioClient#getObjectAcl}. */
20+
public class GetObjectAclArgs extends ObjectVersionArgs {
21+
public static Builder builder() {
22+
return new Builder();
23+
}
24+
25+
/** Argument builder of {@link GetObjectAclArgs}. */
26+
public static final class Builder extends ObjectVersionArgs.Builder<Builder, GetObjectAclArgs> {}
27+
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2025 MinIO, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.minio;
18+
19+
import java.util.Arrays;
20+
import java.util.List;
21+
import java.util.Objects;
22+
23+
/**
24+
* Argument class of {@link MinioAsyncClient#getObjectAttributes} and {@link
25+
* MinioClient#getObjectAttributes}.
26+
*/
27+
public class GetObjectAttributesArgs extends ObjectReadArgs {
28+
private List<String> objectAttributes;
29+
private Integer maxParts;
30+
private Integer partNumberMarker;
31+
32+
public List<String> objectAttributes() {
33+
return objectAttributes;
34+
}
35+
36+
public Integer maxParts() {
37+
return maxParts;
38+
}
39+
40+
public Integer partNumberMarker() {
41+
return partNumberMarker;
42+
}
43+
44+
public static Builder builder() {
45+
return new Builder();
46+
}
47+
48+
/** Argument builder of {@link GetObjectAttributesArgs}. */
49+
public static final class Builder
50+
extends ObjectReadArgs.Builder<Builder, GetObjectAttributesArgs> {
51+
@Override
52+
protected void validate(GetObjectAttributesArgs args) {
53+
super.validate(args);
54+
validateNotNull(args.objectAttributes, "object attributes");
55+
}
56+
57+
public Builder objectAttributes(String[] objectAttributes) {
58+
operations.add(
59+
args ->
60+
args.objectAttributes =
61+
objectAttributes == null ? null : Arrays.asList(objectAttributes));
62+
return this;
63+
}
64+
65+
public Builder objectAttributes(List<String> objectAttributes) {
66+
operations.add(args -> args.objectAttributes = objectAttributes);
67+
return this;
68+
}
69+
70+
public Builder maxParts(Integer maxParts) {
71+
operations.add(args -> args.maxParts = maxParts);
72+
return this;
73+
}
74+
75+
public Builder partNumberMarker(Integer partNumberMarker) {
76+
operations.add(args -> args.partNumberMarker = partNumberMarker);
77+
return this;
78+
}
79+
}
80+
81+
@Override
82+
public boolean equals(Object o) {
83+
if (this == o) return true;
84+
if (!(o instanceof GetObjectAttributesArgs)) return false;
85+
if (!super.equals(o)) return false;
86+
GetObjectAttributesArgs that = (GetObjectAttributesArgs) o;
87+
return Objects.equals(objectAttributes, that.objectAttributes)
88+
&& Objects.equals(maxParts, that.maxParts)
89+
&& Objects.equals(partNumberMarker, that.partNumberMarker);
90+
}
91+
92+
@Override
93+
public int hashCode() {
94+
return Objects.hash(super.hashCode(), objectAttributes, maxParts, partNumberMarker);
95+
}
96+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2025 MinIO, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.minio;
18+
19+
import io.minio.messages.GetObjectAttributesOutput;
20+
import okhttp3.Headers;
21+
22+
/**
23+
* Response class of {@link MinioAsyncClient#getObjectAttributes} and {@link
24+
* MinioClient#getObjectAttributes}.
25+
*/
26+
public class GetObjectAttributesResponse extends GenericResponse {
27+
private GetObjectAttributesOutput result;
28+
29+
public GetObjectAttributesResponse(
30+
Headers headers,
31+
String bucket,
32+
String region,
33+
String object,
34+
GetObjectAttributesOutput result) {
35+
super(headers, bucket, region, object);
36+
this.result = result;
37+
}
38+
39+
public GetObjectAttributesOutput result() {
40+
return result;
41+
}
42+
}

0 commit comments

Comments
 (0)