Search in sources :

Example 1 with CreateMultiRegionAccessPointResponse

use of software.amazon.awssdk.services.s3control.model.CreateMultiRegionAccessPointResponse in project aws-sdk-java-v2 by aws.

the class S3MrapIntegrationTest method createMrapIfNotExist.

private static void createMrapIfNotExist(String mrapName) {
    software.amazon.awssdk.services.s3control.model.Region mrapRegion = software.amazon.awssdk.services.s3control.model.Region.builder().bucket(bucket).build();
    if (s3control.listMultiRegionAccessPoints(r -> r.accountId(accountId)).accessPoints().stream().noneMatch(a -> a.name().equals(S3MrapIntegrationTest.mrapName))) {
        CreateMultiRegionAccessPointInput details = CreateMultiRegionAccessPointInput.builder().name(mrapName).regions(mrapRegion).build();
        log.info(() -> "Creating MRAP: " + mrapName);
        CreateMultiRegionAccessPointResponse response = s3control.createMultiRegionAccessPoint(r -> r.accountId(accountId).details(details));
        waitForResourceCreation(mrapName);
    }
}
Also used : ApacheHttpClient(software.amazon.awssdk.http.apache.ApacheHttpClient) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) BucketAlreadyOwnedByYouException(software.amazon.awssdk.services.s3.model.BucketAlreadyOwnedByYouException) Context(software.amazon.awssdk.core.interceptor.Context) ListMultiRegionAccessPointsResponse(software.amazon.awssdk.services.s3control.model.ListMultiRegionAccessPointsResponse) BucketAlreadyExistsException(software.amazon.awssdk.services.s3control.model.BucketAlreadyExistsException) SignerConstant(software.amazon.awssdk.auth.signer.internal.SignerConstant) Duration(java.time.Duration) PutObjectRequest(software.amazon.awssdk.services.s3.model.PutObjectRequest) StsClient(software.amazon.awssdk.services.sts.StsClient) CreateMultiRegionAccessPointInput(software.amazon.awssdk.services.s3control.model.CreateMultiRegionAccessPointInput) PresignedGetObjectRequest(software.amazon.awssdk.services.s3.presigner.model.PresignedGetObjectRequest) StringUtils.isEmpty(software.amazon.awssdk.utils.StringUtils.isEmpty) PresignedRequest(software.amazon.awssdk.awscore.presigner.PresignedRequest) ExecutionInterceptor(software.amazon.awssdk.core.interceptor.ExecutionInterceptor) S3SignerExecutionAttribute(software.amazon.awssdk.auth.signer.S3SignerExecutionAttribute) MultiRegionAccessPointStatus(software.amazon.awssdk.services.s3control.model.MultiRegionAccessPointStatus) StandardCharsets(java.nio.charset.StandardCharsets) Waiter(software.amazon.awssdk.core.waiters.Waiter) List(java.util.List) StringInputStream(software.amazon.awssdk.utils.StringInputStream) Optional(java.util.Optional) S3Configuration(software.amazon.awssdk.services.s3.S3Configuration) SdkRequest(software.amazon.awssdk.core.SdkRequest) Bucket(software.amazon.awssdk.services.s3.model.Bucket) NoSuchKeyException(software.amazon.awssdk.services.s3.model.NoSuchKeyException) BeforeClass(org.junit.BeforeClass) GetMultiRegionAccessPointResponse(software.amazon.awssdk.services.s3control.model.GetMultiRegionAccessPointResponse) FunctionalUtils.invokeSafely(software.amazon.awssdk.utils.FunctionalUtils.invokeSafely) ArrayList(java.util.ArrayList) S3Presigner(software.amazon.awssdk.services.s3.presigner.S3Presigner) ExecutionAttributes(software.amazon.awssdk.core.interceptor.ExecutionAttributes) SdkHttpMethod(software.amazon.awssdk.http.SdkHttpMethod) Region(software.amazon.awssdk.regions.Region) WaiterAcceptor(software.amazon.awssdk.core.waiters.WaiterAcceptor) UploadPartRequest(software.amazon.awssdk.services.s3.model.UploadPartRequest) SdkHttpRequest(software.amazon.awssdk.http.SdkHttpRequest) S3Client(software.amazon.awssdk.services.s3.S3Client) Logger(software.amazon.awssdk.utils.Logger) IOException(java.io.IOException) Test(org.junit.Test) FixedDelayBackoffStrategy(software.amazon.awssdk.core.retry.backoff.FixedDelayBackoffStrategy) RequestBody(software.amazon.awssdk.core.sync.RequestBody) CreateMultiRegionAccessPointResponse(software.amazon.awssdk.services.s3control.model.CreateMultiRegionAccessPointResponse) HttpExecuteResponse(software.amazon.awssdk.http.HttpExecuteResponse) Collections(java.util.Collections) Assert.assertEquals(org.junit.Assert.assertEquals) ClientOverrideConfiguration(software.amazon.awssdk.core.client.config.ClientOverrideConfiguration) IoUtils(software.amazon.awssdk.utils.IoUtils) HttpExecuteRequest(software.amazon.awssdk.http.HttpExecuteRequest) CreateMultiRegionAccessPointInput(software.amazon.awssdk.services.s3control.model.CreateMultiRegionAccessPointInput) CreateMultiRegionAccessPointResponse(software.amazon.awssdk.services.s3control.model.CreateMultiRegionAccessPointResponse)

Aggregations

IOException (java.io.IOException)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Optional (java.util.Optional)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 S3SignerExecutionAttribute (software.amazon.awssdk.auth.signer.S3SignerExecutionAttribute)1 SignerConstant (software.amazon.awssdk.auth.signer.internal.SignerConstant)1 PresignedRequest (software.amazon.awssdk.awscore.presigner.PresignedRequest)1 SdkRequest (software.amazon.awssdk.core.SdkRequest)1 ClientOverrideConfiguration (software.amazon.awssdk.core.client.config.ClientOverrideConfiguration)1 Context (software.amazon.awssdk.core.interceptor.Context)1 ExecutionAttributes (software.amazon.awssdk.core.interceptor.ExecutionAttributes)1 ExecutionInterceptor (software.amazon.awssdk.core.interceptor.ExecutionInterceptor)1 FixedDelayBackoffStrategy (software.amazon.awssdk.core.retry.backoff.FixedDelayBackoffStrategy)1