Skip to content

aliyun-beta/aliyun-oss-cpp-sdk

Repository files navigation

OSS C++ SDK

Build Status Coverage Status

License

Apache License 2.0

System requirements

  • Ubuntu 12.04 tested, gcc 4.6
  • Windows 7+, Visual Studio 2013 update4+
  • Mac OSX 10.10, Clang 3.7 tested.

How to build

  • Windows
    • open all.sln in visual studio and build.
  • Linux(ubuntu 12.04)
    • 1, install cmake, run sudo apt-get install cmake
    • 2, install dependencies, run sudo apt-get install libapr1-dev libaprutil1-dev libtinyxml-dev libcurl4-openssl-dev
    • 3, run cmake .&& make
  • Mac OSX
    • 1, install cmake, run sudo brew install cmake
    • 2, install dependencies, run brew install tinyxml apr apr-util curl
    • 3, then run cmake .&& make

Api Index

ListBuckets

  Status ListBuckets(const ListBucketsRequest& request, ListBucketsResult* result);
  Status ListBuckets(std::vector<Bucket>* buckets);

Request Parameters

  • prefix — return buckets must begin with prefix
  • marker — return buckets must start from marker.
  • max-key — return buckets must no more than max-keys.

CreateBucket

Status CreateBucket(const std::string& bucket_name, const std::string& acl = kAclPrivate);

Request Parameters

  • bucket_name — the bucket name you wanna use
  • acl — initial acl, default to "private"

DeleteBucket

  Status DeleteBucket(const std::string& bucket_name);

Request Parameters

  • bucket_name — bucket name

BucketExists

  Status BucketExists(const std::string& bucket_name, bool* exist);

Request Parameters

  • bucket_name — bucket name

SetBucketAcl

  Status SetBucketAcl(const std::string& bucket_name,
                      const std::string& acl = kAclPrivate);

Request Parameters

  • bucket_name — bucket name
  • acl — access permission you want to set.

GetBucketAcl

  Status GetBucketAcl(const std::string& bucket_name, std::string* acl);

Request Parameters

  • bucket_name — bucket name

GetBucketLocation

 Status GetBucketLocation(const std::string& bucket_name, std::string* location);

Request Parameters

  • bucket_name — bucket name

GetBucketLogging

  Status GetBucketLogging(const std::string& bucket_name, GetBucketLoggingResult* result);

Request Parameters

  • bucket_name — bucket name

SetBucketLogging

  Status SetBucketLogging(const SetBucketLoggingRequest& request);

Request Parameters

  • target_bucket — the bucket actually store logs.
  • target_prefix — the prefix of log file name.
  • source_bucket — the bucket you want to enable logging on.

DeleteBucketLogging

  Status DeleteBucketLogging(const std::string& bucket_name); 

Request Parameters

  • bucket_name — bucket name

GetBucketWebsite

  Status GetBucketWebsite(const std::string& bucket_name, GetBucketWebsiteResult* result);

Request Parameters

  • bucket_name — bucket name

SetBucketWebsite

  Status SetBucketWebsite(const std::string& bucket_name,
                          const std::string& index_page,
                          const std::string& error_page); 

Request Parameters

  • bucket_name — bucket name
  • index_page — bucket's index page.
  • error_page — bucket's "not found" page

DeleteBucketWebsite

  Status DeleteBucketWebsite(const std::string& bucket_name);

Request Parameters

  • bucket_name — bucket name

GetBucketReferer

  Status GetBucketReferer(const std::string& bucket_name,
                          GetBucketRefererResult* result);

Request Parameters

  • bucket_name — bucket name

SetBucketReferer

  Status SetBucketReferer(const SetBucketRefererRequest& request);

Request Parameters

  • bucket_name — bucket name
  • referer_list — allow website list.
  • allow_empty — allow empty refere or not.

GetBucketLifecycle

  Status GetBucketLifecycle(const std::string& bucket_name,
                            GetBucketLifecycleResult* result);

Request Parameters

  • bucket_name — bucket name


SetBucketLifecycle

  Status GetBucketLifecycle(const std::string& bucket_name,
                            GetBucketLifecycleResult* result);

Request Parameters

  • bucket_name — bucket name
  • rule_list — lifecycle rule list

DeleteBucketLifecycle

  Status DeleteBucketLifecycle(const std::string& bucket_name);

Request Parameters

  • bucket_name — bucket name

GetBucketCors

  Status GetBucketCors(const std::string& bucket_name,
                       GetBucketCorsResult* result);

Request Parameters

  • bucket_name — bucket name

SetBucketCors

  Status SetBucketCors(const SetBucketCorsRequest& request);

Request Parameters

  • bucket_name — bucket name
  • rule_list — cors rule list

DeleteBucketCors

  Status DeleteBucketCors(const std::string& bucket_name);

Request Parameters

  • bucket_name — bucket name

ListObjects

  Status ListObjects(const ListObjectsRequest& request, ListObjectsResult* result);

Request Parameters

  • bucket_name — bucket name
  • delimiter — delimiter used to group objects
  • prefix — return objects must begin with prefix
  • marker — return objects must start from marker.
  • max-key — return objects must no more than max-keys.

CreateFolder

 Status CreateFolder(const std::string& bucket_name, const std::string& folder_name);

Request Parameters

  • bucket_name — bucket name
  • folder_name — folder name, no matter with or without slash(/)

ObjectExists

Status ObjectExists(const std::string& bucket_name, const std::string& key, bool* exist);

Request Parameters

  • bucket_name — bucket name
  • key — object key

