huangyuxin_wd

* 提交wdOssClientSdk封装

Showing 100 changed files with 4370 additions and 0 deletions

Too many changes to show.

To preserve performance only 100 of 100+ files are displayed.

/node_modules
/oh_modules
/local.properties
/.idea
**/build
/.hvigor
.cxx
/.clangd
/.clang-format
/.clang-tidy
**/.test
/.appanalyzer
\ No newline at end of file
... ...
{
"app": {
"bundleName": "com.example.wdapplication",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}
... ...
{
"string": [
{
"name": "app_name",
"value": "WdOssClientSdk"
}
]
}
... ...
{
"app": {
"signingConfigs": [],
"products": [
{
"name": "default",
"signingConfig": "default",
"compatibleSdkVersion": "5.0.0(12)",
"runtimeOS": "HarmonyOS",
}
],
"buildModeSet": [
{
"name": "debug",
},
{
"name": "release"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "wdossclient",
"srcPath": "./wdossclient",
}
]
}
\ No newline at end of file
... ...
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
\ No newline at end of file
... ...
{
"apiType": "stageMode",
"buildOption": {
"externalNativeOptions": {
"path": "./src/main/cpp/CMakeLists.txt",
"arguments": "",
"cppFlags": "",
}
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
}
}
},
"nativeLib": {
"debugSymbol": {
"strip": true,
"exclude": []
}
}
},
],
"targets": [
{
"name": "default"
},
{
"name": "ohosTest",
}
]
}
\ No newline at end of file
... ...
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
... ...
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
... ...
{
"name": "entry",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "",
"author": "",
"license": "",
"dependencies": {
"libentry.so": "file:./src/main/cpp/types/libentry"
}
}
\ No newline at end of file
... ...
# the minimum version of CMake.
cmake_minimum_required(VERSION 3.4.1)
project(WdOssClientSdk)
set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
if(DEFINED PACKAGE_FIND_FILE)
include(${PACKAGE_FIND_FILE})
endif()
include_directories(${NATIVERENDER_ROOT_PATH}
${NATIVERENDER_ROOT_PATH}/include)
add_library(entry SHARED napi_init.cpp)
target_link_libraries(entry PUBLIC libace_napi.z.so)
\ No newline at end of file
... ...
#include "napi/native_api.h"
static napi_value Add(napi_env env, napi_callback_info info)
{
size_t argc = 2;
napi_value args[2] = {nullptr};
napi_get_cb_info(env, info, &argc, args , nullptr, nullptr);
napi_valuetype valuetype0;
napi_typeof(env, args[0], &valuetype0);
napi_valuetype valuetype1;
napi_typeof(env, args[1], &valuetype1);
double value0;
napi_get_value_double(env, args[0], &value0);
double value1;
napi_get_value_double(env, args[1], &value1);
napi_value sum;
napi_create_double(env, value0 + value1, &sum);
return sum;
}
EXTERN_C_START
static napi_value Init(napi_env env, napi_value exports)
{
napi_property_descriptor desc[] = {
{ "add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr }
};
napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
return exports;
}
EXTERN_C_END
static napi_module demoModule = {
.nm_version = 1,
.nm_flags = 0,
.nm_filename = nullptr,
.nm_register_func = Init,
.nm_modname = "entry",
.nm_priv = ((void*)0),
.reserved = { 0 },
};
extern "C" __attribute__((constructor)) void RegisterEntryModule(void)
{
napi_module_register(&demoModule);
}
... ...
export const add: (a: number, b: number) => number;
\ No newline at end of file
... ...
{
"name": "libentry.so",
"types": "./Index.d.ts",
"version": "1.0.0",
"description": "Please describe the basic information."
}
\ No newline at end of file
... ...
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { window } from '@kit.ArkUI';
export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
}
onDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
});
}
onWindowStageDestroy(): void {
// Main window is destroyed, release UI related resources
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
onForeground(): void {
// Ability has brought to foreground
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
}
onBackground(): void {
// Ability has back to background
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
}
};
... ...
import { hilog } from '@kit.PerformanceAnalysisKit';
import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
export default class EntryBackupAbility extends BackupExtensionAbility {
async onBackup() {
hilog.info(0x0000, 'testTag', 'onBackup ok');
}
async onRestore(bundleVersion: BundleVersion) {
hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
}
}
\ No newline at end of file
... ...
import { hilog } from '@kit.PerformanceAnalysisKit';
import testNapi from 'libentry.so';
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.onClick(() => {
hilog.info(0x0000, 'testTag', 'Test NAPI 2 + 3 = %{public}d', testNapi.add(2, 3));
})
}
.width('100%')
}
.height('100%')
}
}
... ...
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"phone",
"tablet",
"2in1"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ets",
"description": "$string:EntryAbility_desc",
"icon": "$media:layered_image",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:startIcon",
"startWindowBackground": "$color:start_window_background",
"exported": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
],
"extensionAbilities": [
{
"name": "EntryBackupAbility",
"srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
"type": "backup",
"exported": false,
"metadata": [
{
"name": "ohos.extension.backup",
"resource": "$profile:backup_config"
}
],
}
]
}
}
\ No newline at end of file
... ...
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
... ...
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
... ...
{
"layered-image":
{
"background" : "$media:background",
"foreground" : "$media:foreground"
}
}
\ No newline at end of file
... ...
{
"allowToBackupRestore": true
}
\ No newline at end of file
... ...
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
... ...
{
"string": [
{
"name": "module_desc",
"value": "模块描述"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
... ...
const NativeMock: Record<string, Object> = {
'add': (a: number, b: number) => {
return a + b;
},
};
export default NativeMock;
\ No newline at end of file
... ...
{
"libentry.so": {
"source": "src/mock/Libentry.mock.ets"
}
}
\ No newline at end of file
... ...
import { hilog } from '@kit.PerformanceAnalysisKit';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function abilityTest() {
describe('ActsAbilityTest', () => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
})
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
hilog.info(0x0000, 'testTag', '%{public}s', 'it begin');
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
})
})
}
\ No newline at end of file
... ...
import abilityTest from './Ability.test';
export default function testsuite() {
abilityTest();
}
\ No newline at end of file
... ...
{
"module": {
"name": "entry_test",
"type": "feature",
"deviceTypes": [
"phone",
"tablet",
"2in1"
],
"deliveryWithInstall": true,
"installationFree": false
}
}
... ...
import localUnitTest from './LocalUnit.test';
export default function testsuite() {
localUnitTest();
}
\ No newline at end of file
... ...
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function localUnitTest() {
describe('localUnitTest', () => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
});
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
});
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
});
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
});
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
});
});
}
\ No newline at end of file
... ...
{
"modelVersion": "5.0.0",
"dependencies": {
},
"execution": {
// "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
// "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
// "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
// "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
// "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
},
"logging": {
// "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
},
"debugging": {
// "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
},
"nodeOptions": {
// "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
// "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
}
}
... ...
import { appTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
... ...
{
"modelVersion": "5.0.0",
"description": "Please describe the basic information.",
"dependencies": {
},
"devDependencies": {
"@ohos/hypium": "1.0.18",
"@ohos/hamock": "1.0.0"
}
}
... ...
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
\ No newline at end of file
... ...
/**
* Use these variables when you tailor your ArkTS code. They must be of the const type.
*/
export const HAR_VERSION = '1.0.0';
export const BUILD_MODE_NAME = 'debug';
export const DEBUG = true;
export const TARGET_NAME = 'default';
/**
* BuildProfile Class is used only for compatibility purposes.
*/
export default class BuildProfile {
static readonly HAR_VERSION = HAR_VERSION;
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
static readonly DEBUG = DEBUG;
static readonly TARGET_NAME = TARGET_NAME;
}
\ No newline at end of file
... ...
export { WDOssClient } from './src/main/ets/WDOssClient'
... ...
{
"apiType": "stageMode",
"buildOption": {
"externalNativeOptions": {
"path": "./src/main/cpp/CMakeLists.txt",
"arguments": "",
"cppFlags": ""
},
},
"buildOptionSet": [
{
"name": "release",
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": [
"./obfuscation-rules.txt"
]
},
"consumerFiles": [
"./consumer-rules.txt"
]
}
},
"nativeLib": {
"debugSymbol": {
"strip": true,
"exclude": []
}
}
},
],
"targets": [
{
"name": "default"
},
{
"name": "ohosTest"
}
]
}
... ...
import { harTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
... ...
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file
# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
... ...
{
"name": "wdossclient",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "Index.ets",
"author": "",
"license": "Apache-2.0",
"dependencies": {
"libwdossclient.so": "file:./src/main/cpp/types/libwdossclient"
}
}
\ No newline at end of file
... ...
# the minimum version of CMake.
cmake_minimum_required(VERSION 3.4.1)
project(myNpmLib)
set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
#set(MODULE_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../libs")
if(DEFINED PACKAGE_FIND_FILE)
include(${PACKAGE_FIND_FILE})
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/alibabacloud/${OHOS_ARCH}/include)
#include_directories(${CMAKE_CURRENT_SOURCE_DIR}/thirdparty)
#aux_source_directory("${CMAKE_CURRENT_SOURCE_DIR}/thirdparty" thirdparty_h)
add_library(wdossclient SHARED napi_wdossclient.cpp)
#add_library(alibabacloud-oss SHARED IMPORTED)
#set_target_properties(alibabacloud-oss
# PROPERTIES
# IMPORTED_LOCATION ${MODULE_LIB_DIR}/${OHOS_ARCH}/libalibabacloud-oss-cpp-sdk.so)
target_include_directories(wdossclient PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} )
target_link_libraries(wdossclient PUBLIC libace_napi.z.so libhilog_ndk.z.so)
target_link_libraries(wdossclient PUBLIC
${CMAKE_SOURCE_DIR}/thirdparty/alibabacloud/${OHOS_ARCH}/lib/libalibabacloud-oss-cpp-sdk.so
${CMAKE_SOURCE_DIR}/thirdparty/curl/${OHOS_ARCH}/lib/libcurl.so
# ${CMAKE_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/lib/libcrypto.so.1.1
# ${CMAKE_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/lib/libssl.so.1.1
)
target_include_directories(wdossclient PRIVATE ${CMAKE_SOURCE_DIR}/thirdparty/alibabacloud/${OHOS_ARCH}/include)
target_include_directories(wdossclient PRIVATE ${CMAKE_SOURCE_DIR}/thirdparty/curl/${OHOS_ARCH}/include)
target_include_directories(wdossclient PRIVATE ${CMAKE_SOURCE_DIR}/thirdparty/openssl/${OHOS_ARCH}/include)
\ No newline at end of file
... ...
#include "napi/native_api.h"
static napi_value Add(napi_env env, napi_callback_info info)
{
size_t argc = 2;
napi_value args[2] = {nullptr};
napi_get_cb_info(env, info, &argc, args , nullptr, nullptr);
napi_valuetype valuetype0;
napi_typeof(env, args[0], &valuetype0);
napi_valuetype valuetype1;
napi_typeof(env, args[1], &valuetype1);
double value0;
napi_get_value_double(env, args[0], &value0);
double value1;
napi_get_value_double(env, args[1], &value1);
napi_value sum;
napi_create_double(env, value0 + value1, &sum);
return sum;
}
static napi_value NativeCallArkTS(napi_env env, napi_callback_info info)
{
// 期望从ArkTS侧获取的参数的数量,napi_value可理解为ArkTS value在native方法中的表现形式。
size_t argc = 1;
napi_value args[1] = {nullptr};
// 从info中,拿到从ArkTS侧传递过来的参数,此处获取了一个ArkTS参数,即arg[0]。
napi_get_cb_info(env, info, &argc, args , nullptr, nullptr);
// 创建一个ArkTS number作为ArkTS function的入参。
napi_value argv = nullptr;
napi_create_int32(env, 10, &argv);
napi_value result = nullptr;
// native方法中调用ArkTS function,其返回值保存到result中并返到ArkTS侧。
napi_call_function(env, nullptr, args[0], 1, &argv, &result);
return result;
}
// EXTERN_C_START
// static napi_value Init(napi_env env, napi_value exports)
// {
// napi_property_descriptor desc[] = {
// { "add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr },
// { "nativeCallArkTS", nullptr, NativeCallArkTS, nullptr, nullptr, nullptr, napi_default, nullptr }
// };
// napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
// return exports;
// }
// EXTERN_C_END
//
// static napi_module demoModule = {
// .nm_version = 1,
// .nm_flags = 0,
// .nm_filename = nullptr,
// .nm_register_func = Init,
// .nm_modname = "wdossclient",
// .nm_priv = ((void*)0),
// .reserved = { 0 },
// };
//
// extern "C" __attribute__((constructor)) void RegisterWdossclientModule(void)
// {
// napi_module_register(&demoModule);
// }
... ...
#pragma once
#include "napi/native_api.h"
#include <string>
napi_value createStringUtf8(napi_env env, const char *string) {
size_t strLength = strlen(string);
napi_value result;
napi_create_string_utf8(env, string, strLength, &result);
return result;
}
char *utf8StringFromValue(napi_env env, napi_value value) {
size_t len = 0;
napi_get_value_string_utf8(env, value, nullptr, 0, &len); // 获取字符串长度到len
char *buf = new char[len + 1]; // 分配合适大小的char数组
napi_get_value_string_utf8(env, value, buf, len + 1, &len); //
return buf;
}
... ...
//
// Created on 2024/4/24.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".
#include "napi/native_api.h"
#include "hilog/log.h"
#include "napi/native_api.h"
#include <iostream>
#include <sstream>
#include "napi_util.h"
// #include <alibabacloud/oss/Export.h>
#include "alibabacloud/oss/OssClient.h"
#include <alibabacloud/oss/client/ClientConfiguration.h>
#include <alibabacloud/oss/auth/CredentialsProvider.h>
using namespace AlibabaCloud::OSS;
static napi_value WDOssClient_InitSdk(napi_env env, napi_callback_info info) {
AlibabaCloud::OSS::InitializeSdk();
return nullptr;
}
static napi_value WDOssClient_UnInitSdk(napi_env env, napi_callback_info info) {
AlibabaCloud::OSS::ShutdownSdk();
return nullptr;
}
static napi_value WDOssClient_IsSdkInitialized(napi_env env, napi_callback_info info) {
napi_value result;
bool isSdkInit = false;
isSdkInit = AlibabaCloud::OSS::IsSdkInitialized();
napi_get_boolean(env, isSdkInit, &result);
return result;
}
static napi_value WDOssClient_UploadFile(napi_env env, napi_callback_info info) {
napi_value result;
bool isSuccess = false;
napi_value IsInitResult;
bool bIsInit = false;
IsInitResult = WDOssClient_IsSdkInitialized(env,info);
napi_get_value_bool(env,IsInitResult,&bIsInit);
if(!bIsInit)
{
AlibabaCloud::OSS::InitializeSdk();
}
size_t argc = 7;
napi_value args[6] = {nullptr};
napi_get_cb_info(env, info, &argc, args , nullptr, nullptr);
napi_valuetype valuetype0;
napi_typeof(env, args[0], &valuetype0);
napi_valuetype valuetype1;
napi_typeof(env, args[1], &valuetype1);
napi_valuetype valuetype2;
napi_typeof(env, args[2], &valuetype2);
napi_valuetype valuetype3;
napi_typeof(env, args[3], &valuetype3);
napi_valuetype valuetype4;
napi_typeof(env, args[4], &valuetype4);
napi_valuetype valuetype5;
napi_typeof(env, args[5], &valuetype5);
napi_valuetype valuetype6;
napi_typeof(env, args[6], &valuetype6);
std::string _Endpoint;
_Endpoint = utf8StringFromValue(env, args[0]);
std::string _accessKeySecret;
_accessKeySecret = utf8StringFromValue(env, args[1]);
std::string _accessKeyId;
_accessKeyId = utf8StringFromValue(env, args[2]);
std::string _sessionToken;
_sessionToken = utf8StringFromValue(env, args[3]);
std::string _BucketName;
_BucketName = utf8StringFromValue(env, args[4]);
std::string _ObjectName;
_ObjectName = utf8StringFromValue(env, args[5]);
std::string _localFileName;
_localFileName = utf8StringFromValue(env, args[6]);
if(_Endpoint.empty() || _accessKeySecret.empty() || _sessionToken.empty() || _accessKeyId.empty() ||
_BucketName.empty() || _ObjectName.empty() || _localFileName.empty())
{
isSuccess = false;
napi_get_boolean(env, isSuccess, &result);
AlibabaCloud::OSS::ShutdownSdk();
return result;
}
/* yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1(杭州)为例,Endpoint填写为https://oss-cn-hangzhou.aliyuncs.com。*/
std::string Endpoint = "yourEndpoint";
/* 填写Bucket名称,例如examplebucket。*/
std::string BucketName = "examplebucket";
/* 填写文件完整路径,例如exampledir/exampleobject.txt。文件完整路径中不能包含Bucket名称。*/
std::string ObjectName = "exampledir/exampleobject.txt";
//本地文件名称
std::string localFileName = "D:\\localpath\\examplefile.txt";
ClientConfiguration conf;
std::string accessKeyId = "1111111111";
std::string accessKeySecret = "222222222";
std::string sessionToken = "333333333";
if(!_Endpoint.empty()){
Endpoint = _Endpoint;
}
if(!_accessKeySecret.empty()){
accessKeySecret = _accessKeySecret;
}
if(!_accessKeyId.empty()){
accessKeyId = _accessKeyId;
}
if(!_sessionToken.empty()){
sessionToken = _sessionToken;
}
if(!_BucketName.empty()){
BucketName = _BucketName;
}
if(!_ObjectName.empty()){
ObjectName = _ObjectName;
}
if(!_localFileName.empty()){
localFileName = _localFileName;
}
// auto credentialsProvider = std::make_shared<Credentials>(accessKeyId,accessKeySecret,sessionToken);
// auto client = std::make_shared<OssClient>(Endpoint, credentialsProvider, &conf);
auto client = std::make_shared<OssClient>(Endpoint, accessKeyId,accessKeySecret,sessionToken,conf);
/* 上传文件。*/
/* 填写本地文件完整路径,例如D:\\localpath\\examplefile.txt,其中localpath为本地文件examplefile.txt所在本地路径。*/
auto outcome = client->PutObject(BucketName, ObjectName,localFileName);
if (!outcome.isSuccess()) {
/* 异常处理。*/
std::cout << "PutObject fail" <<
",code:" << outcome.error().Code() <<
",message:" << outcome.error().Message() <<
",requestId:" << outcome.error().RequestId() << std::endl;
isSuccess = false;
}
napi_get_boolean(env, isSuccess, &result);
AlibabaCloud::OSS::ShutdownSdk();
return result;
}
EXTERN_C_START
static napi_value Init(napi_env env, napi_value exports)
{
napi_property_descriptor desc[] = {
{ "WDOssClient_InitSdk", nullptr, WDOssClient_InitSdk, nullptr, nullptr, nullptr, napi_default, nullptr },
{ "WDOssClient_UnInitSdk", nullptr, WDOssClient_UnInitSdk, nullptr, nullptr, nullptr, napi_default, nullptr },
{ "WDOssClient_IsSdkInitialized", nullptr, WDOssClient_IsSdkInitialized, nullptr, nullptr, nullptr, napi_default, nullptr },
{ "WDOssClient_UploadFile", nullptr, WDOssClient_UploadFile, nullptr, nullptr, nullptr, napi_default, nullptr }
};
napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
return exports;
}
EXTERN_C_END
static napi_module demoModule = {
.nm_version = 1,
.nm_flags = 0,
.nm_filename = nullptr,
.nm_register_func = Init,
.nm_modname = "wdossclient",
.nm_priv = ((void*)0),
.reserved = { 0 },
};
extern "C" __attribute__((constructor)) void RegisterWdossclientModule(void)
{
napi_module_register(&demoModule);
}
\ No newline at end of file
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
// version = (major << 16) + (minor << 8) + patch
#define ALIBABACLOUD_OSS_VERSION ((1 << 16) + (9 << 8) + 0)
#define ALIBABACLOUD_OSS_VERSION_STR "1.9.0"
// auto generated by cmake option
/* #undef OSS_DISABLE_BUCKET */
/* #undef OSS_DISABLE_LIVECHANNEL */
/* #undef OSS_DISABLE_RESUAMABLE */
/* #undef OSS_DISABLE_ENCRYPTION */
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <cstdint>
namespace AlibabaCloud
{
namespace OSS
{
const int64_t MaxFileSize = 5LL * 1024LL * 1024LL * 1024LL;
const int32_t MaxPrefixStringSize = 1024;
const int32_t MaxMarkerStringSize = 1024;
const int32_t MaxDelimiterStringSize = 1024;
const int32_t MaxReturnedKeys = 1000;
const int32_t MaxUploads = 1000;
const int32_t DeleteObjectsUpperLimit = 1000;
const int32_t BucketCorsRuleLimit = 10;
const int32_t LifecycleRuleLimit = 1000;
const int32_t ObjectNameLengthLimit = 1023;
const int32_t PartNumberUpperLimit = 10000;
const int32_t DefaultPartSize = 8 * 1024 * 1024;
const int32_t PartSizeLowerLimit = 100 * 1024;
const int32_t MaxPathLength = 124;
const int32_t MinPathLength = 4;
const int32_t DefaultResumableThreadNum = 3;
const uint32_t MaxLiveChannelNameLength = 1023;
const uint32_t MaxLiveChannelDescriptionLength = 128;
const uint32_t MinLiveChannelFragCount = 1;
const uint32_t MaxLiveChannelFragCount = 100;
const uint32_t MinLiveChannelFragDuration = 1;
const uint32_t MaxLiveChannelFragDuration = 100;
const uint32_t MinLiveChannelPlayListLength = 6;
const uint32_t MaxLiveChannelPlayListLength = 128;
const uint32_t MinLiveChannelInterval = 1;
const uint32_t MaxLiveChannelInterval = 100;
const uint64_t SecondsOfDay = 24*60*60;
const uint32_t MaxListLiveChannelKeys = 1000;
const uint32_t TagKeyLengthLimit = 128;
const uint32_t TagValueLengthLimit = 256;
const uint32_t MaxTagSize = 10;
#ifdef _WIN32
const char PATH_DELIMITER = '\\';
const wchar_t WPATH_DELIMITER = L'\\';
#else
const char PATH_DELIMITER = '/';
const wchar_t WPATH_DELIMITER = L'/';
#endif
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "Global.h"
#if defined(ALIBABACLOUD_SHARED)
# if defined(ALIBABACLOUD_OSS_LIBRARY)
# define ALIBABACLOUD_OSS_EXPORT ALIBABACLOUD_DECL_EXPORT
# else
# define ALIBABACLOUD_OSS_EXPORT ALIBABACLOUD_DECL_IMPORT
# endif
#else
# define ALIBABACLOUD_OSS_EXPORT
#endif
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "Config.h"
#if defined(_WIN32)
# ifdef _MSC_VER
# pragma warning(disable : 4251)
# endif // _MSC_VER
# define ALIBABACLOUD_DECL_EXPORT __declspec(dllexport)
# define ALIBABACLOUD_DECL_IMPORT __declspec(dllimport)
#elif __GNUC__ >= 4
# define ALIBABACLOUD_DECL_EXPORT __attribute__((visibility("default")))
# define ALIBABACLOUD_DECL_IMPORT __attribute__((visibility("default")))
#endif
#if !defined(ALIBABACLOUD_DECL_EXPORT)
# define ALIBABACLOUD_DECL_EXPORT
#endif
#if !defined(ALIBABACLOUD_DECL_IMPORT)
# define ALIBABACLOUD_DECL_IMPORT
#endif
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/client/ClientConfiguration.h>
#include <alibabacloud/oss/auth/CredentialsProvider.h>
#include <alibabacloud/oss/OssFwd.h>
#include <alibabacloud/oss/client/AsyncCallerContext.h>
#include <future>
#include <ctime>
namespace AlibabaCloud
{
namespace OSS
{
/*Global Init/Deinit*/
void ALIBABACLOUD_OSS_EXPORT InitializeSdk();
bool ALIBABACLOUD_OSS_EXPORT IsSdkInitialized();
void ALIBABACLOUD_OSS_EXPORT ShutdownSdk();
/*Log*/
void ALIBABACLOUD_OSS_EXPORT SetLogLevel(LogLevel level);
void ALIBABACLOUD_OSS_EXPORT SetLogCallback(LogCallback callback);
/*Utils*/
std::string ALIBABACLOUD_OSS_EXPORT ComputeContentMD5(const char *data, size_t size);
std::string ALIBABACLOUD_OSS_EXPORT ComputeContentMD5(std::istream& stream);
std::string ALIBABACLOUD_OSS_EXPORT ComputeContentETag(const char* data, size_t size);
std::string ALIBABACLOUD_OSS_EXPORT ComputeContentETag(std::istream& stream);
std::string ALIBABACLOUD_OSS_EXPORT UrlEncode(const std::string& src);
std::string ALIBABACLOUD_OSS_EXPORT UrlDecode(const std::string& src);
std::string ALIBABACLOUD_OSS_EXPORT Base64Encode(const std::string& src);
std::string ALIBABACLOUD_OSS_EXPORT Base64Encode(const char* src, int len);
std::string ALIBABACLOUD_OSS_EXPORT Base64EncodeUrlSafe(const std::string& src);
std::string ALIBABACLOUD_OSS_EXPORT Base64EncodeUrlSafe(const char* src, int len);
std::string ALIBABACLOUD_OSS_EXPORT ToGmtTime(std::time_t& t);
std::string ALIBABACLOUD_OSS_EXPORT ToUtcTime(std::time_t& t);
std::time_t ALIBABACLOUD_OSS_EXPORT UtcToUnixTime(const std::string& t);
uint64_t ALIBABACLOUD_OSS_EXPORT ComputeCRC64(uint64_t crc, void* buf, size_t len);
uint64_t ALIBABACLOUD_OSS_EXPORT CombineCRC64(uint64_t crc1, uint64_t crc2, uintmax_t len2);
/*Aysnc APIs*/
class OssClient;
using ListObjectAsyncHandler = std::function<void(const AlibabaCloud::OSS::OssClient*, const ListObjectsRequest&, const ListObjectOutcome&, const std::shared_ptr<const AsyncCallerContext>&)>;
using GetObjectAsyncHandler = std::function<void(const AlibabaCloud::OSS::OssClient*, const GetObjectRequest&, const GetObjectOutcome&, const std::shared_ptr<const AsyncCallerContext>&)>;
using PutObjectAsyncHandler = std::function<void(const AlibabaCloud::OSS::OssClient*, const PutObjectRequest&, const PutObjectOutcome&, const std::shared_ptr<const AsyncCallerContext>&)>;
using UploadPartAsyncHandler = std::function<void(const AlibabaCloud::OSS::OssClient*, const UploadPartRequest&, const PutObjectOutcome&, const std::shared_ptr<const AsyncCallerContext>&)>;
using UploadPartCopyAsyncHandler = std::function<void(const AlibabaCloud::OSS::OssClient*, const UploadPartCopyRequest&, const UploadPartCopyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)>;
/*Callable*/
using ListObjectOutcomeCallable = std::future<ListObjectOutcome>;
using GetObjectOutcomeCallable = std::future<GetObjectOutcome>;
using PutObjectOutcomeCallable = std::future<PutObjectOutcome>;
using UploadPartCopyOutcomeCallable = std::future<UploadPartCopyOutcome>;
class OssClientImpl;
class ALIBABACLOUD_OSS_EXPORT OssClient
{
public:
OssClient(const std::string& endpoint, const std::string& accessKeyId, const std::string& accessKeySecret,
const ClientConfiguration& configuration);
OssClient(const std::string& endpoint, const std::string& accessKeyId, const std::string& accessKeySecret, const std::string& securityToken,
const ClientConfiguration& configuration);
OssClient(const std::string& endpoint, const Credentials& credentials, const ClientConfiguration& configuration);
OssClient(const std::string& endpoint, const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration& configuration);
virtual ~OssClient();
#if !defined(OSS_DISABLE_BUCKET)
/*Service*/
ListBucketsOutcome ListBuckets() const;
ListBucketsOutcome ListBuckets(const ListBucketsRequest& request) const;
/*Bucket*/
CreateBucketOutcome CreateBucket(const std::string& bucket, StorageClass storageClass = StorageClass::Standard) const;
CreateBucketOutcome CreateBucket(const std::string& bucket, StorageClass storageClass, CannedAccessControlList acl) const;
CreateBucketOutcome CreateBucket(const CreateBucketRequest& request) const;
ListBucketInventoryConfigurationsOutcome ListBucketInventoryConfigurations(const ListBucketInventoryConfigurationsRequest& request) const;
VoidOutcome SetBucketAcl(const std::string& bucket, CannedAccessControlList acl) const;
VoidOutcome SetBucketAcl(const SetBucketAclRequest& request) const;
VoidOutcome SetBucketLogging(const std::string& bucket, const std::string& targetBucket, const std::string& targetPrefix) const;
VoidOutcome SetBucketLogging(const SetBucketLoggingRequest& request) const;
VoidOutcome SetBucketWebsite(const std::string& bucket, const std::string& indexDocument) const;
VoidOutcome SetBucketWebsite(const std::string& bucket, const std::string& indexDocument, const std::string& errorDocument) const;
VoidOutcome SetBucketWebsite(const SetBucketWebsiteRequest& request) const;
VoidOutcome SetBucketReferer(const std::string& bucket, const RefererList& refererList, bool allowEmptyReferer) const;
VoidOutcome SetBucketReferer(const SetBucketRefererRequest& request) const;
VoidOutcome SetBucketLifecycle(const SetBucketLifecycleRequest& request) const;
VoidOutcome SetBucketCors(const std::string& bucket, const CORSRuleList& rules) const;
VoidOutcome SetBucketCors(const SetBucketCorsRequest& request) const;
VoidOutcome SetBucketStorageCapacity(const std::string& bucket, int64_t storageCapacity) const;
VoidOutcome SetBucketStorageCapacity(const SetBucketStorageCapacityRequest& request) const;
VoidOutcome SetBucketPolicy(const SetBucketPolicyRequest& request) const;
VoidOutcome SetBucketRequestPayment(const SetBucketRequestPaymentRequest& request) const;
VoidOutcome SetBucketEncryption(const SetBucketEncryptionRequest& request) const;
VoidOutcome SetBucketTagging(const SetBucketTaggingRequest& request) const;
VoidOutcome SetBucketQosInfo(const SetBucketQosInfoRequest& request) const;
VoidOutcome SetBucketVersioning(const SetBucketVersioningRequest& request) const;
VoidOutcome SetBucketInventoryConfiguration(const SetBucketInventoryConfigurationRequest& request) const;
VoidOutcome DeleteBucket(const std::string& bucket) const;
VoidOutcome DeleteBucket(const DeleteBucketRequest& request) const;
VoidOutcome DeleteBucketLogging(const std::string& bucket) const;
VoidOutcome DeleteBucketLogging(const DeleteBucketLoggingRequest& request) const;
VoidOutcome DeleteBucketPolicy(const DeleteBucketPolicyRequest& request) const;
VoidOutcome DeleteBucketWebsite(const std::string& bucket) const;
VoidOutcome DeleteBucketWebsite(const DeleteBucketWebsiteRequest& request) const;
VoidOutcome DeleteBucketLifecycle(const std::string& bucket) const;
VoidOutcome DeleteBucketLifecycle(const DeleteBucketLifecycleRequest& request) const;
VoidOutcome DeleteBucketCors(const std::string& bucket) const;
VoidOutcome DeleteBucketCors(const DeleteBucketCorsRequest& request) const;
VoidOutcome DeleteBucketEncryption(const DeleteBucketEncryptionRequest& request) const;
VoidOutcome DeleteBucketTagging(const DeleteBucketTaggingRequest& request) const;
VoidOutcome DeleteBucketQosInfo(const DeleteBucketQosInfoRequest& request) const;
VoidOutcome DeleteBucketInventoryConfiguration(const DeleteBucketInventoryConfigurationRequest& request) const;
GetBucketAclOutcome GetBucketAcl(const std::string& bucket) const;
GetBucketAclOutcome GetBucketAcl(const GetBucketAclRequest& request) const;
GetBucketLocationOutcome GetBucketLocation(const std::string& bucket) const;
GetBucketLocationOutcome GetBucketLocation(const GetBucketLocationRequest& request) const;
GetBucketInfoOutcome GetBucketInfo(const std::string& bucket) const;
GetBucketInfoOutcome GetBucketInfo(const GetBucketInfoRequest& request) const;
GetBucketLoggingOutcome GetBucketLogging(const std::string& bucket) const;
GetBucketLoggingOutcome GetBucketLogging(const GetBucketLoggingRequest& request) const;
GetBucketWebsiteOutcome GetBucketWebsite(const std::string& bucket) const;
GetBucketWebsiteOutcome GetBucketWebsite(const GetBucketWebsiteRequest& request) const;
GetBucketRefererOutcome GetBucketReferer(const std::string& bucket) const;
GetBucketRefererOutcome GetBucketReferer(const GetBucketRefererRequest& request) const;
GetBucketLifecycleOutcome GetBucketLifecycle(const std::string& bucket) const;
GetBucketLifecycleOutcome GetBucketLifecycle(const GetBucketLifecycleRequest& request) const;
GetBucketStatOutcome GetBucketStat(const std::string& bucket) const;
GetBucketStatOutcome GetBucketStat(const GetBucketStatRequest& request) const;
GetBucketCorsOutcome GetBucketCors(const std::string& bucket) const;
GetBucketCorsOutcome GetBucketCors(const GetBucketCorsRequest& request) const;
GetBucketStorageCapacityOutcome GetBucketStorageCapacity(const std::string& bucket) const;
GetBucketStorageCapacityOutcome GetBucketStorageCapacity(const GetBucketStorageCapacityRequest& request) const;
GetBucketPolicyOutcome GetBucketPolicy(const GetBucketPolicyRequest& request) const;
GetBucketPaymentOutcome GetBucketRequestPayment(const GetBucketRequestPaymentRequest& request) const;
GetBucketEncryptionOutcome GetBucketEncryption(const GetBucketEncryptionRequest& request) const;
GetBucketTaggingOutcome GetBucketTagging(const GetBucketTaggingRequest& request) const;
GetBucketQosInfoOutcome GetBucketQosInfo(const GetBucketQosInfoRequest& request) const;
GetUserQosInfoOutcome GetUserQosInfo(const GetUserQosInfoRequest& request) const;
GetBucketVersioningOutcome GetBucketVersioning(const GetBucketVersioningRequest& request) const;
GetBucketInventoryConfigurationOutcome GetBucketInventoryConfiguration(const GetBucketInventoryConfigurationRequest& request) const;
InitiateBucketWormOutcome InitiateBucketWorm(const InitiateBucketWormRequest& request) const;
VoidOutcome AbortBucketWorm(const AbortBucketWormRequest& request) const;
VoidOutcome CompleteBucketWorm(const CompleteBucketWormRequest& request) const;
VoidOutcome ExtendBucketWormWorm(const ExtendBucketWormRequest& request) const;
GetBucketWormOutcome GetBucketWorm(const GetBucketWormRequest& request) const;
#endif
/*Object*/
ListObjectOutcome ListObjects(const std::string& bucket) const;
ListObjectOutcome ListObjects(const std::string& bucket, const std::string& prefix) const;
ListObjectOutcome ListObjects(const ListObjectsRequest& request) const;
ListObjectsV2Outcome ListObjectsV2(const ListObjectsV2Request& request) const;
ListObjectVersionsOutcome ListObjectVersions(const std::string& bucket) const;
ListObjectVersionsOutcome ListObjectVersions(const std::string& bucket, const std::string& prefix) const;
ListObjectVersionsOutcome ListObjectVersions(const ListObjectVersionsRequest& request) const;
GetObjectOutcome GetObject(const std::string& bucket, const std::string& key) const;
GetObjectOutcome GetObject(const std::string& bucket, const std::string& key, const std::shared_ptr<std::iostream>& content) const;
GetObjectOutcome GetObject(const std::string& bucket, const std::string& key, const std::string& fileToSave) const;
GetObjectOutcome GetObject(const GetObjectRequest& request) const;
PutObjectOutcome PutObject(const std::string& bucket, const std::string& key, const std::shared_ptr<std::iostream>& content) const;
PutObjectOutcome PutObject(const std::string& bucket, const std::string& key, const std::string& fileToUpload) const;
PutObjectOutcome PutObject(const std::string& bucket, const std::string& key, const std::shared_ptr<std::iostream>& content, const ObjectMetaData& meta) const;
PutObjectOutcome PutObject(const std::string& bucket, const std::string& key, const std::string& fileToUpload, const ObjectMetaData& meta) const;
PutObjectOutcome PutObject(const PutObjectRequest& request) const;
DeleteObjectOutcome DeleteObject(const std::string& bucket, const std::string& key) const;
DeleteObjectOutcome DeleteObject(const DeleteObjectRequest& request) const;
DeleteObjecstOutcome DeleteObjects(const std::string bucket, const DeletedKeyList &keyList) const;
DeleteObjecstOutcome DeleteObjects(const DeleteObjectsRequest& request) const;
DeleteObjecVersionstOutcome DeleteObjectVersions(const std::string bucket, const ObjectIdentifierList &objectList) const;
DeleteObjecVersionstOutcome DeleteObjectVersions(const DeleteObjectVersionsRequest& request) const;
ObjectMetaDataOutcome HeadObject(const std::string& bucket, const std::string& key) const;
ObjectMetaDataOutcome HeadObject(const HeadObjectRequest& request) const;
ObjectMetaDataOutcome GetObjectMeta(const std::string& bucket, const std::string& key) const;
ObjectMetaDataOutcome GetObjectMeta(const GetObjectMetaRequest& request) const;
AppendObjectOutcome AppendObject(const AppendObjectRequest& request) const;
CopyObjectOutcome CopyObject(const CopyObjectRequest& request) const;
RestoreObjectOutcome RestoreObject(const std::string& bucket, const std::string& key) const;
RestoreObjectOutcome RestoreObject(const RestoreObjectRequest& request) const;
SetObjectAclOutcome SetObjectAcl(const SetObjectAclRequest& request) const;
GetObjectAclOutcome GetObjectAcl(const GetObjectAclRequest& request) const;
CreateSymlinkOutcome CreateSymlink(const CreateSymlinkRequest& request) const;
GetSymlinkOutcome GetSymlink(const GetSymlinkRequest& request) const;
GetObjectOutcome ProcessObject(const ProcessObjectRequest& request) const;
GetObjectOutcome SelectObject(const SelectObjectRequest& request) const;
CreateSelectObjectMetaOutcome CreateSelectObjectMeta(const CreateSelectObjectMetaRequest& request) const;
SetObjectTaggingOutcome SetObjectTagging(const SetObjectTaggingRequest& request) const;
DeleteObjectTaggingOutcome DeleteObjectTagging(const DeleteObjectTaggingRequest& request) const;
GetObjectTaggingOutcome GetObjectTagging(const GetObjectTaggingRequest& request) const;
/*MultipartUpload*/
InitiateMultipartUploadOutcome InitiateMultipartUpload(const InitiateMultipartUploadRequest& request) const;
PutObjectOutcome UploadPart(const UploadPartRequest& request) const;
UploadPartCopyOutcome UploadPartCopy(const UploadPartCopyRequest& request) const;
CompleteMultipartUploadOutcome CompleteMultipartUpload(const CompleteMultipartUploadRequest& request) const;
VoidOutcome AbortMultipartUpload(const AbortMultipartUploadRequest& request) const;
ListMultipartUploadsOutcome ListMultipartUploads(const ListMultipartUploadsRequest& request) const;
ListPartsOutcome ListParts(const ListPartsRequest& request) const;
/*Generate URL*/
StringOutcome GeneratePresignedUrl(const GeneratePresignedUrlRequest& request) const;
StringOutcome GeneratePresignedUrl(const std::string& bucket, const std::string& key) const;
StringOutcome GeneratePresignedUrl(const std::string& bucket, const std::string& key, int64_t expires) const;
StringOutcome GeneratePresignedUrl(const std::string& bucket, const std::string& key, int64_t expires, Http::Method method) const;
GetObjectOutcome GetObjectByUrl(const GetObjectByUrlRequest& request) const;
GetObjectOutcome GetObjectByUrl(const std::string& url) const;
GetObjectOutcome GetObjectByUrl(const std::string& url, const std::string& file) const;
PutObjectOutcome PutObjectByUrl(const PutObjectByUrlRequest& request) const;
PutObjectOutcome PutObjectByUrl(const std::string& url, const std::string& file) const;
PutObjectOutcome PutObjectByUrl(const std::string& url, const std::string& file, const ObjectMetaData& metaData) const;
PutObjectOutcome PutObjectByUrl(const std::string& url, const std::shared_ptr<std::iostream>& content) const;
PutObjectOutcome PutObjectByUrl(const std::string& url, const std::shared_ptr<std::iostream>& content, const ObjectMetaData& metaData) const;
/*Generate Post Policy*/
/*Resumable Operation*/
#if !defined(OSS_DISABLE_RESUAMABLE)
PutObjectOutcome ResumableUploadObject(const UploadObjectRequest& request) const;
CopyObjectOutcome ResumableCopyObject(const MultiCopyObjectRequest& request) const;
GetObjectOutcome ResumableDownloadObject(const DownloadObjectRequest& request) const;
#endif
#if !defined(OSS_DISABLE_LIVECHANNEL)
/*Live Channel*/
VoidOutcome PutLiveChannelStatus(const PutLiveChannelStatusRequest& request) const;
PutLiveChannelOutcome PutLiveChannel(const PutLiveChannelRequest& request) const;
VoidOutcome PostVodPlaylist(const PostVodPlaylistRequest& request) const;
GetVodPlaylistOutcome GetVodPlaylist(const GetVodPlaylistRequest& request) const;
GetLiveChannelStatOutcome GetLiveChannelStat(const GetLiveChannelStatRequest& request) const;
GetLiveChannelInfoOutcome GetLiveChannelInfo(const GetLiveChannelInfoRequest& request) const;
GetLiveChannelHistoryOutcome GetLiveChannelHistory(const GetLiveChannelHistoryRequest& request) const;
ListLiveChannelOutcome ListLiveChannel(const ListLiveChannelRequest& request) const;
VoidOutcome DeleteLiveChannel(const DeleteLiveChannelRequest& request) const;
StringOutcome GenerateRTMPSignedUrl(const GenerateRTMPSignedUrlRequest& request) const;
#endif
/*Aysnc APIs*/
void ListObjectsAsync(const ListObjectsRequest& request, const ListObjectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
void GetObjectAsync(const GetObjectRequest& request, const GetObjectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
void PutObjectAsync(const PutObjectRequest& request, const PutObjectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
void UploadPartAsync(const UploadPartRequest& request, const UploadPartAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
void UploadPartCopyAsync(const UploadPartCopyRequest& request, const UploadPartCopyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
/*Callable APIs*/
ListObjectOutcomeCallable ListObjectsCallable(const ListObjectsRequest& request) const;
GetObjectOutcomeCallable GetObjectCallable(const GetObjectRequest& request) const;
PutObjectOutcomeCallable PutObjectCallable(const PutObjectRequest& request) const;
PutObjectOutcomeCallable UploadPartCallable(const UploadPartRequest& request) const;
UploadPartCopyOutcomeCallable UploadPartCopyCallable(const UploadPartCopyRequest& request) const;
/*Extended APIs*/
#if !defined(OSS_DISABLE_BUCKET)
bool DoesBucketExist(const std::string& bucket) const;
#endif
bool DoesObjectExist(const std::string& bucket, const std::string& key) const;
CopyObjectOutcome ModifyObjectMeta(const std::string& bucket, const std::string& key, const ObjectMetaData& meta);
/*Requests control*/
void DisableRequest();
void EnableRequest();
protected:
std::shared_ptr<OssClientImpl> client_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/OssClient.h>
#include <alibabacloud/oss/encryption/EncryptionMaterials.h>
#include <alibabacloud/oss/encryption/CryptoConfiguration.h>
#include <alibabacloud/oss/model/MultipartUploadCryptoContext.h>
namespace AlibabaCloud
{
namespace OSS
{
class EncryptionResumableDownloader;
class EncryptionResumableUploader;
class ALIBABACLOUD_OSS_EXPORT OssEncryptionClient : public OssClient
{
public:
OssEncryptionClient(const std::string& endpoint, const std::string& accessKeyId, const std::string& accessKeySecret,
const ClientConfiguration& configuration,
const std::shared_ptr<EncryptionMaterials>& encryptionMaterials, const CryptoConfiguration& cryptoConfig);
OssEncryptionClient(const std::string& endpoint, const std::string& accessKeyId, const std::string& accessKeySecret, const std::string& securityToken,
const ClientConfiguration& configuration,
const std::shared_ptr<EncryptionMaterials>& encryptionMaterials, const CryptoConfiguration& cryptoConfig);
OssEncryptionClient(const std::string& endpoint,
const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration& configuration,
const std::shared_ptr<EncryptionMaterials>& encryptionMaterials, const CryptoConfiguration& cryptoConfig);
virtual ~OssEncryptionClient();
/*Object*/
GetObjectOutcome GetObject(const GetObjectRequest& request) const;
GetObjectOutcome GetObject(const std::string &bucket, const std::string &key, const std::shared_ptr<std::iostream> &content) const;
GetObjectOutcome GetObject(const std::string &bucket, const std::string &key, const std::string &fileToSave) const;
PutObjectOutcome PutObject(const PutObjectRequest& request) const;
PutObjectOutcome PutObject(const std::string &bucket, const std::string &key, const std::shared_ptr<std::iostream> &content) const;
PutObjectOutcome PutObject(const std::string &bucket, const std::string &key, const std::string &fileToUpload) const;
/*MultipartUpload*/
InitiateMultipartUploadOutcome InitiateMultipartUpload(const InitiateMultipartUploadRequest& request, MultipartUploadCryptoContext& ctx) const;
PutObjectOutcome UploadPart(const UploadPartRequest& request, const MultipartUploadCryptoContext& ctx) const;
CompleteMultipartUploadOutcome CompleteMultipartUpload(const CompleteMultipartUploadRequest& request, const MultipartUploadCryptoContext& ctx) const;
#if !defined(OSS_DISABLE_RESUAMABLE)
/*Resumable Operation*/
PutObjectOutcome ResumableUploadObject(const UploadObjectRequest& request) const;
GetObjectOutcome ResumableDownloadObject(const DownloadObjectRequest& request) const;
#endif
/*Aysnc APIs*/
void GetObjectAsync(const GetObjectRequest& request, const GetObjectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
void PutObjectAsync(const PutObjectRequest& request, const PutObjectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
void UploadPartAsync(const UploadPartRequest& request, const UploadPartAsyncHandler& handler, const MultipartUploadCryptoContext& cryptoCtx, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
/*Callable APIs*/
GetObjectOutcomeCallable GetObjectCallable(const GetObjectRequest& request) const;
PutObjectOutcomeCallable PutObjectCallable(const PutObjectRequest& request) const;
PutObjectOutcomeCallable UploadPartCallable(const UploadPartRequest& request, const MultipartUploadCryptoContext& cryptoCtx) const;
protected:
AppendObjectOutcome AppendObject(const AppendObjectRequest& request) const;
UploadPartCopyOutcome UploadPartCopy(const UploadPartCopyRequest& request, const MultipartUploadCryptoContext& ctx) const;
void UploadPartCopyAsync(const UploadPartCopyRequest& request, const UploadPartCopyAsyncHandler& handler, const MultipartUploadCryptoContext& cryptoCtx, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
UploadPartCopyOutcomeCallable UploadPartCopyCallable(const UploadPartCopyRequest& request, const MultipartUploadCryptoContext& cryptoCtx) const;
CopyObjectOutcome ResumableCopyObject(const MultiCopyObjectRequest& request) const;
GetObjectOutcome GetObjectByUrl(const GetObjectByUrlRequest& request) const;
PutObjectOutcome PutObjectByUrl(const PutObjectByUrlRequest& request) const;
private:
friend class EncryptionResumableDownloader;
friend class EncryptionResumableUploader;
GetObjectOutcome GetObjectInternal(const GetObjectRequest& request, const ObjectMetaData& meta) const;
private:
std::shared_ptr<EncryptionMaterials> encryptionMaterials_;
CryptoConfiguration cryptoConfig_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Export.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT OssError
{
public:
OssError() = default;
OssError(const std::string& code, const std::string& message) :
code_(code),
message_(message)
{
}
OssError(const OssError& rhs) :
code_(rhs.code_),
message_(rhs.message_),
requestId_(rhs.requestId_),
host_(rhs.host_)
{
}
OssError(OssError&& lhs) :
code_(std::move(lhs.code_)),
message_(std::move(lhs.message_)),
requestId_(std::move(lhs.requestId_)),
host_(std::move(lhs.host_))
{
}
OssError& operator=(OssError&& lhs)
{
code_ = std::move(lhs.code_);
message_ = std::move(lhs.message_);
requestId_ = std::move(lhs.requestId_);
host_ = std::move(lhs.host_);
return *this;
}
OssError& operator=(const OssError& rhs)
{
code_ = rhs.code_;
message_ = rhs.message_;
requestId_ = rhs.requestId_;
host_ = rhs.host_;
return *this;
}
~OssError() = default;
const std::string& Code()const { return code_; }
const std::string& Message() const { return message_; }
const std::string& RequestId() const { return requestId_; }
const std::string& Host() const { return host_; }
void setCode(const std::string& value) { code_ = value; }
void setCode(const char *value) { code_ = value; }
void setMessage(const std::string& value) { message_ = value; }
void setMessage(const char *value) { message_ = value; }
void setRequestId(const std::string& value) { requestId_ = value; }
void setRequestId(const char *value) { requestId_ = value; }
void setHost(const std::string& value) { host_ = value; }
void setHost(const char *value) { host_ = value; }
private:
std::string code_;
std::string message_;
std::string requestId_;
std::string host_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>
#include <iostream>
#include <alibabacloud/oss/Global.h>
#include <alibabacloud/oss/Types.h>
#include <alibabacloud/oss/OssError.h>
#include <alibabacloud/oss/ServiceResult.h>
#include <alibabacloud/oss/utils/Outcome.h>
#include <alibabacloud/oss/model/VoidResult.h>
#if !defined(OSS_DISABLE_BUCKET)
#include <alibabacloud/oss/model/ListBucketsRequest.h>
#include <alibabacloud/oss/model/ListBucketsResult.h>
#include <alibabacloud/oss/model/CreateBucketRequest.h>
#include <alibabacloud/oss/model/SetBucketAclRequest.h>
#include <alibabacloud/oss/model/SetBucketLoggingRequest.h>
#include <alibabacloud/oss/model/SetBucketWebsiteRequest.h>
#include <alibabacloud/oss/model/SetBucketRefererRequest.h>
#include <alibabacloud/oss/model/SetBucketLifecycleRequest.h>
#include <alibabacloud/oss/model/SetBucketCorsRequest.h>
#include <alibabacloud/oss/model/SetBucketStorageCapacityRequest.h>
#include <alibabacloud/oss/model/DeleteBucketRequest.h>
#include <alibabacloud/oss/model/DeleteBucketLoggingRequest.h>
#include <alibabacloud/oss/model/DeleteBucketWebsiteRequest.h>
#include <alibabacloud/oss/model/DeleteBucketLifecycleRequest.h>
#include <alibabacloud/oss/model/DeleteBucketCorsRequest.h>
#include <alibabacloud/oss/model/GetBucketAclRequest.h>
#include <alibabacloud/oss/model/GetBucketAclResult.h>
#include <alibabacloud/oss/model/GetBucketLocationRequest.h>
#include <alibabacloud/oss/model/GetBucketLocationResult.h>
#include <alibabacloud/oss/model/GetBucketInfoRequest.h>
#include <alibabacloud/oss/model/GetBucketInfoResult.h>
#include <alibabacloud/oss/model/GetBucketLoggingRequest.h>
#include <alibabacloud/oss/model/GetBucketLoggingResult.h>
#include <alibabacloud/oss/model/GetBucketWebsiteRequest.h>
#include <alibabacloud/oss/model/GetBucketWebsiteResult.h>
#include <alibabacloud/oss/model/GetBucketRefererRequest.h>
#include <alibabacloud/oss/model/GetBucketRefererResult.h>
#include <alibabacloud/oss/model/GetBucketLifecycleRequest.h>
#include <alibabacloud/oss/model/GetBucketLifecycleResult.h>
#include <alibabacloud/oss/model/GetBucketStatRequest.h>
#include <alibabacloud/oss/model/GetBucketStatResult.h>
#include <alibabacloud/oss/model/GetBucketCorsRequest.h>
#include <alibabacloud/oss/model/GetBucketCorsResult.h>
#include <alibabacloud/oss/model/GetBucketStorageCapacityRequest.h>
#include <alibabacloud/oss/model/GetBucketStorageCapacityResult.h>
#include <alibabacloud/oss/model/SetBucketPolicyRequest.h>
#include <alibabacloud/oss/model/GetBucketPolicyRequest.h>
#include <alibabacloud/oss/model/GetBucketPolicyResult.h>
#include <alibabacloud/oss/model/DeleteBucketPolicyRequest.h>
#include <alibabacloud/oss/model/SetBucketPaymentRequest.h>
#include <alibabacloud/oss/model/GetBucketPaymentRequest.h>
#include <alibabacloud/oss/model/GetBucketPaymentResult.h>
#include <alibabacloud/oss/model/SetBucketEncryptionRequest.h>
#include <alibabacloud/oss/model/DeleteBucketEncryptionRequest.h>
#include <alibabacloud/oss/model/GetBucketEncryptionRequest.h>
#include <alibabacloud/oss/model/GetBucketEncryptionResult.h>
#include <alibabacloud/oss/model/SetBucketTaggingRequest.h>
#include <alibabacloud/oss/model/GetBucketTaggingRequest.h>
#include <alibabacloud/oss/model/GetBucketTaggingResult.h>
#include <alibabacloud/oss/model/DeleteBucketTaggingRequest.h>
#include <alibabacloud/oss/model/SetBucketQosInfoRequest.h>
#include <alibabacloud/oss/model/DeleteBucketQosInfoRequest.h>
#include <alibabacloud/oss/model/GetBucketQosInfoRequest.h>
#include <alibabacloud/oss/model/GetBucketQosInfoResult.h>
#include <alibabacloud/oss/model/GetUserQosInfoRequest.h>
#include <alibabacloud/oss/model/GetUserQosInfoResult.h>
#include <alibabacloud/oss/model/SetBucketVersioningRequest.h>
#include <alibabacloud/oss/model/GetBucketVersioningRequest.h>
#include <alibabacloud/oss/model/GetBucketVersioningResult.h>
#include <alibabacloud/oss/model/SetBucketInventoryConfigurationRequest.h>
#include <alibabacloud/oss/model/DeleteBucketInventoryConfigurationRequest.h>
#include <alibabacloud/oss/model/GetBucketInventoryConfigurationResult.h>
#include <alibabacloud/oss/model/GetBucketInventoryConfigurationRequest.h>
#include <alibabacloud/oss/model/ListBucketInventoryConfigurationsRequest.h>
#include <alibabacloud/oss/model/ListBucketInventoryConfigurationsResult.h>
#include <alibabacloud/oss/model/InitiateBucketWormRequest.h>
#include <alibabacloud/oss/model/InitiateBucketWormResult.h>
#include <alibabacloud/oss/model/AbortBucketWormRequest.h>
#include <alibabacloud/oss/model/CompleteBucketWormRequest.h>
#include <alibabacloud/oss/model/ExtendBucketWormRequest.h>
#include <alibabacloud/oss/model/GetBucketWormRequest.h>
#include <alibabacloud/oss/model/GetBucketWormResult.h>
#endif
#include <alibabacloud/oss/model/ListObjectsRequest.h>
#include <alibabacloud/oss/model/ListObjectsResult.h>
#include <alibabacloud/oss/model/ListObjectsV2Request.h>
#include <alibabacloud/oss/model/ListObjectsV2Result.h>
#include <alibabacloud/oss/model/ListObjectVersionsRequest.h>
#include <alibabacloud/oss/model/ListObjectVersionsResult.h>
#include <alibabacloud/oss/model/GetObjectRequest.h>
#include <alibabacloud/oss/model/GetObjectResult.h>
#include <alibabacloud/oss/model/PutObjectRequest.h>
#include <alibabacloud/oss/model/PutObjectResult.h>
#include <alibabacloud/oss/model/DeleteObjectRequest.h>
#include <alibabacloud/oss/model/DeleteObjectResult.h>
#include <alibabacloud/oss/model/DeleteObjectsRequest.h>
#include <alibabacloud/oss/model/DeleteObjectsResult.h>
#include <alibabacloud/oss/model/DeleteObjectVersionsRequest.h>
#include <alibabacloud/oss/model/DeleteObjectVersionsResult.h>
#include <alibabacloud/oss/model/HeadObjectRequest.h>
#include <alibabacloud/oss/model/GetObjectMetaRequest.h>
#include <alibabacloud/oss/model/GeneratePresignedUrlRequest.h>
#include <alibabacloud/oss/model/GetObjectByUrlRequest.h>
#include <alibabacloud/oss/model/PutObjectByUrlRequest.h>
#include <alibabacloud/oss/model/GetObjectAclRequest.h>
#include <alibabacloud/oss/model/GetObjectAclResult.h>
#include <alibabacloud/oss/model/AppendObjectRequest.h>
#include <alibabacloud/oss/model/AppendObjectResult.h>
#include <alibabacloud/oss/model/CopyObjectRequest.h>
#include <alibabacloud/oss/model/CopyObjectResult.h>
#include <alibabacloud/oss/model/GetSymlinkRequest.h>
#include <alibabacloud/oss/model/GetSymlinkResult.h>
#include <alibabacloud/oss/model/RestoreObjectRequest.h>
#include <alibabacloud/oss/model/RestoreObjectResult.h>
#include <alibabacloud/oss/model/CreateSymlinkRequest.h>
#include <alibabacloud/oss/model/CreateSymlinkResult.h>
#include <alibabacloud/oss/model/SetObjectAclRequest.h>
#include <alibabacloud/oss/model/SetObjectAclResult.h>
#include <alibabacloud/oss/model/ProcessObjectRequest.h>
#include <alibabacloud/oss/model/ObjectCallbackBuilder.h>
#include <alibabacloud/oss/model/SelectObjectRequest.h>
#include <alibabacloud/oss/model/CreateSelectObjectMetaRequest.h>
#include <alibabacloud/oss/model/CreateSelectObjectMetaResult.h>
#include <alibabacloud/oss/model/SetObjectTaggingRequest.h>
#include <alibabacloud/oss/model/SetObjectTaggingResult.h>
#include <alibabacloud/oss/model/GetObjectTaggingRequest.h>
#include <alibabacloud/oss/model/GetObjectTaggingResult.h>
#include <alibabacloud/oss/model/DeleteObjectTaggingRequest.h>
#include <alibabacloud/oss/model/DeleteObjectTaggingResult.h>
#include <alibabacloud/oss/model/InitiateMultipartUploadRequest.h>
#include <alibabacloud/oss/model/InitiateMultipartUploadResult.h>
#include <alibabacloud/oss/model/UploadPartRequest.h>
#include <alibabacloud/oss/model/UploadPartCopyRequest.h>
#include <alibabacloud/oss/model/UploadPartCopyResult.h>
#include <alibabacloud/oss/model/CompleteMultipartUploadRequest.h>
#include <alibabacloud/oss/model/CompleteMultipartUploadResult.h>
#include <alibabacloud/oss/model/AbortMultipartUploadRequest.h>
#include <alibabacloud/oss/model/ListMultipartUploadsRequest.h>
#include <alibabacloud/oss/model/ListMultipartUploadsResult.h>
#include <alibabacloud/oss/model/ListPartsRequest.h>
#include <alibabacloud/oss/model/ListPartsResult.h>
#if !defined(OSS_DISABLE_RESUAMABLE)
#include <alibabacloud/oss/model/UploadObjectRequest.h>
#include <alibabacloud/oss/model/MultiCopyObjectRequest.h>
#include <alibabacloud/oss/model/DownloadObjectRequest.h>
#endif
#if !defined(OSS_DISABLE_LIVECHANNEL)
#include <alibabacloud/oss/model/PutLiveChannelStatusRequest.h>
#include <alibabacloud/oss/model/PutLiveChannelRequest.h>
#include <alibabacloud/oss/model/PutLiveChannelResult.h>
#include <alibabacloud/oss/model/PostVodPlaylistRequest.h>
#include <alibabacloud/oss/model/GetVodPlaylistRequest.h>
#include <alibabacloud/oss/model/GetVodPlaylistResult.h>
#include <alibabacloud/oss/model/GetLiveChannelStatRequest.h>
#include <alibabacloud/oss/model/GetLiveChannelStatResult.h>
#include <alibabacloud/oss/model/GetLiveChannelInfoRequest.h>
#include <alibabacloud/oss/model/GetLiveChannelInfoResult.h>
#include <alibabacloud/oss/model/GetLiveChannelHistoryRequest.h>
#include <alibabacloud/oss/model/GetLiveChannelHistoryResult.h>
#include <alibabacloud/oss/model/ListLiveChannelRequest.h>
#include <alibabacloud/oss/model/ListLiveChannelResult.h>
#include <alibabacloud/oss/model/DeleteLiveChannelRequest.h>
#include <alibabacloud/oss/model/GenerateRTMPSignedUrlRequest.h>
#endif
namespace AlibabaCloud
{
namespace OSS
{
using OssOutcome = Outcome<OssError, ServiceResult>;
using VoidOutcome = Outcome<OssError, VoidResult>;
using StringOutcome = Outcome<OssError, std::string>;
#if !defined(OSS_DISABLE_BUCKET)
using ListBucketsOutcome = Outcome<OssError, ListBucketsResult>;
using CreateBucketOutcome = Outcome<OssError, Bucket>;
using ListBucketInventoryConfigurationsOutcome = Outcome<OssError, ListBucketInventoryConfigurationsResult>;
using GetBucketAclOutcome = Outcome<OssError, GetBucketAclResult>;
using GetBucketLocationOutcome = Outcome<OssError, GetBucketLocationResult>;
using GetBucketInfoOutcome = Outcome<OssError, GetBucketInfoResult>;
using GetBucketLoggingOutcome = Outcome<OssError, GetBucketLoggingResult>;
using GetBucketWebsiteOutcome = Outcome<OssError, GetBucketWebsiteResult>;
using GetBucketRefererOutcome = Outcome<OssError, GetBucketRefererResult>;
using GetBucketLifecycleOutcome = Outcome<OssError, GetBucketLifecycleResult>;
using GetBucketStatOutcome = Outcome<OssError, GetBucketStatResult>;
using GetBucketCorsOutcome = Outcome<OssError, GetBucketCorsResult>;
using GetBucketStorageCapacityOutcome = Outcome<OssError, GetBucketStorageCapacityResult>;
using GetBucketPolicyOutcome = Outcome<OssError, GetBucketPolicyResult>;
using GetBucketPaymentOutcome = Outcome<OssError, GetBucketPaymentResult>;
using GetBucketEncryptionOutcome = Outcome<OssError, GetBucketEncryptionResult>;
using GetBucketTaggingOutcome = Outcome<OssError, GetBucketTaggingResult>;
using GetBucketQosInfoOutcome = Outcome<OssError, GetBucketQosInfoResult>;
using GetUserQosInfoOutcome = Outcome<OssError, GetUserQosInfoResult>;
using GetBucketVersioningOutcome = Outcome<OssError, GetBucketVersioningResult>;
using GetBucketInventoryConfigurationOutcome = Outcome<OssError, GetBucketInventoryConfigurationResult>;
using InitiateBucketWormOutcome = Outcome<OssError, InitiateBucketWormResult>;
using GetBucketWormOutcome = Outcome<OssError, GetBucketWormResult>;
#endif
using ListObjectOutcome = Outcome<OssError, ListObjectsResult>;
using ListObjectsV2Outcome = Outcome<OssError, ListObjectsV2Result>;
using ListObjectVersionsOutcome = Outcome<OssError, ListObjectVersionsResult>;
using GetObjectOutcome = Outcome<OssError, GetObjectResult>;
using PutObjectOutcome = Outcome<OssError, PutObjectResult>;
using DeleteObjectOutcome = Outcome<OssError, DeleteObjectResult>;
using DeleteObjecstOutcome = Outcome<OssError, DeleteObjectsResult>;
using DeleteObjecVersionstOutcome = Outcome<OssError, DeleteObjectVersionsResult>;
using ObjectMetaDataOutcome = Outcome<OssError, ObjectMetaData>;
using GetObjectAclOutcome = Outcome<OssError, GetObjectAclResult>;
using SetObjectAclOutcome = Outcome<OssError, SetObjectAclResult>;
using AppendObjectOutcome = Outcome<OssError, AppendObjectResult>;
using CopyObjectOutcome = Outcome<OssError, CopyObjectResult>;
using RestoreObjectOutcome = Outcome<OssError, RestoreObjectResult>;
using GetSymlinkOutcome = Outcome<OssError, GetSymlinkResult>;
using CreateSymlinkOutcome = Outcome<OssError, CreateSymlinkResult>;
using CreateSelectObjectMetaOutcome = Outcome<OssError, CreateSelectObjectMetaResult>;
using SetObjectTaggingOutcome = Outcome<OssError, SetObjectTaggingResult>;
using GetObjectTaggingOutcome = Outcome<OssError, GetObjectTaggingResult>;
using DeleteObjectTaggingOutcome = Outcome<OssError, DeleteObjectTaggingResult>;
/*multipart*/
using InitiateMultipartUploadOutcome = Outcome<OssError, InitiateMultipartUploadResult>;
using UploadPartCopyOutcome = Outcome<OssError, UploadPartCopyResult>;
using CompleteMultipartUploadOutcome = Outcome<OssError, CompleteMultipartUploadResult>;
using ListMultipartUploadsOutcome = Outcome<OssError, ListMultipartUploadsResult>;
using ListPartsOutcome = Outcome<OssError, ListPartsResult>;
#if !defined(OSS_DISABLE_LIVECHANNEL)
/*livechannel*/
using PutLiveChannelOutcome = Outcome<OssError, PutLiveChannelResult>;
using GetLiveChannelStatOutcome = Outcome<OssError, GetLiveChannelStatResult>;
using GetLiveChannelInfoOutcome = Outcome<OssError, GetLiveChannelInfoResult>;
using GetLiveChannelHistoryOutcome = Outcome<OssError, GetLiveChannelHistoryResult>;
using ListLiveChannelOutcome = Outcome<OssError, ListLiveChannelResult>;
using GetVodPlaylistOutcome = Outcome<OssError, GetVodPlaylistResult>;
#endif
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/ServiceRequest.h>
namespace AlibabaCloud
{
namespace OSS
{
class OssClientImpl;
class OssEncryptionClient;
class ALIBABACLOUD_OSS_EXPORT OssRequest : public ServiceRequest
{
public:
OssRequest();
virtual ~ OssRequest() = default;
virtual HeaderCollection Headers() const;
virtual ParameterCollection Parameters() const;
virtual std::shared_ptr<std::iostream> Body() const;
protected:
OssRequest(const std::string& bucket, const std::string& key);
friend class OssClientImpl;
friend class OssEncryptionClient;
virtual int validate() const;
const char *validateMessage(int code) const;
virtual std::string payload() const;
virtual HeaderCollection specialHeaders() const;
virtual ParameterCollection specialParameters() const;
const std::string& bucket() const;
const std::string& key() const;
protected:
std::string bucket_;
std::string key_;
};
class ALIBABACLOUD_OSS_EXPORT OssBucketRequest : public OssRequest
{
public:
OssBucketRequest(const std::string& bucket):
OssRequest(bucket, "")
{}
void setBucket(const std::string& bucket);
const std::string& Bucket() const;
protected:
virtual int validate() const;
};
class ALIBABACLOUD_OSS_EXPORT OssObjectRequest : public OssRequest
{
public:
OssObjectRequest(const std::string& bucket, const std::string& key) :
OssRequest(bucket, key),
requestPayer_(AlibabaCloud::OSS::RequestPayer::NotSet),
versionId_()
{}
void setBucket(const std::string& bucket);
const std::string& Bucket() const;
void setKey(const std::string& key);
const std::string& Key() const;
void setRequestPayer(AlibabaCloud::OSS::RequestPayer value);
AlibabaCloud::OSS::RequestPayer RequestPayer() const;
void setVersionId(const std::string& versionId);
const std::string& VersionId() const;
protected:
virtual int validate() const;
virtual HeaderCollection specialHeaders() const;
virtual ParameterCollection specialParameters() const;
AlibabaCloud::OSS::RequestPayer requestPayer_;
std::string versionId_;
};
class ALIBABACLOUD_OSS_EXPORT OssResumableBaseRequest : public OssRequest
{
public:
OssResumableBaseRequest(const std::string& bucket, const std::string& key,
const std::string& checkpointDir, const uint64_t partSize, const uint32_t threadNum) :
OssRequest(bucket, key),
partSize_(partSize),
checkpointDir_(checkpointDir),
requestPayer_(AlibabaCloud::OSS::RequestPayer::NotSet),
trafficLimit_(0),
versionId_()
{
threadNum_ = threadNum == 0 ? 1 : threadNum;
}
OssResumableBaseRequest(const std::string& bucket, const std::string& key,
const std::wstring& checkpointDir, const uint64_t partSize, const uint32_t threadNum) :
OssRequest(bucket, key),
partSize_(partSize),
checkpointDirW_(checkpointDir),
requestPayer_(AlibabaCloud::OSS::RequestPayer::NotSet),
trafficLimit_(0),
versionId_()
{
threadNum_ = threadNum == 0 ? 1 : threadNum;
}
void setBucket(const std::string& bucket);
const std::string& Bucket() const;
void setKey(const std::string& key);
const std::string& Key() const;
void setPartSize(uint64_t partSize);
uint64_t PartSize() const;
void setObjectSize(uint64_t objectSize);
uint64_t ObjectSize() const;
void setThreadNum(uint32_t threadNum);
uint32_t ThreadNum() const;
void setCheckpointDir(const std::string& checkpointDir);
const std::string& CheckpointDir() const;
void setCheckpointDir(const std::wstring& checkpointDir);
const std::wstring& CheckpointDirW() const;
bool hasCheckpointDir() const;
void setObjectMtime(const std::string& mtime);
const std::string& ObjectMtime() const;
void setRequestPayer(RequestPayer value);
AlibabaCloud::OSS::RequestPayer RequestPayer() const;
void setTrafficLimit(uint64_t value);
uint64_t TrafficLimit() const;
void setVersionId(const std::string& versionId);
const std::string& VersionId() const;
protected:
friend class OssClientImpl;
friend class OssEncryptionClient;
virtual int validate() const;
const char *validateMessage(int code) const;
protected:
uint64_t partSize_;
uint64_t objectSize_;
uint32_t threadNum_;
std::string checkpointDir_;
std::wstring checkpointDirW_;
std::string mtime_;
AlibabaCloud::OSS::RequestPayer requestPayer_;
uint64_t trafficLimit_;
std::string versionId_;
};
class ALIBABACLOUD_OSS_EXPORT LiveChannelRequest : public OssRequest
{
public:
LiveChannelRequest(const std::string &bucket, const std::string &channelName) :
OssRequest(bucket, channelName),
channelName_(channelName)
{}
void setBucket(const std::string &bucket);
const std::string& Bucket() const;
void setChannelName(const std::string &channelName);
const std::string& ChannelName() const;
protected:
virtual int validate() const;
protected:
std::string channelName_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Export.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT OssResponse
{
public:
OssResponse();
explicit OssResponse(const std::string& payload);
~OssResponse();
std::string payload()const;
private:
std::string payload_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/Types.h>
#include <string>
#include <vector>
namespace AlibabaCloud
{
namespace OSS
{
using CommonPrefixeList = std::vector<std::string>;
class OssClientImpl;
class ALIBABACLOUD_OSS_EXPORT OssResult
{
public:
OssResult();
OssResult(const HeaderCollection& value);
virtual ~OssResult() {};
const std::string& RequestId() const {return requestId_;}
protected:
friend class OssClientImpl;
bool ParseDone() { return parseDone_; };
bool parseDone_;
std::string requestId_;
};
class ALIBABACLOUD_OSS_EXPORT OssObjectResult : public OssResult
{
public:
OssObjectResult();
OssObjectResult(const HeaderCollection& value);
virtual ~OssObjectResult() {};
const std::string& VersionId() const { return versionId_; }
protected:
std::string versionId_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>
#include <iostream>
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/Types.h>
namespace AlibabaCloud
{
namespace OSS
{
const int REQUEST_FLAG_CONTENTMD5 = (1 << 0);
const int REQUEST_FLAG_PARAM_IN_PATH = (1 << 1);
const int REQUEST_FLAG_CHECK_CRC64 = (1 << 2);
const int REQUEST_FLAG_SAVE_CLIENT_CRC64 = (1 << 3);
class ALIBABACLOUD_OSS_EXPORT ServiceRequest
{
public:
virtual ~ServiceRequest() = default;
std::string Path() const;
virtual HeaderCollection Headers() const = 0;
virtual ParameterCollection Parameters() const = 0;
virtual std::shared_ptr<std::iostream> Body() const = 0;
int Flags() const;
void setFlags(int flags);
const IOStreamFactory& ResponseStreamFactory() const;
void setResponseStreamFactory(const IOStreamFactory& factory);
const AlibabaCloud::OSS::TransferProgress& TransferProgress() const;
void setTransferProgress(const AlibabaCloud::OSS::TransferProgress& arg);
protected:
ServiceRequest();
void setPath(const std::string &path);
private:
int flags_;
std::string path_;
IOStreamFactory responseStreamFactory_;
AlibabaCloud::OSS::TransferProgress transferProgress_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <memory>
#include <iostream>
namespace AlibabaCloud
{
namespace OSS
{
class ServiceResult
{
public:
ServiceResult() {}
virtual ~ServiceResult() {};
inline const std::string& RequestId() const {return requestId_;}
inline const std::shared_ptr<std::iostream>& payload() const {return payload_;}
inline const HeaderCollection& headerCollection() const {return headerCollection_;}
inline int responseCode() const {return responseCode_;}
void setRequestId(const std::string& requestId) {requestId_ = requestId;}
void setPlayload(const std::shared_ptr<std::iostream>& payload) {payload_ = payload;}
void setHeaderCollection(const HeaderCollection& values) { headerCollection_ = values;}
void setResponseCode(const int code) { responseCode_ = code;}
private:
std::string requestId_;
std::shared_ptr<std::iostream> payload_;
HeaderCollection headerCollection_;
int responseCode_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <cstdint>
#include <vector>
#include <string>
#include <map>
#include <memory>
#include <functional>
#include <alibabacloud/oss/Export.h>
namespace AlibabaCloud
{
namespace OSS
{
enum StorageClass
{
Standard, // Standard bucket
IA, // Infrequent Access bucket
Archive, // Archive bucket
ColdArchive // Cold Archive bucket
};
enum CannedAccessControlList
{
Private = 0,
PublicRead,
PublicReadWrite,
Default
};
enum CopyActionList
{
Copy = 0,
Replace
};
enum EncodingType {
STRING_ANY,
URL,
};
enum RequestResponseHeader {
ContentType,
ContentLanguage,
Expires,
CacheControl,
ContentDisposition,
ContentEncoding,
};
enum RuleStatus
{
Enabled,
Disabled
};
enum LogLevel
{
LogOff = 0,
LogFatal,
LogError,
LogWarn,
LogInfo,
LogDebug,
LogTrace,
LogAll,
};
enum LiveChannelStatus
{
EnabledStatus,
DisabledStatus,
IdleStatus,
LiveStatus,
UnknownStatus=99
};
enum class RequestPayer
{
NotSet = 0,
BucketOwner,
Requester
};
enum class SSEAlgorithm
{
NotSet = 0,
KMS,
AES256
};
enum class DataRedundancyType
{
NotSet = 0,
LRS,
ZRS
};
enum class VersioningStatus
{
NotSet,
Enabled,
Suspended
};
enum class InventoryFormat
{
NotSet,
CSV
};
enum class InventoryFrequency
{
NotSet,
Daily,
Weekly
};
enum class InventoryOptionalField
{
NotSet,
Size,
LastModifiedDate,
ETag,
StorageClass,
IsMultipartUploaded,
EncryptionStatus
};
enum class InventoryIncludedObjectVersions
{
NotSet,
All,
Current
};
enum class TierType
{
Expedited,
Standard,
Bulk
};
typedef void(*LogCallback)(LogLevel level, const std::string& stream);
struct ALIBABACLOUD_OSS_EXPORT caseSensitiveLess
{
bool operator() (const std::string& lhs, const std::string& rhs) const
{
return lhs < rhs;
}
};
struct ALIBABACLOUD_OSS_EXPORT caseInsensitiveLess
{
bool operator() (const std::string& lhs, const std::string& rhs) const
{
auto first1 = lhs.begin(), last1 = lhs.end();
auto first2 = rhs.begin(), last2 = rhs.end();
while (first1 != last1) {
if (first2 == last2)
return false;
auto first1_ch = ::tolower(*first1);
auto first2_ch = ::tolower(*first2);
if (first1_ch != first2_ch) {
return (first1_ch < first2_ch);
}
++first1; ++first2;
}
return (first2 != last2);
}
};
using TransferProgressHandler = std::function<void(size_t increment, int64_t transferred, int64_t total, void *userData)>;
struct ALIBABACLOUD_OSS_EXPORT TransferProgress
{
TransferProgressHandler Handler;
void *UserData;
};
using RefererList = std::vector<std::string>;
using MetaData = std::map<std::string, std::string, caseInsensitiveLess>;
using HeaderCollection = std::map<std::string, std::string, caseInsensitiveLess>;
using ParameterCollection = std::map<std::string, std::string, caseSensitiveLess>;
using IOStreamFactory = std::function< std::shared_ptr<std::iostream>(void)>;
using ByteBuffer = std::vector<unsigned char>;
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Export.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT Credentials
{
public:
Credentials(const std::string& accessKeyId, const std::string& accessKeySecret,
const std::string& sessionToken="");
~Credentials();
const std::string& AccessKeyId () const;
const std::string& AccessKeySecret () const;
const std::string& SessionToken () const;
void setAccessKeyId(const std::string& accessKeyId);
void setAccessKeySecret(const std::string& accessKeySecret);
void setSessionToken (const std::string& sessionToken);
private:
std::string accessKeyId_;
std::string accessKeySecret_;
std::string sessionToken_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "Credentials.h"
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CredentialsProvider
{
public:
CredentialsProvider() = default;
virtual ~CredentialsProvider();
virtual Credentials getCredentials() = 0;
private:
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Export.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT AsyncCallerContext
{
public:
AsyncCallerContext();
explicit AsyncCallerContext(const std::string &uuid);
virtual ~AsyncCallerContext();
const std::string &Uuid()const;
void setUuid(const std::string &uuid);
private:
std::string uuid_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>
#include <string>
#include <alibabacloud/oss/auth/CredentialsProvider.h>
#include <alibabacloud/oss/http/HttpClient.h>
#include <alibabacloud/oss/utils/Executor.h>
namespace AlibabaCloud
{
namespace OSS
{
class RetryStrategy;
class RateLimiter;
class ALIBABACLOUD_OSS_EXPORT ClientConfiguration
{
public:
ClientConfiguration();
~ClientConfiguration() = default;
public:
/**
* User Agent string user for http calls.
*/
std::string userAgent;
/**
* Http scheme to use. E.g. Http or Https.
*/
Http::Scheme scheme;
/**
* Max concurrent tcp connections for a single http client to use.
*/
unsigned maxConnections;
/**
* Socket read timeouts. Default 3000 ms.
*/
long requestTimeoutMs;
/**
* Socket connect timeout.
*/
long connectTimeoutMs;
/**
* Strategy to use in case of failed requests.
*/
std::shared_ptr<RetryStrategy> retryStrategy;
/**
* The proxy scheme. Default HTTP
*/
Http::Scheme proxyScheme;
/**
* The proxy host.
*/
std::string proxyHost;
/**
* The proxy port.
*/
unsigned int proxyPort;
/**
* The proxy username.
*/
std::string proxyUserName;
/**
* The proxy password
*/
std::string proxyPassword;
/**
* set false to bypass SSL check.
*/
bool verifySSL;
/**
* your Certificate Authority path.
*/
std::string caPath;
/**
* your certificate file.
*/
std::string caFile;
/**
* your certificate file.
*/
bool isCname;
/**
* enable or disable crc64 check.
*/
bool enableCrc64;
/**
* enable or disable auto correct http request date.
*/
bool enableDateSkewAdjustment;
/**
* Rate limit data upload speed.
*/
std::shared_ptr<RateLimiter> sendRateLimiter;
/**
* Rate limit data download speed.
*/
std::shared_ptr<RateLimiter> recvRateLimiter;
/**
* The interface for outgoing traffic. E.g. eth0 in linux
*/
std::string networkInterface;
/**
* Your executor's implement
*/
std::shared_ptr<Executor> executor;
/**
* Your http client' implement
*/
std::shared_ptr<HttpClient> httpClient;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/Types.h>
namespace AlibabaCloud
{
namespace OSS
{
/*
The status comes from the following modules: client, server, httpclient(ex. curl).
server: [100-600)
client: [100000-199999]
curl : [200000-299999], 200000 + CURLcode
it's sucessful only if the status/100 equals to 2.
*/
const int ERROR_CLIENT_BASE = 100000;
const int ERROR_CRC_INCONSISTENT = ERROR_CLIENT_BASE + 1;
const int ERROR_REQUEST_DISABLE = ERROR_CLIENT_BASE + 2;
const int ERROR_CURL_BASE = 200000;
class ALIBABACLOUD_OSS_EXPORT Error
{
public:
Error() = default;
Error(const std::string& code, const std::string& message):
status_(0),
code_(code),
message_(message)
{
}
~Error() = default;
long Status() const {return status_;}
const std::string& Code()const {return code_;}
const std::string& Message() const {return message_;}
const HeaderCollection& Headers() const { return headers_; }
void setStatus(long status) { status_ = status;}
void setCode(const std::string& code) { code_ = code;}
void setMessage(const std::string& message) { message_ = message;}
void setHeaders(const HeaderCollection& headers) { headers_ = headers; }
private:
long status_;
std::string code_;
std::string message_;
HeaderCollection headers_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
namespace AlibabaCloud
{
namespace OSS
{
/*the unit of rate is kB/S*/
class ALIBABACLOUD_OSS_EXPORT RateLimiter
{
public:
virtual ~RateLimiter() {}
virtual void setRate(int rate) = 0;
virtual int Rate() const = 0;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/client/Error.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT RetryStrategy
{
public:
virtual ~RetryStrategy() {}
virtual bool shouldRetry(const Error& error, long attemptedRetries) const = 0;
virtual long calcDelayTimeMs(const Error& error, long attemptedRetries) const = 0;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/Types.h>
namespace AlibabaCloud
{
namespace OSS
{
enum class CipherAlgorithm {
AES,
RSA,
};
enum class CipherMode {
NONE,
ECB,
CBC,
CTR,
};
enum class CipherPadding {
NoPadding,
PKCS1Padding,
PKCS5Padding,
PKCS7Padding,
ZeroPadding,
};
class ALIBABACLOUD_OSS_EXPORT SymmetricCipher
{
public:
virtual ~SymmetricCipher() {};
//algorithm/mode/padding format. ex. AES/CBC/NoPadding
const std::string& Name() const { return name_; }
CipherAlgorithm Algorithm() { return algorithm_; }
CipherMode Mode() { return mode_; }
CipherPadding Padding() { return padding_; }
int BlockSize() { return blockSize_; }
virtual void EncryptInit(const ByteBuffer& key, const ByteBuffer& iv) = 0;
virtual ByteBuffer Encrypt(const ByteBuffer& data) = 0;
virtual int Encrypt(unsigned char * dst, int dstLen, const unsigned char* src, int srcLen) = 0;
virtual ByteBuffer EncryptFinish() = 0;
virtual void DecryptInit(const ByteBuffer& key, const ByteBuffer& iv) = 0;
virtual ByteBuffer Decrypt(const ByteBuffer& data) = 0;
virtual int Decrypt(unsigned char * dst, int dstLen, const unsigned char* src, int srcLen) = 0;
virtual ByteBuffer DecryptFinish() = 0;
public:
static ByteBuffer GenerateIV(size_t length);
static ByteBuffer GenerateKey(size_t length);
static ByteBuffer IncCTRCounter(const ByteBuffer& counter, uint64_t numberOfBlocks);
static std::shared_ptr<SymmetricCipher> CreateAES128_CTRImpl();
static std::shared_ptr<SymmetricCipher> CreateAES128_CBCImpl();
static std::shared_ptr<SymmetricCipher> CreateAES256_CTRImpl();
protected:
SymmetricCipher(const std::string& impl, CipherAlgorithm algo, CipherMode mode, CipherPadding pad);
private:
std::string impl_;
std::string name_;
CipherAlgorithm algorithm_;
CipherMode mode_;
CipherPadding padding_;
int blockSize_;
};
class ALIBABACLOUD_OSS_EXPORT AsymmetricCipher
{
public:
virtual ~AsymmetricCipher() {};
const std::string& Name() const { return name_; }
CipherAlgorithm Algorithm() { return algorithm_; }
CipherMode Mode() { return mode_; }
CipherPadding Padding() { return padding_; }
void setPublicKey(const std::string& key) { publicKey_ = key; }
void setPrivateKey(const std::string& key) { privateKey_ = key; }
const std::string& PublicKey() const { return publicKey_; }
const std::string& PrivateKey() const { return privateKey_; }
virtual ByteBuffer Encrypt(const ByteBuffer& data) = 0;
virtual ByteBuffer Decrypt(const ByteBuffer& data) = 0;
public:
static std::shared_ptr<AsymmetricCipher> CreateRSA_NONEImpl();
protected:
AsymmetricCipher(const std::string& impl, CipherAlgorithm algo, CipherMode mode, CipherPadding pad);
private:
std::string impl_;
std::string name_;
CipherAlgorithm algorithm_;
CipherMode mode_;
CipherPadding padding_;
std::string publicKey_;
std::string privateKey_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/Types.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT ContentCryptoMaterial
{
public:
ContentCryptoMaterial();
~ContentCryptoMaterial();
std::string Tag() const { return "Material"; }
const ByteBuffer& ContentKey() const { return contentKey_; }
const ByteBuffer& ContentIV() const { return contentIV_; }
const std::string& CipherName() const { return cipherName_; }
const std::string& KeyWrapAlgorithm() const { return keyWrapAlgorithm_; }
const std::map<std::string, std::string>& Description() const { return description_; }
const ByteBuffer& EncryptedContentKey() const { return encryptedContentKey_; }
const ByteBuffer& EncryptedContentIV() const { return encryptedContentIV_; }
const std::string& MagicNumber() const { return magicNumber_; }
void setContentKey(const ByteBuffer& key) { contentKey_ = key; }
void setContentIV(const ByteBuffer& iv) { contentIV_ = iv; }
void setCipherName(const std::string& name) { cipherName_ = name; }
void setKeyWrapAlgorithm(const std::string& algo) { keyWrapAlgorithm_ = algo; }
void setDescription(const std::map<std::string, std::string>& desc) { description_ = desc; }
void setEncryptedContentKey(const ByteBuffer& key) { encryptedContentKey_ = key; }
void setEncryptedContentIV(const ByteBuffer& iv) { encryptedContentIV_ = iv; }
void setMagicNumber(const std::string& value) { magicNumber_ = value; }
private:
ByteBuffer contentKey_;
ByteBuffer contentIV_;
std::string cipherName_;
std::string keyWrapAlgorithm_;
std::map<std::string, std::string> description_;
ByteBuffer encryptedContentKey_;
ByteBuffer encryptedContentIV_;
std::string magicNumber_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/auth/CredentialsProvider.h>
#include <alibabacloud/oss/http/HttpType.h>
#include <string>
#include <vector>
namespace AlibabaCloud
{
namespace OSS
{
enum class CryptoStorageMethod
{
METADATA,
};
enum class CryptoMode
{
ENCRYPTION_AESCTR,
};
class ALIBABACLOUD_OSS_EXPORT CryptoConfiguration
{
public:
CryptoConfiguration();
~CryptoConfiguration();
public:
CryptoMode cryptoMode;
CryptoStorageMethod cryptoStorageMethod;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/encryption/ContentCryptoMaterial.h>
#include <map>
#include <string>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT EncryptionMaterials
{
public:
virtual ~EncryptionMaterials();
virtual int EncryptCEK(ContentCryptoMaterial& contentCryptoMaterial) = 0;
virtual int DecryptCEK(ContentCryptoMaterial& contentCryptoMaterial) = 0;
};
using RSAEncryptionMaterial = std::pair<std::pair<std::string, std::string>, std::map<std::string, std::string>>;
class ALIBABACLOUD_OSS_EXPORT SimpleRSAEncryptionMaterials : public EncryptionMaterials
{
public:
SimpleRSAEncryptionMaterials(const std::string& publicKey, const std::string& privateKey);
SimpleRSAEncryptionMaterials(const std::string& publicKey, const std::string& privateKey,
const std::map<std::string, std::string>& description);
~SimpleRSAEncryptionMaterials();
void addEncryptionMaterial(const std::string& publicKey, const std::string& privateKey,
const std::map<std::string, std::string>& description);
virtual int EncryptCEK(ContentCryptoMaterial& contentCryptoMaterial);
virtual int DecryptCEK(ContentCryptoMaterial& contentCryptoMaterial);
private:
int findIndexByDescription(const std::map<std::string, std::string>& description);
std::string publicKey_;
std::map<std::string, std::string> description_;
std::vector<RSAEncryptionMaterial> encryptionMaterials_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>
#include <atomic>
#include <mutex>
#include <condition_variable>
#include <alibabacloud/oss/http/HttpRequest.h>
#include <alibabacloud/oss/http/HttpResponse.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT HttpClient
{
public:
HttpClient();
virtual ~HttpClient();
virtual std::shared_ptr<HttpResponse> makeRequest(const std::shared_ptr<HttpRequest> &request) = 0;
bool isEnable();
void disable();
void enable();
void waitForRetry(long milliseconds);
protected:
std::atomic<bool> disable_;
std::mutex requestLock_;
std::condition_variable requestSignal_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <iostream>
#include <memory>
#include <alibabacloud/oss/Types.h>
#include <alibabacloud/oss/http/HttpType.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT HttpMessage
{
public:
HttpMessage(const HttpMessage &other);
HttpMessage(HttpMessage &&other);
HttpMessage& operator=(const HttpMessage &other);
HttpMessage& operator=(HttpMessage &&other);
virtual ~HttpMessage();
void addHeader(const std::string &name, const std::string &value);
void setHeader(const std::string &name, const std::string &value);
void removeHeader(const std::string &name);
bool hasHeader(const std::string &name) const ;
std::string Header(const std::string &name)const;
const HeaderCollection &Headers()const;
void addBody(const std::shared_ptr<std::iostream>& body) { body_ = body;}
std::shared_ptr<std::iostream>& Body() { return body_;}
protected:
HttpMessage();
private:
HeaderCollection headers_;
std::shared_ptr<std::iostream> body_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Types.h>
#include <alibabacloud/oss/ServiceRequest.h>
#include <alibabacloud/oss/http/HttpMessage.h>
#include <alibabacloud/oss/http/Url.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT HttpRequest : public HttpMessage
{
public:
HttpRequest(Http::Method method = Http::Method::Get);
~HttpRequest();
Http::Method method() const;
Url url() const;
void setMethod(Http::Method method);
void setUrl(const Url &url);
const IOStreamFactory& ResponseStreamFactory() const { return responseStreamFactory_; }
void setResponseStreamFactory(const IOStreamFactory& factory) { responseStreamFactory_ = factory; }
const AlibabaCloud::OSS::TransferProgress & TransferProgress() const { return transferProgress_; }
void setTransferProgress(const AlibabaCloud::OSS::TransferProgress &arg) { transferProgress_ = arg;}
void setCheckCrc64(bool enable) { hasCheckCrc64_ = enable; }
bool hasCheckCrc64() const { return hasCheckCrc64_; }
void setCrc64Result(uint64_t crc) { crc64Result_ = crc; }
uint64_t Crc64Result() const { return crc64Result_; }
void setTransferedBytes(int64_t value) { transferedBytes_ = value; }
uint64_t TransferedBytes() const { return transferedBytes_;}
private:
Http::Method method_;
Url url_;
IOStreamFactory responseStreamFactory_;
AlibabaCloud::OSS::TransferProgress transferProgress_;
bool hasCheckCrc64_;
uint64_t crc64Result_;
int64_t transferedBytes_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <memory>
#include <alibabacloud/oss/http/HttpMessage.h>
#include <alibabacloud/oss/http/HttpRequest.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT HttpResponse : public HttpMessage
{
public:
HttpResponse(const std::shared_ptr<HttpRequest> & request);
~HttpResponse();
const HttpRequest &request()const;
void setStatusCode(int code);
int statusCode()const;
void setStatusMsg(std::string &msg);
void setStatusMsg(const char *msg);
std::string statusMsg()const;
private:
HttpResponse() = delete;
std::shared_ptr<HttpRequest> request_;
mutable int statusCode_;
mutable std::string statusMsg_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <map>
#include <alibabacloud/oss/Export.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT Http
{
public:
enum Method
{
Get,
Head,
Post,
Put,
Delete,
Connect,
Options,
Patch,
Trace
};
enum Scheme
{
HTTP,
HTTPS
};
static std::string MethodToString(Method method);
static std::string SchemeToString(Scheme scheme);
//HEADERS
static const char* ACCEPT;
static const char* ACCEPT_CHARSET;
static const char* ACCEPT_ENCODING;
static const char* ACCEPT_LANGUAGE;
static const char* AUTHORIZATION;
static const char* CACHE_CONTROL;
static const char* CONTENT_DISPOSITION;
static const char* CONTENT_ENCODING;
static const char* CONTENT_LENGTH;
static const char* CONTENT_MD5;
static const char* CONTENT_RANGE;
static const char* CONTENT_TYPE;
static const char* DATE;
static const char* EXPECT;
static const char* EXPIRES;
static const char* ETAG;
static const char* LAST_MODIFIED;
static const char* RANGE;
static const char* USER_AGENT;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Export.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT Url
{
public:
explicit Url(const std::string &url = "");
~Url();
bool operator==(const Url &url) const;
bool operator!=(const Url &url) const;
std::string authority() const;
void clear();
std::string fragment() const;
void fromString(const std::string &url);
bool hasFragment() const;
bool hasQuery() const;
std::string host()const;
bool isEmpty() const;
bool isValid() const;
int port()const;
std::string password() const;
std::string path() const;
std::string query() const;
std::string scheme() const;
void setAuthority(const std::string &authority);
void setFragment(const std::string &fragment);
void setHost(const std::string &host);
void setPassword(const std::string &password);
void setPath(const std::string &path);
void setPort(int port);
void setQuery(const std::string &query);
void setScheme(const std::string &scheme);
void setUserInfo(const std::string &userInfo);
void setUserName(const std::string &userName);
std::string toString()const;
std::string userInfo() const;
std::string userName() const;
private:
std::string scheme_;
std::string userName_;
std::string password_;
std::string host_;
std::string path_;
int port_;
std::string query_;
std::string fragment_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT AbortBucketWormRequest : public OssBucketRequest
{
public:
AbortBucketWormRequest(const std::string& bucket);
protected:
virtual ParameterCollection specialParameters() const;
};
}
}
... ...
/*
* Copyright 2009-2018 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
#include <iostream>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT AbortMultipartUploadRequest: public OssObjectRequest
{
public:
AbortMultipartUploadRequest(const std::string& bucket, const std::string& key,
const std::string& uploadId);
protected:
virtual ParameterCollection specialParameters() const;
private:
std::string uploadId_;
};
}
}
\ No newline at end of file
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
#include <alibabacloud/oss/Types.h>
#include <alibabacloud/oss/model/ObjectMetaData.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT AppendObjectRequest: public OssObjectRequest
{
public:
AppendObjectRequest(const std::string& bucket, const std::string& key,
const std::shared_ptr<std::iostream>& content);
AppendObjectRequest(const std::string& bucket, const std::string& key,
const std::shared_ptr<std::iostream>& content,
const ObjectMetaData& meta);
void setPosition(uint64_t position);
void setCacheControl(const std::string& value);
void setContentDisposition(const std::string& value);
void setContentEncoding(const std::string& value);
void setContentMd5(const std::string& value);
void setExpires(uint64_t expires);
void setExpires(const std::string& value);
void setAcl(const CannedAccessControlList& acl);
void setTagging(const std::string& value);
void setTrafficLimit(uint64_t value);
virtual std::shared_ptr<std::iostream> Body() const;
protected:
virtual HeaderCollection specialHeaders() const ;
virtual ParameterCollection specialParameters() const;
private:
uint64_t position_;
std::shared_ptr<std::iostream> content_;
ObjectMetaData metaData_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssResult.h>
#include <alibabacloud/oss/ServiceRequest.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT AppendObjectResult : public OssObjectResult
{
public:
public:
AppendObjectResult();
AppendObjectResult(const HeaderCollection& header);
uint64_t Length() const { return length_ ; }
uint64_t CRC64() const { return crc64_ ; }
private:
uint64_t length_;
uint64_t crc64_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/Types.h>
#include <alibabacloud/oss/model/Owner.h>
namespace AlibabaCloud
{
namespace OSS
{
class ListBucketsResult;
class ALIBABACLOUD_OSS_EXPORT Bucket
{
public:
Bucket() = default;
~Bucket();
const std::string& Location() const { return location_; }
const std::string& Name() const { return name_; }
const std::string& CreationDate() const { return creationDate_; }
const std::string& IntranetEndpoint() const { return intranetEndpoint_; }
const std::string& ExtranetEndpoint() const { return extranetEndpoint_; }
AlibabaCloud::OSS::StorageClass StorageClass() const { return storageClass_; }
const AlibabaCloud::OSS::Owner& Owner() const { return owner_; }
private:
friend class ListBucketsResult;
std::string location_;
std::string name_;
std::string creationDate_;
std::string intranetEndpoint_;
std::string extranetEndpoint_;
AlibabaCloud::OSS::StorageClass storageClass_;
AlibabaCloud::OSS::Owner owner_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <string>
#include <list>
namespace AlibabaCloud
{
namespace OSS
{
using CORSAllowedList = std::list<std::string>;
class ALIBABACLOUD_OSS_EXPORT CORSRule
{
public:
static const int UNSET_AGE_SEC = -1;
public:
CORSRule() : maxAgeSeconds_(UNSET_AGE_SEC) {}
const CORSAllowedList& AllowedOrigins() const { return allowedOrigins_; }
const CORSAllowedList& AllowedMethods() const { return allowedMethods_; }
const CORSAllowedList& AllowedHeaders() const { return allowedHeaders_; }
const CORSAllowedList& ExposeHeaders() const { return exposeHeaders_; }
int MaxAgeSeconds() const { return maxAgeSeconds_; }
void addAllowedOrigin(const std::string& origin) { allowedOrigins_.push_back(origin); }
void addAllowedMethod(const std::string& method) { allowedMethods_.push_back(method); }
void addAllowedHeader(const std::string& header) { allowedHeaders_.push_back(header); }
void addExposeHeader(const std::string& header) { exposeHeaders_.push_back(header); }
void setMaxAgeSeconds(int value) { maxAgeSeconds_ = value; }
void clear()
{
allowedOrigins_.clear();
allowedMethods_.clear();
allowedHeaders_.clear();
exposeHeaders_.clear();
maxAgeSeconds_ = UNSET_AGE_SEC;
}
private:
CORSAllowedList allowedOrigins_;
CORSAllowedList allowedMethods_;
CORSAllowedList allowedHeaders_;
CORSAllowedList exposeHeaders_;
int maxAgeSeconds_;
};
using CORSRuleList = std::list<CORSRule>;
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CompleteBucketWormRequest : public OssBucketRequest
{
public:
CompleteBucketWormRequest(const std::string& bucket, const std::string& wormId);
protected:
virtual ParameterCollection specialParameters() const;
private:
std::string wormId_;
};
}
}
... ...
/*
* Copyright 2009-2018 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
#include <alibabacloud/oss/model/Part.h>
#include <alibabacloud/oss/model/ObjectMetaData.h>
#include <sstream>
#include <iostream>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CompleteMultipartUploadRequest: public OssObjectRequest
{
public:
CompleteMultipartUploadRequest(const std::string& bucket, const std::string& key);
CompleteMultipartUploadRequest(const std::string& bucket, const std::string& key,
const PartList& partList);
CompleteMultipartUploadRequest(const std::string& bucket, const std::string& key,
const PartList& partList,
const std::string& uploadId);
void setEncodingType(const std::string& encodingType);
void setPartList(const AlibabaCloud::OSS::PartList& partList);
void setUploadId(const std::string& uploadId);
void setAcl(CannedAccessControlList acl);
void setCallback(const std::string& callback, const std::string& callbackVar = "");
ObjectMetaData& MetaData();
protected:
virtual std::string payload() const;
virtual ParameterCollection specialParameters() const;
virtual HeaderCollection specialHeaders() const;
virtual int validate() const;
private:
AlibabaCloud::OSS::PartList partList_;
std::string uploadId_;
std::string encodingType_;
bool encodingTypeIsSet_;
ObjectMetaData metaData_;
};
}
}
\ No newline at end of file
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>
#include <iostream>
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssResult.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CompleteMultipartUploadResult: public OssObjectResult
{
public:
CompleteMultipartUploadResult();
CompleteMultipartUploadResult(const std::string& data);
CompleteMultipartUploadResult(const std::shared_ptr<std::iostream>& data,
const HeaderCollection& headers);
CompleteMultipartUploadResult& operator=(const std::string& data);
const std::string& Location() const;
const std::string& Bucket() const;
const std::string& Key() const;
const std::string& ETag() const;
const std::string& EncodingType() const;
uint64_t CRC64() const;
const std::shared_ptr<std::iostream>& Content() const;
private:
std::string location_;
std::string bucket_;
std::string key_;
std::string eTag_;
std::string encodingType_;
uint64_t crc64_;
std::shared_ptr<std::iostream> content_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
#include <alibabacloud/oss/Types.h>
#include <alibabacloud/oss/model/ObjectMetaData.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CopyObjectRequest: public OssObjectRequest
{
public:
CopyObjectRequest(const std::string& bucket, const std::string& key);
CopyObjectRequest(const std::string& bucket, const std::string& key,
const ObjectMetaData& meta);
void setCopySource(const std::string& srcBucket,const std::string& srcObject);
void setSourceIfMatchETag(const std::string& value);
void setSourceIfNotMatchETag(const std::string& value);
void setSourceIfUnModifiedSince(const std::string& value);
void setSourceIfModifiedSince(const std::string& value);
void setMetadataDirective(const CopyActionList& action);
void setAcl(const CannedAccessControlList& acl);
void setTagging(const std::string& value);
void setTaggingDirective(const CopyActionList& action);
void setTrafficLimit(uint64_t value);
protected:
virtual HeaderCollection specialHeaders() const ;
virtual ParameterCollection specialParameters() const;
private:
std::string sourceBucket_;
std::string sourceKey_;
ObjectMetaData metaData_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssResult.h>
#include <alibabacloud/oss/ServiceRequest.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CopyObjectResult : public OssObjectResult
{
public:
CopyObjectResult();
CopyObjectResult(const std::string& data);
CopyObjectResult(const std::shared_ptr<std::iostream>& data);
CopyObjectResult(const HeaderCollection& headers, const std::shared_ptr<std::iostream>& data);
CopyObjectResult& operator=(const std::string& data);
const std::string& ETag() const { return etag_; }
const std::string& LastModified() const { return lastModified_; }
const std::string& SourceVersionId() { return sourceVersionId_; }
void setEtag(const std::string& etag) { etag_ = etag; }
void setLastModified(const std::string& lastModified) { lastModified_ = lastModified; }
void setVersionId(const std::string& versionId) { versionId_ = versionId; }
void setRequestId(const std::string& requestId) { requestId_ = requestId; }
private:
std::string etag_;
std::string lastModified_;
std::string sourceVersionId_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
#include <alibabacloud/oss/Types.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CreateBucketRequest: public OssBucketRequest
{
public:
CreateBucketRequest(const std::string& bucket, StorageClass storageClass = StorageClass::Standard);
CreateBucketRequest(const std::string& bucket, StorageClass storageClass,
CannedAccessControlList acl);
void setDataRedundancyType(DataRedundancyType type) { dataRedundancyType_ = type; }
protected:
virtual std::string payload() const;
virtual HeaderCollection specialHeaders() const;
private:
StorageClass storageClass_;
CannedAccessControlList acl_;
DataRedundancyType dataRedundancyType_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/OssRequest.h>
#include <alibabacloud/oss/model/InputFormat.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CreateSelectObjectMetaRequest : public OssObjectRequest
{
public:
CreateSelectObjectMetaRequest(const std::string& bucket, const std::string& key);
void setOverWriteIfExists(bool overWriteIfExist);
void setInputFormat(InputFormat& inputFormat);
protected:
virtual int validate() const;
virtual std::string payload() const;
virtual ParameterCollection specialParameters() const;
private:
InputFormat *inputFormat_;
bool overWriteIfExists_;
};
}
}
\ No newline at end of file
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/OssResult.h>
#include <memory>
#include <iostream>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CreateSelectObjectMetaResult : public OssResult
{
public:
CreateSelectObjectMetaResult();
CreateSelectObjectMetaResult(
const std::string& bucket,
const std::string& key,
const std::string& requestId,
const std::shared_ptr<std::iostream>& data);
CreateSelectObjectMetaResult& operator=(const std::shared_ptr<std::iostream>& data);
const std::string& Bucket() const { return bucket_; }
const std::string& Key() const { return key_; }
uint64_t Offset() const { return offset_; }
uint64_t TotalScanned() const { return totalScanned_; }
uint32_t Status() const { return status_; }
uint32_t SplitsCount() const { return splitsCount_; }
uint64_t RowsCount() const { return rowsCount_; }
uint32_t ColsCount() const { return colsCount_; }
const std::string& ErrorMessage() const { return errorMessage_; }
private:
std::string bucket_;
std::string key_;
uint64_t offset_;
uint64_t totalScanned_;
uint32_t status_;
uint32_t splitsCount_;
uint64_t rowsCount_;
uint32_t colsCount_;
std::string errorMessage_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
#include <alibabacloud/oss/Types.h>
#include <alibabacloud/oss/model/ObjectMetaData.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CreateSymlinkRequest: public OssObjectRequest
{
public:
CreateSymlinkRequest(const std::string& bucket, const std::string& key);
CreateSymlinkRequest(const std::string& bucket, const std::string& key,
const ObjectMetaData& meta);
void SetSymlinkTarget(const std::string& value);
void setTagging(const std::string& value);
protected:
virtual HeaderCollection specialHeaders() const ;
virtual ParameterCollection specialParameters() const;
private:
ObjectMetaData metaData_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssResult.h>
#include <alibabacloud/oss/ServiceRequest.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT CreateSymlinkResult : public OssObjectResult
{
public:
CreateSymlinkResult();
CreateSymlinkResult(const std::string& etag);
CreateSymlinkResult(const HeaderCollection& headers);
const std::string& ETag() const { return etag_; }
private:
std::string etag_;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT DeleteBucketCorsRequest : public OssBucketRequest
{
public:
DeleteBucketCorsRequest(const std::string& bucket);
protected:
virtual ParameterCollection specialParameters() const;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT DeleteBucketEncryptionRequest : public OssBucketRequest
{
public:
DeleteBucketEncryptionRequest(const std::string& bucket);
protected:
virtual ParameterCollection specialParameters() const;
};
}
}
... ...
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <alibabacloud/oss/Export.h>
#include <alibabacloud/oss/OssRequest.h>
namespace AlibabaCloud
{
namespace OSS
{
class ALIBABACLOUD_OSS_EXPORT DeleteBucketInventoryConfigurationRequest : public OssBucketRequest
{
public:
DeleteBucketInventoryConfigurationRequest(const std::string& bucket);
DeleteBucketInventoryConfigurationRequest(const std::string& bucket, const std::string& id);
void setId(const std::string& id) { id_ = id; }
protected:
virtual ParameterCollection specialParameters() const;
private:
std::string id_;
};
}
}
... ...