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

Update aws java sdk to support ecs task roles #25552

2 changes: 1 addition & 1 deletion plugins/repository-s3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ esplugin {
}

versions << [
'aws': '1.10.69'
'aws': '1.11.16'
Copy link
Member

Choose a reason for hiding this comment

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

Could you update it to 1.11.187 to align with what we have in #26479?

]

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.auth.InstanceProfileCredentialsProvider;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.http.IdleConnectionReaper;
import com.amazonaws.internal.StaticCredentialsProvider;
import com.amazonaws.services.s3.AmazonS3;
Expand Down Expand Up @@ -166,10 +166,10 @@ protected void doClose() throws ElasticsearchException {
}

static class PrivilegedInstanceProfileCredentialsProvider implements AWSCredentialsProvider {
private final InstanceProfileCredentialsProvider credentials;
private final DefaultAWSCredentialsProviderChain credentials;

private PrivilegedInstanceProfileCredentialsProvider() {
this.credentials = new InstanceProfileCredentialsProvider();
this.credentials = new DefaultAWSCredentialsProviderChain();
Copy link
Member

Choose a reason for hiding this comment

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

This is incorrect. This needs to be turned into a chain over InstanceProfile provider and container credentials provider as I described in #23039 (comment). We will not use the default chain because it exposes insecure methods of passing credentials.

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.amazonaws.services.s3.model.AbortMultipartUploadRequest;
import com.amazonaws.services.s3.model.AccessControlList;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.BucketAccelerateConfiguration;
import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration;
import com.amazonaws.services.s3.model.BucketLifecycleConfiguration;
import com.amazonaws.services.s3.model.BucketLoggingConfiguration;
Expand Down Expand Up @@ -59,6 +60,7 @@
import com.amazonaws.services.s3.model.DeleteObjectsResult;
import com.amazonaws.services.s3.model.DeleteVersionRequest;
import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest;
import com.amazonaws.services.s3.model.GetBucketAccelerateConfigurationRequest;
import com.amazonaws.services.s3.model.GetBucketAclRequest;
import com.amazonaws.services.s3.model.GetBucketCrossOriginConfigurationRequest;
import com.amazonaws.services.s3.model.GetBucketLifecycleConfigurationRequest;
Expand All @@ -83,6 +85,8 @@
import com.amazonaws.services.s3.model.ListNextBatchOfObjectsRequest;
import com.amazonaws.services.s3.model.ListNextBatchOfVersionsRequest;
import com.amazonaws.services.s3.model.ListObjectsRequest;
import com.amazonaws.services.s3.model.ListObjectsV2Request;
import com.amazonaws.services.s3.model.ListObjectsV2Result;
import com.amazonaws.services.s3.model.ListPartsRequest;
import com.amazonaws.services.s3.model.ListVersionsRequest;
import com.amazonaws.services.s3.model.MultipartUploadListing;
Expand All @@ -94,6 +98,7 @@
import com.amazonaws.services.s3.model.PutObjectResult;
import com.amazonaws.services.s3.model.RestoreObjectRequest;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.SetBucketAccelerateConfigurationRequest;
import com.amazonaws.services.s3.model.SetBucketAclRequest;
import com.amazonaws.services.s3.model.SetBucketCrossOriginConfigurationRequest;
import com.amazonaws.services.s3.model.SetBucketLifecycleConfigurationRequest;
Expand Down Expand Up @@ -167,6 +172,21 @@ public ObjectListing listObjects(ListObjectsRequest listObjectsRequest) throws A
return delegate.listObjects(listObjectsRequest);
}

@Override
public ListObjectsV2Result listObjectsV2(final String bucketName) throws AmazonClientException, AmazonServiceException {
return delegate.listObjectsV2(bucketName);
}

@Override
public ListObjectsV2Result listObjectsV2(final String bucketName, final String prefix) throws AmazonClientException, AmazonServiceException {
return delegate.listObjectsV2(bucketName, prefix);
}

@Override
public ListObjectsV2Result listObjectsV2(final ListObjectsV2Request listObjectsV2Request) throws AmazonClientException, AmazonServiceException {
return delegate.listObjectsV2(listObjectsV2Request);
}

@Override
public ObjectListing listNextBatchOfObjects(ObjectListing previousObjectListing) throws AmazonClientException, AmazonServiceException {
return delegate.listNextBatchOfObjects(previousObjectListing);
Expand Down Expand Up @@ -332,6 +352,11 @@ public ObjectMetadata getObject(GetObjectRequest getObjectRequest, File destinat
return delegate.getObject(getObjectRequest, destinationFile);
}

@Override
public String getObjectAsString(final String bucketName, final String key) throws AmazonServiceException, AmazonClientException {
return null;
}

@Override
public void deleteBucket(DeleteBucketRequest deleteBucketRequest) throws AmazonClientException, AmazonServiceException {
delegate.deleteBucket(deleteBucketRequest);
Expand Down Expand Up @@ -373,6 +398,36 @@ public boolean doesObjectExist(String bucketName, String objectName) throws Amaz
return delegate.doesObjectExist(bucketName, objectName);
}

@Override
public BucketAccelerateConfiguration getBucketAccelerateConfiguration(final String bucket) throws AmazonServiceException, AmazonClientException {
return delegate.getBucketAccelerateConfiguration(bucket);
}

@Override
public BucketAccelerateConfiguration getBucketAccelerateConfiguration(final GetBucketAccelerateConfigurationRequest getBucketAccelerateConfigurationRequest) throws AmazonServiceException, AmazonClientException {
return delegate.getBucketAccelerateConfiguration(getBucketAccelerateConfigurationRequest);
}

@Override
public void setBucketAccelerateConfiguration(final String bucketName, final BucketAccelerateConfiguration accelerateConfiguration) throws AmazonServiceException, AmazonClientException {
delegate.setBucketAccelerateConfiguration(bucketName, accelerateConfiguration);
}

@Override
public void setBucketAccelerateConfiguration(final SetBucketAccelerateConfigurationRequest setBucketAccelerateConfigurationRequest) throws AmazonServiceException, AmazonClientException {
delegate.setBucketAccelerateConfiguration(setBucketAccelerateConfigurationRequest);
}

@Override
public com.amazonaws.services.s3.model.Region getRegion() {
return delegate.getRegion();
}

@Override
public URL getUrl(final String bucketName, final String key) {
return delegate.getUrl(bucketName,key);
}

@Override
public PutObjectResult putObject(PutObjectRequest putObjectRequest) throws AmazonClientException, AmazonServiceException {
return delegate.putObject(putObjectRequest);
Expand All @@ -388,6 +443,11 @@ public PutObjectResult putObject(String bucketName, String key, InputStream inpu
return delegate.putObject(bucketName, key, input, metadata);
}

@Override
public PutObjectResult putObject(final String bucketName, final String key, final String content) throws AmazonServiceException, AmazonClientException {
return delegate.putObject(bucketName, key, content);
}

@Override
public CopyObjectResult copyObject(String sourceBucketName, String sourceKey, String destinationBucketName, String destinationKey) throws AmazonClientException, AmazonServiceException {
return delegate.copyObject(sourceBucketName, sourceKey, destinationBucketName, destinationKey);
Expand Down