Examples of AWSClient


Examples of com.streamreduce.util.AWSClient

    /**
     * {@inheritDoc}
     */
    @Override
    public AWSClient getClient(Connection connection) {
        return new AWSClient(connection);
    }
View Full Code Here

Examples of com.streamreduce.util.AWSClient

        }
    }

    private void sendPayload(String key, byte[] payload) throws OutboundStorageException {
        try {
            AWSClient awsClient = new AWSClient(outboundConfiguration);
            String result = awsClient.pushToS3(outboundConfiguration, key, payload);
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("rawMessage sent to S3 identified by: " + result);
            }
        } catch (Exception e) {
            throw new OutboundStorageException(e.getMessage(), e);
View Full Code Here

Examples of com.streamreduce.util.AWSClient

        List<String> processedKeys = new ArrayList<>();
        List<JSONObject> externalInventoryItems;
        ExternalIntegrationClient client = getClient(connection);

        if (client instanceof AWSClient) {
            AWSClient awsClient = null;
            try {
                awsClient = new AWSClient(connection);
                // Get the EC2 inventory items
                externalInventoryItems = (awsClient.getEC2Instances());
                // Get the S3 inventory items
                externalInventoryItems.addAll(awsClient.getS3BucketsAsJson());
            } finally {
                if (awsClient != null) {
                    awsClient.cleanUp();
                }
            }
        } else if (client instanceof GitHubClient) {
            externalInventoryItems = ((GitHubClient) client).getRepositories();
        } else if (client instanceof GoogleAnalyticsClient) {
View Full Code Here

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

Examples of com.streamreduce.util.AWSClient

        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
Copyright © 2018 www.massapi.com. 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.