Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrated s3 client lib and its dependencies #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

basavaraj29
Copy link
Collaborator

@basavaraj29 basavaraj29 commented Oct 18, 2022

the following libraries need to be installed in the base image

apt install zlib1g-dev
apt install zlib1g
apt-get install libssl-dev
apt install curl
apt-get install libcurl4-openssl-dev

creds are read from ~/.aws/credentials. format

[default]
aws_access_key_id=<...>
aws_secret_access_key=<...>

test code, will check in an example if the changes are good to go with.

#include <aws/s3/S3Client.h>
#include <aws/core/Aws.h>
#include <aws/s3/model/ListObjectsRequest.h>
#include <aws/s3/model/Object.h>

Aws::SDKOptions options;
Aws::InitAPI(options);
Aws::Client::ClientConfiguration client_config;
Aws::S3::S3Client s3_client(client_config);
Aws::S3::Model::ListObjectsRequest request;

const Aws::String bucket_name = "fb15k237";
request.WithBucket(bucket_name);
auto outcome = s3_client.ListObjects(request);

if (!outcome.IsSuccess()) {
    std::cerr << "Error: ListObjects: " <<
              outcome.GetError().GetMessage() << std::endl;
}
else {
    Aws::Vector<Aws::S3::Model::Object> objects =
            outcome.GetResult().GetContents();

    for (Aws::S3::Model::Object &object: objects) {
        std::cout << object.GetKey() << std::endl;
    }
}

@basavaraj29 basavaraj29 requested a review from JasonMoho October 18, 2022 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant