Skip to content

Commit

Permalink
Add getObject{Acl,Attributes}, putObjectFanOut, promptObject APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Bala.FA <[email protected]>
  • Loading branch information
balamurugana committed Jan 29, 2025
1 parent 0f533e8 commit 9c1f1b4
Show file tree
Hide file tree
Showing 26 changed files with 2,051 additions and 39 deletions.
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
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

0 comments on commit 9c1f1b4

Please sign in to comment.