PutString

  Status PutString(const std::string & bucket_name,
                   const std::string & key,
                   const std::string & str,
                   const ObjectMetadata* object_metadata = NULL);

Request Parameters

  • bucket_name — bucket name
  • key — object key
  • str — arbitrary data used to write to the object
  • object_metadata — specify your own object metadata

PutObject

  Status PutObject(const std::string & bucket_name,
                   const std::string & key,
                   const std::string & file_path,
                   const ObjectMetadata* object_metadata = NULL);

  Status PutObject(const std::string& bucket_name,
                   const std::string& key,
                   const std::string& file_path,
                   int64_t stream_bytes,
                   const ObjectMetadata* object_metadata = NULL);


  Status PutObject(const std::string& bucket_name,
                   const std::string& key,
                   std::ifstream* stream,
                   const ObjectMetadata* object_metadata = NULL);

  Status PutObject(const std::string& bucket_name,
                   const std::string& key,
                   std::ifstream* stream,
                   int64_t stream_bytes,
                   const ObjectMetadata* object_metadata = NULL);

Request Parameters

  • bucket_name — bucket name
  • key — object key
  • file_path — local file to upload
  • stream — local stream to upload
  • stream_bytes — upload bytes must no more than stream_bytes.
  • object_metadata — specify your own object metadata.

DeleteObject

  Status DeleteObject(const std::string & bucket_name,  const std::string & key);

Request Parameters

  • bucket_name — bucket name

DeleteMultipleObjects

  Status DeleteMultipleObjects(const DeleteMultipleObjectsRequest& request,
                               DeleteMultipleObjectsResult* result);

Request Parameters

  • bucket_name — bucket name
  • key — object key
  • quiet — if true, result contains all the key in your request otherwise, result only contains "failed deletion" keys.

OptionObject

 Status OptionObject(const OptionObjectRequest& request, OptionObjectResult* result);

Request Parameters

  • bucket_name — bucket name
  • key — object key
  • origin — origin used to test
  • request_method — http method used to test
  • request_headers — http header used to test.

CopyObject

  Status CopyObject(const CopyObjectRequest& request, CopyObjectResult* result);

Request Parameters

  • source_bucket — source bucket
  • source_key — source key
  • target_bucket — target bucket
  • target_key — target key
  • ...
  • ...

GetObject

  Status GetObject(const GetObjectRequest& request);

Request Parameters

  • bucket_name — bucket name
  • key — object key
  • file_path — download to this path
  • output_stream — download to this stream

GetObjectMetadata

  Status GetObjectMetadata(const std::string& bucket_name,
                           const std::string& key,
                           std::unique_ptr<ObjectMetadata>* object_meta_data);
 

Request Parameters

  • bucket_name — bucket name
  • key — object key

AppendObject

  Status AppendObject(const AppendObjectRequest& request);

  Status AppendObject(const AppendObjectRequest& request,
                      const ObjectMetadata* object_metadata);

  Status AppendObject(const AppendObjectRequest& request,
                      const ObjectMetadata* object_metadata,
                      AppendObjectResult* result);

Request Parameters

  • bucket_name — bucket name
  • key — object key
  • file_path — local file for upload
  • position — position of file for read from.

InitiateMultipartUpload

  Status InitiateMultipartUpload(const InitiateMultipartUploadRequest& request,
                                 InitiateMultipartUploadResult* result);

Request Parameters

  • bucket_name — bucket name
  • key — object key

UploadPart

  Status UploadPart(const UploadPartRequest& request, UploadPartResult* result);

Request Parameters

  • bucket_name — bucket name
  • key — object key
  • upload_id — unique id for upload
  • input_steam — stream for read
  • part_number — part unique number.
  • part_size — bytes to read
  • md5_digest — md5 checksum for chcksum.

UploadPartCopy

  Status UploadPartCopy(const UploadPartCopyRequest& request,
                        UploadPartCopyResult* result);

Request Parameters

  • source_bucket — souree bucket name
  • source_key — souree object key
  • target_bucket — target bucket name
  • target_key — target object key
  • upload_id — unique id for upload
  • part_number — part unique number.
  • part_size — bytes to read

CompleteMultipartUpload

  Status CompleteMultipartUpload(const CompleteMultipartUploadrequest& request,
                                 CompleteMultipartUploadResult* result);

Request Parameters

  • bucket_name — bucket name
  • key — object key
  • upload_id — unique id for upload
  • etag_list — etag list of previous uploads.

AbortMultipartUpload

  Status AbortMultipartUpload(const std::string& bucket_name,
                              const std::string& key,
                              const std::string& upload_id);

Request Parameters

  • bucket_name — bucket name
  • key — object key
  • upload_id — unique id for upload

ListMultipartUploads

  Status ListMultipartUploads(const ListMultipartUploadsRequest& request,
                              ListMultipartUploadsResult* result);

Request Parameters

  • bucket_name — bucket name
  • delimiter — delimiter used to group uploads
  • max-key — return uploads must no more than max-keys.
  • key_marker — keys must start from key_marker.
  • prefix — return objects must begin with prefix
  • upload_id_marker — upload id must start from upload_id_marker.

ListParts

  Status ListParts(const ListPartsRequest& request, ListPartsResult* result);

Request Parameters

  • bucket_name — bucket name
  • key — object key
  • upload_id_ — unique id for upload
  • max-parts — return parts must no more than max-parts
  • part_number_marker — part number must start from part_number_marker

Releases

No releases published

Packages

No packages published

Languages