Skip to content

Commit 4da8724

Browse files
committed
Added the new set of naming convention for object, bucket, testfiles.
1 parent f15ea24 commit 4da8724

17 files changed

Lines changed: 86 additions & 33 deletions

examples/BucketExists.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,23 @@
1414
* limitations under the License.
1515
*/
1616

17+
18+
1719
import io.minio.MinioClient;
1820
import io.minio.errors.ClientException;
1921

2022
import java.io.IOException;
2123

2224
public class BucketExists {
2325
public static void main(String[] args) throws IOException, ClientException {
24-
System.out.println("BucketExists app");
2526

27+
28+
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname are
29+
// dummy values, please replace them with original values.
2630
// Set s3 endpoint, region is calculated automatically
2731
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
2832

29-
boolean bucketExists = s3Client.bucketExists("mymultipartbucket");
33+
boolean bucketExists = s3Client.bucketExists("my-bucketname");
3034
System.out.println(bucketExists);
3135
}
3236
}

examples/GetBucketAcl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
1718
import io.minio.MinioClient;
1819
import io.minio.acl.Acl;
1920
import io.minio.errors.ClientException;
@@ -23,13 +24,14 @@
2324

2425
public class GetBucketAcl {
2526
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
26-
System.out.println("GetBucketAcl app");
2727

28+
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname are
29+
// dummy values, please replace them with original values.
2830
// Set s3 endpoint, region is calculated automatically
2931
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
3032

3133
// get bucket canned acl
32-
Acl acl = s3Client.getBucketACL("bucketName");
34+
Acl acl = s3Client.getBucketACL("my-bucketname");
3335
System.out.println(acl);
3436
}
3537
}

examples/GetObject.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
1718
import com.google.api.client.util.IOUtils;
1819
import io.minio.MinioClient;
1920
import io.minio.errors.ClientException;
@@ -24,13 +25,14 @@
2425

