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


Java AmazonWebServiceClient.setRegion方法代码示例

本文整理汇总了Java中com.amazonaws.AmazonWebServiceClient.setRegion方法的典型用法代码示例。如果您正苦于以下问题:Java AmazonWebServiceClient.setRegion方法的具体用法?Java AmazonWebServiceClient.setRegion怎么用?Java AmazonWebServiceClient.setRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.AmazonWebServiceClient的用法示例。


在下文中一共展示了AmazonWebServiceClient.setRegion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBuildWithRegion

import com.amazonaws.AmazonWebServiceClient; //导入方法依赖的package包/类
@Test
@SuppressWarnings("deprecation")
public void testBuildWithRegion() {
    Region region = Region.getRegion(Regions.US_WEST_1);
    AmazonWebServiceClient mockedS3 = createMock(AmazonWebServiceClient.class);
    AwsClientBuilder builder = createPartialMock(AwsClientBuilder.class,
        new String[] {"instantiateClient"}, region);
    try {
        expect(builder.instantiateClient(AmazonS3Client.class))
            .andReturn(mockedS3);
        mockedS3.setRegion(region);
        expectLastCall();
        replay(mockedS3, builder);

        builder.build(AmazonS3Client.class);

        verify(mockedS3, builder);
    } catch (Exception ex) {
        fail("Unexpected exception: " + ex.getMessage());
    }
}
 
开发者ID:bluedenim,项目名称:log4j-s3-search,代码行数:22,代码来源:AwsClientBuilderTest.java

示例2: configureServiceClient

import com.amazonaws.AmazonWebServiceClient; //导入方法依赖的package包/类
static void configureServiceClient(AmazonWebServiceClient client, Optional<String> endpoint, Optional<String> regionName)
{
    // Configure endpoint or region. Endpoint takes precedence over region.
    if (endpoint.isPresent()) {
        client.setEndpoint(endpoint.get());
    }
    else if (regionName.isPresent()) {
        Regions region;
        try {
            region = Regions.fromName(regionName.get());
        }
        catch (IllegalArgumentException e) {
            throw new ConfigException("Illegal AWS region: " + regionName.get());
        }
        client.setRegion(Region.getRegion(region));
    }
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:18,代码来源:Aws.java

示例3: createClient

import com.amazonaws.AmazonWebServiceClient; //导入方法依赖的package包/类
private C createClient() {
    Class<? extends C> clientImplType = factory.getClientImplType();
    C client = ReflectionUtils.newInstance(
            clientImplType, credentials, configuration);

    if (client instanceof AmazonWebServiceClient) {
        AmazonWebServiceClient awsc = (AmazonWebServiceClient) client;
        if (region != null) {
            awsc.setRegion(region);
        }
        if (endpoint != null) {
            awsc.setEndpoint(endpoint);
        }
    }

    return client;
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:18,代码来源:ServiceBuilder.java


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