Skip to content

Commit

Permalink
remove all deprecated methods and usage
Browse files Browse the repository at this point in the history
  • Loading branch information
balamurugana committed Mar 8, 2020
1 parent 095285f commit fcad3da
Show file tree
Hide file tree
Showing 24 changed files with 249 additions and 1,592 deletions.
26 changes: 0 additions & 26 deletions api/src/main/java/io/minio/BucketEventListener.java

This file was deleted.

1,358 changes: 30 additions & 1,328 deletions api/src/main/java/io/minio/MinioClient.java

Large diffs are not rendered by default.

63 changes: 0 additions & 63 deletions api/src/main/java/io/minio/ServerSideEncryption.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,6 @@ public static enum Type {
public boolean requiresTls() {
return this.equals(SSE_C) || this.equals(SSE_KMS);
}

/**
* Returns true if the server-side encryption requires signature V4.
* @return true if the type of server-side encryption requires signature V4.
*
* @deprecated As of release 7.0
*/
@Deprecated
public boolean requiresV4() {
return this.equals(SSE_KMS);
}
}

protected boolean destroyed = false;
Expand All @@ -83,28 +72,6 @@ public Map<String, String> copySourceHeaders() throws InvalidArgumentException {
throw new InvalidArgumentException(this.type().name() + " is not supported in copy source");
}

/**
* Returns the type of server-side encryption.
* @return the type of server-side encryption.
*
* @deprecated As of release 7.0
*/
@Deprecated
public Type getType() {
return this.type();
}

/**
* Set the server-side-encryption headers of this specific encryption.
* @param headers The metadata key-value map.
*
* @deprecated As of release 7.0
*/
@Deprecated
public void marshal(Map<String, String> headers) {
headers.putAll(this.headers());
}

@Override
public boolean isDestroyed() {
return this.destroyed;
Expand Down Expand Up @@ -198,36 +165,6 @@ public static ServerSideEncryption withCustomerKey(SecretKey key)
return new ServerSideEncryptionWithCustomerKey(key, MessageDigest.getInstance(("MD5")));
}

/**
* @deprecated As of release 7.0
*/
@Deprecated
static final class ServerSideEncryptionCopyWithCustomerKey extends ServerSideEncryptionWithCustomerKey {
public ServerSideEncryptionCopyWithCustomerKey(SecretKey key, MessageDigest md5) {
super(key, md5);
}
}

/**
* Create a new server-side-encryption object for encryption with customer
* provided keys (a.k.a. SSE-C).
*
* @param key The secret AES-256 key.
* @return An instance of ServerSideEncryption implementing SSE-C.
* @throws InvalidKeyException if the provided secret key is not a 256 bit AES key.
* @throws NoSuchAlgorithmException if the crypto provider does not implement MD5.
*
* @deprecated As of release 7.0
*/
@Deprecated
public static ServerSideEncryption copyWithCustomerKey(SecretKey key)
throws InvalidKeyException, NoSuchAlgorithmException {
if (!isCustomerKeyValid(key)) {
throw new InvalidKeyException("The secret key is not a 256 bit AES key");
}
return new ServerSideEncryptionCopyWithCustomerKey(key, MessageDigest.getInstance(("MD5")));
}

static final class ServerSideEncryptionS3 extends ServerSideEncryption {
@Override
public final Type type() {
Expand Down
11 changes: 6 additions & 5 deletions examples/ComposeObjectEncrypted.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.ComposeSource;
import io.minio.ServerSideEncryption;
import io.minio.errors.MinioException;
Expand Down Expand Up @@ -62,10 +63,10 @@ public static void main(String[] args)
String inputfile1 = "my-inputfile";
String inputfile2 = "my-inputfile";

minioClient.putObject(bucketName, sourceObject1, inputfile1, null,
null, ssePut, null);
minioClient.putObject(bucketName, sourceObject2, inputfile2, null,
null, ssePut, null);
PutObjectOptions options = new PutObjectOptions(-1, 6000000);
options.setSse(ssePut);
minioClient.putObject(bucketName, sourceObject1, inputfile1, options);
minioClient.putObject(bucketName, sourceObject2, inputfile2, options);

ComposeSource s1 = new ComposeSource(bucketName,sourceObject1, null, null,
null, null, ssePut );
Expand All @@ -83,4 +84,4 @@ public static void main(String[] args)
System.out.println("Error occurred: " + e);
}
}
}
}
4 changes: 2 additions & 2 deletions examples/CopyObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.errors.MinioException;

