Skip to content
forked from minio/minio-cpp

MinIO C++ Client SDK for Amazon S3 Compatible Cloud Storage

License

Notifications You must be signed in to change notification settings

cumafo/minio-cpp

 
 

Repository files navigation

NOTE: This project is work in progress.

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

The MinIO C++ Client SDK provides simple APIs to access any Amazon S3 compatible object storage. This quickstart guide will show you how to install the MinIO client SDK, connect to MinIO, and provide a walkthrough for a simple file uploader. For a complete list of APIs and examples, please take a look at the MinIO C++ Client API Reference

This document assumes that you have a working C++ development environment. In order to build this project, you need the Cross-Platform Make CMake 3.10 or higher, vcpkg.

Install from vcpkg

vcpkg install minio-cpp

Source build

git clone https://github.com/minio/minio-cpp; cd minio-cpp;
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=${VCPKGDIR}/scripts/buildsystems/vcpkg.cmake
cmake --build build

Example code

#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <getopt.h>
#include <s3.h>

using namespace Minio;

int
main ( int argc, char** argv )
{
  S3Client s3("https://play.min.io:9000", "minioadmin", "minioadmin");
  S3ClientIO io;
  s3.MakeBucket("newbucket", io);
  if(io.Failure()) {
    std::cerr << "ERROR: failed to create bucket" << endl;
    std::cerr << "response:\n" << io << endl;
    std::cerr << "response body:\n" << io.response.str() << endl;
    return -1;
  }
  return 0;
}

Run an example

Following example runs 'multipart' upload, uploads a single part. You would have to choose a local file to upload for -f, and also remote bucket to upload the object to as -n and final object name in the bucket as -k.

export ACTION="multipart"
export ACCESS_KEY=minioadmin
export SECRET_KEY=minioadmin
export ENDPOINT="https://play.min.io:9000"

./examples/s3 -a ${ACTION} -f <local_filename_to_upload> \
              -n <remote_bucket> -k <remote_objectname>

Please choose a <remote_bucket> that exists.

License

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

About

MinIO C++ Client SDK for Amazon S3 Compatible Cloud Storage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 85.4%
  • CMake 14.6%