This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pxz-hos-client-cpp-module/src/hos_client.h

90 lines
3.7 KiB
C
Raw Normal View History

2020-09-11 16:13:02 +08:00
/*************************************************************************
> File Name: hos_client_api.h
> Author: pxz
> Created Time: Thu 10 Sep 2020 03:13:59 PM CST
************************************************************************/
#ifndef __HOS_CLIENT_INIT__
#define __HOS_CLIENT_INIT__
/*hos client 句柄*/
2020-09-11 16:13:02 +08:00
typedef void* hos_client_handle;
#define HOS_CLINET_OK 0
#define HOS_CLIENT_ERR -1
/* s3 的错误码 */
enum s3errors
{
//From Core//
//////////////////////////////////////////////////////////////////////////////////////////
INCOMPLETE_SIGNATURE = 0,
INTERNAL_FAILURE = 1,
INVALID_ACTION = 2,
INVALID_CLIENT_TOKEN_ID = 3,
INVALID_PARAMETER_COMBINATION = 4,
INVALID_QUERY_PARAMETER = 5,
INVALID_PARAMETER_VALUE = 6,
MISSING_ACTION = 7, // SDK should never allow
MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow
MISSING_PARAMETER = 9, // SDK should never allow
OPT_IN_REQUIRED = 10,
REQUEST_EXPIRED = 11,
SERVICE_UNAVAILABLE = 12,
THROTTLING = 13,
VALIDATION = 14,
ACCESS_DENIED = 15,
RESOURCE_NOT_FOUND = 16, // Shared with multiple services
UNRECOGNIZED_CLIENT = 17, // Most likely caused by an invalid access key or secret key
MALFORMED_QUERY_STRING = 18,
SLOW_DOWN = 19,
REQUEST_TIME_TOO_SKEWED = 20,
INVALID_SIGNATURE = 21,
SIGNATURE_DOES_NOT_MATCH = 22,
INVALID_ACCESS_KEY_ID = 23,
REQUEST_TIMEOUT = 24,
NETWORK_CONNECTION = 99, // General failure to send message to service
// These are needed for logical reasons
UNKNOWN = 100,
CLIENT_SIGNING_FAILURE = 101, // Client failed to sign the request
USER_CANCELLED = 102, // User cancelled the request
SERVICE_EXTENSION_START_RANGE = 128
BUCKET_ALREADY_EXISTS= SERVICE_EXTENSION_START_RANGE + 1,
BUCKET_ALREADY_OWNED_BY_YOU,
NO_SUCH_BUCKET,
NO_SUCH_KEY,
NO_SUCH_UPLOAD,
OBJECT_ALREADY_IN_ACTIVE_TIER,
OBJECT_NOT_IN_ACTIVE_TIER
};
/*************************************************************************************
* hos_client_init
* const char *endpoint http://192.168.44.12:9098/hos“
* const char *accesskeyid AWS access key IDdefault
* const char *secretkey AWS secret keysecretkey
* NULL
*************************************************************************************/
2020-09-11 16:13:02 +08:00
hos_client_handle hos_client_init(const char *endpoint, const char *accesskeyid, const char *secretkey);
/*************************************************************************************
* hos_create_bucket
* hos_client_handle handle
* const char * bucket
* bool
*************************************************************************************/
2020-09-11 16:13:02 +08:00
bool hos_create_bucket(hos_client_handle handle, const char *bucket);
/*************************************************************************************
* hos_upload_async
* hos_client_handle handle
* const char * bucket
* const char * object
* bool
*************************************************************************************/
2020-09-11 16:13:02 +08:00
bool hos_upload_async(hos_client_handle handle, const char *bucket, const char *object);
/*************************************************************************************
* hos_client_close
* hos_client_handle handle
*************************************************************************************/
2020-09-11 16:13:02 +08:00
void hos_client_close(hos_client_handle handle);
#endif