List of usage examples for com.amazonaws.internal StaticCredentialsProvider StaticCredentialsProvider
public StaticCredentialsProvider(AWSCredentials credentials)
From source file:biz.neustar.webmetrics.plugins.neustar_s3_maven_plugin.S3UploadMojo.java
License:Apache License
/** */ private static AmazonS3 getS3Client(String accessKey, String secretKey) { AWSCredentialsProvider provider = null; if (accessKey != null && secretKey != null) { AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); provider = new StaticCredentialsProvider(credentials); } else {/*www. j a va 2 s. co m*/ provider = new DefaultAWSCredentialsProviderChain(); } return new AmazonS3Client(provider); }
From source file:br.com.ingenieux.jenkins.plugins.awsebdeployment.Deployer.java
License:Apache License
private void initAWS() { log("Creating S3 and AWSEB Client (AWS Access Key Id: %s, region: %s)", context.getAwsAccessKeyId(), context.getAwsRegion());// w w w.ja v a 2 s . c om AWSCredentialsProvider credentials = new AWSCredentialsProviderChain(new StaticCredentialsProvider( new BasicAWSCredentials(context.getAwsAccessKeyId(), context.getAwsSecretSharedKey()))); Region region = Region.getRegion(Regions.fromName(context.getAwsRegion())); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setUserAgent("ingenieux CloudButler/" + getVersion()); s3 = region.createClient(AmazonS3Client.class, credentials, clientConfig); awseb = region.createClient(AWSElasticBeanstalkClient.class, credentials, clientConfig); }
From source file:com.emc.vipr.services.s3.S3ClientFactory.java
License:Open Source License
private static ViPRS3Client getS3Client(boolean smart, boolean setNamespace) { try {/*w ww . j av a 2s . c o m*/ Properties props = ViprConfig.getProperties(); String accessKey = ViprConfig.getPropertyNotEmpty(props, ViprConfig.PROP_S3_ACCESS_KEY_ID); String secretKey = ViprConfig.getPropertyNotEmpty(props, ViprConfig.PROP_S3_SECRET_KEY); String endpoint = ViprConfig.getPropertyNotEmpty(props, ViprConfig.PROP_S3_ENDPOINT); String endpoints = props.getProperty(ViprConfig.PROP_S3_ENDPOINTS); BasicAWSCredentials creds = new BasicAWSCredentials(accessKey, secretKey); ViPRS3Config viprConfig = new ViPRS3Config() .withCredentialsProvider(new StaticCredentialsProvider(creds)); if (endpoints != null) viprConfig.withS3Endpoints(endpoints); else viprConfig.withS3Endpoints(endpoint); ViPRS3Client client = smart ? new ViPRS3Client(viprConfig) : new ViPRS3Client(endpoint, creds); String namespace = props.getProperty(ViprConfig.PROP_NAMESPACE); if (namespace != null && setNamespace) { client.setNamespace(namespace); } checkProxyConfig(client, props); return client; } catch (IOException e) { log.info("Failed to load properties: " + e); return null; } }
From source file:com.emc.vipr.services.s3.ViPRS3Client.java
License:Open Source License
/** * Constructs a new ViPR S3 client using the specified endpoint, AWS credentials to * access the EMC ViPR S3 protocol./*w w w. ja v a2 s. c o m*/ * * @param endpoint * The ViPR S3 endpoint (i.e. "https://vipr-data.emc.com:9021") * @param awsCredentials * The AWS credentials to use when making requests * with this client. * * @see AmazonS3Client#AmazonS3Client() * @see AmazonS3Client#AmazonS3Client(AWSCredentials) */ public ViPRS3Client(String endpoint, AWSCredentials awsCredentials) { this(endpoint, new StaticCredentialsProvider(awsCredentials), new ClientConfiguration()); }
From source file:com.emc.vipr.services.s3.ViPRS3Client.java
License:Open Source License
/** * Constructs a new ViPR S3 client using the specified endpoint, AWS credentials and * client configuration to access the EMC ViPR S3 protocol. * * @param endpoint/*from w ww .j a va 2 s. com*/ * The ViPR S3 endpoint (i.e. "https://vipr-data.emc.com:9021") * @param awsCredentials * The AWS credentials to use when making requests * with this client. * @param clientConfiguration * The client configuration options controlling how this client * connects (e.g. proxy settings, retry counts, etc). * * @see AmazonS3Client#AmazonS3Client() * @see AmazonS3Client#AmazonS3Client(AWSCredentials, ClientConfiguration) */ public ViPRS3Client(String endpoint, AWSCredentials awsCredentials, ClientConfiguration clientConfiguration) { this(endpoint, new StaticCredentialsProvider(awsCredentials), clientConfiguration); }
From source file:com.facebook.presto.dynamodb.DynamodbConfig.java
License:Apache License
public AWSCredentialsProvider getCredentials() { if (accessKey == null && secretAccessKey == null) { return new InstanceProfileCredentialsProvider(); }/* ww w. j a v a2s . c o m*/ return new StaticCredentialsProvider(new BasicAWSCredentials(getAccessKey(), getSecretAccessKey())); }
From source file:com.github.abhinavmishra14.aws.glacier.service.impl.GlacierArchiveServiceImpl.java
License:Open Source License
/** * The Constructor.<br/>//w w w .j av a2 s . c om * This Constructor will return glacier client using accessKey and secretKey.<br/> * Additionally it will set the given endPoint for performing upload operation over vault.<br/> * Default endpoint will be always: "https://glacier.us-east-1.amazonaws.com/" * SSL Certificate checking will be disabled based on provided flag. * * @param accessKey the access key * @param secretKey the secret key * @param disableCertCheck the disable cert check * @param endpoint the endpoint */ public GlacierArchiveServiceImpl(final String accessKey, final String secretKey, final boolean disableCertCheck, final String endpoint) { super(); AWSUtil.notNull(accessKey, ERR_MSG_ACCESSKEY); AWSUtil.notNull(secretKey, ERR_MSG_SECRETKEY); if (LOGGER.isDebugEnabled()) { LOGGER.debug("GlacierArchiveServiceImpl is initializing using keys.."); } final AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); final AWSCredentialsProvider credentialsProvider = new StaticCredentialsProvider(credentials); glacierClient = new AmazonGlacierClient(credentialsProvider); sqsClient = new AmazonSQSClient(credentialsProvider); snsClient = new AmazonSNSClient(credentialsProvider); if (disableCertCheck) { System.setProperty(DISABLE_CERT_PARAM, TRUE);//Disable cert check } if (StringUtils.isNotBlank(endpoint)) { glacierClient.setEndpoint(endpoint); } }
From source file:com.github.abhinavmishra14.aws.glacier.service.impl.GlacierVaultServiceImpl.java
License:Open Source License
/** * The Constructor.<br/>/*w ww . j a va2 s . c om*/ * This Constructor will return glacier client using accessKey and secretKey.<br/> * Additionally it will set the given endPoint for performing operations over vault.<br/> * Default endpoint will be always: "https://glacier.us-east-1.amazonaws.com/" * SSL Certificate checking will be disabled based on provided flag. * * @param accessKey the access key * @param secretKey the secret key * @param disableCertCheck the disable cert check * @param endpoint the endpoint */ public GlacierVaultServiceImpl(final String accessKey, final String secretKey, final boolean disableCertCheck, final String endpoint) { super(); AWSUtil.notNull(accessKey, ERR_MSG_ACCESSKEY); AWSUtil.notNull(secretKey, ERR_MSG_SECRETKEY); if (LOGGER.isDebugEnabled()) { LOGGER.debug("GlacierVaultServiceImpl is initializing using keys.."); } final AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); final AWSCredentialsProvider credentialsProvider = new StaticCredentialsProvider(credentials); glacierClient = new AmazonGlacierClient(credentialsProvider); if (disableCertCheck) { System.setProperty(DISABLE_CERT_PARAM, TRUE);//Disable cert check } if (StringUtils.isNotBlank(endpoint)) { glacierClient.setEndpoint(endpoint); } }
From source file:com.github.scizeron.logback.appender.SqsAppender.java
License:Apache License
/** * //www. j a v a2s . c o m * @return */ private AWSCredentialsProvider getCredentials() { return new AWSCredentialsProviderChain(new StaticCredentialsProvider(new AppenderCredentials()), new SystemPropertiesCredentialsProvider(), new EnvironmentVariableCredentialsProvider(), new ProfileCredentialsProvider(), new InstanceProfileCredentialsProvider()); }
From source file:com.github.sjones4.youcan.youare.YouAreClient.java
License:Open Source License
public YouAreClient(final AWSCredentials awsCredentials) { this(new StaticCredentialsProvider(awsCredentials), new ClientConfiguration()); }