hdq 6ea57a1c8e - пре 6 месеци
..
.github a0fae58fdb - пре 7 месеци
3rdparty 9878211534 - пре 7 месеци
docs a0fae58fdb - пре 7 месеци
examples a0fae58fdb - пре 7 месеци
include a22c86d8a3 - пре 6 месеци
out 6ea57a1c8e - пре 6 месеци
src 6ea57a1c8e - пре 6 месеци
tests a0fae58fdb - пре 7 месеци
.gitignore a0fae58fdb - пре 7 месеци
.gitmodules a0fae58fdb - пре 7 месеци
CMakeLists.txt 6ea57a1c8e - пре 6 месеци
CNAME a0fae58fdb - пре 7 месеци
LICENSE a0fae58fdb - пре 7 месеци
README.md 7c27ef0cea - пре 7 месеци
check-style.sh a0fae58fdb - пре 7 месеци
find_nlohmann_json.cmake 2357afc5d6 - пре 7 месеци
find_pugixml.cmake 2357afc5d6 - пре 7 месеци
find_unofficial_curlpp.cmake 2357afc5d6 - пре 7 месеци
miniocpp.pc.in a0fae58fdb - пре 7 месеци
vcpkg.json a0fae58fdb - пре 7 месеци

README.md

MinIO C++ Client SDK for Amazon S3 Compatible Cloud Storage Slack Sourcegraph Apache V2 License

MinIO C++ SDK is Simple Storage Service (aka S3) client to perform bucket and object operations to any Amazon S3 compatible object storage service.

For a complete list of APIs and examples, please take a look at the MinIO C++ Client API Reference

In addition to doc, test, and examples, this library has been ported for Visual Studio and has been successfully compiled on Visual Studio 2022 ver.17.3.5 .

Build requirements

  • A working C++ development environment supporting C++17 standards.
  • CMake 3.10 or higher.

Dependencies

Example:: file-uploader.cc

#include <client.h>

int main(int argc, char* argv[]) {
  // Create S3 base URL.
  minio::s3::BaseUrl base_url("play.min.io");

  // Create credential provider.
  minio::creds::StaticProvider provider(
      "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG");

  // Create S3 client.
  minio::s3::Client client(base_url, &provider);
  std::string bucket_name = "asiatrip";

  // Check 'asiatrip' bucket exist or not.
  bool exist;
  {
    minio::s3::BucketExistsArgs args;
    args.bucket = bucket_name;

    minio::s3::BucketExistsResponse resp = client.BucketExists(args);
    if (!resp) {
      std::cout << "unable to do bucket existence check; " << resp.Error()
                << std::endl;
      return EXIT_FAILURE;
    }

    exist = resp.exist;
  }

  // Make 'asiatrip' bucket if not exist.
  if (!exist) {
    minio::s3::MakeBucketArgs args;
    args.bucket = bucket_name;

    minio::s3::MakeBucketResponse resp = client.MakeBucket(args);
    if (!resp) {
      std::cout << "unable to create bucket; " << resp.Error() << std::endl;
      return EXIT_FAILURE;
    }
  }

  // Upload '/home/user/Photos/asiaphotos.zip' as object name
  // 'asiaphotos-2015.zip' to bucket 'asiatrip'.
  minio::s3::UploadObjectArgs args;
  args.bucket = bucket_name;
  args.object = "asiaphotos-2015.zip";
  args.filename = "/home/user/Photos/asiaphotos.zip";

  minio::s3::UploadObjectResponse resp = client.UploadObject(args);
  if (!resp) {
    std::cout << "unable to upload object; " << resp.Error() << std::endl;
    return EXIT_FAILURE;
  }

  std::cout << "'/home/user/Photos/asiaphotos.zip' is successfully uploaded as "
            << "object 'asiaphotos-2015.zip' to bucket 'asiatrip'."
            << std::endl;

  return EXIT_SUCCESS;
}

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.