Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new APIs #1619

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions api/src/main/java/io/minio/BaseArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.function.Consumer;
import okhttp3.HttpUrl;

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

protected void checkSse(ServerSideEncryption sse, HttpUrl url) {
if (sse == null) {
return;
}

if (sse.tlsRequired() && !url.isHttps()) {
throw new IllegalArgumentException(
sse + " operations must be performed over a secure connection.");
}
}

/** Base builder which builds arguments. */
public abstract static class Builder<B extends Builder<B, A>, A extends BaseArgs> {
protected List<Consumer<A>> operations;
Expand Down
30 changes: 30 additions & 0 deletions api/src/main/java/io/minio/DeleteBucketCorsArgs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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 {@link MinioAsyncClient#deleteBucketCors} and {@link
* MinioClient#deleteBucketCors}.
*/
public class DeleteBucketCorsArgs extends BucketArgs {
public static Builder builder() {
return new Builder();
}

/** Argument builder of {@link DeleteBucketCorsArgs}. */
public static final class Builder extends BucketArgs.Builder<Builder, DeleteBucketCorsArgs> {}
}
29 changes: 29 additions & 0 deletions api/src/main/java/io/minio/GetBucketCorsArgs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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 {@link MinioAsyncClient#getBucketCors} and {@link MinioClient#getBucketCors}.
*/
public class GetBucketCorsArgs extends BucketArgs {
public static Builder builder() {
return new Builder();
}

/** Argument builder of {@link GetBucketCorsArgs}. */
public static final class Builder extends BucketArgs.Builder<Builder, GetBucketCorsArgs> {}
}
27 changes: 27 additions & 0 deletions api/src/main/java/io/minio/GetObjectAclArgs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2025 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 {@link MinioAsyncClient#getObjectAcl} and {@link MinioClient#getObjectAcl}. */
public class GetObjectAclArgs extends ObjectVersionArgs {
public static Builder builder() {
return new Builder();
}

/** Argument builder of {@link GetObjectAclArgs}. */
public static final class Builder extends ObjectVersionArgs.Builder<Builder, GetObjectAclArgs> {}
}
96 changes: 96 additions & 0 deletions api/src/main/java/io/minio/GetObjectAttributesArgs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2025 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 java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
* Argument class of {@link MinioAsyncClient#getObjectAttributes} and {@link
* MinioClient#getObjectAttributes}.
*/
public class GetObjectAttributesArgs extends ObjectReadArgs {
private List<String> objectAttributes;
private Integer maxParts;
private Integer partNumberMarker;

public List<String> objectAttributes() {
return objectAttributes;
}

public Integer maxParts() {
return maxParts;
}

public Integer partNumberMarker() {
return partNumberMarker;
}

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

/** Argument builder of {@link GetObjectAttributesArgs}. */
public static final class Builder
extends ObjectReadArgs.Builder<Builder, GetObjectAttributesArgs> {
@Override
protected void validate(GetObjectAttributesArgs args) {
super.validate(args);
validateNotNull(args.objectAttributes, "object attributes");
}

public Builder objectAttributes(String[] objectAttributes) {
operations.add(
args ->
args.objectAttributes =
objectAttributes == null ? null : Arrays.asList(objectAttributes));
return this;
}

public Builder objectAttributes(List<String> objectAttributes) {
operations.add(args -> args.objectAttributes = objectAttributes);
return this;
}

public Builder maxParts(Integer maxParts) {
operations.add(args -> args.maxParts = maxParts);
return this;
}

public Builder partNumberMarker(Integer partNumberMarker) {
operations.add(args -> args.partNumberMarker = partNumberMarker);
return this;
}
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof GetObjectAttributesArgs)) return false;
if (!super.equals(o)) return false;
GetObjectAttributesArgs that = (GetObjectAttributesArgs) o;
return Objects.equals(objectAttributes, that.objectAttributes)
&& Objects.equals(maxParts, that.maxParts)
&& Objects.equals(partNumberMarker, that.partNumberMarker);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), objectAttributes, maxParts, partNumberMarker);
}
}
42 changes: 42 additions & 0 deletions api/src/main/java/io/minio/GetObjectAttributesResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* MinIO Java SDK for Amazon S3 Compatible Cloud Storage, (C) 2025 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.GetObjectAttributesOutput;
import okhttp3.Headers;

/**
* Response class of {@link MinioAsyncClient#getObjectAttributes} and {@link
* MinioClient#getObjectAttributes}.
*/
public class GetObjectAttributesResponse extends GenericResponse {
private GetObjectAttributesOutput result;

public GetObjectAttributesResponse(
Headers headers,
String bucket,
String region,
String object,
GetObjectAttributesOutput result) {
super(headers, bucket, region, object);
this.result = result;
}

public GetObjectAttributesOutput result() {
return result;
}
}
Loading