Package com.netflix.simianarmy.aws

Examples of com.netflix.simianarmy.aws.AWSResource


            usedLCs.add(asg.getLaunchConfigurationName());
        }

        for (LaunchConfiguration launchConfiguration : awsClient.describeLaunchConfigurations(launchConfigNames)) {
            String lcName = launchConfiguration.getLaunchConfigurationName();
            Resource lcResource = new AWSResource().withId(lcName)
                    .withRegion(getAWSClient().region()).withResourceType(AWSResourceType.LAUNCH_CONFIG)
                    .withLaunchTime(launchConfiguration.getCreatedTime());
            lcResource.setOwnerEmail(getOwnerEmailForResource(lcResource));

            lcResource.setAdditionalField(LAUNCH_CONFIG_FIELD_USED_BY_ASG, String.valueOf(usedLCs.contains(lcName)));
View Full Code Here


        List<Resource> resources = new LinkedList<Resource>();

        AWSClient awsClient = getAWSClient();

        for (Volume volume : awsClient.describeVolumes(volumeIds)) {
            Resource volumeResource = new AWSResource().withId(volume.getVolumeId())
                    .withRegion(getAWSClient().region()).withResourceType(AWSResourceType.EBS_VOLUME)
                    .withLaunchTime(volume.getCreateTime());
            for (Tag tag : volume.getTags()) {
                LOGGER.info(String.format("Adding tag %s = %s to resource %s",
                        tag.getKey(), tag.getValue(), volumeResource.getId()));
View Full Code Here

        Validate.notNull(jsonNode);

        String instanceId = jsonNode.get("instanceId").getTextValue();
        long launchTime = jsonNode.get("launchTime").getLongValue();

        Resource resource = new AWSResource().withId(instanceId).withRegion(region)
                .withResourceType(AWSResourceType.INSTANCE)
                .withLaunchTime(new Date(launchTime));

        JsonNode publicDnsName = jsonNode.get("publicDnsName");
        String description = String.format("type=%s; host=%s",
View Full Code Here

        List<Resource> resources = new LinkedList<Resource>();
        AWSClient awsClient = getAWSClient();

        for (Snapshot snapshot : awsClient.describeSnapshots(snapshotIds)) {
            Resource snapshotResource = new AWSResource().withId(snapshot.getSnapshotId())
                    .withRegion(getAWSClient().region()).withResourceType(AWSResourceType.EBS_SNAPSHOT)
                    .withLaunchTime(snapshot.getStartTime()).withDescription(snapshot.getDescription());
            for (Tag tag : snapshot.getTags()) {
                LOGGER.debug(String.format("Adding tag %s = %s to resource %s",
                        tag.getKey(), tag.getValue(), snapshotResource.getId()));
View Full Code Here

        Validate.notNull(jsonNode);

        String asgName = jsonNode.get("autoScalingGroupName").getTextValue();
        long createdTime = jsonNode.get("createdTime").getLongValue();

        Resource resource = new AWSResource().withId(asgName).withRegion(region)
                .withResourceType(AWSResourceType.ASG)
                .withLaunchTime(new Date(createdTime));

        JsonNode tags = jsonNode.get("tags");
        if (tags == null || !tags.isArray() || tags.size() == 0) {
View Full Code Here

            nameToLaunchConfig.put(lc.getLaunchConfigurationName(), lc);
        }

        List<Resource> resources = new LinkedList<Resource>();
        for (AutoScalingGroup asg : awsClient.describeAutoScalingGroups(asgNames)) {
            Resource asgResource = new AWSResource().withId(asg.getAutoScalingGroupName())
                    .withResourceType(AWSResourceType.ASG).withRegion(awsClient.region())
                    .withLaunchTime(asg.getCreatedTime());
            for (TagDescription tag : asg.getTags()) {
                asgResource.setTag(tag.getKey(), tag.getValue());
            }
View Full Code Here

        for (AutoScalingInstanceDetails instanceDetails : awsClient.describeAutoScalingInstances(instanceIds)) {
            idToASGInstance.put(instanceDetails.getInstanceId(), instanceDetails);
        }

        for (Instance instance : awsClient.describeInstances(instanceIds)) {
            Resource instanceResource = new AWSResource().withId(instance.getInstanceId())
                    .withRegion(getAWSClient().region()).withResourceType(AWSResourceType.INSTANCE)
                    .withLaunchTime(instance.getLaunchTime());
            for (Tag tag : instance.getTags()) {
                instanceResource.setTag(tag.getKey(), tag.getValue());
            }
View Full Code Here

    private Resource parseJsonElementToSnapshotResource(String region, JsonNode jsonNode) {
        Validate.notNull(jsonNode);
        long startTime = jsonNode.get("startTime").asLong();

        Resource resource = new AWSResource().withId(jsonNode.get("snapshotId").getTextValue()).withRegion(region)
                .withResourceType(AWSResourceType.EBS_SNAPSHOT)
                .withLaunchTime(new Date(startTime));
        JsonNode tags = jsonNode.get("tags");

        if (tags == null || !tags.isArray() || tags.size() == 0) {
View Full Code Here

        Set<String> usedLCs = getLaunchConfigsInUse(region);

        for (Iterator<JsonNode> it = jsonNode.getElements(); it.hasNext();) {
            JsonNode launchConfiguration = it.next();
            String lcName = launchConfiguration.get("launchConfigurationName").getTextValue();
            Resource lcResource = new AWSResource().withId(lcName)
                    .withRegion(region).withResourceType(AWSResourceType.LAUNCH_CONFIG)
                    .withLaunchTime(new Date(launchConfiguration.get("createdTime").getLongValue()));
            lcResource.setOwnerEmail(getOwnerEmailForResource(lcResource));

            lcResource.setAdditionalField(LAUNCH_CONFIG_FIELD_USED_BY_ASG, String.valueOf(usedLCs.contains(lcName)));
View Full Code Here

    private Resource parseJsonElementToresource(String region, JsonNode jsonNode) {
        Validate.notNull(jsonNode);

        String imageId = jsonNode.get("imageId").getTextValue();

        Resource resource = new AWSResource().withId(imageId).withRegion(region)
                .withResourceType(AWSResourceType.IMAGE);

        Long creationTime = imageIdToCreationTime.get(imageId);
        if (creationTime != null) {
            resource.setLaunchTime(new Date(creationTime));
View Full Code Here

TOP

Related Classes of com.netflix.simianarmy.aws.AWSResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.