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

fix: send request XML object instead of Object.toString() to execute() #883

Conversation

balamurugana
Copy link
Member

Fixes #881

@balamurugana balamurugana force-pushed the fix-makebucket-to-send-request-to-us-east-1 branch from de13db2 to d7ececf Compare March 27, 2020 10:49
Copy link
Contributor

@kannappanr kannappanr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work with AWS S3

@kannappanr
Copy link
Contributor

import io.minio.MinioClient;
import io.minio.errors.MinioException;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import org.xmlpull.v1.XmlPullParserException;

public class MakeBucket {
  /** MinioClient.makeBucket() example. */
  public static void main(String[] args)
      throws IOException, NoSuchAlgorithmException, InvalidKeyException, XmlPullParserException {
    try {
      /* Amazon S3: */
      MinioClient minioClient = new MinioClient("https://s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY");

      // Create bucket if it doesn't exist.
      boolean found = minioClient.bucketExists("non-existent-bucket");
      minioClient.traceOn(System.out);
      if (found) {
        System.out.println("non-existent-bucket already exists");
      } else {
        // Create bucket 'non-existent-bucket'.
        minioClient.makeBucket("non-existent-bucket", "us-west-1", false);
        System.out.println("non-existent-bucket is created successfully");
      }
    } catch (MinioException e) {
      System.out.println("Error occurred: " + e);
    }
  }
}

@balamurugana balamurugana force-pushed the fix-makebucket-to-send-request-to-us-east-1 branch 3 times, most recently from d49fffb to 3f50850 Compare March 28, 2020 04:06
@kannappanr
Copy link
Contributor

This still doesn't work when you set MINIO_REGION=us-west-1 and start minio server and use the code provided above

@balamurugana
Copy link
Member Author

This still doesn't work when you set MINIO_REGION=us-west-1 and start minio server and use the code provided above

Can you enable MinioClient.traceOn() and share the trace?

@balamurugana
Copy link
Member Author

This still doesn't work when you set MINIO_REGION=us-west-1 and start minio server and use the code provided above

Minio server master doesn't work with region. minio-go throws 2020/03/28 13:23:11 The authorization header is malformed; the region is wrong; expecting 'us-east-1'.

@balamurugana balamurugana force-pushed the fix-makebucket-to-send-request-to-us-east-1 branch 2 times, most recently from 193ed8a to 49ff255 Compare March 28, 2020 17:25
@harshavardhana
Copy link
Member

If the server region is set then it's like AWS region specific endpoints, so you can't use us-east-1 for that minio-go constructor needs to be initialized with the right region.

@balamurugana
Copy link
Member Author

If the server region is set then it's like AWS region specific endpoints, so you can't use us-east-1 for that minio-go constructor needs to be initialized with the right region.

Found actual behaviour and fixed

@balamurugana balamurugana force-pushed the fix-makebucket-to-send-request-to-us-east-1 branch from 49ff255 to e0151c8 Compare March 28, 2020 17:56
@balamurugana balamurugana changed the title fix: makeBucket() to send request to us-east-1 fix: send request XML objects to execute(), not Class.toString() Mar 28, 2020
harshavardhana
harshavardhana previously approved these changes Mar 28, 2020
@balamurugana balamurugana force-pushed the fix-makebucket-to-send-request-to-us-east-1 branch from e0151c8 to 47265eb Compare March 28, 2020 20:12
@balamurugana balamurugana changed the title fix: send request XML objects to execute(), not Class.toString() fix: send request XML object instead of Object.toString() to execute() Mar 28, 2020
Copy link
Contributor

@kannappanr kannappanr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@harshavardhana harshavardhana merged commit 8004523 into minio:master Mar 29, 2020
@balamurugana balamurugana deleted the fix-makebucket-to-send-request-to-us-east-1 branch March 30, 2020 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to create bucket when updating java client from 6.x.x to 7.0.0
3 participants