@Bean @ConditionalOnMissingBean(StackResourceRegistry.class) public StackResourceRegistryFactoryBean stackResourceRegistryFactoryBean(AmazonCloudFormation amazonCloudFormation) { if (StringUtils.hasText(environment.getProperty("cloud.aws.stack.name"))) { return new StackResourceRegistryFactoryBean(amazonCloudFormation, new StaticStackNameProvider(this.environment.getProperty("cloud.aws.stack.name"))); } if (environment.getProperty("cloud.aws.stack.auto") == null || "true".equalsIgnoreCase(environment.getProperty("cloud.aws.stack.auto"))) { return new StackResourceRegistryFactoryBean(amazonCloudFormation, new AutoDetectingStackNameProvider(amazonCloudFormation, this.amazonEC2)); } return null; }
private Map<String, StackResource> getResourceMappings(String prefix, String stackName) { List<StackResourceSummary> stackResourceSummaries = getStackResourceSummaries(stackName); Map<String, StackResource> current = convertToStackResourceMappings(prefix, stackResourceSummaries); Map<String, StackResource> stackResourceMappings = new HashMap<>(current); for (Map.Entry<String, StackResource> e : current.entrySet()) { StackResource resource = e.getValue(); if ("AWS::CloudFormation::Stack".equals(resource.getType())) { stackResourceMappings.putAll(getResourceMappings(e.getKey(), resource.getPhysicalId())); } } return stackResourceMappings; }
@Override protected ListableStackResourceFactory createInstance() { String stackName = this.stackNameProvider.getStackName(); return new StaticStackResourceRegistry(stackName, getResourceMappings("", stackName)); }
private Map<String, StackResource> convertToStackResourceMappings(String prefix, List<StackResourceSummary> stackResourceSummaries) { Map<String, StackResource> stackResourceMappings = new HashMap<>(); for (StackResourceSummary stackResourceSummary : stackResourceSummaries) { String logicalResourceId = toNestedResourceId(prefix, stackResourceSummary.getLogicalResourceId()); stackResourceMappings.put(logicalResourceId, new StackResource(logicalResourceId, stackResourceSummary.getPhysicalResourceId(), stackResourceSummary.getResourceType())); } return stackResourceMappings; }
@Override protected ListableStackResourceFactory createInstance() { String stackName = this.stackNameProvider.getStackName(); return new StaticStackResourceRegistry(stackName, getResourceMappings("", stackName)); }
private Map<String, StackResource> convertToStackResourceMappings(String prefix, List<StackResourceSummary> stackResourceSummaries) { Map<String, StackResource> stackResourceMappings = new HashMap<>(); for (StackResourceSummary stackResourceSummary : stackResourceSummaries) { String logicalResourceId = toNestedResourceId(prefix, stackResourceSummary.getLogicalResourceId()); stackResourceMappings.put(logicalResourceId, new StackResource(logicalResourceId, stackResourceSummary.getPhysicalResourceId(), stackResourceSummary.getResourceType())); } return stackResourceMappings; }
private Map<String, StackResource> getResourceMappings(String prefix, String stackName) { List<StackResourceSummary> stackResourceSummaries = getStackResourceSummaries(stackName); Map<String, StackResource> current = convertToStackResourceMappings(prefix, stackResourceSummaries); Map<String, StackResource> stackResourceMappings = new HashMap<>(current); for (Map.Entry<String, StackResource> e : current.entrySet()) { StackResource resource = e.getValue(); if ("AWS::CloudFormation::Stack".equals(resource.getType())) { stackResourceMappings.putAll(getResourceMappings(e.getKey(), resource.getPhysicalId())); } } return stackResourceMappings; }
@Bean @ConditionalOnMissingBean(StackResourceRegistry.class) public StackResourceRegistryFactoryBean stackResourceRegistryFactoryBean(AmazonCloudFormation amazonCloudFormation) { if (StringUtils.hasText(environment.getProperty("cloud.aws.stack.name"))) { return new StackResourceRegistryFactoryBean(amazonCloudFormation, new StaticStackNameProvider(this.environment.getProperty("cloud.aws.stack.name"))); } if (environment.getProperty("cloud.aws.stack.auto") == null || "true".equalsIgnoreCase(environment.getProperty("cloud.aws.stack.auto"))) { return new StackResourceRegistryFactoryBean(amazonCloudFormation, new AutoDetectingStackNameProvider(amazonCloudFormation, this.amazonEC2)); } return null; }
@Bean public StackResourceRegistryFactoryBean stackResourceRegistryFactoryBean(AmazonCloudFormation amazonCloudFormation) { if (StringUtils.hasText(this.annotationAttributes.getString("stackName"))) { return new StackResourceRegistryFactoryBean(amazonCloudFormation, new StaticStackNameProvider(this.annotationAttributes.getString("stackName"))); } else { return new StackResourceRegistryFactoryBean(amazonCloudFormation, new AutoDetectingStackNameProvider(amazonCloudFormation, this.amazonEc2)); } }
@Bean public StackResourceRegistryFactoryBean stackResourceRegistryFactoryBean(AmazonCloudFormation amazonCloudFormation) { if (StringUtils.hasText(this.annotationAttributes.getString("stackName"))) { return new StackResourceRegistryFactoryBean(amazonCloudFormation, new StaticStackNameProvider(this.annotationAttributes.getString("stackName"))); } else { return new StackResourceRegistryFactoryBean(amazonCloudFormation, new AutoDetectingStackNameProvider(amazonCloudFormation, this.amazonEc2)); } }