Java 类com.amazonaws.services.cloudformation.model.DescribeStackEventsResult 实例源码

项目:cerberus-lifecycle-cli    文件:CloudFormationService.java   
/**
 * Returns the events for a named stack.
 *
 * @param stackId Stack ID.
 * @return Collection of events
 */
public List<StackEvent> getStackEvents(final String stackId) {
    final DescribeStackEventsRequest request = new DescribeStackEventsRequest().withStackName(stackId);

    try {
        final DescribeStackEventsResult result = cloudFormationClient.describeStackEvents(request);
        return result.getStackEvents();
    } catch (final AmazonServiceException ase) {
        // Stack doesn't exist, just return with no status
        if (ase.getStatusCode() != 400) {
            throw ase;
        }
    }

    return Collections.emptyList();
}
项目:aws-maven-plugin    文件:CloudFormationDeployer.java   
private void displayEvents(final String stackName, AmazonCloudFormation cf, long sinceTime) {
    // list history of application
    log.info("------------------------------");
    log.info("Event history - " + stackName);
    log.info("------------------------------");
    DescribeStackEventsResult r = cf.describeStackEvents(new DescribeStackEventsRequest().withStackName(stackName));
    r.getStackEvents() //
            .stream() //
            .sorted((a, b) -> a.getTimestamp().compareTo(b.getTimestamp())) //
            .filter(x -> x.getTimestamp().getTime() >= sinceTime - TimeUnit.MINUTES.toMillis(1)) //
            .forEach(x -> {
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-ddd HH:mm:ss");
                log.info(sdf.format(x.getTimestamp()) + " " + x.getResourceStatus() + " " + x.getResourceType());
                if (x.getResourceStatusReason() != null) {
                    log.info("  reason=" + x.getResourceStatusReason());
                    if (x.getResourceProperties() != null) {
                        log.info("  properties=\n");
                        log.info(Util.formatJson(x.getResourceProperties()));
                    }
                }
            });
}
项目:jwrapper-maven-plugin    文件:CarrotCloudForm.java   
private void printStackEvents() {

        final DescribeStackEventsRequest request = new DescribeStackEventsRequest();

        request.withStackName(name);

        final DescribeStackEventsResult describeStackEvents = amazonClient
                .describeStackEvents(request);

        final List<StackEvent> stackEvents = describeStackEvents
                .getStackEvents();

        Collections.reverse(stackEvents);

        logger.info("stack events:");

        for (final StackEvent event : stackEvents) {

            final StringBuilder text = new StringBuilder(128);

            text.append("\n\t");
            text.append("time=");
            text.append(event.getTimestamp());

            text.append("\n\t");
            text.append("id=");
            text.append(event.getEventId());

            text.append("\n\t");
            text.append("type=");
            text.append(event.getResourceType());

            text.append("\n\t");
            text.append("status=");
            text.append(event.getResourceStatus());

            text.append("\n\t");
            text.append("reason=");
            text.append(event.getResourceStatusReason());

            logger.info("event {}", text);

        }

    }