• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DefaultAwsRegionProviderChain类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: awsRegion

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
@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;
}
 
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:17,代码来源:AwsConfig.java


示例2: region

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
@Bean String region(ZipkinElasticsearchStorageProperties es,
    ZipkinElasticsearchAwsStorageProperties aws) {
  List<String> hosts = es.getHosts();
  String domain = aws.getDomain();
  if (hosts != null && domain != null) {
    log.warning(
        format("Expected exactly one of hosts or domain: instead saw hosts '%s' and domain '%s'."
            + " Ignoring hosts and proceeding to look for domain. Either unset ES_HOSTS or "
            + "ES_AWS_DOMAIN to suppress this message.", hosts, domain));
  }

  if (aws.getRegion() != null) {
    return aws.getRegion();
  } else if (domain != null) {
    return new DefaultAwsRegionProviderChain().getRegion();
  } else {
    return regionFromAwsUrls(hosts).get();
  }
}
 
开发者ID:liaominghua,项目名称:zipkin,代码行数:20,代码来源:ZipkinElasticsearchAwsStorageAutoConfiguration.java


示例3: createFacade

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
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;	
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:19,代码来源:FacadeFactory.java


示例4: beforeEachTestRuns

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
@Before
public void beforeEachTestRuns() {
	AWSCredentialsProvider credentialsProvider = new DefaultAWSCredentialsProviderChain();
	AmazonEC2 ec2Client = EnvironmentSetupForTests.createEC2Client();
	AmazonElasticLoadBalancing awsElbClient = EnvironmentSetupForTests.createELBClient();
	AmazonCloudFormation cfnClient = EnvironmentSetupForTests.createCFNClient();
	AmazonRDS awsRdsClient = EnvironmentSetupForTests.createRDSClient();

	CloudClient cloudClient = new CloudClient(ec2Client, new DefaultAwsRegionProviderChain());
	LoadBalancerClient elbClient = new LoadBalancerClient(awsElbClient);
	VpcRepository vpcRepository = new VpcRepository(cloudClient);

	CloudFormationClient cloudFormationClient = new CloudFormationClient(cfnClient);
	cloudRepository = new CloudRepository(cloudClient);
	ResourceRepository cfnRepository = new CfnRepository(cloudFormationClient, cloudRepository, "CfnAssist");
	
	elbRepository = new ELBRepository(elbClient, vpcRepository, cfnRepository);
	rdsClient = new RDSClient(awsRdsClient);
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:20,代码来源:TestPictureGeneration.java


示例5: beforeEveryTestRun

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
@Before
public void beforeEveryTestRun() {
	vpcRepository = new VpcRepository(new CloudClient(ec2Client, new DefaultAwsRegionProviderChain()));
	altProjectAndEnv = EnvironmentSetupForTests.getAltProjectAndEnv();
	EnvironmentSetupForTests.getMainProjectAndEnv();
	
	altEnvVPC = EnvironmentSetupForTests.findAltVpc(vpcRepository);	
	deletesStacks = new DeletesStacks(cfnClient);
	deletesStacks.ifPresent(EnvironmentSetupForTests.TEMPORARY_STACK)
		.ifPresent("CfnAssistTest01createSubnet")
		.ifPresent("CfnAssistTest02createAcls")
		.ifPresent("CfnAssistTestsimpleStack")
		.ifPresent("CfnAssistTestsubnet")
		.ifPresent("CfnAssist876TestelbAndInstance")
           .ifPresent("CfnAssistTestsimpleStackWithAZ");
	deletesStacks.act();
	testName = test.getMethodName();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:19,代码来源:TestCommandLineStackOperations.java


示例6: beforeEveryTestRun

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
@Before
public void beforeEveryTestRun() {

	deleteTestKeysFromBucket();
	
	vpcRepository = new VpcRepository(new CloudClient(ec2Client, new DefaultAwsRegionProviderChain()));
	projectAndEnv = EnvironmentSetupForTests.getMainProjectAndEnv();
	
	deletesStacks = new DeletesStacks(cfnClient);
	deletesStacks.ifPresent(EnvironmentSetupForTests.TEMPORARY_STACK)
		.ifPresent("CfnAssistTest01createSubnet")
		.ifPresent("CfnAssistTest02createAcls")
		.ifPresent("CfnAssistTestsimpleStack");
	deletesStacks.act();
	testName = test.getMethodName();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:17,代码来源:TestCommandLineS3Operations.java


示例7: getRegionFromMetadata

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
private Optional<Region> getRegionFromMetadata() {
    try {
        Region resolvedRegion = null;
        if (EC2MetadataUtils.getInstanceInfo() != null) {
            if (EC2MetadataUtils.getInstanceInfo().getRegion() != null) {
                resolvedRegion = Region.fromName(EC2MetadataUtils.getInstanceInfo().getRegion());
            } else { // fallback to provider chain if region is not exposed
                resolvedRegion = Region.fromName(new DefaultAwsRegionProviderChain().getRegion());
            }
        }
        return Optional.ofNullable(resolvedRegion);
    } catch (SdkClientException e) {
        return Optional.empty();
    }
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:16,代码来源:CustomRegionProviderChain.java


示例8: defaultRegion

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
private String defaultRegion() {
  try {
    return new DefaultAwsRegionProviderChain().getRegion();
  }
  catch (SdkClientException e) {
    String region = Regions.DEFAULT_REGION.getName();
    log.warn("Default AWS region not configured, using {}", region, e);
    return region;
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:11,代码来源:AmazonS3Factory.java


示例9: createProviders

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
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);
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:10,代码来源:FacadeFactory.java


示例10: onceBeforeClassRuns

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
@BeforeClass
public static void onceBeforeClassRuns() {
	DefaultAWSCredentialsProviderChain credentialsProvider = new DefaultAWSCredentialsProviderChain();
	ec2Client = EnvironmentSetupForTests.createEC2Client();
	regionProvider = new DefaultAwsRegionProviderChain();
	vpcRepository = new VpcRepository(new CloudClient(ec2Client, regionProvider));
	cfnClient = EnvironmentSetupForTests.createCFNClient();
	AmazonSNS snsClient = EnvironmentSetupForTests.createSNSClient();
	AmazonSQS sqsClient = EnvironmentSetupForTests.createSQSClient();
	snsNotifProvider = new SNSEventSource(snsClient, sqsClient);
	
	new DeletesStacks(cfnClient).ifPresent("queryStackTest").
		ifPresent("createStackTest").
		ifPresent("createIAMStackTest").act();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:16,代码来源:TestCloudFormationClient.java


示例11: beforeEachTestRuns

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
@Before
public void beforeEachTestRuns() {	
	client = new CloudClient(ec2Client, new DefaultAwsRegionProviderChain());
	
	deleteGroupIfPresent();
	
	CreateSecurityGroupRequest createRequest = new CreateSecurityGroupRequest().
			withDescription("test group").
			withGroupName(GROUP_NAME);
	CreateSecurityGroupResult result = ec2Client.createSecurityGroup(createRequest);
	groupId = result.getGroupId();
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:13,代码来源:TestManageSecGroups.java


示例12: shouldGetAvailabilityZones

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
@Test
public void shouldGetAvailabilityZones() {
	String regionName = new DefaultAwsRegionProviderChain().getRegion();
	Map<String, AvailabilityZone> zones = cloudClient.getAvailabilityZones();

	assertEquals(3, zones.size());
	zones.forEach((name, zone) -> assertEquals(regionName, zone.getRegionName()));
       assertTrue(zones.containsKey("a"));
       assertTrue(zones.containsKey("b"));
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:11,代码来源:TestCloudClient.java


示例13: getRegion

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
protected final String getRegion() {
    return new DefaultAwsRegionProviderChain().getRegion();
}
 
开发者ID:widdix,项目名称:aws-cf-templates,代码行数:4,代码来源:AAWSTest.java


示例14: beforeEachTestIsRun

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
@Before
public void beforeEachTestIsRun() {
	ec2Client = EnvironmentSetupForTests.createEC2Client();
	cloudClient = new CloudClient(ec2Client, new DefaultAwsRegionProviderChain());
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:6,代码来源:TestCloudClient.java


示例15: beforeEveryTestRun

import com.amazonaws.regions.DefaultAwsRegionProviderChain; //导入依赖的package包/类
@Before
public void beforeEveryTestRun() {
	VpcRepository vpcRepository = new VpcRepository(new CloudClient(ec2Client, new DefaultAwsRegionProviderChain()));
	altEnvVPC = EnvironmentSetupForTests.findAltVpc(vpcRepository);	
}
 
开发者ID:cartwrightian,项目名称:cfnassist,代码行数:6,代码来源:TestCommandLineVPCoperations.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SortedList类代码示例发布时间:2022-05-23
下一篇:
Java BlackHoleChannel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap