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.

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