public class CopyObject {
Expand Down Expand Up @@ -65,8 +66,7 @@ public static void main(String[] args)
ByteArrayInputStream bais = new ByteArrayInputStream(builder.toString().getBytes("UTF-8"));

// Create object 'my-objectname' in 'my-bucketname' with content from the input stream.
minioClient.putObject("my-bucketname", "my-objectname", bais, Long.valueOf(bais.available()), null, null,
"application/octet-stream");
minioClient.putObject("my-bucketname", "my-objectname", bais, new PutObjectOptions(bais.available(), -1));
bais.close();
System.out.println("my-objectname is uploaded successfully");

Expand Down
5 changes: 4 additions & 1 deletion examples/CopyObjectEncrypted.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.ServerSideEncryption;
import io.minio.errors.MinioException;

Expand Down Expand Up @@ -61,7 +62,9 @@ public static void main(String[] args)
ServerSideEncryption sseTarget = ServerSideEncryption.withCustomerKey(secretKeySpecTarget);

// Create object 'my-objectname' in 'my-bucketname' with content from the input stream.
minioClient.putObject("my-bucketname", "my-objectname", bais, Long.valueOf(bais.available()), null, ssePut, null);
PutObjectOptions options = new PutObjectOptions(bais.available(), -1);
options.setSse(ssePut);
minioClient.putObject("my-bucketname", "my-objectname", bais, options);
System.out.println("my-objectname is uploaded successfully");

minioClient.copyObject("my-destbucketname", "my-objectname-copy", null, sseTarget,
Expand Down
5 changes: 4 additions & 1 deletion examples/CopyObjectEncryptedKms.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.ServerSideEncryption;
import io.minio.errors.MinioException;

Expand Down Expand Up @@ -57,7 +58,9 @@ public static void main(String[] args)
ServerSideEncryption sse = ServerSideEncryption.withManagedKeys("Key-Id", myContext);

// Create object 'my-objectname' in 'my-bucketname' with content from the input stream.
minioClient.putObject("my-bucketname", "my-objectname", bais, Long.valueOf(bais.available()), null, sse, null);
PutObjectOptions options = new PutObjectOptions(bais.available(), -1);
options.setSse(sse);
minioClient.putObject("my-bucketname", "my-objectname", bais, options);
bais.close();
System.out.println("my-objectname is uploaded successfully");

Expand Down
5 changes: 4 additions & 1 deletion examples/CopyObjectEncryptedS3.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.ServerSideEncryption;
import io.minio.errors.MinioException;

Expand Down Expand Up @@ -51,7 +52,9 @@ public static void main(String[] args)
ServerSideEncryption sse = ServerSideEncryption.atRest();

// Create object 'my-objectname' in 'my-bucketname' with content from the input stream.
minioClient.putObject("my-bucketname", "my-objectname", bais, Long.valueOf(bais.available()), null, sse, null);
PutObjectOptions options = new PutObjectOptions(bais.available(), -1);
options.setSse(sse);
minioClient.putObject("my-bucketname", "my-objectname", bais, options);
bais.close();
System.out.println("my-objectname is uploaded successfully");

Expand Down
4 changes: 2 additions & 2 deletions examples/CopyObjectMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.CopyConditions;
import io.minio.errors.MinioException;

Expand Down Expand Up @@ -67,8 +68,7 @@ public static void main(String[] args)
ByteArrayInputStream bais = new ByteArrayInputStream(builder.toString().getBytes("UTF-8"));

// Create object 'my-objectname' in 'my-bucketname' with content from the input stream.
minioClient.putObject("my-bucketname", "my-objectname", bais, Long.valueOf(bais.available()),null, null,
"application/octet-stream");
minioClient.putObject("my-bucketname", "my-objectname", bais, new PutObjectOptions(bais.available(), -1));
bais.close();
System.out.println("my-objectname is uploaded successfully");

Expand Down
4 changes: 2 additions & 2 deletions examples/EnableDisableObjectLegalHold.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.errors.ErrorResponseException;
import io.minio.errors.InsufficientDataException;
import io.minio.errors.InternalException;
Expand Down Expand Up @@ -72,8 +73,7 @@ public static void main(String[] args)
ByteArrayInputStream bais = new ByteArrayInputStream(builder.toString().getBytes("UTF-8"));

// Create object 'my-objectname' in 'my-bucketname' with content from the input stream.
minioClient.putObject("my-bucketname", "my-objectname", bais, Long.valueOf(bais.available()), null, null,
"application/octet-stream");
minioClient.putObject("my-bucketname", "my-objectname", bais, new PutObjectOptions(bais.available(), -1));
bais.close();
System.out.println("my-objectname is uploaded successfully");

Expand Down
7 changes: 5 additions & 2 deletions examples/PutGetObjectEncrypted.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.ServerSideEncryption;
import io.minio.errors.MinioException;

Expand Down Expand Up @@ -61,7 +62,9 @@ public static void main(String[] args)
// To test SSE-C
ServerSideEncryption sse = ServerSideEncryption.withCustomerKey(keyGen.generateKey());

minioClient.putObject("my-bucketname", "my-objectname", bais, Long.valueOf(bais.available()),null, sse, null);
PutObjectOptions options = new PutObjectOptions(bais.available(), -1);
options.setSse(sse);
minioClient.putObject("my-bucketname", "my-objectname", bais, options);

bais.close();

Expand All @@ -83,4 +86,4 @@ public static void main(String[] args)
System.out.println("Error occurred: " + e);
}
}
}
}
7 changes: 5 additions & 2 deletions examples/PutGetObjectEncryptedFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.ServerSideEncryption;
import io.minio.errors.MinioException;

