Package com.streamreduce.util

Examples of com.streamreduce.util.AWSClient


            throws CommandNotAllowedException, InvalidCredentialsException {
        Preconditions.checkNotNull(inventoryItem, "inventoryItem cannot be null.");
        Preconditions.checkArgument(inventoryItem.getType().equals(Constants.COMPUTE_INSTANCE_TYPE),
                                    "Inventory item of type '" + inventoryItem.getType() + "' cannot be rebooted.");

        AWSClient client = (AWSClient)getClient(inventoryItem.getConnection());

        logger.debug("Rebooting node: " + inventoryItem.getExternalId());

        BasicDBObject payload = getInventoryItemPayload(inventoryItem);
        String jcloudsNodeId = payload.getString("id");
        NodeMetadata nodeMetadata = client.getEC2Instance(jcloudsNodeId);

        if (nodeMetadata.getStatus().equals(NodeMetadata.Status.TERMINATED)) {
            throw new CommandNotAllowedException("You cannot reboot a terminated node.");
        }

        EventId eventId;

        if (client.rebootEC2Instance(jcloudsNodeId)) {
            eventId = EventId.CLOUD_INVENTORY_ITEM_REBOOT;
        } else {
            // TODO: Handle this issue but it can be a false positive if the time it takes surpasses the time we wait
            eventId = EventId.CLOUD_INVENTORY_ITEM_REBOOT_FAILURE;
        }
View Full Code Here


        JSONObject expectedJSONFromOriginalSobaMessage = JSONObject.fromObject(sw.toString());

        Assert.assertEquals(expectedJSONFromOriginalSobaMessage, actualJSONPayloadFromS3);
        final String bucketName = payload.getMetadata().getContainer();

        List<JSONObject> allBucketsAsJSONObjs = new AWSClient(outboundConfiguration).getS3BucketsAsJson();
        JSONObject bucketAsJSON = Iterables.find(allBucketsAsJSONObjs, new Predicate<JSONObject>() {
            @Override
            public boolean apply(@Nullable JSONObject input) {
                return input != null && bucketName.equals(input.getString("name"));
            }
View Full Code Here

TOP

Related Classes of com.streamreduce.util.AWSClient

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.