use of com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation in project aws-mobile-appsync-sdk-android by awslabs.
the class AWSAppSyncClients method withAPIKEYFromAWSConfiguration.
@NonNull
public static AWSAppSyncClient withAPIKEYFromAWSConfiguration(boolean subscriptionsAutoReconnect, long credentialsDelay) {
AWSConfiguration awsConfiguration = new AWSConfiguration(getTargetContext());
JSONObject ccpConfig = awsConfiguration.optJsonObject("CredentialsProvider");
String cognitoIdentityPoolID = JsonExtract.stringValue(ccpConfig, "CognitoIdentity.Default.PoolId");
String cognitoRegion = JsonExtract.stringValue(ccpConfig, "CognitoIdentity.Default.Region");
DelayedCognitoCredentialsProvider credentialsProvider = new DelayedCognitoCredentialsProvider(cognitoIdentityPoolID, Regions.fromName(cognitoRegion), credentialsDelay);
AmazonS3Client s3Client = new AmazonS3Client(credentialsProvider, Region.getRegion("us-west-2"));
S3ObjectManager s3ObjectManager = new S3ObjectManagerImplementation((s3Client));
return AWSAppSyncClient.builder().context(getTargetContext()).awsConfiguration(awsConfiguration).conflictResolver(new TestConflictResolver()).s3ObjectManager(s3ObjectManager).subscriptionsAutoReconnect(subscriptionsAutoReconnect).mutationQueueExecutionTimeout(TimeUnit.SECONDS.toMillis(30)).persistentMutationsCallback(LoggingPersistentMutationsCallback.instance()).useClientDatabasePrefix(true).build();
}
use of com.amazonaws.mobileconnectors.appsync.S3ObjectManagerImplementation in project aws-mobile-appsync-sdk-android by awslabs.
the class AWSAppSyncClients method withIAMFromAWSConfiguration.
@NonNull
public static AWSAppSyncClient withIAMFromAWSConfiguration(boolean subscriptionsAutoReconnect, long credentialsDelay) {
AWSConfiguration awsConfiguration = new AWSConfiguration(getTargetContext());
awsConfiguration.setConfiguration("MultiAuthAndroidIntegTestApp_AWS_IAM");
JSONObject ccpConfig = awsConfiguration.optJsonObject("CredentialsProvider");
String cognitoIdentityPoolID = JsonExtract.stringValue(ccpConfig, "CognitoIdentity.Default.PoolId");
String cognitoRegion = JsonExtract.stringValue(ccpConfig, "CognitoIdentity.Default.Region");
DelayedCognitoCredentialsProvider credentialsProvider = new DelayedCognitoCredentialsProvider(cognitoIdentityPoolID, Regions.fromName(cognitoRegion), credentialsDelay);
AmazonS3Client s3Client = new AmazonS3Client(credentialsProvider, Region.getRegion("us-west-2"));
S3ObjectManager s3ObjectManager = new S3ObjectManagerImplementation(s3Client);
return AWSAppSyncClient.builder().context(getTargetContext()).credentialsProvider(credentialsProvider).awsConfiguration(awsConfiguration).conflictResolver(new TestConflictResolver()).s3ObjectManager(s3ObjectManager).subscriptionsAutoReconnect(subscriptionsAutoReconnect).mutationQueueExecutionTimeout(TimeUnit.SECONDS.toMillis(30)).persistentMutationsCallback(LoggingPersistentMutationsCallback.instance()).useClientDatabasePrefix(true).build();
}
Aggregations