Expand Down Expand Up @@ -38,7 +39,9 @@ public static void main(String[] args)

// To test SSE-C
ServerSideEncryption sse = ServerSideEncryption.withCustomerKey(keyGen.generateKey());
minioClient.putObject(bucketName, objectName, inputfile, null, null, sse, null);
PutObjectOptions options = new PutObjectOptions(-1, 6000000);
options.setSse(sse);
minioClient.putObject(bucketName, objectName, inputfile, options);
System.out.println("my-objectname is encrypted and uploaded successfully.");

minioClient.getObject(bucketName, objectName, sse, outputfile);
Expand All @@ -48,4 +51,4 @@ public static void main(String[] args)
}

}
}
}
4 changes: 2 additions & 2 deletions examples/PutObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.errors.MinioException;

public class PutObject {
Expand Down Expand Up @@ -64,8 +65,7 @@ public static void main(String[] args)
ByteArrayInputStream bais = new ByteArrayInputStream(builder.toString().getBytes("UTF-8"));

// Create object 'my-objectname' in 'my-bucketname' with content from the input stream.
minioClient.putObject("my-bucketname", "my-objectname", bais, Long.valueOf(bais.available()), null, null,
"application/octet-stream");
minioClient.putObject("my-bucketname", "my-objectname", bais, new PutObjectOptions(bais.available(), -1));
bais.close();
System.out.println("my-objectname is uploaded successfully");
} catch (MinioException e) {
Expand Down
7 changes: 5 additions & 2 deletions examples/PutObjectEncryptedKms.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.ServerSideEncryption;
import io.minio.errors.MinioException;

Expand Down Expand Up @@ -56,7 +57,9 @@ public static void main(String[] args)
// To test SSE-KMS
ServerSideEncryption sse = ServerSideEncryption.withManagedKeys("Key-Id", myContext);

minioClient.putObject("my-bucketname", "my-objectname", bais, Long.valueOf(bais.available()), null, sse, null);
PutObjectOptions options = new PutObjectOptions(bais.available(), -1);
options.setSse(sse);
minioClient.putObject("my-bucketname", "my-objectname", bais, options);

bais.close();

Expand All @@ -66,4 +69,4 @@ public static void main(String[] args)
System.out.println("Error occurred: " + e);
}
}
}
}
7 changes: 5 additions & 2 deletions examples/PutObjectEncryptedS3.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.ServerSideEncryption;
import io.minio.errors.MinioException;

Expand Down Expand Up @@ -52,7 +53,9 @@ public static void main(String[] args)
// To test SSE-S3
ServerSideEncryption sse = ServerSideEncryption.atRest();

minioClient.putObject("my-bucketname", "my-objectname", bais, Long.valueOf(bais.available()), null, sse, null);
PutObjectOptions options = new PutObjectOptions(bais.available(), -1);
options.setSse(sse);
minioClient.putObject("my-bucketname", "my-objectname", bais, options);

bais.close();

Expand All @@ -62,4 +65,4 @@ public static void main(String[] args)
System.out.println("Error occurred: " + e);
}
}
}
}
4 changes: 2 additions & 2 deletions examples/PutObjectProgressBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.xmlpull.v1.XmlPullParserException;

import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.minio.errors.ErrorResponseException;
import io.minio.errors.InsufficientDataException;
import io.minio.errors.InternalException;
Expand Down Expand Up @@ -60,8 +61,7 @@ public static void main(String[] args) throws InvalidKeyException, NoSuchAlgorit
InputStream pis = new BufferedInputStream(new ProgressStream("Uploading... ",
ProgressBarStyle.ASCII,
new FileInputStream(file)));
minioClient.putObject(bucketName, objectName, pis, Long.valueOf(pis.available()), null, null,
"application/octet-stream");
minioClient.putObject(bucketName, objectName, pis, new PutObjectOptions(pis.available(), -1));
pis.close();
System.out.println("my-objectname is uploaded successfully");
}
Expand Down
Loading

0 comments on commit fcad3da

Please sign in to comment.