/** * Sets the protocol (i.e. HTTP or HTTPS) to use when connecting to Amazon Web Services, and * returns the updated ClientConfiguration object so that additional calls may be chained * together. * <p> * The default configuration is to use HTTPS for all requests for increased security. * <p> * Individual clients can also override this setting by explicitly including the protocol as * part of the endpoint URL when calling {@link AmazonWebServiceClient#setEndpoint(String)}. * * @param protocol * The protocol to use when connecting to Amazon Web Services. * @return The updated ClientConfiguration object with the new max HTTP connections setting. */ public ClientConfiguration withProtocol(Protocol protocol) { setProtocol(protocol); return this; }
static ClientConfiguration s3ClientCfg() { ClientConfiguration cfg = new ClientConfiguration(); Properties prop = System.getProperties(); if( prop.containsKey(S3_SOCKET_TIMEOUT_PROP) ) cfg.setSocketTimeout(Integer.getInteger(S3_SOCKET_TIMEOUT_PROP)); if( prop.containsKey(S3_CONNECTION_TIMEOUT_PROP) ) cfg.setConnectionTimeout(Integer .getInteger(S3_CONNECTION_TIMEOUT_PROP)); if( prop.containsKey(S3_MAX_ERROR_RETRY_PROP) ) cfg.setMaxErrorRetry(Integer.getInteger(S3_MAX_ERROR_RETRY_PROP)); if( prop.containsKey(S3_MAX_HTTP_CONNECTIONS_PROP) ) cfg.setMaxConnections(Integer .getInteger(S3_MAX_HTTP_CONNECTIONS_PROP)); cfg.setProtocol(Protocol.HTTP); return cfg; }
/** * @param accessKey * @param secretKey * @return */ public static AmazonEC2Client getEC2Client( String accessKey, String secretKey ) { AWSCredentialsProvider provider; if ( accessKey != null && secretKey != null ) { AWSCredentials credentials = new BasicAWSCredentials( accessKey, secretKey ); provider = new StaticCredentialsProvider( credentials ); } else { provider = new DefaultAWSCredentialsProviderChain(); } AmazonEC2Client client = new AmazonEC2Client( provider ); ClientConfiguration configuration = new ClientConfiguration(); configuration.setProtocol( Protocol.HTTPS ); client.setConfiguration( configuration ); return client; }
clientConfig.setMaxErrorRetry(Integer.parseInt(maxErrorRetry)); if(protocol.equals("HTTP")) { clientConfig.setProtocol(Protocol.HTTP); } else { clientConfig.setProtocol(Protocol.HTTPS);
private AmazonS3 getS3Client() throws Exception{ this.bucketName = properties.getProperty( "usergrid.binary.bucketname" ); if(bucketName == null){ logger.error( "usergrid.binary.bucketname not properly set so amazon bucket is null" ); throw new AwsPropertiesNotFoundException( "usergrid.binary.bucketname" ); } final UsergridAwsCredentialsProvider ugProvider = new UsergridAwsCredentialsProvider(); AWSCredentials credentials = ugProvider.getCredentials(); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setProtocol(Protocol.HTTP); s3Client = new AmazonS3Client(credentials, clientConfig); if(regionName != null) s3Client.setRegion( Region.getRegion(Regions.fromName(regionName)) ); return s3Client; }
/** * Sets the protocol (i.e. HTTP or HTTPS) to use when connecting to Amazon Web Services, and * returns the updated ClientConfiguration object so that additional calls may be chained * together. * <p> * The default configuration is to use HTTPS for all requests for increased security. * <p> * Individual clients can also override this setting by explicitly including the protocol as * part of the endpoint URL when calling {@link AmazonWebServiceClient#setEndpoint(String)}. * * @param protocol * The protocol to use when connecting to Amazon Web Services. * @return The updated ClientConfiguration object with the new max HTTP connections setting. */ public ClientConfiguration withProtocol(Protocol protocol) { setProtocol(protocol); return this; }
clientConf.setProtocol(Protocol.HTTPS); } else { clientConf.setProtocol(Protocol.HTTP);
/** * Sets the protocol (i.e. HTTP or HTTPS) to use when connecting to Amazon * Web Services, and returns the updated ClientConfiguration object so that * additional calls may be chained together. * <p> * The default configuration is to use HTTPS for all requests for increased * security. * <p> * Individual clients can also override this setting by explicitly including * the protocol as part of the endpoint URL when calling * {@link AmazonWebServiceClient#setEndpoint(String)}. * * @param protocol The protocol to use when connecting to Amazon Web * Services. * @return The updated ClientConfiguration object with the new max HTTP * connections setting. */ @SuppressWarnings("checkstyle:hiddenfield") public ClientConfiguration withProtocol(Protocol protocol) { setProtocol(protocol); return this; }
config.setUserAgent(DEFAULT_USER_AGENT); config.setProtocol(DEFAULT_PROTOCOL); final int commsTimeout = context.getProperty(TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue(); config.setConnectionTimeout(commsTimeout);
clientConfiguration.setProtocol(Protocol.HTTPS); } else { clientConfiguration.setProtocol(Protocol.HTTP);
configuration.setProtocol(clientOptions.isHttps() ? HTTPS : HTTP);
protected ClientConfiguration getClientConfiguration() { ClientConfiguration configuration = new ClientConfiguration(); if (http) { log.info("http selected"); configuration.setProtocol(Protocol.HTTP); } return configuration; }
private ClientConfiguration createConfiguration(boolean isSecure) { ClientConfiguration config = new ClientConfiguration(); config.setUserAgent(USER_AGENT); Protocol protocol = isSecure ? Protocol.HTTPS : Protocol.HTTP; config.setProtocol(protocol); return config; }
static ClientConfiguration s3ClientCfg() { ClientConfiguration cfg = new ClientConfiguration(); Properties prop = System.getProperties(); if (prop.containsKey(S3_SOCKET_TIMEOUT_PROP)) cfg.setSocketTimeout(Integer.getInteger(S3_SOCKET_TIMEOUT_PROP)); if (prop.containsKey(S3_CONNECTION_TIMEOUT_PROP)) cfg.setConnectionTimeout(Integer.getInteger(S3_CONNECTION_TIMEOUT_PROP)); if (prop.containsKey(S3_MAX_ERROR_RETRY_PROP)) cfg.setMaxErrorRetry(Integer.getInteger(S3_MAX_ERROR_RETRY_PROP)); if (prop.containsKey(S3_MAX_HTTP_CONNECTIONS_PROP)) cfg.setMaxConnections(Integer.getInteger(S3_MAX_HTTP_CONNECTIONS_PROP)); if (prop.containsKey(S3_FORCE_HTTP)) cfg.setProtocol(Protocol.HTTP); return cfg; }
public ClientConfiguration getClientConfig() { clientConfig.setCacheResponseMetadata(enableCacheResponseMetadata); clientConfig.setProtocol(protocol); clientConfig.setMaxConnections(maxConnections); return clientConfig; }
private void initS3() { credentials = new BasicAWSCredentials(accessKey, secretKey); ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setProtocol(Protocol.HTTP); s3 = AmazonS3ClientBuilder.standard() .withPathStyleAccessEnabled(true) .withCredentials(this) .withClientConfiguration(clientConfiguration) .withEndpointConfiguration(new EndpointConfiguration(endpoint, region)) .build(); }
AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setProtocol(Protocol.HTTP); AmazonS3 conn = new AmazonS3Client(credentials, clientConfig); conn.setEndpoint("correct end point"); Bucket bucket = conn.createBucket(bucketName); ObjectListing objects = conn.listObjects(bucket.getName()); do { for (S3ObjectSummary objectSummary : objects.getObjectSummaries()) { System.out.println(objectSummary.getKey() + "\t" + objectSummary.getSize() + "\t" + StringUtils.fromDate(objectSummary.getLastModified())); } objects = conn.listNextBatchOfObjects(objects); } while (objects.isTruncated());
@Override public void prepare(Object configurationObject) { // Connect to Kinesis synchronized (this) { // Create the credentials Object AWSCredentials credentials = new BasicAWSCredentials(config.getKey(), config.getSecretKey()); ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setProtocol(Protocol.valueOf(config.getProtocol().toString())); this.client = new AmazonKinesisClient(credentials, clientConfig); if (StringUtils.isNotEmpty(config.getRegion())) { this.client.setRegion(Region.getRegion(Regions.fromName(config.getRegion()))); } } executor = Executors.newSingleThreadExecutor(); }
private AmazonSQS createSQSClient() { final AmazonSQSClientBuilder builder = AmazonSQSClientBuilder.standard() .withRegion(sqsConfig.getRegion()); if (sqsConfig.hasStaticCredentials()) { final BasicAWSCredentials awsCreds = new BasicAWSCredentials(sqsConfig.getAccessKey(), sqsConfig.getSecretKey()); builder.withCredentials(new AWSStaticCredentialsProvider(awsCreds)); } if (sqsConfig.isUseHttp()) { final ClientConfiguration clientConfig = new ClientConfiguration(); clientConfig.setProtocol(Protocol.HTTP); builder.withClientConfiguration(clientConfig); } return builder.build(); }
c.setProtocol(Protocol.HTTPS); assertEquals(c.getProtocol(), Protocol.HTTPS);