com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider Java Examples
The following examples show how to use
com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AwsModuleTest.java From beam with Apache License 2.0 | 6 votes |
@Test public void testClasspathPropertiesFileCredentialsProviderSerializationDeserialization() throws Exception { String credentialsFilePath = "/path/to/file"; ClasspathPropertiesFileCredentialsProvider credentialsProvider = new ClasspathPropertiesFileCredentialsProvider(credentialsFilePath); String serializedCredentialsProvider = objectMapper.writeValueAsString(credentialsProvider); AWSCredentialsProvider deserializedCredentialsProvider = objectMapper.readValue(serializedCredentialsProvider, AWSCredentialsProvider.class); assertEquals(credentialsProvider.getClass(), deserializedCredentialsProvider.getClass()); Field field = ClasspathPropertiesFileCredentialsProvider.class.getDeclaredField("credentialsFilePath"); field.setAccessible(true); String deserializedCredentialsFilePath = (String) field.get(deserializedCredentialsProvider); assertEquals(credentialsFilePath, deserializedCredentialsFilePath); }
Example #2
Source File: AwsModule.java From beam with Apache License 2.0 | 5 votes |
@Override public AWSCredentialsProvider deserializeWithType( JsonParser jsonParser, DeserializationContext context, TypeDeserializer typeDeserializer) throws IOException { Map<String, String> asMap = jsonParser.readValueAs(new TypeReference<Map<String, String>>() {}); String typeNameKey = typeDeserializer.getPropertyName(); String typeName = asMap.get(typeNameKey); if (typeName == null) { throw new IOException( String.format("AWS credentials provider type name key '%s' not found", typeNameKey)); } if (typeName.equals(AWSStaticCredentialsProvider.class.getSimpleName())) { return new AWSStaticCredentialsProvider( new BasicAWSCredentials(asMap.get(AWS_ACCESS_KEY_ID), asMap.get(AWS_SECRET_KEY))); } else if (typeName.equals(PropertiesFileCredentialsProvider.class.getSimpleName())) { return new PropertiesFileCredentialsProvider(asMap.get(CREDENTIALS_FILE_PATH)); } else if (typeName.equals( ClasspathPropertiesFileCredentialsProvider.class.getSimpleName())) { return new ClasspathPropertiesFileCredentialsProvider(asMap.get(CREDENTIALS_FILE_PATH)); } else if (typeName.equals(DefaultAWSCredentialsProviderChain.class.getSimpleName())) { return new DefaultAWSCredentialsProviderChain(); } else if (typeName.equals(EnvironmentVariableCredentialsProvider.class.getSimpleName())) { return new EnvironmentVariableCredentialsProvider(); } else if (typeName.equals(SystemPropertiesCredentialsProvider.class.getSimpleName())) { return new SystemPropertiesCredentialsProvider(); } else if (typeName.equals(ProfileCredentialsProvider.class.getSimpleName())) { return new ProfileCredentialsProvider(); } else if (typeName.equals(EC2ContainerCredentialsProviderWrapper.class.getSimpleName())) { return new EC2ContainerCredentialsProviderWrapper(); } else { throw new IOException( String.format("AWS credential provider type '%s' is not supported", typeName)); } }
Example #3
Source File: PropertiesFileConfiguration.java From aws-cloudtrail-processing-library with Apache License 2.0 | 5 votes |
/** * Creates a {@link PropertiesFileConfiguration} from values provided in a classpath properties file. * * @param propertiesFile the classpath properties file to load. */ public PropertiesFileConfiguration(String propertiesFile) { //load properties from configuration properties file Properties prop = loadProperty(propertiesFile); sqsUrl = prop.getProperty(SQS_URL); LibraryUtils.checkArgumentNotNull(sqsUrl, "Cannot find SQS URL in properties file."); String accessKey = prop.getProperty(ACCESS_KEY); String secretKey = prop.getProperty(SECRET_KEY); if (accessKey != null && secretKey != null) { awsCredentialsProvider = new ClasspathPropertiesFileCredentialsProvider(propertiesFile); } s3Region = prop.getProperty(S3_REGION); visibilityTimeout = getIntProperty(prop, VISIBILITY_TIMEOUT); sqsRegion = prop.getProperty(SQS_REGION); threadCount = getIntProperty(prop, THREAD_COUNT); threadTerminationDelaySeconds = getIntProperty(prop, THREAD_TERMINATION_DELAY_SECONDS); maxEventsPerEmit = getIntProperty(prop, MAX_EVENTS_PER_EMIT); enableRawEventInfo = getBooleanProperty(prop, ENABLE_RAW_EVENT_INFO); deleteMessageUponFailure = getBooleanProperty(prop, DELETE_MESSAGE_UPON_FAILURE); }
Example #4
Source File: CustomCredentialsProviderChain.java From aws-big-data-blog with Apache License 2.0 | 4 votes |
public CustomCredentialsProviderChain() { super(new EnvironmentVariableCredentialsProvider(), new SystemPropertiesCredentialsProvider(), new ClasspathPropertiesFileCredentialsProvider(), new InstanceProfileCredentialsProvider()); }
Example #5
Source File: CustomCredentialsProviderChain.java From kinesis-log4j-appender with Apache License 2.0 | 4 votes |
public CustomCredentialsProviderChain() { super(new ClasspathPropertiesFileCredentialsProvider(), new InstanceProfileCredentialsProvider(), new SystemPropertiesCredentialsProvider(), new EnvironmentVariableCredentialsProvider()); }
Example #6
Source File: SampleIvonaSpeechCloudVoiceList.java From ivona-speechcloud-sdk-java with Apache License 2.0 | 4 votes |
private static void init() { speechCloud = new IvonaSpeechCloudClient( new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties")); speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com"); }
Example #7
Source File: SampleIvonaSpeechCloudGetVoiceListURL.java From ivona-speechcloud-sdk-java with Apache License 2.0 | 4 votes |
private static void init() { speechCloud = new IvonaSpeechCloudClient( new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties")); speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com"); }
Example #8
Source File: SampleIvonaSpeechCloudGetCreateSpeechURL.java From ivona-speechcloud-sdk-java with Apache License 2.0 | 4 votes |
private static void init() { speechCloud = new IvonaSpeechCloudClient( new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties")); speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com"); }
Example #9
Source File: SampleIvonaSpeechCloudCreateSpeech.java From ivona-speechcloud-sdk-java with Apache License 2.0 | 4 votes |
private static void init() { speechCloud = new IvonaSpeechCloudClient( new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties")); speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com"); }
Example #10
Source File: SampleIvonaSpeechCloudPutLexicon.java From ivona-speechcloud-sdk-java with Apache License 2.0 | 4 votes |
private static void init() { speechCloud = new IvonaSpeechCloudClient( new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties")); speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com"); }
Example #11
Source File: SampleIvonaSpeechCloudGetLexicon.java From ivona-speechcloud-sdk-java with Apache License 2.0 | 4 votes |
private static void init() { speechCloud = new IvonaSpeechCloudClient( new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties")); speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com"); }
Example #12
Source File: SampleIvonaSpeechCloudDeleteLexicon.java From ivona-speechcloud-sdk-java with Apache License 2.0 | 4 votes |
private static void init() { speechCloud = new IvonaSpeechCloudClient( new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties")); speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com"); }
Example #13
Source File: SampleIvonaSpeechCloudListLexicons.java From ivona-speechcloud-sdk-java with Apache License 2.0 | 4 votes |
private static void init() { speechCloud = new IvonaSpeechCloudClient( new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties")); speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com"); }