当前位置: 首页>>代码示例>>Java>>正文


Java EndpointConfiguration类代码示例

本文整理汇总了Java中com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration的典型用法代码示例。如果您正苦于以下问题:Java EndpointConfiguration类的具体用法?Java EndpointConfiguration怎么用?Java EndpointConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EndpointConfiguration类属于com.amazonaws.client.builder.AwsClientBuilder包,在下文中一共展示了EndpointConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getClient

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
/**
 * Returns a client instance for AWS DynamoDB.
 * @return a client that talks to DynamoDB
 */
public static AmazonDynamoDB getClient() {
	if (ddbClient != null) {
		return ddbClient;
	}

	if (Config.IN_PRODUCTION) {
		ddbClient = AmazonDynamoDBClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(
			new BasicAWSCredentials(Config.AWS_ACCESSKEY, Config.AWS_SECRETKEY))).
				withRegion(Config.AWS_REGION).build();
	} else {
		ddbClient = AmazonDynamoDBClientBuilder.standard().
				withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("local", "null"))).
				withEndpointConfiguration(new EndpointConfiguration(LOCAL_ENDPOINT, "")).build();
	}

	if (!existsTable(Config.getRootAppIdentifier())) {
		createTable(Config.getRootAppIdentifier());
	}

	ddb = new DynamoDB(ddbClient);

	Para.addDestroyListener(new DestroyListener() {
		public void onDestroy() {
			shutdownClient();
		}
	});

	return ddbClient;
}
 
开发者ID:Erudika,项目名称:para,代码行数:34,代码来源:AWSDynamoUtils.java

示例2: getClient

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
/**
 * Returns a client instance for AWS SQS.
 * @return a client that talks to SQS
 */
public static AmazonSQS getClient() {
	if (sqsClient != null) {
		return sqsClient;
	}
	if (Config.IN_PRODUCTION) {
		sqsClient = AmazonSQSClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(
			new BasicAWSCredentials(Config.AWS_ACCESSKEY, Config.AWS_SECRETKEY))).
				withRegion(Config.AWS_REGION).build();
	} else {
		sqsClient = AmazonSQSClientBuilder.standard().
				withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x"))).
				withEndpointConfiguration(new EndpointConfiguration(LOCAL_ENDPOINT, "")).build();
	}

	Para.addDestroyListener(new DestroyListener() {
		public void onDestroy() {
			sqsClient.shutdown();
		}
	});
	return sqsClient;
}
 
开发者ID:Erudika,项目名称:para,代码行数:26,代码来源:AWSQueueUtils.java

示例3: setup

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
@Before
public void setup() {
  store = new InMemoryStorage();
  metrics = new InMemoryCollectorMetrics();

  collector = new SQSCollector.Builder()
      .queueUrl(sqsRule.queueUrl())
      .parallelism(2)
      .waitTimeSeconds(1) // using short wait time to make test teardown faster
      .endpointConfiguration(new EndpointConfiguration(sqsRule.queueUrl(), "us-east-1"))
      .credentialsProvider(new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x")))
      .metrics(metrics)
      .sampler(CollectorSampler.ALWAYS_SAMPLE)
      .storage(store)
      .build()
      .start();
}
 
开发者ID:openzipkin,项目名称:zipkin-aws,代码行数:18,代码来源:SQSCollectorTest.java

示例4: getAmazonS3Client

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
/**
 * Gets an Amazon S3 client from basic session credentials.
 *
 * @return an authenticated Amazon S3 amazonS3
 */
public AmazonS3 getAmazonS3Client() {
    if (amazonS3 == null) {
        amazonS3 = AmazonS3ClientBuilder.standard()
            .withEndpointConfiguration(new EndpointConfiguration(endpoint, region))
            .withClientConfiguration(new ClientConfiguration().withProtocol(Protocol.HTTP))
            .withCredentials(
                new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKeyId, accessKeySecret)))
            .build();
    }
    return amazonS3;
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:17,代码来源:AmazonS3Template.java