2526
public class GetObject {
2627
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
27-
System.out.println("GetObject app");
2828

29+
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname, my-objectname and
30+
// my-testfile are dummy values, please replace them with original values.
2931
// Set s3 endpoint, region is calculated automatically
3032
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
3133

3234
// get object
33-
InputStream object = s3Client.getObject("bucketName", "objectName");
35+
InputStream object = s3Client.getObject("my-bucketname", "my-objectname");
3436
try {
3537
System.out.println("Printing object: ");
3638
IOUtils.copy(object, System.out);

examples/GetPartialObject.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
1718
import com.google.api.client.util.IOUtils;
1819
import io.minio.MinioClient;
1920
import io.minio.errors.ClientException;
@@ -24,13 +25,14 @@
2425

2526
public class GetPartialObject {
2627
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
27-
System.out.println("GetPartialObject app");
2828

29+
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname, my-objectname and
30+
// my-testfile are dummy values, please replace them with original values.
2931
// Set s3 endpoint, region is calculated automatically
3032
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
3133

3234
// get object from offset, of specific length
33-
InputStream object = s3Client.getPartialObject("bucketName", "objectName", 1024, 4096);
35+
InputStream object = s3Client.getPartialObject("my-bucketname", "my-objectname", 1024, 4096);
3436
try {
3537
System.out.println("Printing object: ");
3638
IOUtils.copy(object, System.out);

examples/ListBuckets.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
1718
import io.minio.MinioClient;
1819
import io.minio.errors.ClientException;
1920
import io.minio.messages.Bucket;
@@ -24,8 +25,9 @@
2425

2526
public class ListBuckets {
2627
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
27-
System.out.println("ListBuckets app");
2828

29+
// Note: YOUR-ACCESSKEYID and YOUR-SECRETACCESSKEY are
30+
// dummy values, please replace them with original values.
2931
// Set s3 endpoint, region is calculated automatically
3032
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
3133

examples/ListIncompleteUploads.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
1718
import io.minio.MinioClient;
1819
import io.minio.Result;
1920
import io.minio.errors.ClientException;
@@ -25,13 +26,14 @@
2526

2627
public class ListIncompleteUploads {
2728
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
28-
System.out.println("listIncompleteUploads app");
2929

30+
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname
31+
// are dummy values, please replace them with original values.
3032
// Set s3 endpoint, region is calculated automatically
3133
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
3234

3335
// list objects
34-
Iterator<Result<Upload>> myObjects = s3Client.listIncompleteUploads("bucketName");
36+
Iterator<Result<Upload>> myObjects = s3Client.listIncompleteUploads("my-bucketname");
3537
while (myObjects.hasNext()) {
3638
Result<Upload> result = myObjects.next();
3739
Upload object = result.getResult();

examples/ListObjects.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
1718
import io.minio.MinioClient;
1819
import io.minio.Result;
1920
import io.minio.errors.ClientException;
@@ -25,13 +26,15 @@
2526

2627
public class ListObjects {
2728
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
28-
System.out.println("ListObjects app");
2929

30-
// Set s3 endpoint, region is calculated automatically
30+
31+
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname
32+
// are dummy values, please replace them with original values.
33+
// Set s3 endpoint, region is calculated automatically
3134
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
3235

3336
// list objects
34-
Iterator<Result<Item>> myObjects = s3Client.listObjects("bucketName");
37+
Iterator<Result<Item>> myObjects = s3Client.listObjects("my-bucketname");
3538
while (myObjects.hasNext()) {
3639
Result<Item> result = myObjects.next();
3740
Item object = result.getResult();

examples/MakeBucket.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
1718
import io.minio.MinioClient;
1819
import io.minio.acl.Acl;
1920
import io.minio.errors.ClientException;
@@ -23,12 +24,14 @@
2324

2425
public class MakeBucket {
2526
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException {
26-
System.out.println("MakeBucket app");
2727

28+
29+
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY and my-bucketname are
30+
// dummy values, please replace them with original values.
2831
// Set s3 endpoint, region is calculated automatically
2932
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
3033

3134
// create bucket
32-
s3Client.makeBucket("bucketName");
35+
s3Client.makeBucket("my-bucketname");
3336
}
3437
}

examples/PresignedGetObject.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
1718
import com.google.api.client.util.IOUtils;
1819
import io.minio.MinioClient;
1920
import io.minio.errors.ClientException;
@@ -26,10 +27,13 @@
2627

2728
public class PresignedGetObject {
2829
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException, NoSuchAlgorithmException, InvalidKeyException {
30+
31+
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname and my-objectname
32+
// are dummy values, please replace them with original values.
2933
// Set s3 endpoint, region is calculated automatically
3034
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
3135

32-
String str = s3Client.presignedGetObject("bucketName", "objectName", 1000);
36+
String str = s3Client.presignedGetObject("my-bucketname", "my-objectname", 1000);
3337

3438
System.out.println(str);
3539
}

examples/PresignedPostPolicy.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
1718
import io.minio.MinioClient;
1819
import io.minio.PostPolicy;
1920
import io.minio.errors.ClientException;
@@ -33,6 +34,9 @@
3334

3435
public class PresignedPostPolicy {
3536
public static void main(String[] args) throws IOException, XmlPullParserException, ClientException, NoSuchAlgorithmException, InvalidKeyException {
37+
38+
// Note: YOUR-ACCESSKEYID, YOUR-SECRETACCESSKEY, my-bucketname and my-objectname
39+
// are dummy values, please replace them with original values.
3640
// Set s3 endpoint, region is calculated automatically.
3741
MinioClient s3Client = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");
3842

@@ -41,8 +45,8 @@ public static void main(String[] args) throws IOException, XmlPullParserExceptio
4145
date = date.plusMonths(1); // Expire in one month.
4246

4347
// set policy parameters.
44-
policy.setKey("objectName");
45-
policy.setBucket("bucketName");
48+
policy.setKey("my-objectname");
49+
policy.setBucket("my-bucketname");
4650
policy.setExpires(date);
4751
policy.setContentType("image/png");
4852

@@ -52,6 +56,6 @@ public static void main(String[] args) throws IOException, XmlPullParserExceptio
5256
for (Map.Entry<String, String> entry : formData.entrySet()) {
5357
System.out.print(" -F " + entry.getKey() + "=" + entry.getValue());
5458
}
55-
System.out.print("-F file=@/tmp/userpic.png https://s3.amazonaws.com/bucketName\n");
59+
System.out.print("-F file=@/tmp/userpic.png https://s3.amazonaws.com/my-bucketname\n");
5660
}
5761
}

0 commit comments

Comments
 (0)