Java 类com.amazonaws.regions.AwsRegionProvider 实例源码

项目:aem-orchestrator    文件:AwsConfig.java   
@Bean
public Region awsRegion() {
    Region region;
    if(regionString != null && !regionString.isEmpty()) {
        region = RegionUtils.getRegion(regionString);
    } else {
        AwsRegionProvider regionProvider = new DefaultAwsRegionProviderChain();
        region = RegionUtils.getRegion(regionProvider.getRegion());
    }

    if(region == null) {
        throw new BeanInitializationException("Unable to determine AWS region");
    }

    return region;
}
项目:cfnassist    文件:FacadeFactory.java   
public AwsFacade createFacade() throws MissingArgumentException, CfnAssistException, InterruptedException {     
    if (awsFacade==null) {
        init();
        SNSEventSource eventSource = new SNSEventSource(snsClient, sqsClient);
        MonitorStackEvents monitor;
        if (snsMonitoring) {    
            monitor = new SNSMonitor(eventSource, cfnRepository);
        } else {
            monitor = new PollingStackMonitor(cfnRepository);
        }

        monitor.init();
           AwsRegionProvider regionProvider = new DefaultAwsRegionProviderChain();
           awsFacade = new AwsFacade(monitor, cfnRepository, vpcRepository, elbRepository,
                cloudRepository, notificationSender, identityProvider);
    }   
    return awsFacade;   
}
项目:ibm-cos-sdk-java    文件:AwsClientBuilderTest.java   
/**
 * If no region is explicitly given and no region can be found from the {@link
 * AwsRegionProvider} implementation then the builder should fail to build clients. We mock the
 * provider to yield consistent results for the tests.
 */
@Test(expected = AmazonClientException.class)
public void noRegionProvidedExplicitlyOrImplicitly_ThrowsException() {
    AwsRegionProvider mockRegionProvider = mock(AwsRegionProvider.class);
    when(mockRegionProvider.getRegion()).thenReturn(null);
    new ConcreteAsyncBuilder(mockRegionProvider).build();
}
项目:ibm-cos-sdk-java    文件:AwsClientBuilderTest.java   
/**
 * Customers may not need to explicitly configure a builder with a region if one can be found
 * from the {@link AwsRegionProvider} implementation. We mock the provider to yield consistent
 * results for the tests.
 */
@Test
public void regionImplicitlyProvided_UsesRegionToConstructEndpoint() {
    AwsRegionProvider mockRegionProvider = mock(AwsRegionProvider.class);
    when(mockRegionProvider.getRegion()).thenReturn("ap-southeast-2");
    final URI actualUri = new ConcreteAsyncBuilder(mockRegionProvider).build().getEndpoint();
    assertEquals(URI.create("https://mockprefix.ap-southeast-2.amazonaws.com"), actualUri);
}
项目:ibm-cos-sdk-java    文件:AmazonS3Builder.java   
@SdkTestInternalApi
AmazonS3Builder(SdkFunction<AmazonS3ClientParamsWrapper, AmazonS3> clientFactory,
                ClientConfigurationFactory clientConfigFactory,
                AwsRegionProvider regionProvider) {
    super(clientConfigFactory, regionProvider);
    this.clientFactory = clientFactory;
}
项目:cfnassist    文件:FacadeFactory.java   
private void createProviders() {
    loadBalancerClient = new LoadBalancerClient(elbClient);
       AwsRegionProvider regionProvider = new DefaultAwsRegionProviderChain();
       cloudClient = new CloudClient(ec2Client, regionProvider);
    formationClient = new CloudFormationClient(cfnClient);
    datastoreClient = new RDSClient(rdsClient);
    notificationSender = new SNSNotificationSender(snsClient);
    identityProvider = new IdentityProvider(iamClient);
}
项目:ibm-cos-sdk-java    文件:AwsSyncClientBuilder.java   
@SdkTestInternalApi
protected AwsSyncClientBuilder(ClientConfigurationFactory clientConfigFactory,
                               AwsRegionProvider regionProvider) {
    super(clientConfigFactory, regionProvider);
}
项目:ibm-cos-sdk-java    文件:AwsAsyncClientBuilder.java   
@SdkTestInternalApi
protected AwsAsyncClientBuilder(ClientConfigurationFactory clientConfigFactory,
                                AwsRegionProvider regionProvider) {
    super(clientConfigFactory, regionProvider);
}
项目:ibm-cos-sdk-java    文件:AwsClientBuilder.java   
@SdkTestInternalApi
protected AwsClientBuilder(ClientConfigurationFactory clientConfigFactory,
                           AwsRegionProvider regionProvider) {
    this.clientConfigFactory = clientConfigFactory;
    this.regionProvider = regionProvider;
}
项目:ibm-cos-sdk-java    文件:AwsClientBuilderTest.java   
private ConcreteAsyncBuilder(AwsRegionProvider mockRegionProvider) {
    super(new MockClientConfigurationFactory(), mockRegionProvider);
}
项目:ibm-cos-sdk-java    文件:AmazonS3ClientBuilder.java   
@SdkTestInternalApi
AmazonS3ClientBuilder(SdkFunction<AmazonS3ClientParamsWrapper, AmazonS3> clientFactory,
                      ClientConfigurationFactory clientConfigFactory,
                      AwsRegionProvider regionProvider) {
    super(clientFactory, clientConfigFactory, regionProvider);
}
项目:cfnassist    文件:CloudClient.java   
public CloudClient(AmazonEC2 ec2Client, AwsRegionProvider regionProvider) {
    this.ec2Client = ec2Client;
    this.regionProvider = regionProvider;
}