Example usage for com.amazonaws.services.cloudformation.model CreateStackRequest withTemplateURL

List of usage examples for com.amazonaws.services.cloudformation.model CreateStackRequest withTemplateURL

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudformation.model CreateStackRequest withTemplateURL.

Prototype


public CreateStackRequest withTemplateURL(String templateURL) 

Source Link

Document

Location of file containing the template body.

Usage

From source file:br.com.ingenieux.mojo.cloudformation.PushStackMojo.java

License:Apache License

private CreateStackResult createStack() throws Exception {
    CreateStackRequest req = new CreateStackRequest().withStackName(stackName)
            .withCapabilities(Capability.CAPABILITY_IAM);

    if (null != this.destinationS3Uri) {
        req.withTemplateURL(generateExternalUrl(this.destinationS3Uri));
    } else {//from ww  w . j a  v  a2  s  . c  o  m
        req.withTemplateBody(templateBody);
    }

    req.withNotificationARNs(notificationArns);

    req.withParameters(parameters);
    req.withResourceTypes(resourceTypes);
    req.withDisableRollback(disableRollback);
    req.withTags(tags);
    req.withTimeoutInMinutes(timeoutInMinutes);

    return getService().createStack(req);
}

From source file:com.tvarit.plugin.InfrastructureMojo.java

License:Open Source License

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    getLog().debug("Starting " + this.getClass().getSimpleName() + " execution ");
    getLog().warn(//from   w w w  . j a v  a 2s . c o  m
            "This goal has been deprecated and may be removed without notice. Please use the goal 'make-infrastructure' instead.");
    final BasicAWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
    AmazonCloudFormationClient amazonCloudFormationClient = new AmazonCloudFormationClient(awsCredentials);
    final com.amazonaws.services.cloudformation.model.Parameter domainNameParameter = new com.amazonaws.services.cloudformation.model.Parameter()
            .withParameterKey("domainName").withParameterValue(this.domainName);
    final com.amazonaws.services.cloudformation.model.Parameter projectNameParameter = new com.amazonaws.services.cloudformation.model.Parameter()
            .withParameterKey("projectName").withParameterValue(this.projectName);
    final com.amazonaws.services.cloudformation.model.Parameter bucketNameParameter = new com.amazonaws.services.cloudformation.model.Parameter()
            .withParameterKey("bucketName").withParameterValue("tvarit-" + this.bucketName);
    final CreateStackRequest createStackRequest = new CreateStackRequest()
            .withCapabilities(Capability.CAPABILITY_IAM).withStackName(projectName + "-infra")
            .withParameters(domainNameParameter, projectNameParameter, bucketNameParameter);
    if (templateUrl == null) {
        final String template = new TemplateReader().readTemplate("/cfn-templates/vpc-infra.template");
        createStackRequest.withTemplateBody(template);
    } else {
        createStackRequest.withTemplateURL(templateUrl);
    }
    new StackMaker().makeStack(createStackRequest, amazonCloudFormationClient, getLog());

    getLog().info("Finished completing stack");

}