src/main/java/com/digitalglobe/util/maven/plugin/CloudFormationDeployMavenPlugin.java
/**
     * Use this method to create or update a cloud formation stack.
     *
     * @param stackName is the name of the stack to create.
     * @param templateUrl is the URL to the template to use when creating or updating the stack.
     * @param cfClient is the cloud formation client to use when creating or updating the stack.
     * @param parameters is a list of parameters to update the stack with.
     * @throws MojoExecutionException when a retry exception isn't a Rate Exceeded exception.
     */
Use this method to create or update a cloud formation stack.
@param stackName is the name of the stack to create.
@param templateUrl is the URL to the template to use when creating or updating the stack.
@param cfClient is the cloud formation client to use when creating or updating the stack.
@param parameters is a list of parameters to update the stack with.
@throws MojoExecutionException when a retry exception isn't a Rate Exceeded exception.
Use this method to create or update a cloud formation stack . @param stackName is the name of the stack to create . @param templateUrl is the URL to the template to use when creating or updating the stack . @param cfClient is the cloud formation client to use when creating or updating the stack . @param parameters is a list of parameters to update the stack with . @throws MojoExecutionException when a retry exception isn ' t a Rate Exceeded exception .
private void createStack(String stackName, String templateUrl, CloudFormationAsyncClient cfClient,
                             Parameter[] parameters) throws MojoExecutionException {
        boolean retry;
        CreateStackRequest request;
        if(requiresIAM) {
            request = CreateStackRequest.builder()
                    .stackName(stackName)
                    .templateURL(templateUrl)
                    .parameters(parameters)
                    .capabilities(Capability.CAPABILITY_NAMED_IAM)
                    .build();
        } else {
            request = CreateStackRequest.builder()
                    .stackName(stackName)
                    .templateURL(templateUrl)
                    .parameters(parameters)
                    .build();
        }
        do {
            try {
                CreateStackResponse result = cfClient.createStack(request).get();
                WaitStackInProgress(stackName, cfClient);
                DescribeStacksResponse describeResponse = cfClient.describeStacks(DescribeStacksRequest.builder()
                        .stackName(stackName).build()).get();
                if(describeResponse.stacks().get(0).stackStatus() != StackStatus.CREATE_COMPLETE)
                    throw new MojoExecutionException(describeResponse.stacks().get(0).stackStatusReason());
                audit.write("Created " + stackName + " with id: " + result.stackId() + ".\n");
                retry = false;
            } catch (Exception ex) {
                retry = isRetry(ex);
            }
        } while(retry);
    }
private void createStack ( String stackName , String templateUrl , CloudFormationAsyncClient cfClient , Parameter [ ] parameters ) throws MojoExecutionException { boolean retry ; CreateStackRequest request ; if ( requiresIAM ) { request = CreateStackRequest . builder ( ) . stackName ( stackName ) . templateURL ( templateUrl ) . parameters ( parameters ) . capabilities ( Capability . CAPABILITY_NAMED_IAM ) . build ( ) ; } else { request = CreateStackRequest . builder ( ) . stackName ( stackName ) . templateURL ( templateUrl ) . parameters ( parameters ) . build ( ) ; } do { try { CreateStackResponse result = cfClient . createStack ( request ) . get ( ) ; WaitStackInProgress ( stackName , cfClient ) ; DescribeStacksResponse describeResponse = cfClient . describeStacks ( DescribeStacksRequest . builder ( ) . stackName ( stackName ) . build ( ) ) . get ( ) ; if ( describeResponse . stacks ( ) . get ( 0 ) . stackStatus ( ) != StackStatus . CREATE_COMPLETE ) throw new MojoExecutionException ( describeResponse . stacks ( ) . get ( 0 ) . stackStatusReason ( ) ) ; audit . write ( "Created " + stackName + " with id: " + result . stackId ( ) + ".\n" ) ; retry = false ; } catch ( Exception ex ) { retry = isRetry ( ex ) ; } } while ( retry ) ; }
Use this method to create or update a cloud formation stack.
Use this method to create or update a cloud formation stack .
// Create the stack.