Example usage for com.amazonaws.services.cloudformation.model Output getOutputKey

List of usage examples for com.amazonaws.services.cloudformation.model Output getOutputKey

Introduction

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

Prototype


public String getOutputKey() 

Source Link

Document

The key associated with the output.

Usage

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

License:Apache License

private String resolvePropertyName(Output o) {
    // TODO Handle Globs + Eventual Replacements

    if (outputMapping.containsKey(o.getOutputKey())) {
        final String replacementKey = outputMapping.get(o.getOutputKey());

        getLog().info("There's a <outputMapping/> entry for '" + o.getOutputKey() + "' (set to '"
                + replacementKey + "') declared. Using it instead.");

        return replacementKey;
    }//from www.  j a  v  a2  s.c o m

    return "cloudformation.stack." + o.getOutputKey();
}

From source file:com.carrotgarden.maven.aws.cfn.CloudFormCreateStack.java

License:BSD License

/**
 * {@inheritDoc}//www .j a  v a  2  s .  co  m
 */
@Override
public void execute() throws MojoFailureException {

    try {

        getLog().info("stack create init [" + stackName() + "]");

        final Properties stackInputProps = Util.propsLoad(getLog(), stackPropertiesInputFile);

        final Map<String, String> pluginProps = mergePluginProps(stackInputProps, stackInputParams);

        final Map<String, String> stackTemplateParams = loadTemplateParameters(stackTemplateFile, pluginProps);

        final CarrotCloudForm formation = newCloudFormation(stackTemplateFile, stackTemplateParams);

        formation.logParamList();

        final Stack stack = formation.stackCreate();

        final StackStatus status = StackStatus.fromValue(stack.getStackStatus());

        switch (status) {
        case CREATE_COMPLETE:
            break;
        default:
            throw new IllegalStateException("stack create failed");
        }

        //

        getLog().info("stack create stack=\n" + stack);

        getLog().info("stack create output:");

        final List<Output> outputList = stack.getOutputs();

        final Properties outputProps = new Properties();

        for (final Output output : outputList) {

            final String key = output.getOutputKey();
            final String value = output.getOutputValue();

            outputProps.put(key, value);

            getLog().info("\t" + key + "=" + value);

        }

        if (stackIsInjectOutputProperties) {

            project().getProperties().putAll(outputProps);

            getLog().info("stack create output is injected in project.properties]");

        }

        if (stackIsPersistOutputProperties) {

            Util.propsSave(getLog(), outputProps, stackPropertiesOutputFile);

            getLog().info("stack create output is persisted to : " + stackPropertiesOutputFile);

        }

        //

        getLog().info("stack create done [" + stackName() + "]");

    } catch (final Exception e) {

        throw new MojoFailureException("bada-boom", e);

    }

}

From source file:com.deploymentio.cfnstacker.CloudFormationClient.java

License:Apache License

/**
* Prints the output variables for the given stack
* 
* @param stack the stack/*from w  ww . ja v a  2s  .  c om*/
*/
public void printStackOutputs(Stack stack) {
    for (Output outputs : stack.getOutputs()) {
        logger.info("Output Variable: Key=" + outputs.getOutputKey() + " Value=" + outputs.getOutputValue());
    }
}

From source file:com.haskins.cloudtrailviewer.dialog.resourcedetail.detailpanels.CfStackDetail.java

License:Open Source License

