public static AmazonCloudFormationClientBuilder builder() { return AmazonCloudFormationClientBuilder.standard(); }
/** * @return Create new instance of builder with all defaults set. */ public static AmazonCloudFormationClientBuilder standard() { return new AmazonCloudFormationClientBuilder(); }
public static AmazonCloudFormation getCloudFormationClient( String accessKeyId, String secretAccessKey, String proxyHost, String proxyPort, String proxyUsername, String proxyPassword, String connectTimeoutMs, String executionTimeoutMs, String region) { connectTimeoutMs = defaultIfEmpty(connectTimeoutMs, DefaultValues.CONNECT_TIMEOUT); executionTimeoutMs = defaultIfEmpty(executionTimeoutMs, DefaultValues.EXEC_TIMEOUT); ClientConfiguration clientConf = AmazonWebServiceClientUtil.getClientConfiguration(proxyHost, proxyPort, proxyUsername, proxyPassword, connectTimeoutMs, executionTimeoutMs); return AmazonCloudFormationClientBuilder.standard() .withRegion(region) .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKeyId, secretAccessKey))) .withClientConfiguration(clientConf) .build(); }
List<Stack> stacksTemp = new ArrayList<>(); String nextToken = null; cloudFormClient = AmazonCloudFormationClientBuilder.standard(). withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build(); DescribeStacksResult describeResult ; do{
String region = inputs.getProperty(AWS_REGION_PARAMETER); configFilePath = TestGridUtil.getConfigFilePath(); AmazonCloudFormation stackdestroy = AmazonCloudFormationClientBuilder.standard() .withCredentials(new PropertiesFileCredentialsProvider(configFilePath.toString())) .withRegion(region) .build(); DeleteStackRequest deleteStackRequest = new DeleteStackRequest(); deleteStackRequest.setStackName(stackName);
public static AmazonCloudFormationClientBuilder builder() { return AmazonCloudFormationClientBuilder.standard(); }
/** * @return Create new instance of builder with all defaults set. */ public static AmazonCloudFormationClientBuilder standard() { return new AmazonCloudFormationClientBuilder(); }
Path configFilePath = TestGridUtil.getConfigFilePath(); String region = inputs.getProperty(AWS_REGION_PARAMETER); AmazonCloudFormation cloudFormation = AmazonCloudFormationClientBuilder.standard() .withCredentials(new PropertiesFileCredentialsProvider(configFilePath.toString())) .withRegion(region) .build(); script.getInputParameters().setProperty(AWS_REGION_PARAMETER, region); cloudFormation = AmazonCloudFormationClientBuilder.standard() .withCredentials(new PropertiesFileCredentialsProvider(configFilePath.toString())) .withRegion(region) .build();
public DeployService(SamConfig config, Logger logger) { this(config, config.getAwsClientFactory().create(AmazonCloudFormationClientBuilder.standard()), logger); }
@Override public Void run() throws Exception { final String stackSet = this.step.getStackSet(); final TaskListener listener = this.getContext().get(TaskListener.class); Preconditions.checkArgument(stackSet != null && !stackSet.isEmpty(), "StackSet must not be null or empty"); listener.getLogger().format("Removing CloudFormation stack set %s %n", stackSet); AmazonCloudFormation client = AWSClientFactory.create(AmazonCloudFormationClientBuilder.standard(), Execution.this.getContext()); CloudFormationStackSet cfnStackSet = new CloudFormationStackSet(client, stackSet, listener, SleepStrategy.EXPONENTIAL_BACKOFF_STRATEGY); cfnStackSet.delete(); listener.getLogger().println("Stack Set deletion complete"); return null; }
@Override public Void run() throws Exception { final String stack = this.step.getStack(); final TaskListener listener = this.getContext().get(TaskListener.class); Preconditions.checkArgument(stack != null && !stack.isEmpty(), "Stack must not be null or empty"); listener.getLogger().format("Removing CloudFormation stack %s %n", stack); AmazonCloudFormation client = AWSClientFactory.create(AmazonCloudFormationClientBuilder.standard(), Execution.this.getContext()); CloudFormationStack cfnStack = new CloudFormationStack(client, stack, listener); cfnStack.delete(Execution.this.step.getPollConfiguration()); listener.getLogger().println("Stack deletion complete"); return null; }
@Override public Map<String, String> run() throws Exception { final String changeSet = this.step.getChangeSet(); final String stack = this.step.getStack(); final TaskListener listener = this.getContext().get(TaskListener.class); Preconditions.checkArgument(changeSet != null && !changeSet.isEmpty(), "Change Set must not be null or empty"); Preconditions.checkArgument(stack != null && !stack.isEmpty(), "Stack must not be null or empty"); listener.getLogger().format("Executing CloudFormation change set %s %n", changeSet); AmazonCloudFormation client = AWSClientFactory.create(AmazonCloudFormationClientBuilder.standard(), Execution.this.getContext()); CloudFormationStack cfnStack = new CloudFormationStack(client, stack, listener); Map<String, String> outputs = cfnStack.executeChangeSet(changeSet, Execution.this.step.getPollConfiguration()); listener.getLogger().println("Execute change set complete"); return outputs; }
@Override protected Map<String, String> run() throws Exception { final String stack = this.step.getStack(); final TaskListener listener = this.getContext().get(TaskListener.class); Preconditions.checkArgument(stack != null && !stack.isEmpty(), "Stack must not be null or empty"); listener.getLogger().format("Getting outputs of CloudFormation stack %s %n", stack); AmazonCloudFormation client = AWSClientFactory.create(AmazonCloudFormationClientBuilder.standard(), Execution.this.getContext()); CloudFormationStack cfnStack = new CloudFormationStack(client, stack, listener); return cfnStack.describeOutputs(); }
@Override protected Map<String, String> run() throws Exception { this.getContext().get(TaskListener.class).getLogger().format("Getting global exports of CloudFormation %n"); AmazonCloudFormation client = AWSClientFactory.create(AmazonCloudFormationClientBuilder.standard(), Execution.this.getContext()); return Execution.this.getExports(client, null); }
protected CloudFormationStack getCfnStack() { AmazonCloudFormation client = AWSClientFactory.create(AmazonCloudFormationClientBuilder.standard(), this.getEnvVars()); return new CloudFormationStack(client, this.getStack(), this.getListener()); }
protected CloudFormationStackSet getCfnStackSet() { AmazonCloudFormation client = AWSClientFactory.create(AmazonCloudFormationClientBuilder.standard(), this.getEnvVars()); return new CloudFormationStackSet(client, this.getStackSet(), this.getListener(), SleepStrategy.EXPONENTIAL_BACKOFF_STRATEGY); }
@Override public DescribeStackSetResult run() throws Exception { final String stackSet = this.getStackSet(); final Boolean create = this.getCreate(); Preconditions.checkArgument(stackSet != null && !stackSet.isEmpty(), "Stack set must not be null or empty"); this.checkPreconditions(); AmazonCloudFormation client = AWSClientFactory.create(AmazonCloudFormationClientBuilder.standard(), Execution.this.getEnvVars()); CloudFormationStackSet cfnStackSet = new CloudFormationStackSet(client, stackSet, Execution.this.getListener(), SleepStrategy.EXPONENTIAL_BACKOFF_STRATEGY); if (cfnStackSet.exists()) { Collection<Parameter> parameters = ParameterParser.parseWithKeepParams(getWorkspace(), getStep()); return Execution.this.whenStackSetExists(parameters, getStep().getAwsTags(Execution.this)); } else if (create) { Collection<Parameter> parameters = ParameterParser.parse(getWorkspace(), getStep()); return Execution.this.whenStackSetMissing(parameters, getStep().getAwsTags(Execution.this)); } else { Execution.this.getListener().getLogger().println("No stack set found with the name=" + stackSet + " and skipped creation due to configuration."); return null; } }
@Override public T run() throws Exception { final String stack = this.getStack(); final String roleArn = this.getRoleArn(); final Boolean create = this.getCreate(); Preconditions.checkArgument(stack != null && !stack.isEmpty(), "Stack must not be null or empty"); Preconditions.checkArgument(roleArn == null || IamRoleUtils.validRoleArn(roleArn), "RoleArn must be a valid ARN."); this.checkPreconditions(); AmazonCloudFormation client = AWSClientFactory.create(AmazonCloudFormationClientBuilder.standard(), Execution.this.getEnvVars()); CloudFormationStack cfnStack = new CloudFormationStack(client, stack, Execution.this.getListener()); if (cfnStack.exists()) { Collection<Parameter> parameters = ParameterParser.parseWithKeepParams(Execution.this.getWorkspace(), Execution.this.getStep()); return Execution.this.whenStackExists(parameters, Execution.this.getStep().getAwsTags(Execution.this), Execution.this.getStep().getRollbackConfiguration()); } else if (create) { Collection<Parameter> parameters = ParameterParser.parse(Execution.this.getWorkspace(), Execution.this.getStep()); return Execution.this.whenStackMissing(parameters, Execution.this.getStep().getAwsTags(Execution.this)); } else { Execution.this.getListener().getLogger().println("No stack found with the name and skipped creation due to configuration."); return null; } }