/** * @deprecated Use {@link S3ClientOptions#builder()} to build new * S3ClientOptions instead. */ @Deprecated public S3ClientOptions withPathStyleAccess(boolean pathStyleAccess) { setPathStyleAccess(pathStyleAccess); return this; }
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); } }
clientOptions.setPathStyleAccess(true); client.setS3ClientOptions(clientOptions);
/** * <p> * Configures the client to use path-style access for all requests. * </p> * <p> * Amazon S3 supports virtual-hosted-style and path-style access in all * Regions. The path-style syntax, however, requires that you use the * region-specific endpoint when attempting to access a bucket. * </p> * <p> * The default behaviour is to detect which access style to use based on the * configured endpoint (an IP will result in path-style access) and the * bucket being accessed (some buckets are not valid DNS names). Setting * this flag will result in path-style access being used for all requests. * </p> * * @param pathStyleAccess True to always use path-style access. * @return The updated S3ClientOptions object with the new path-style access * setting. */ @Deprecated @SuppressWarnings("checkstyle:hiddenfield") public S3ClientOptions withPathStyleAccess(boolean pathStyleAccess) { setPathStyleAccess(pathStyleAccess); return this; }
/** * @deprecated Use {@link S3ClientOptions#builder()} to build new * S3ClientOptions instead. */ @Deprecated public S3ClientOptions withPathStyleAccess(boolean pathStyleAccess) { setPathStyleAccess(pathStyleAccess); return this; }
/** * <p> * Configures the client to use path-style access for all requests. * </p> * <p> * Amazon S3 supports virtual-hosted-style and path-style access in all * Regions. The path-style syntax, however, requires that you use the * region-specific endpoint when attempting to access a bucket. * </p> * <p> * The default behaviour is to detect which access style to use based on the * configured endpoint (an IP will result in path-style access) and the * bucket being accessed (some buckets are not valid DNS names). Setting * this flag will result in path-style access being used for all requests. * </p> * * @param pathStyleAccess True to always use path-style access. * @return The updated S3ClientOptions object with the new path-style access * setting. */ @Deprecated @SuppressWarnings("checkstyle:hiddenfield") public S3ClientOptions withPathStyleAccess(boolean pathStyleAccess) { setPathStyleAccess(pathStyleAccess); return this; }
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 prepare(Object configurationObject) { lineWriterUtil = LineReadWriteUtil.getInstance(s3WriterConfiguration); // Connect to S3 synchronized (this) { try { // if the user has chosen to not set the object mapper, then set a default object mapper for them. if (this.objectMapper == null) { this.objectMapper = StreamsJacksonMapper.getInstance(); } // Create the credentials Object if (this.amazonS3Client == null) { AWSCredentials credentials = new BasicAWSCredentials(s3WriterConfiguration.getKey(), s3WriterConfiguration.getSecretKey()); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setProtocol(Protocol.valueOf(s3WriterConfiguration.getProtocol().toString())); // We do not want path style access S3ClientOptions clientOptions = new S3ClientOptions(); clientOptions.setPathStyleAccess(false); this.amazonS3Client = new AmazonS3Client(credentials, clientConfig); if (StringUtils.isNotEmpty(s3WriterConfiguration.getRegion())) { this.amazonS3Client.setRegion(Region.getRegion(Regions.fromName(s3WriterConfiguration.getRegion()))); } this.amazonS3Client.setS3ClientOptions(clientOptions); } } catch (Exception ex) { LOGGER.error("Exception while preparing the S3 client: {}", ex); } Preconditions.checkArgument(this.amazonS3Client != null); } }
clientOptions.setPathStyleAccess(pathStyleAccess.get());
clientOptions.setPathStyleAccess(false);
if (endpoint != null && !"".equals(endpoint)) { S3ClientOptions s3ClientOptions = new S3ClientOptions(); s3ClientOptions.setPathStyleAccess(true); client.setS3ClientOptions(s3ClientOptions); client.setEndpoint(endpoint);
if (endpoint != null && !"".equals(endpoint)) { S3ClientOptions s3ClientOptions = new S3ClientOptions(); s3ClientOptions.setPathStyleAccess(true); client.setS3ClientOptions(s3ClientOptions); client.setEndpoint(endpoint);