示例5: newInstance

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
private AmazonS3 newInstance(String region, S3S3CopierOptions s3s3CopierOptions) {
  HadoopAWSCredentialProviderChain credentialsChain = getCredentialsProviderChain();
  AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard().withCredentials(credentialsChain);
  URI s3Endpoint = s3s3CopierOptions.getS3Endpoint(region);
  if (s3Endpoint != null) {
    EndpointConfiguration endpointConfiguration = new EndpointConfiguration(s3Endpoint.toString(), region);
    builder.withEndpointConfiguration(endpointConfiguration);
  } else {
    builder.withRegion(region);
  }
  return builder.build();
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:13,代码来源:JceksAmazonS3ClientFactory.java

示例6: newGlobalInstance

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
private AmazonS3 newGlobalInstance(S3S3CopierOptions s3s3CopierOptions) {
  HadoopAWSCredentialProviderChain credentialsChain = getCredentialsProviderChain();
  AmazonS3ClientBuilder builder = AmazonS3ClientBuilder
      .standard()
      .withForceGlobalBucketAccessEnabled(Boolean.TRUE)
      .withCredentials(credentialsChain);
  URI s3Endpoint = s3s3CopierOptions.getS3Endpoint();
  if (s3Endpoint != null) {
    EndpointConfiguration endpointConfiguration = new EndpointConfiguration(s3Endpoint.toString(),
        Region.US_Standard.getFirstRegionId());
    builder.withEndpointConfiguration(endpointConfiguration);
  }
  return builder.build();
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:15,代码来源:JceksAmazonS3ClientFactory.java

示例7: getEndpointConfiguration

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
private static EndpointConfiguration getEndpointConfiguration(Configuration conf) {
  String endpointUrl = conf.get(ConfigurationVariable.S3_ENDPOINT_URI.getName());
  if (endpointUrl == null) {
    return null;
  }
  return new EndpointConfiguration(endpointUrl, getRegion(conf));
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:8,代码来源:AwsS3ClientFactory.java

示例8: newInstance

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
public AmazonS3 newInstance(Configuration conf) {
  int maxErrorRetry = conf.getInt(ConfigurationVariable.UPLOAD_RETRY_COUNT.getName(),
      ConfigurationVariable.UPLOAD_RETRY_COUNT.defaultIntValue());
  long errorRetryDelay = conf.getLong(ConfigurationVariable.UPLOAD_RETRY_DELAY_MS.getName(),
      ConfigurationVariable.UPLOAD_RETRY_DELAY_MS.defaultLongValue());

  LOG.info("Creating AWS S3 client with a retry policy of {} retries and {} ms of exponential backoff delay",
      maxErrorRetry, errorRetryDelay);

  RetryPolicy retryPolicy = new RetryPolicy(new CounterBasedRetryCondition(maxErrorRetry),
      new ExponentialBackoffStrategy(errorRetryDelay), maxErrorRetry, true);
  ClientConfiguration clientConfiguration = new ClientConfiguration();
  clientConfiguration.setRetryPolicy(retryPolicy);
  clientConfiguration.setMaxErrorRetry(maxErrorRetry);

  AmazonS3ClientBuilder builder = AmazonS3ClientBuilder
      .standard()
      .withCredentials(new HadoopAWSCredentialProviderChain(conf))
      .withClientConfiguration(clientConfiguration);

  EndpointConfiguration endpointConfiguration = getEndpointConfiguration(conf);
  if (endpointConfiguration != null) {
    builder.withEndpointConfiguration(endpointConfiguration);
  } else {
    builder.withRegion(getRegion(conf));
  }

  return builder.build();
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:30,代码来源:AwsS3ClientFactory.java

示例9: setup

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
@Before
public void setup() {
  EndpointConfiguration endpoint =
      new EndpointConfiguration(UNIT_STACK_URL + ":" + SNS_PORT, Region.EU_Frankfurt.name());
  AWSCredentials credentials = new BasicAWSCredentials("key", "secret");
  AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);

  sns = AmazonSNSAsyncClientBuilder.standard().withEndpointConfiguration(endpoint)
      .withCredentials(credentialsProvider).build();
}
 
开发者ID:daflockinger,项目名称:unitstack,代码行数:11,代码来源:MockSnsTest.java

示例10: setup

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
@Before
public void setup() {
  MockParameters params = new MockParameters();
  params.setMockRegion("EU");
  mockS3(params);
  
  EndpointConfiguration endpoint =
      new EndpointConfiguration(UNIT_STACK_URL + ":" + S3_PORT, Region.EU_Frankfurt.name());
  AWSCredentials credentials = new BasicAWSCredentials("key", "secret");
  AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);

  s3 = AmazonS3ClientBuilder.standard().withEndpointConfiguration(endpoint)
      .withCredentials(credentialsProvider).build();
}
 
开发者ID:daflockinger,项目名称:unitstack,代码行数:15,代码来源:MockS3Test.java

示例11: setup

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
@Before
public void setup() {
  mockSqs(null);
  
  EndpointConfiguration endpoint =
      new EndpointConfiguration(UNIT_STACK_URL + ":" + SQS_PORT, "eu-central-1");
  AWSCredentials credentials = new BasicAWSCredentials("key", "secret");
  AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials);

  sqs = AmazonSQSAsyncClientBuilder.standard().withEndpointConfiguration(endpoint)
      .withCredentials(credentialsProvider).build();
}
 
开发者ID:daflockinger,项目名称:unitstack,代码行数:13,代码来源:MockSqsTest.java

示例12: endpointAndSigningRegionCanBeUsedInPlaceOfSetRegion

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
@Test
public void endpointAndSigningRegionCanBeUsedInPlaceOfSetRegion() {
    AmazonConcreteClient client = new ConcreteSyncBuilder()
            .withEndpointConfiguration(new EndpointConfiguration("https://mockprefix.ap-southeast-2.amazonaws.com", "us-east-1"))
            .build();
    assertEquals("us-east-1", client.getSignerRegionOverride());
    assertEquals(URI.create("https://mockprefix.ap-southeast-2.amazonaws.com"), client.getEndpoint());
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:9,代码来源:AwsClientBuilderTest.java

示例13: cannotSetBothEndpointConfigurationAndRegionOnBuilder

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void cannotSetBothEndpointConfigurationAndRegionOnBuilder() {
    new ConcreteSyncBuilder()
            .withEndpointConfiguration(new EndpointConfiguration("http://localhost:3030", "us-west-2"))
            .withRegion("us-east-1")
            .build();
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:8,代码来源:AwsClientBuilderTest.java

示例14: createS3Client

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
/**
 * @return An {@link AmazonS3} client instance that is configured to call the started S3Mock
 *         server using HTTPS.
 */
public AmazonS3 createS3Client() {
  final BasicAWSCredentials credentials = new BasicAWSCredentials("foo", "bar");

  return AmazonS3ClientBuilder.standard()
      .withCredentials(new AWSStaticCredentialsProvider(credentials))
      .withClientConfiguration(
          configureClientToIgnoreInvalidSslCertificates(new ClientConfiguration()))
      .withEndpointConfiguration(
          new EndpointConfiguration("https://localhost:" + getPort(), "us-east-1"))
      .enablePathStyleAccess()
      .build();
}
 
开发者ID:adobe,项目名称:S3Mock,代码行数:17,代码来源:S3MockRule.java

示例15: prepareS3Client

import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration; //导入依赖的package包/类
/**
 * Configures the S3-Client to be used in the Test. Sets the SSL context to accept untrusted SSL
 * connections.
 */
@Before
public void prepareS3Client() {
  final BasicAWSCredentials credentials = new BasicAWSCredentials("foo", "bar");

  s3Client = AmazonS3ClientBuilder.standard()
      .withCredentials(new AWSStaticCredentialsProvider(credentials))
      .withClientConfiguration(ignoringInvalidSslCertificates(new ClientConfiguration()))
      .withEndpointConfiguration(
          new EndpointConfiguration("https://" + getHost() + ":" + getPort(), "us-east-1"))
      .enablePathStyleAccess()
      .build();
}
 
开发者ID:adobe,项目名称:S3Mock,代码行数:17,代码来源:AmazonClientUploadIT.java


注:本文中的com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。