public S3ClientOptions build() { if (pathStyleAccess && accelerateModeEnabled) { throw new SdkClientException("Both accelerate mode and path style access are being enabled either through " + "S3ClientOptions or AmazonS3ClientBuilder. These options are mutually exclusive " + "and cannot be enabled together. Please disable one of them"); } return new S3ClientOptions(pathStyleAccess, chunkedEncodingDisabled, accelerateModeEnabled, payloadSigningEnabled, dualstackEnabled, forceGlobalBucketAccessEnabled); } /**
/** * <p> * Override the default S3 client options for this client. Also set the * endpoint to s3-accelerate if such is specified in the S3 client options. * </p> * * @param clientOptions * The S3 client options to use. */ @Override public synchronized void setS3ClientOptions(S3ClientOptions clientOptions) { checkMutability(); this.clientOptions = new S3ClientOptions(clientOptions); }
private void initalizeEndpointOverride(final ProcessContext context, final AmazonS3Client s3) { // if ENDPOINT_OVERRIDE is set, use PathStyleAccess if(StringUtils.trimToEmpty(context.getProperty(ENDPOINT_OVERRIDE).evaluateAttributeExpressions().getValue()).isEmpty() == false){ final S3ClientOptions s3Options = new S3ClientOptions(); s3Options.setPathStyleAccess(true); s3.setS3ClientOptions(s3Options); } }
/** * Builder. * @return S3ClientOptions instance. */ public S3ClientOptions build() { return new S3ClientOptions(pathStyleAccess, chunkedEncodingDisabled, accelerateModeEnabled, payloadSigningEnabled, dualstackEnabled); }
S3ClientOptions clientOptions = new S3ClientOptions(); clientOptions.setPathStyleAccess(true); client.setS3ClientOptions(clientOptions);
/** * <p> * Override the default S3 client options for this client. Also set the * endpoint to s3-accelerate if such is specified in the S3 client options. * </p> * * @param clientOptions The S3 client options to use. */ @Override public void setS3ClientOptions(S3ClientOptions clientOptions) { this.clientOptions = new S3ClientOptions(clientOptions); }
/** * Builder. * @return S3ClientOptions instance. */ public S3ClientOptions build() { return new S3ClientOptions(pathStyleAccess, chunkedEncodingDisabled, accelerateModeEnabled, payloadSigningEnabled, dualstackEnabled); }
/** * <p> * Override the default S3 client options for this client. Also set the * endpoint to s3-accelerate if such is specified in the S3 client options. * </p> * * @param clientOptions The S3 client options to use. */ @Override public void setS3ClientOptions(S3ClientOptions clientOptions) { this.clientOptions = new S3ClientOptions(clientOptions); }
public S3ClientOptions build() { return new S3ClientOptions(pathStyleAccess, chunkedEncodingDisabled, accelerateModeEnabled, payloadSigningEnabled, dualstackEnabled, forceGlobalBucketAccessEnabled); } /**
s3client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true));
s3Client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true));
/** * <p> * Override the default S3 client options for this client. Also set the * endpoint to s3-accelerate if such is specified in the S3 client options. * </p> * * @param clientOptions * The S3 client options to use. */ @Override public synchronized void setS3ClientOptions(S3ClientOptions clientOptions) { checkMutability(); this.clientOptions = new S3ClientOptions(clientOptions); }
AmazonS3 client = new AmazonS3Client(credentials); client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true));
/** * Enables path-style access to S3 buckets if configured. By default, the * behavior is to use virtual hosted-style access with URIs of the form * http://bucketname.s3.amazonaws.com. Enabling path-style access and a * region-specific endpoint switches the behavior to use URIs of the form * http://s3-eu-west-1.amazonaws.com/bucketname. * * @param s3 S3 client * @param conf Hadoop configuration */ private static void enablePathStyleAccessIfRequired(AmazonS3 s3, Configuration conf) { final boolean pathStyleAccess = conf.getBoolean(S3Constants.PATH_STYLE_ACCESS, false); if (pathStyleAccess) { logger.debug("Enabling path style access!"); s3.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true)); } }
public static AmazonS3 s3client(Map<String, String> config) { // Use default credentials provider that looks in Env + Java properties + profile + instance role AmazonS3 s3Client = new AmazonS3Client(); // If worker config sets explicit endpoint override (e.g. for testing) use that String s3Endpoint = config.get("s3.endpoint"); if (s3Endpoint != null && !Objects.equals(s3Endpoint, "")) { s3Client.setEndpoint(s3Endpoint); } Boolean s3PathStyle = Boolean.parseBoolean(config.get("s3.path_style")); if (s3PathStyle) { s3Client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true)); } return s3Client; }
private void initalizeEndpointOverride(final ProcessContext context, final AmazonS3Client s3) { // if ENDPOINT_OVERRIDE is set, use PathStyleAccess if(StringUtils.trimToEmpty(context.getProperty(ENDPOINT_OVERRIDE).evaluateAttributeExpressions().getValue()).isEmpty() == false){ final S3ClientOptions s3Options = new S3ClientOptions(); s3Options.setPathStyleAccess(true); s3.setS3ClientOptions(s3Options); } }
static AmazonS3Client configureClient(AmazonS3Client s3Client) { if (System.getProperty(S3_REGION) != null) { String region = System.getProperty(S3_REGION); Log.debug("S3 region specified: ", region); s3Client.setRegion(RegionUtils.getRegion(region)); } // Region overrides end-point settings if (System.getProperty(S3_END_POINT) != null) { String endPoint = System.getProperty(S3_END_POINT); Log.debug("S3 endpoint specified: ", endPoint); s3Client.setEndpoint(endPoint); } if (System.getProperty(S3_ENABLE_PATH_STYLE) != null && Boolean.valueOf(System.getProperty(S3_ENABLE_PATH_STYLE))) { Log.debug("S3 path style access enabled"); S3ClientOptions sco = new S3ClientOptions(); sco.setPathStyleAccess(true); s3Client.setS3ClientOptions(sco); } return s3Client; }
private AmazonS3Client getAmazonS3Client(BackupRestoreContext ctx) throws URISyntaxException { final String accessKey = ctx.getAccountId(); final String secretKey = ctx.getSecretKey(); String endpoint = getEndpoint(ctx); LOGGER.info("endpoint: {}", endpoint); final BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(accessKey, secretKey); final AmazonS3Client amazonS3Client = new AmazonS3Client(basicAWSCredentials); amazonS3Client.setEndpoint(endpoint); if (ctx.usesEmc()) { final S3ClientOptions options = new S3ClientOptions(); options.setPathStyleAccess(true); amazonS3Client.setS3ClientOptions(options); } return amazonS3Client; }
@Override public void start(Map<String, String> props) throws ConnectException { readConfig(props); // Use default credentials provider that looks in Env + Java properties + profile + instance role AmazonS3 s3Client = new AmazonS3Client(); // If worker config sets explicit endpoint override (e.g. for testing) use that if (overrideS3Endpoint != "") { s3Client.setEndpoint(overrideS3Endpoint); } if (s3PathStyle) { s3Client.setS3ClientOptions(new S3ClientOptions().withPathStyleAccess(true)); } s3 = new S3Writer(bucket, prefix, s3Client); // Recover initial assignments Set<TopicPartition> assignment = context.assignment(); recoverAssignment(assignment); }
AmazonS3Client client = new AmazonS3Client(getCredentialsProvider(), clientConfig); if (endpoint != null && !"".equals(endpoint)) { S3ClientOptions s3ClientOptions = new S3ClientOptions(); s3ClientOptions.setPathStyleAccess(true); client.setS3ClientOptions(s3ClientOptions);