private void buildUI(DescribeStacksResult detail) {

    JTabbedPane tabs = new JTabbedPane();
    tabs.add("Stack", primaryScrollPane);

    final JTable outputCheckTable = new JTable(outputTableModel);
    JScrollPane healthCheckScrollPane = new JScrollPane(outputCheckTable);
    tabs.add("Output", healthCheckScrollPane);

    final JTable paramsTable = new JTable(parametersTableModel);
    JScrollPane listenersScrollPane = new JScrollPane(paramsTable);
    tabs.add("Parameters", listenersScrollPane);

    this.add(tabs, BorderLayout.CENTER);

    if (!detail.getStacks().isEmpty()) {

        List<Stack> stacks = detail.getStacks();
        Stack stack = stacks.get(0);

        if (stack.getCreationTime() != null) {
            primaryTableModel.addRow(new Object[] { "Created", getDateString(stack.getCreationTime()) });
        }/*from   w ww  .java 2  s  . c  o  m*/
        if (stack.getDescription() != null) {
            primaryTableModel.addRow(new Object[] { "Description", stack.getDescription() });
        }
        if (stack.getDisableRollback() != null) {
            primaryTableModel.addRow(new Object[] { "Disable Rollback", stack.getDisableRollback() });
        }
        if (stack.getLastUpdatedTime() != null) {
            primaryTableModel
                    .addRow(new Object[] { "Last Updated", getDateString(stack.getLastUpdatedTime()) });
        }
        if (stack.getNotificationARNs() != null) {
            primaryTableModel.addRow(new Object[] { "Notification Arns", stack.getNotificationARNs() });
        }
        if (stack.getStackId() != null) {
            primaryTableModel.addRow(new Object[] { "Stacks Id", stack.getStackId() });
        }
        if (stack.getStackName() != null) {
            primaryTableModel.addRow(new Object[] { "Stacks Name", stack.getStackName() });
        }
        if (stack.getStackStatus() != null) {
            primaryTableModel.addRow(new Object[] { "Stacks Status", stack.getStackStatus() });
        }
        if (stack.getStackStatusReason() != null) {
            primaryTableModel.addRow(new Object[] { "Stacks Status Reason", stack.getStackStatusReason() });
        }
        if (stack.getTimeoutInMinutes() != null) {
            primaryTableModel.addRow(new Object[] { "Timeout (minutes)", stack.getTimeoutInMinutes() });
        }

        /**
         * Tags
         */
        List<Tag> tags = stack.getTags();
        for (Tag tag : tags) {
            tagsTableModel.addRow(new Object[] { tag.getKey(), tag.getValue() });
        }

        /**
         * Output
         */
        outputTableModel.addColumn("Description");
        outputTableModel.addColumn("Key");
        outputTableModel.addColumn("Value");

        List<Output> outputs = stack.getOutputs();
        for (Output output : outputs) {
            tagsTableModel.addRow(
                    new Object[] { output.getDescription(), output.getOutputKey(), output.getOutputValue() });
        }

        /**
         * Parameters
         */
        parametersTableModel.addColumn("Key");
        parametersTableModel.addColumn("Value");
        parametersTableModel.addColumn("User Previous Value");

        List<Parameter> parameters = stack.getParameters();
        for (Parameter parameter : parameters) {
            tagsTableModel.addRow(new Object[] { parameter.getParameterKey(), parameter.getParameterValue(),
                    parameter.getUsePreviousValue() });
        }
    }
}

From source file:de.taimos.pipeline.aws.cloudformation.CloudFormationStack.java

License:Apache License

public Map<String, String> describeOutputs() {
    DescribeStacksResult result = this.client
            .describeStacks(new DescribeStacksRequest().withStackName(this.stack));
    Stack cfnStack = result.getStacks().get(0);
    Map<String, String> map = new HashMap<>();
    for (Output output : cfnStack.getOutputs()) {
        map.put(output.getOutputKey(), output.getOutputValue());
    }//from w ww . j  a va2 s  . co  m
    return map;
}

From source file:doug.iotdemo.common.AmazonUtils.java

License:Open Source License

public static String getStackOutput(String outputKey) {
    AmazonCloudFormation cf = new AmazonCloudFormationClient();
    DescribeStacksRequest request = new DescribeStacksRequest().withStackName(stackName);
    for (Stack stack : cf.describeStacks(request).getStacks()) {
        for (Output output : stack.getOutputs()) {
            if (outputKey.equals(output.getOutputKey())) {
                return output.getOutputValue();
            }/*from   w w  w .jav  a  2s . co  m*/
        }
    }
    return null;
}

From source file:org.xmlsh.aws.util.AWSCFNCommand.java

License:BSD License

private void writeOutput(Output o) throws XMLStreamException {
    startElement("output");
    attribute("description", o.getDescription());
    attribute("output-key", o.getOutputKey());
    attribute("output-value", o.getOutputValue());
    endElement();//from ww w .  j a  v a  2  s  .  c  o  m

}