code
stringlengths
1
1.05M
repo_name
stringlengths
6
83
path
stringlengths
3
242
language
stringclasses
222 values
license
stringclasses
20 values
size
int64
1
1.05M
/* * Copyright (C) 2015-2018 Alibaba Group Holding Limited */ #ifndef _OBJECTDET_H_ #define _OBJECTDET_H_ #include "model/internal.h" #ifdef __cplusplus extern "C" { #endif typedef struct _DetectObjectStruct { char *type; float score; RectStruct box; } DetectObjectStruct; typedef struct _DetectMainBodyStruct { RectStruct location; } DetectMainBodyStruct; typedef union _ObjectDetResultStruct { DetectObjectStruct object; DetectMainBodyStruct mainbody; } ObjectDetResultStruct; int detectObject(char *url, AIModelCBFunc cb); int detectMainBody(char *url, AIModelCBFunc cb); #ifdef __cplusplus } #endif #endif // _OBJECTDET_H_
YifuLiu/AliOS-Things
components/ucloud_ai/include/model/objectdet.h
C
apache-2.0
661
/* * Copyright (C) 2021-2023 Alibaba Group Holding Limited */ #ifndef _OCR_H_ #define _OCR_H_ #include "model/internal.h" #ifdef __cplusplus extern "C" { #endif typedef union _RecogIdentityCardStruct { struct { char *address; char *birthDate; char *gender; char *nationality; char *iDNumber; float cardX[4]; float cardY[4]; float faceX[4]; float faceY[4]; RectStruct location; } face; struct { char *startDate; char *issue; char *endDate; } back; } RecogIdentityCardStruct; typedef struct _RecogBankCardStruct { char *bankName; char *cardNumber; char *validDate; } RecogBankCardStruct; typedef struct _RecogCharacterStruct { char *text; float probability; int angle; int left; int top; int height; int width; } RecogCharacterStruct; typedef struct _RecogLicensePlateStruct { const char *plateNumber; float confidence; const char *plateType; float plateTypeConfidence; struct { int x; int y; int w; int h; } roi; } RecogLicensePlateStruct; typedef struct _RecogOcrCodeStruct { char *taskId; char imageURL; struct { char *suggestion; float rate; char *qrCodesData; char *label; } results; } RecogOcrCodeStruct; typedef struct _OcrResultStruct { union { RecogIdentityCardStruct identity; RecogBankCardStruct bank; RecogCharacterStruct character; RecogLicensePlateStruct licensePlate; RecogOcrCodeStruct qrCode; }; } OcrResultStruct; int recognizeIdentityCardFaceSide(char *url, AIModelCBFunc cb); int recognizeIdentityCardBackSide(char *url, AIModelCBFunc cb); int recognizeBankCard(char *url, AIModelCBFunc cb); int recognizeCharacter(char *url, AIModelCBFunc cb); int recognizeLicensePlate(char *url, AIModelCBFunc cb); #ifdef __cplusplus } #endif #endif
YifuLiu/AliOS-Things
components/ucloud_ai/include/model/ocr.h
C
apache-2.0
1,963
/* * Copyright (C) 2020-2023 Alibaba Group Holding Limited */ #ifndef _UCLOUD_AI_NLP_H_ #define _UCLOUD_AI_NLP_H_ #include "ucloud_ai_common.h" #ifdef __cplusplus extern "C" { #endif /** @addtogroup ucloud_ai_aos_api * @{ */ /** * Ucloud ai recognizing identity card face side api. * * @param[in] InstanceId chatbot's instanceId. * @param[in] text user's input text for interaction. * @return response text result. * */ char *ucloud_ai_chatbot(char *instance_id, char *session_id, char *text); /** * @} */ #ifdef __cplusplus } #endif #endif // _UCLOUD_AI_NLP_H_
YifuLiu/AliOS-Things
components/ucloud_ai/include/ucloud_ai_chatbot.h
C
apache-2.0
613
/* * Copyright (C) 2020-2023 Alibaba Group Holding Limited */ #ifndef _UCLOUD_AI_COMMON_H_ #define _UCLOUD_AI_COMMON_H_ #include "model/common.h" #include "oss_app.h" #ifdef __cplusplus extern "C" { #endif #define FACE1_IMAGE "/data/ucloud_ai_image/face1.png" #define FACE2_IMAGE "/data/ucloud_ai_image/face2.png" #define ANIME_IMAGE "/data/ucloud_ai_image/expression.jpg" #define EXPRESSION_IMAGE "/data/ucloud_ai_image/expression.jpg" #define OBJECT_IMAGE "/data/ucloud_ai_image/object.jpg" #define MAINBODY_IMAGE "/data/ucloud_ai_image/face1.png" #define CARD_FACE_IMAGE "/data/ucloud_ai_image/card_face.jpg" #define CARD_BACK_IMAGE "/data/ucloud_ai_image/card_back.jpg" #define BANK_CARD_IMAGE "/data/ucloud_ai_image/bank_card.jpg" #define CHARACTER_IMAGE "/data/ucloud_ai_image/character.jpg" #define RUBBISH_IMAGE "/data/ucloud_ai_image/rubbish.jpg" #define FRUITS_IMAGE "/data/ucloud_ai_image/fruits.jpg" #define PERSON_ORG_IMAGE "/data/ucloud_ai_image/person_org.jpg" #define STYLE_IMAGE "/data/ucloud_ai_image/person_org.jpg" // imageenhan style url #define IMAGEENHAN_ERASE_PERSON_USERMASK_URL "http://viapi-test.oss-cn-shanghai.aliyuncs.com/viapi-3.0domepic/imageenhan/ErasePerson/ErasePerson6.jpg" #define IMAGEENHAN_EXTEND_IMAGE_STYLE_URL "http://ivpd-demo.oss-cn-shanghai.aliyuncs.com/ivpd-demo/images/ExtendImageStyle/styleUrl.jpeg" typedef AIModelCBFunc ucloud_ai_cb_t; typedef AIModelResultStruct ucloud_ai_result_t; typedef enum _ucloud_ai_model_t { UCLOUD_AI_MODEL_COMPARING_FACEBODY, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.59.bc2e797dbbIyZQ&tagName=facebody&children=CompareFace UCLOUD_AI_MODEL_GENERATE_HUMAN_ANIME_STYLE, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.15.54ca797dDKkjDk&tagName=facebody&children=GenerateHumanAnimeStyle UCLOUD_AI_MODEL_RECOGNIZE_EXPRESSION, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.10.4e1a797dHZHzS5&tagName=facebody&children=RecognizeExpression UCLOUD_AI_MODEL_DETECT_PEDSTRIAN, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.35.15b8797dPuaXsj&tagName=facebody&children=DetectPedestrian UCLOUD_AI_MODEL_DETECT_OBJECT, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.20.2074797dOvJ4L2&tagName=objectdet&children=DetectObject UCLOUD_AI_MODEL_DETECT_MAIN_BODY, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.23.61df797dKC0yXR&tagName=objectdet&children=DetectMainBody UCLOUD_AI_MODEL_SEGMENT_COMMON_IMAGE, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.6.7d9e797dL51BIO&tagName=imageseg&children=SegmentCommonImage UCLOUD_AI_MODEL_SEGMENT_FACE, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.22.9e3a797deY528B&tagName=imageseg&children=SegmentFace UCLOUD_AI_MODEL_RECOGNIZE_IDENTITY_CARD_FACE_SIDE, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.16.7d87797d2vHJJ9&tagName=ocr&children=RecognizeIdentityCard UCLOUD_AI_MODEL_RECOGNIZE_IDENTITY_CARD_BACK_SIDE, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.16.7d87797d2vHJJ9&tagName=ocr&children=RecognizeIdentityCard UCLOUD_AI_MODEL_RECOGNIZE_BANK_CARD, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.20.63cd797d7APYEE&tagName=ocr&children=RecognizeBankCard UCLOUD_AI_MODEL_RECOGNIZE_CHARACTER, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14020179.J_7524944390.6.66cd608dJkkY48&tagName=ocr&children=RecognizeCharacter UCLOUD_AI_MODEL_RECOGNIZE_LICENCE_PLATE, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.13.73f5797d26kqtB&tagName=ocr&children=RecognizeLicensePlate UCLOUD_AI_MODEL_CLASSIFYING_RUBBISH, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.13.73f5797dHFaJxR&tagName=imagerecog&children=ClassifyingRubbish UCLOUD_AI_MODEL_DETECT_FRUITS, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14020179.J_7524944390.44.66cd608dt39mQW&tagName=imagerecog&children=DetectFruits UCLOUD_AI_MODEL_ERASE_PERSON, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.6.6c49797dKzzl8D&tagName=imageenhan&children=ErasePerson, have some unknown issue UCLOUD_AI_MODEL_EXTEND_IMAGE_STYLE, // refer to https://vision.aliyun.com/experience/detail?spm=a211p3.14471187.J_7524944390.18.6c49797dKzzl8D&tagName=imageenhan&children=ExtendImageStyle UCLOUD_AI_MODEL_MAX } ucloud_ai_model_t; /** @defgroup ucloud_ai_aos_api ucloud_ai * @{ */ /** * Ucloud ai set key and secret. * @param[in] key alibaba cloud key account. * @param[in] secret alibaba cloud secret. * */ void ucloud_ai_set_key_secret(char *key, char *secret); /** * Set oss bucket name. * * @param[in] bucket oss bucket name. * */ void ucloud_ai_set_oss_bucket(char *bucket); /** * Set oss endpoint. * * @param[in] endpoint oss endpoint. * */ void ucloud_ai_set_oss_endpoint(char *endpoint); /** * Upload file to oss bucket. * * @param[in] path local file path. * * @return oss url result. */ uint8_t *ucloud_ai_upload_file(char *path); /** * Initialize ucloud ai. * * @return 0 on success, negative error on failure. */ int32_t ucloud_ai_init(void); /** * Uninitialize ucloud ai. * * @return 0 on success, negative error on failure. */ int32_t ucloud_ai_uninit(void); /** * Connect to url server. * * @param[in] url url address. * * @return 0 on success, negative error on failure. */ int32_t ucloud_ai_connect(char *url); /** * Disconnect to url server. * */ void ucloud_ai_disconnect(void); /** * Get stream by url address. * */ int32_t ucloud_ai_get_stream(char *url, char **stream); /** * Get token id by domain and region id. * */ char *ucloud_ai_get_token_id(const char *domain, const char *region_id); /** * Compute content md5. * @param[in] data data content. * @param[in] size data size. * * @return md5 data after compute. */ char *ucloud_ai_compute_md5(const char *data, size_t size); /** * Generate uuid. * * @return uuid. */ char *ucloud_ai_generate_uuid(); /** * Url encode. * @param[in] src encode url. * * @return string after url encode. */ char *ucloud_ai_url_encode(const char *src); /** * Url decode. * @param[in] src decode url. * * @return string after url decode. */ char *ucloud_ai_url_decode(const char *src); /** * @} */ #ifdef __cplusplus } #endif #endif // _UCLOUD_AI_COMMON_H_
YifuLiu/AliOS-Things
components/ucloud_ai/include/ucloud_ai_common.h
C
apache-2.0
6,783
/* * Copyright (C) 2020-2023 Alibaba Group Holding Limited */ #ifndef _UCLOUD_AI_FACEBODY_H_ #define _UCLOUD_AI_FACEBODY_H_ #include "ucloud_ai_common.h" #ifdef __cplusplus extern "C" { #endif /** @addtogroup ucloud_ai_aos_api * @{ */ /** * Ucloud ai facebody comparing face api. * * @param[in] path face image you want to recognize. * @param[in] myface original face image you want to compare to. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_facebody_comparing_face(char *path, char *myface, ucloud_ai_cb_t cb); /** * Ucloud ai facebody recognizing expression api. * * @param[in] path face image you want to recognize. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_facebody_recognize_expression(char *path, ucloud_ai_cb_t cb); /** * Ucloud ai facebody generating human animation style api. * * @param[in] path face image you want to recognize. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_facebody_generate_human_anime_style(char *path, ucloud_ai_cb_t cb); /** * Ucloud ai facebody detect pedestrian api. * * @param[in] path facebody image you want to recognize. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_facebody_detect_pedestrian(char *path, ucloud_ai_cb_t cb); /** * @} */ #ifdef __cplusplus } #endif #endif // _UCLOUD_AI_FACEBODY_H_
YifuLiu/AliOS-Things
components/ucloud_ai/include/ucloud_ai_facebody.h
C
apache-2.0
1,460
/* * Copyright (C) 2020-2023 Alibaba Group Holding Limited */ #ifndef _UCLOUD_AI_IMAGEENHAN_H_ #define _UCLOUD_AI_IMAGEENHAN_H_ #include "ucloud_ai_common.h" #ifdef __cplusplus extern "C" { #endif /** @addtogroup ucloud_ai_aos_api * @{ */ /** * Ucloud ai imageenhan erasing person api. * * @param[in] image_path person image you want to enhance. * @param[in] user_mask_path mask style image you want to follow. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_imageenhan_erase_person(char *image_path, char *user_mask_path, ucloud_ai_cb_t cb); /** * Ucloud ai imageenhan extending image style api. * * @param[in] major_path image you want to extend. * @param[in] style_path style image you want to follow. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_imageenhan_extend_image_style(char *major_path, char *style_path, ucloud_ai_cb_t cb); /** * @} */ #ifdef __cplusplus } #endif #endif // _UCLOUD_AI_IMAGEENHAN_H_
YifuLiu/AliOS-Things
components/ucloud_ai/include/ucloud_ai_imageenhan.h
C
apache-2.0
1,058
/* * Copyright (C) 2020-2023 Alibaba Group Holding Limited */ #ifndef _UCLOUD_AI_IMAGERECOG_H_ #define _UCLOUD_AI_IMAGERECOG_H_ #include "ucloud_ai_common.h" #ifdef __cplusplus extern "C" { #endif /** @addtogroup ucloud_ai_aos_api * @{ */ /** * Ucloud ai cassifying rubbish api. * * @param[in] path rubbish image you want to cassify. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_imagerecog_classifying_rubbish(char *path, ucloud_ai_cb_t cb); /** * Ucloud ai detecting fruits api. * * @param[in] path fruit image you want to detect. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_imagerecog_detect_fruits(char *path, ucloud_ai_cb_t cb); /** * @} */ #ifdef __cplusplus } #endif #endif // _UCLOUD_AI_IMAGERECOG_H_
YifuLiu/AliOS-Things
components/ucloud_ai/include/ucloud_ai_imagerecog.h
C
apache-2.0
863
/* * Copyright (C) 2020-2023 Alibaba Group Holding Limited */ #ifndef _UCLOUD_AI_IMAGESEG_H_ #define _UCLOUD_AI_IMAGESEG_H_ #include "ucloud_ai_common.h" #ifdef __cplusplus extern "C" { #endif /** @addtogroup ucloud_ai_aos_api * @{ */ /** * Ucloud ai segmenting face api. * * @param[in] path face image you want to segment. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_imageseg_segment_face(char *path, ucloud_ai_cb_t cb); /** * Ucloud ai segmenting common image api. * * @param[in] path common image you want to segment. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_imageseg_segment_common_image(char *path, ucloud_ai_cb_t cb); /** * @} */ #ifdef __cplusplus } #endif #endif // _UCLOUD_AI_IMAGESEG_H_
YifuLiu/AliOS-Things
components/ucloud_ai/include/ucloud_ai_imageseg.h
C
apache-2.0
856
/* * Copyright (C) 2020-2023 Alibaba Group Holding Limited */ #ifndef _UCLOUD_AI_OBJECTDET_H_ #define _UCLOUD_AI_OBJECTDET_H_ #include "ucloud_ai_common.h" #ifdef __cplusplus extern "C" { #endif /** @addtogroup ucloud_ai_aos_api * @{ */ /** * Ucloud ai detecting object api. * * @param[in] path object you want to detect. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_objectdet_detect_object(char *path, ucloud_ai_cb_t cb); /** * Ucloud ai detecting main body api. * * @param[in] path main body you want to detect. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_objectdet_detect_main_body(char *path, ucloud_ai_cb_t cb); /** * @} */ #ifdef __cplusplus } #endif #endif // _UCLOUD_AI_OBJECTDET_H_
YifuLiu/AliOS-Things
components/ucloud_ai/include/ucloud_ai_objectdet.h
C
apache-2.0
846
/* * Copyright (C) 2020-2023 Alibaba Group Holding Limited */ #ifndef _UCLOUD_AI_OCR_H_ #define _UCLOUD_AI_OCR_H_ #include "ucloud_ai_common.h" #ifdef __cplusplus extern "C" { #endif /** @addtogroup ucloud_ai_aos_api * @{ */ /** * Ucloud ai recognizing identity card face side api. * * @param[in] path identity card face side you want to recognize. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_ocr_recognize_identity_card_face_side(char *path, ucloud_ai_cb_t cb); /** * Ucloud ai recognizing identity card back side api. * * @param[in] path identity card back side you want to recognize. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_ocr_recognize_identity_card_back_side(char *path, ucloud_ai_cb_t cb); /** * Ucloud ai recognizing bank card api. * * @param[in] path bank card you want to recognize. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_ocr_recognize_bank_card(char *path, ucloud_ai_cb_t cb); /** * Ucloud ai recognizing character api. * * @param[in] path character you want to recogize. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_ocr_recognize_character(char *path, ucloud_ai_cb_t cb); /** * Ucloud ai recognizing license plate api. * * @param[in] path license plate you want to recogize. * @param[in] cb callback function to deal with result. * */ void ucloud_ai_ocr_recognize_license_plate(char *path, ucloud_ai_cb_t cb); /** * @} */ #ifdef __cplusplus } #endif #endif // _UCLOUD_AI_OCR_H_
YifuLiu/AliOS-Things
components/ucloud_ai/include/ucloud_ai_ocr.h
C
apache-2.0
1,739
# # Copyright 1999-2019 Alibaba Cloud All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # coverage option OPTION (ENABLE_COVERAGE "Use gcov" OFF) MESSAGE(STATUS ENABLE_COVERAGE=${ENABLE_COVERAGE}) IF(ENABLE_COVERAGE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage") # SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") ENDIF() configure_file(src/Config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/alibabacloud/core/Config.h @ONLY) set(core_public_header include/alibabacloud/core/AlibabaCloud.h include/alibabacloud/core/AsyncCallerContext.h include/alibabacloud/core/ClientConfiguration.h include/alibabacloud/core/CommonClient.h include/alibabacloud/core/CommonRequest.h include/alibabacloud/core/CommonResponse.h include/alibabacloud/core/Config.h include/alibabacloud/core/CoreClient.h include/alibabacloud/core/CoreExport.h include/alibabacloud/core/Credentials.h include/alibabacloud/core/CredentialsProvider.h include/alibabacloud/core/EndpointProvider.h include/alibabacloud/core/Error.h include/alibabacloud/core/Global.h include/alibabacloud/core/HmacSha1Signer.h include/alibabacloud/core/HttpClient.h include/alibabacloud/core/HttpMessage.h include/alibabacloud/core/HttpResponse.h include/alibabacloud/core/HttpRequest.h include/alibabacloud/core/InstanceProfileCredentialsProvider.h include/alibabacloud/core/NetworkProxy.h include/alibabacloud/core/Outcome.h include/alibabacloud/core/Runnable.h include/alibabacloud/core/RoaServiceClient.h include/alibabacloud/core/RoaServiceRequest.h include/alibabacloud/core/RpcServiceClient.h include/alibabacloud/core/RpcServiceRequest.h include/alibabacloud/core/ServiceRequest.h include/alibabacloud/core/ServiceResult.h include/alibabacloud/core/Signer.h include/alibabacloud/core/SimpleCredentialsProvider.h include/alibabacloud/core/StsAssumeRoleCredentialsProvider.h include/alibabacloud/core/Url.h include/alibabacloud/core/Utils.h ) set(core_public_header_location include/alibabacloud/core/location/LocationClient.h include/alibabacloud/core/location/LocationRequest.h ) set(core_public_header_location_model include/alibabacloud/core/location/model/DescribeEndpointsRequest.h include/alibabacloud/core/location/model/DescribeEndpointsResult.h ) set(core_public_header_sts include/alibabacloud/core/sts/StsClient.h include/alibabacloud/core/sts/StsRequest.h ) set(core_public_header_sts_model include/alibabacloud/core/sts/model/AssumeRoleRequest.h include/alibabacloud/core/sts/model/AssumeRoleResult.h include/alibabacloud/core/sts/model/GetCallerIdentityRequest.h include/alibabacloud/core/sts/model/GetCallerIdentityResult.h ) set(core_src src/AlibabaCloud.cc src/AsyncCallerContext.cc src/ClientConfiguration.cc src/CommonClient.cc src/CommonRequest.cc src/CommonResponse.cc src/CoreClient.cc src/Credentials.cc src/CredentialsProvider.cc src/CurlHttpClient.h src/CurlHttpClient.cc src/EcsMetadataFetcher.cc src/EcsMetadataFetcher.h src/EndpointProvider.cc src/Error.cc src/Executor.cc src/Executor.h src/HmacSha1Signer.cc src/HttpClient.cc src/HttpMessage.cc src/HttpResponse.cc src/HttpRequest.cc src/InstanceProfileCredentialsProvider.cc src/NetworkProxy.cc src/Outcome.cc src/Runnable.cc src/RoaServiceClient.cc src/RoaServiceRequest.cc src/RpcServiceClient.cc src/RpcServiceRequest.cc src/ServiceRequest.cc src/ServiceResult.cc src/Signer.cc src/SimpleCredentialsProvider.cc src/StsAssumeRoleCredentialsProvider.cc src/Url.cc src/Utils.cc src/location/LocationClient.cc src/location/LocationRequest.cc src/location/model/DescribeEndpointsRequest.cc src/location/model/DescribeEndpointsResult.cc src/sts/StsClient.cc src/sts/StsRequest.cc src/sts/model/AssumeRoleRequest.cc src/sts/model/AssumeRoleResult.cc src/sts/model/GetCallerIdentityRequest.cc src/sts/model/GetCallerIdentityResult.cc ) add_library(core ${LIB_TYPE} ${core_public_header} ${core_public_header_location} ${core_public_header_location_model} ${core_public_header_sts} ${core_public_header_sts_model} ${core_src}) set_target_properties(core PROPERTIES LINKER_LANGUAGE CXX ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}core ) if(${LIB_TYPE} STREQUAL "SHARED") set_target_properties(core PROPERTIES DEFINE_SYMBOL ALIBABACLOUD_CORE_LIBRARY) endif() target_include_directories(core PRIVATE include ) if(CMAKE_HOST_WIN32) ExternalProject_Get_Property(curl INSTALL_DIR) set(curl_install_dir ${INSTALL_DIR}) ExternalProject_Get_Property(jsoncpp INSTALL_DIR) set(jsoncpp_install_dir ${INSTALL_DIR}) add_dependencies(core curl jsoncpp ) target_include_directories(core PRIVATE ${curl_install_dir}/include ${jsoncpp_install_dir}/include ${tinyxml2_install_dir}/include) target_link_libraries(core Crypt32 Rpcrt4 Ws2_32 ${jsoncpp_install_dir}/lib/jsoncpp.lib debug ${curl_install_dir}/lib/libcurl-d.lib optimized ${curl_install_dir}/lib/libcurl.lib ) target_compile_definitions(core PRIVATE CURL_STATICLIB _CRT_SECURE_NO_WARNINGS) else() target_include_directories(core PRIVATE /usr/include/jsoncpp) target_link_libraries(core crypto curl jsoncpp uuid ) endif() install(FILES ${core_public_header} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/core) install(FILES ${core_public_header_location} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/core/location) install(FILES ${core_public_header_location_model} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/core/location/model) install(FILES ${core_public_header_sts} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/core/sts) install(FILES ${core_public_header_sts_model} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/core/sts/model) install(TARGETS core ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/CMakeLists.txt
CMake
apache-2.0
6,686
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_ALIBABACLOUD_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_ALIBABACLOUD_H_ #include "CoreExport.h" #include <limits> namespace AlibabaCloud { const long kInvalidTimeout = (std::numeric_limits<long>::min)(); const long kDefaultConnectTimeout = 5000; const long kDefaultReadTimeout = 10000; ALIBABACLOUD_CORE_EXPORT void InitializeSdk(); ALIBABACLOUD_CORE_EXPORT bool IsSdkInitialized(); ALIBABACLOUD_CORE_EXPORT void ShutdownSdk(); } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ALIBABACLOUD_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/AlibabaCloud.h
C++
apache-2.0
1,182
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_ASYNCCALLERCONTEXT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_ASYNCCALLERCONTEXT_H_ #include "CoreExport.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT AsyncCallerContext { public: AsyncCallerContext(); explicit AsyncCallerContext(const std::string &uuid); virtual ~AsyncCallerContext(); std::string uuid() const; void setUuid(const std::string &uuid); private: std::string uuid_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ASYNCCALLERCONTEXT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/AsyncCallerContext.h
C++
apache-2.0
1,184
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_CLIENTCONFIGURATION_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_CLIENTCONFIGURATION_H_ #include "CoreExport.h" #include "CredentialsProvider.h" #include "NetworkProxy.h" #include "Signer.h" #include <memory> #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT ClientConfiguration { public: explicit ClientConfiguration(const std::string &regionId = "cn-hangzhou", const NetworkProxy &proxy = NetworkProxy()); ~ClientConfiguration(); std::string endpoint() const; NetworkProxy proxy() const; std::string regionId() const; void setEndpoint(const std::string &endpoint); void setProxy(const NetworkProxy &proxy); void setRegionId(const std::string &regionId); long connectTimeout() const; long readTimeout() const; void setConnectTimeout(const long connectTimeout); void setReadTimeout(const long readTimeout); bool rejectUnauthorized() const; void setRejectUnauthorized(const bool rejectUnauthorized); private: std::string endpoint_; NetworkProxy proxy_; std::string regionId_; long connectTimeout_; long readTimeout_; bool rejectUnauthorized_ = true; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CLIENTCONFIGURATION_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/ClientConfiguration.h
C++
apache-2.0
1,907
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONCLIENT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONCLIENT_H_ #include "AsyncCallerContext.h" #include "ClientConfiguration.h" #include "CommonRequest.h" #include "CommonResponse.h" #include "CoreClient.h" #include "CoreExport.h" #include "CredentialsProvider.h" #include <future> #include <memory> #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT CommonClient : public CoreClient { public: typedef Outcome<Error, CommonResponse> CommonResponseOutcome; typedef std::future<CommonResponseOutcome> CommonResponseOutcomeCallable; typedef std::function<void(const CommonClient *, const CommonRequest &, const CommonResponseOutcome &, const std::shared_ptr<const AsyncCallerContext> &)> CommonResponseAsyncHandler; typedef Outcome<Error, std::string> JsonOutcome; CommonClient(const Credentials &credentials, const ClientConfiguration &configuration); CommonClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration); CommonClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); ~CommonClient(); CommonResponseOutcome commonResponse(const CommonRequest &request) const; void commonResponseAsync( const CommonRequest &request, const CommonResponseAsyncHandler &handler, const std::shared_ptr<const AsyncCallerContext> &context = nullptr) const; CommonResponseOutcomeCallable commonResponseCallable(const CommonRequest &request) const; protected: HttpRequest buildHttpRequest(const std::string &endpoint, const ServiceRequest &msg, HttpRequest::Method method) const override; HttpRequest buildHttpRequest(const std::string &endpoint, const CommonRequest &msg, HttpRequest::Method method) const; HttpRequest buildRoaHttpRequest(const std::string &endpoint, const CommonRequest &msg, HttpRequest::Method method) const; HttpRequest buildRpcHttpRequest(const std::string &endpoint, const CommonRequest &msg, HttpRequest::Method method) const; JsonOutcome makeRequest(const std::string &endpoint, const CommonRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get) const; using CoreClient::asyncExecute; private: std::shared_ptr<CredentialsProvider> credentialsProvider_; std::shared_ptr<Signer> signer_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONCLIENT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/CommonClient.h
C++
apache-2.0
3,468
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_ #include "CoreExport.h" #include "HttpRequest.h" #include "ServiceRequest.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT CommonRequest : public ServiceRequest { public: enum RequestPattern { RpcPattern, RoaPattern }; explicit CommonRequest(RequestPattern pattern = RpcPattern); ~CommonRequest(); std::string domain() const; ParameterValueType headerParameter(const ParameterNameType &name) const; ParameterCollection headerParameters() const; HttpRequest::Method httpMethod() const; ParameterValueType queryParameter(const ParameterNameType &name) const; ParameterCollection queryParameters() const; using ServiceRequest::setContent; void setDomain(const std::string &domain); void setHeaderParameter(const ParameterNameType &name, const ParameterValueType &value); void setHttpMethod(HttpRequest::Method method); void setQueryParameter(const ParameterNameType &name, const ParameterValueType &value); using ServiceRequest::setResourcePath; void setRequestPattern(RequestPattern pattern); using ServiceRequest::setScheme; using ServiceRequest::setVersion; RequestPattern requestPattern() const; protected: using ServiceRequest::product; private: std::string domain_; RequestPattern requestPattern_; ParameterCollection queryParams_; ParameterCollection headerParams_; HttpRequest::Method httpMethod_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONREQUEST_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/CommonRequest.h
C++
apache-2.0
2,264
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONRESPONSE_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONRESPONSE_H_ #include "CoreExport.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT CommonResponse { public: CommonResponse(); explicit CommonResponse(const std::string &payload); ~CommonResponse(); std::string payload() const; private: std::string payload_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COMMONRESPONSE_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/CommonResponse.h
C++
apache-2.0
1,116
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ALIBABACLOUD_CORE_CONFIG_H_ #define ALIBABACLOUD_CORE_CONFIG_H_ // version = (major << 16) + (minor << 8) + patch #define ALIBABACLOUD_VERSION ((1 << 16) + (36 << 8) + 632) #define ALIBABACLOUD_VERSION_STR "1.36.632" #endif // !ALIBABACLOUD_CORE_CONFIG_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/Config.h
C
apache-2.0
892
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_CORECLIENT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_CORECLIENT_H_ #include "ClientConfiguration.h" #include "CoreExport.h" #include "HttpClient.h" #include "HttpRequest.h" #include "HttpResponse.h" #include "Outcome.h" #include "Runnable.h" #include "ServiceRequest.h" #include <functional> #include <memory> #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT CoreClient { public: CoreClient(const std::string &servicename, const ClientConfiguration &configuration); virtual ~CoreClient(); ClientConfiguration configuration() const; std::string serviceName() const; protected: virtual HttpClient::HttpResponseOutcome AttemptRequest(const std::string &endpoint, const ServiceRequest &request, HttpRequest::Method method) const; Error buildCoreError(const HttpResponse &response) const; bool hasResponseError(const HttpResponse &response) const; virtual HttpRequest buildHttpRequest(const std::string &endpoint, const ServiceRequest &msg, HttpRequest::Method method) const = 0; void asyncExecute(Runnable *r) const; private: std::string serviceName_; ClientConfiguration configuration_; std::shared_ptr<CredentialsProvider> credentialsProvider_; HttpClient *httpClient_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CORECLIENT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/CoreClient.h
C++
apache-2.0
2,084
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_COREEXPORT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_COREEXPORT_H_ #include "Global.h" #if defined(ALIBABACLOUD_SHARED) #if defined(ALIBABACLOUD_CORE_LIBRARY) #define ALIBABACLOUD_CORE_EXPORT ALIBABACLOUD_DECL_EXPORT #else #define ALIBABACLOUD_CORE_EXPORT ALIBABACLOUD_DECL_IMPORT #endif #else #define ALIBABACLOUD_CORE_EXPORT #endif #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_COREEXPORT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/CoreExport.h
C
apache-2.0
1,056
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALS_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALS_H_ #include "CoreExport.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT Credentials { public: Credentials(const std::string &accessKeyId, const std::string &accessKeySecret, const std::string &sessionToken = ""); ~Credentials(); std::string accessKeyId() const; std::string accessKeySecret() const; void setAccessKeyId(const std::string &accessKeyId); void setAccessKeySecret(const std::string &accessKeySecret); void setSessionToken(const std::string &sessionToken); std::string sessionToken() const; private: std::string accessKeyId_; std::string accessKeySecret_; std::string sessionToken_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALS_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/Credentials.h
C++
apache-2.0
1,495
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALSPROVIDER_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALSPROVIDER_H_ #include "CoreExport.h" #include "Credentials.h" namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT CredentialsProvider { public: CredentialsProvider() = default; virtual ~CredentialsProvider() = default; virtual Credentials getCredentials() = 0; private: }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_CREDENTIALSPROVIDER_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/CredentialsProvider.h
C++
apache-2.0
1,114
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_ENDPOINTPROVIDER_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_ENDPOINTPROVIDER_H_ #include <alibabacloud/core/CoreClient.h> #include <alibabacloud/core/location/LocationClient.h> #include <chrono> #include <list> #include <map> #include <memory> #include <mutex> #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT EndpointProvider : public Location::LocationClient { public: typedef Outcome<Error, std::string> EndpointOutcome; EndpointProvider( const std::shared_ptr<Location::LocationClient> &locationClient, const std::string regionId, const std::string product, const std::string serviceCode = std::string(), int durationSeconds = 3600); EndpointProvider(const Credentials &credentials, const ClientConfiguration &configuration, const std::string &regionId, const std::string &product, const std::string &serviceCode = std::string(), int durationSeconds = 3600); ~EndpointProvider(); EndpointOutcome getEndpoint(); using LocationClient::describeEndpoints; private: EndpointOutcome loadRemoteEndpoint(); bool checkExpiry() const; bool loadLocalProductsInfo(); std::string localEndpoint(const std::string regionId, const std::string product); std::mutex cachedMutex_; std::string cachedEndpoint_; int durationSeconds_; std::chrono::system_clock::time_point expiry_; std::string regionId_; std::string product_; std::string serviceCode_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ENDPOINTPROVIDER_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/EndpointProvider.h
C++
apache-2.0
2,289
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_ERROR_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_ERROR_H_ #include "CoreExport.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT Error { public: Error() = default; Error(std::string code, const std::string message); ~Error() = default; std::string errorCode() const; std::string errorMessage() const; std::string host() const; std::string requestId() const; std::string detail() const; void setErrorCode(const std::string &code); void setErrorMessage(const std::string &message); void setHost(const std::string &host); void setRequestId(const std::string &request); void setDetail(const std::string &detail); private: std::string errorCode_; std::string message_; std::string host_; std::string requestId_; std::string detail_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ERROR_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/Error.h
C++
apache-2.0
1,540
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_GLOBAL_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_GLOBAL_H_ #include "Config.h" #if defined(_WIN32) #ifdef _MSC_VER #pragma warning(disable : 4251) #endif // _MSC_VER #define ALIBABACLOUD_DECL_EXPORT __declspec(dllexport) #define ALIBABACLOUD_DECL_IMPORT __declspec(dllimport) #elif defined(__linux__) #define ALIBABACLOUD_DECL_EXPORT __attribute__((visibility("default"))) #define ALIBABACLOUD_DECL_IMPORT __attribute__((visibility("default"))) #endif #if !defined(ALIBABACLOUD_DECL_EXPORT) #define ALIBABACLOUD_DECL_EXPORT #endif #if !defined(ALIBABACLOUD_DECL_IMPORT) #define ALIBABACLOUD_DECL_IMPORT #endif #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_GLOBAL_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/Global.h
C
apache-2.0
1,330
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_HMACSHA1SIGNER_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_HMACSHA1SIGNER_H_ #include "Signer.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT HmacSha1Signer : public Signer { public: HmacSha1Signer(); ~HmacSha1Signer(); std::string generate(const std::string &src, const std::string &secret) const override; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HMACSHA1SIGNER_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/HmacSha1Signer.h
C++
apache-2.0
1,122
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPCLIENT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPCLIENT_H_ #include <alibabacloud/core/Error.h> #include <alibabacloud/core/HttpRequest.h> #include <alibabacloud/core/HttpResponse.h> #include <alibabacloud/core/NetworkProxy.h> #include <alibabacloud/core/Outcome.h> namespace AlibabaCloud { class HttpClient { public: typedef Outcome<Error, HttpResponse> HttpResponseOutcome; HttpClient(); virtual ~HttpClient(); virtual HttpResponseOutcome makeRequest(const HttpRequest &request) = 0; NetworkProxy proxy() const; void setProxy(const NetworkProxy &proxy); bool rejectUnauthorized() const; void setRejectUnauthorized(const bool &rejectUnauthorized); private: NetworkProxy proxy_; bool rejectUnauthorized_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPCLIENT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/HttpClient.h
C++
apache-2.0
1,488
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPMESSAGE_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPMESSAGE_H_ #include "CoreExport.h" #include <map> #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT HttpMessage { private: struct ALIBABACLOUD_CORE_EXPORT nocaseLess { bool operator()(const std::string &s1, const std::string &s2) const; }; public: enum KnownHeader { Accept, AcceptCharset, AcceptEncoding, AcceptLanguage, Authorization, Connection, ContentLength, ContentMD5, ContentType, Date, Host, Server, UserAgent }; typedef std::string HeaderNameType; typedef std::string HeaderValueType; typedef std::map<HeaderNameType, HeaderValueType, nocaseLess> HeaderCollection; HttpMessage(const HttpMessage &other); HttpMessage(HttpMessage &&other); HttpMessage &operator=(const HttpMessage &other); HttpMessage &operator=(HttpMessage &&other); virtual ~HttpMessage(); void addHeader(const HeaderNameType &name, const HeaderValueType &value); void addHeader(KnownHeader header, const HeaderValueType &value); const char *body() const; size_t bodySize() const; bool hasBody() const; HeaderValueType header(const HeaderNameType &name) const; HeaderValueType header(KnownHeader header) const; HeaderCollection headers() const; void removeHeader(const HeaderNameType &name); void removeHeader(KnownHeader header); void setBody(const char *data, size_t size); void setHeader(const HeaderNameType &name, const HeaderValueType &value); void setHeader(KnownHeader header, const std::string &value); protected: HttpMessage(); private: char *body_; size_t bodySize_; HeaderCollection headers_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPMESSAGE_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/HttpMessage.h
C++
apache-2.0
2,443
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_ #include "HttpMessage.h" #include "Url.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT HttpRequest : public HttpMessage { public: enum Method { Get, Head, Post, Put, Delete, Connect, Options, Patch, Trace }; explicit HttpRequest(const Url &url = Url(), Method method = Get); ~HttpRequest(); Method method() const; void setMethod(Method method); void setUrl(const Url &url); Url url() const; long connectTimeout() const; long readTimeout() const; void setConnectTimeout(const long connectTimeout); void setReadTimeout(const long readTimeout); private: Method method_; Url url_; long connectTimeout_; long readTimeout_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPREQUEST_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/HttpRequest.h
C++
apache-2.0
1,501
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPRESPONSE_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPRESPONSE_H_ #include "CoreExport.h" #include "HttpMessage.h" #include "HttpRequest.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT HttpResponse : public HttpMessage { public: HttpResponse(); explicit HttpResponse(const HttpRequest &request); ~HttpResponse(); HttpRequest request() const; void setStatusCode(int code); int statusCode() const; private: int statusCode_; HttpRequest request_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_HTTPRESPONSE_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/HttpResponse.h
C++
apache-2.0
1,251
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALS_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALS_H_ #include "BasicSessionCredentials.h" namespace AlibabaCloud { class InstanceProfileCredentials : public BasicSessionCredentials { public: InstanceProfileCredentials(); ~InstanceProfileCredentials(); private: }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALS_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/InstanceProfileCredentials.h
C++
apache-2.0
1,080
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALSPROVIDER_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALSPROVIDER_H_ #include "../src/EcsMetadataFetcher.h" #include "Credentials.h" #include "CredentialsProvider.h" #include <chrono> #include <memory> #include <mutex> #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT InstanceProfileCredentialsProvider : public CredentialsProvider, public EcsMetadataFetcher { public: InstanceProfileCredentialsProvider(const std::string &roleName, int durationSeconds = 3600); ~InstanceProfileCredentialsProvider(); std::string roleName() const; Credentials getCredentials() override; using EcsMetadataFetcher::getMetadata; using EcsMetadataFetcher::roleName; using EcsMetadataFetcher::setRoleName; private: void loadCredentials(); bool checkExpiry() const; std::mutex cachedMutex_; Credentials cachedCredentials_; int durationSeconds_; std::chrono::system_clock::time_point expiry_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_INSTANCEPROFILECREDENTIALSPROVIDER_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/InstanceProfileCredentialsProvider.h
C++
apache-2.0
1,792
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_NETWORKPROXY_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_NETWORKPROXY_H_ #include "CoreExport.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT NetworkProxy { public: enum Type { None = 0, Http, Socks5 }; NetworkProxy(Type type = None, const std::string &hostName = "", uint16_t port = 0, const std::string &user = "", const std::string &password = ""); ~NetworkProxy(); std::string hostName() const; std::string password() const; uint16_t port() const; void setHostName(const std::string &hostName); void setPassword(const std::string &password); void setPort(uint16_t port); void setType(Type type); void setUser(const std::string &user); Type type() const; std::string user() const; private: std::string hostName_; std::string password_; uint16_t port_; Type type_; std::string user_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_NETWORKPROXY_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/NetworkProxy.h
C++
apache-2.0
1,635
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_OUTCOME_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_OUTCOME_H_ #include <utility> namespace AlibabaCloud { template <typename E, typename R> class Outcome { public: Outcome() : success_(true), e_(), r_() {} explicit Outcome(const E &e) : e_(e), success_(false), r_() {} explicit Outcome(const R &r) : r_(r), success_(true), e_() {} Outcome(const Outcome &other) : success_(other.success_), e_(other.e_), r_(other.r_) {} Outcome(Outcome &&other) { *this = std::move(other); } Outcome &operator=(const Outcome &other) { if (this != &other) { success_ = other.success_; e_ = other.e_; r_ = other.r_; } return *this; } Outcome &operator=(Outcome &&other) { if (this != &other) { success_ = other.success_; r_ = other.r_; e_ = other.e_; } return *this; } bool isSuccess() const { return success_; } E error() const { return e_; } R result() const { return r_; } private: bool success_; E e_; R r_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_OUTCOME_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/Outcome.h
C++
apache-2.0
1,738
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICECLIENT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICECLIENT_H_ #include "CoreClient.h" #include "CredentialsProvider.h" #include "HmacSha1Signer.h" #include "HttpRequest.h" #include "RoaServiceRequest.h" #include <map> #include <memory> #include <string> namespace AlibabaCloud { class RoaErrorMarshaller; class ALIBABACLOUD_CORE_EXPORT RoaServiceClient : public CoreClient { public: typedef Outcome<Error, std::string> JsonOutcome; RoaServiceClient( const std::string &servicename, const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration, const std::shared_ptr<Signer> &signer = std::make_shared<HmacSha1Signer>()); virtual ~RoaServiceClient(); protected: JsonOutcome makeRequest(const std::string &endpoint, const RoaServiceRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get) const; HttpRequest buildHttpRequest(const std::string &endpoint, const ServiceRequest &msg, HttpRequest::Method method) const override; HttpRequest buildHttpRequest(const std::string &endpoint, const RoaServiceRequest &msg, HttpRequest::Method method) const; private: std::shared_ptr<CredentialsProvider> credentialsProvider_; std::shared_ptr<Signer> signer_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICECLIENT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/RoaServiceClient.h
C++
apache-2.0
2,172
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICEREQUEST_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICEREQUEST_H_ #include "ServiceRequest.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT RoaServiceRequest : public ServiceRequest { public: RoaServiceRequest(const std::string &product, const std::string &version); virtual ~RoaServiceRequest(); using ServiceRequest::parameter; using ServiceRequest::setContent; using ServiceRequest::setMethod; using ServiceRequest::setParameter; using ServiceRequest::setResourcePath; using ServiceRequest::setScheme; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_ROASERVICEREQUEST_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/RoaServiceRequest.h
C++
apache-2.0
1,323
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICECLIENT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICECLIENT_H_ #include "CoreClient.h" #include "CredentialsProvider.h" #include "HmacSha1Signer.h" #include "HttpRequest.h" #include "Outcome.h" #include "RpcServiceRequest.h" #include <map> #include <memory> #include <string> namespace AlibabaCloud { class RpcErrorMarshaller; class RpcServiceRequest; class ALIBABACLOUD_CORE_EXPORT RpcServiceClient : public CoreClient { public: typedef Outcome<Error, std::string> JsonOutcome; RpcServiceClient( const std::string &servicename, const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration, const std::shared_ptr<Signer> &signer = std::make_shared<HmacSha1Signer>()); virtual ~RpcServiceClient(); std::shared_ptr<CredentialsProvider> credentialsProvider() { return credentialsProvider_; } using CoreClient::AttemptRequest; using CoreClient::configuration; protected: virtual JsonOutcome makeRequest(const std::string &endpoint, const RpcServiceRequest &msg, HttpRequest::Method method = HttpRequest::Method::Get) const; HttpRequest buildHttpRequest(const std::string &endpoint, const ServiceRequest &msg, HttpRequest::Method method) const override; HttpRequest buildHttpRequest(const std::string &endpoint, const RpcServiceRequest &msg, HttpRequest::Method method) const; private: std::shared_ptr<CredentialsProvider> credentialsProvider_; std::shared_ptr<Signer> signer_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICECLIENT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/RpcServiceClient.h
C++
apache-2.0
2,398
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICEREQUEST_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICEREQUEST_H_ #include "ServiceRequest.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT RpcServiceRequest : public ServiceRequest { public: RpcServiceRequest(const std::string &product, const std::string &version, const std::string &action); virtual ~RpcServiceRequest(); std::string actionName() const; using ServiceRequest::setMethod; using ServiceRequest::setScheme; protected: void setActionName(const std::string &name); }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_RPCSERVICEREQUEST_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/RpcServiceRequest.h
C++
apache-2.0
1,314
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_RUNNABLE_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_RUNNABLE_H_ #include "CoreExport.h" #include <functional> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT Runnable { public: explicit Runnable(const std::function<void()> f); void run() const; private: std::function<void()> f_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_RUNNABLE_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/Runnable.h
C++
apache-2.0
1,044
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICEREQUEST_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICEREQUEST_H_ #include "CoreExport.h" #include "HttpRequest.h" #include "Url.h" #include <map> #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT ServiceRequest { public: typedef std::string ParameterNameType; typedef std::string ParameterValueType; typedef std::map<ParameterNameType, ParameterValueType> ParameterCollection; virtual ~ServiceRequest(); const char *content() const; size_t contentSize() const; bool hasContent() const; ParameterCollection parameters() const; ParameterCollection bodyParameters() const; std::string product() const; std::string resourcePath() const; std::string version() const; std::string scheme() const; HttpRequest::Method method() const; long connectTimeout() const; long readTimeout() const; void setConnectTimeout(const long connectTimeout); void setReadTimeout(const long readTimeout); void setMethod(const HttpRequest::Method method); void setHeader(const ParameterNameType &name, const ParameterValueType &value); ParameterValueType getHeader(const ParameterNameType &name); void removeHeader(const ParameterNameType &name); ParameterCollection headers() const; void setBodyParameter(const ParameterNameType &name, const ParameterValueType &value); protected: ServiceRequest(const std::string &product, const std::string &version); ServiceRequest(const ServiceRequest &other); ServiceRequest(ServiceRequest &&other); ServiceRequest &operator=(const ServiceRequest &other); ServiceRequest &operator=(ServiceRequest &&other); void addParameter(const ParameterNameType &name, const ParameterValueType &value); ParameterValueType parameter(const ParameterNameType &name) const; ParameterValueType coreParameter(const ParameterNameType &name) const; void removeParameter(const ParameterNameType &name); void setContent(const char *data, size_t size); void setParameter(const ParameterNameType &name, const ParameterValueType &value); void setCoreParameter(const ParameterNameType &name, const ParameterValueType &value); void setParameters(const ParameterCollection &params); void setJsonParameters(const ParameterNameType &name, const ParameterCollection &params); void setResourcePath(const std::string &path); void setProduct(const std::string &product); void setVersion(const std::string &version); void setScheme(const std::string scheme); private: char *content_; size_t contentSize_; ParameterCollection params_; ParameterCollection body_params_; ParameterCollection headers_; std::string product_; std::string resourcePath_; std::string version_; std::string scheme_; long connectTimeout_; long readTimeout_; HttpRequest::Method method_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICEREQUEST_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/ServiceRequest.h
C++
apache-2.0
3,670
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICERESULT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICERESULT_H_ #include "CoreExport.h" #include <string> namespace AlibabaCloud { class PayloadReader; class ALIBABACLOUD_CORE_EXPORT ServiceResult { public: ServiceResult(); virtual ~ServiceResult(); std::string requestId() const; protected: void setRequestId(const std::string &requestId); private: std::string requestId_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SERVICERESULT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/ServiceResult.h
C++
apache-2.0
1,151
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_SIGNER_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_SIGNER_H_ #include "CoreExport.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT Signer { public: enum Type { HmacSha1, }; virtual ~Signer(); virtual std::string generate(const std::string &src, const std::string &secret) const = 0; std::string name() const; Type type() const; std::string version() const; protected: Signer(Type type, const std::string &name, const std::string &version = "1.0"); private: std::string name_; std::string version_; Type type_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SIGNER_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/Signer.h
C++
apache-2.0
1,353
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_SIMPLECREDENTIALSPROVIDER_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_SIMPLECREDENTIALSPROVIDER_H_ #include "CredentialsProvider.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT SimpleCredentialsProvider : public CredentialsProvider { public: explicit SimpleCredentialsProvider(const Credentials &credentials); SimpleCredentialsProvider(const std::string &accessKeyId, const std::string &accessKeySecret); ~SimpleCredentialsProvider(); Credentials getCredentials() override; private: Credentials credentials_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_SIMPLECREDENTIALSPROVIDER_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/SimpleCredentialsProvider.h
C++
apache-2.0
1,347
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_STSASSUMEROLECREDENTIALSPROVIDER_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_STSASSUMEROLECREDENTIALSPROVIDER_H_ #include <alibabacloud/core/CredentialsProvider.h> #include <alibabacloud/core/sts/StsClient.h> #include <chrono> #include <mutex> #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT StsAssumeRoleCredentialsProvider : public CredentialsProvider, public Sts::StsClient { public: StsAssumeRoleCredentialsProvider(const Credentials &credentials, const ClientConfiguration &configuration, const std::string &roleArn, const std::string &roleSessionName, const std::string &policy = "", int durationSeconds = 3600); ~StsAssumeRoleCredentialsProvider(); Credentials getCredentials() override; using StsClient::assumeRole; private: void loadCredentials(); bool checkExpiry() const; std::mutex cachedMutex_; Credentials cachedCredentials_; int durationSeconds_; std::chrono::system_clock::time_point expiry_; std::string policy_; std::string roleArn_; std::string roleSessionName_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_STSASSUMEROLECREDENTIALSPROVIDER_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/StsAssumeRoleCredentialsProvider.h
C++
apache-2.0
1,994
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_URL_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_URL_H_ #include "CoreExport.h" #include <string> namespace AlibabaCloud { class ALIBABACLOUD_CORE_EXPORT Url { public: explicit Url(const std::string &url = ""); Url(const Url &other) = default; Url(Url &&other) = default; ~Url(); Url &operator=(const Url &url) = default; Url &operator=(Url &&other) = default; bool operator==(const Url &url) const; bool operator!=(const Url &url) const; std::string authority() const; void clear(); std::string fragment() const; void fromString(const std::string &url); bool hasFragment() const; bool hasQuery() const; std::string host() const; bool isEmpty() const; bool isValid() const; int port() const; std::string password() const; std::string path() const; std::string query() const; std::string scheme() const; void setAuthority(const std::string &authority); void setFragment(const std::string &fragment); void setHost(const std::string &host); void setPassword(const std::string &password); void setPath(const std::string &path); void setPort(int port); void setQuery(const std::string &query); void setScheme(const std::string &scheme); void setUserInfo(const std::string &userInfo); void setUserName(const std::string &userName); std::string toString() const; std::string userInfo() const; std::string userName() const; private: std::string scheme_; std::string userName_; std::string password_; std::string host_; std::string path_; int port_; std::string query_; std::string fragment_; }; } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_URL_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/Url.h
C++
apache-2.0
2,314
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_SRC_UTILS_H_ #define CORE_SRC_UTILS_H_ #include <alibabacloud/core/HttpMessage.h> #include <alibabacloud/core/HttpRequest.h> //#include <json/json.h> #include <map> #include <string> namespace AlibabaCloud { std::string ComputeContentMD5(const char *data, size_t size); std::string GenerateUuid(); std::string HttpMethodToString(HttpRequest::Method method); void StringReplace(std::string &src, const std::string &s1, const std::string &s2); std::string UrlEncode(const std::string &src); std::string UrlDecode(const std::string &src); std::string canonicalizedQuery(const std::map<std::string, std::string> &params); std::string canonicalizedHeaders(const HttpMessage::HeaderCollection &headers); std::string GetEnv(const std::string env); std::string MapToJson(const std::map<std::string, std::string> &maps); std::map<std::string, std::string> JsonToMap(const std::string &json); } // namespace AlibabaCloud #endif // CORE_SRC_UTILS_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/Utils.h
C++
apache-2.0
1,598
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONCLIENT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONCLIENT_H_ #include "model/DescribeEndpointsRequest.h" #include "model/DescribeEndpointsResult.h" #include <alibabacloud/core/AsyncCallerContext.h> #include <alibabacloud/core/RpcServiceClient.h> #include <future> #include <memory> #include <string> namespace AlibabaCloud { namespace Location { class ALIBABACLOUD_CORE_EXPORT LocationClient : public RpcServiceClient { public: typedef Outcome<Error, Model::DescribeEndpointsResult> DescribeEndpointsOutcome; typedef std::future<DescribeEndpointsOutcome> DescribeEndpointsOutcomeCallable; typedef std::function<void(const LocationClient *, const Model::DescribeEndpointsRequest &, const DescribeEndpointsOutcome &, const std::shared_ptr<const AsyncCallerContext> &)> DescribeEndpointsAsyncHandler; LocationClient(const Credentials &credentials, const ClientConfiguration &configuration); LocationClient( const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration); LocationClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); LocationClient( const std::shared_ptr<Location::LocationClient> &locationClient); ~LocationClient(); virtual DescribeEndpointsOutcome describeEndpoints(const Model::DescribeEndpointsRequest &request) const; void describeEndpointsAsync( const Model::DescribeEndpointsRequest &request, const DescribeEndpointsAsyncHandler &handler, const std::shared_ptr<const AsyncCallerContext> &context = nullptr) const; DescribeEndpointsOutcomeCallable describeEndpointsCallable( const Model::DescribeEndpointsRequest &request) const; using RpcServiceClient::configuration; using RpcServiceClient::makeRequest; }; } // namespace Location } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONCLIENT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/location/LocationClient.h
C++
apache-2.0
2,783
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONREQUEST_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONREQUEST_H_ #include <alibabacloud/core/RpcServiceRequest.h> #include <string> namespace AlibabaCloud { namespace Location { class ALIBABACLOUD_CORE_EXPORT LocationRequest : public RpcServiceRequest { public: explicit LocationRequest(const std::string &action); virtual ~LocationRequest(); private: }; } // namespace Location } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_LOCATIONREQUEST_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/location/LocationRequest.h
C++
apache-2.0
1,178
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSREQUEST_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSREQUEST_H_ #include <alibabacloud/core/location/LocationRequest.h> #include <string> namespace AlibabaCloud { namespace Location { namespace Model { class ALIBABACLOUD_CORE_EXPORT DescribeEndpointsRequest : public LocationRequest { public: DescribeEndpointsRequest(); ~DescribeEndpointsRequest(); std::string serviceCode() const; void setServiceCode(const std::string &serviceCode); std::string id() const; void setId(const std::string &id); std::string type() const; void setType(const std::string &type); }; } // namespace Model } // namespace Location } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSREQUEST_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/location/model/DescribeEndpointsRequest.h
C++
apache-2.0
1,468
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSRESULT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSRESULT_H_ #include <alibabacloud/core/ServiceResult.h> #include <string> #include <utility> #include <vector> namespace AlibabaCloud { namespace Location { namespace Model { class ALIBABACLOUD_CORE_EXPORT DescribeEndpointsResult : public ServiceResult { public: struct Endpoint { std::string endpoint; std::string id; std::string namespace_; std::string serivceCode; std::string type; std::vector<std::string> protocols; }; DescribeEndpointsResult(); explicit DescribeEndpointsResult(const std::string &payload); ~DescribeEndpointsResult(); std::vector<Endpoint> endpoints() const; void setEndpoints(const std::vector<Endpoint> &endpoints); bool success() const; void setSuccess(const bool &success); protected: void parse(const std::string &payload); private: std::vector<Endpoint> endpoints_; bool success_; }; } // namespace Model } // namespace Location } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_LOCATION_MODEL_DESCRIBEENDPOINTSRESULT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/location/model/DescribeEndpointsResult.h
C++
apache-2.0
1,801
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSCLIENT_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSCLIENT_H_ #include "model/AssumeRoleRequest.h" #include "model/AssumeRoleResult.h" #include "model/GetCallerIdentityRequest.h" #include "model/GetCallerIdentityResult.h" #include <alibabacloud/core/AsyncCallerContext.h> #include <alibabacloud/core/RpcServiceClient.h> #include <future> #include <memory> #include <string> namespace AlibabaCloud { namespace Sts { class ALIBABACLOUD_CORE_EXPORT StsClient : public RpcServiceClient { public: typedef Outcome<Error, Model::AssumeRoleResult> AssumeRoleOutcome; typedef std::future<AssumeRoleOutcome> AssumeRoleOutcomeCallable; typedef std::function<void(const StsClient *, const Model::AssumeRoleRequest &, const AssumeRoleOutcome &, const std::shared_ptr<const AsyncCallerContext> &)> AssumeRoleAsyncHandler; typedef Outcome<Error, Model::GetCallerIdentityResult> GetCallerIdentityOutcome; typedef std::future<GetCallerIdentityOutcome> GetCallerIdentityOutcomeCallable; typedef std::function<void(const StsClient *, const Model::GetCallerIdentityRequest &, const GetCallerIdentityOutcome &, const std::shared_ptr<const AsyncCallerContext> &)> GetCallerIdentityAsyncHandler; StsClient(const Credentials &credentials, const ClientConfiguration &configuration); StsClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration); StsClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); ~StsClient(); virtual AssumeRoleOutcome assumeRole(const Model::AssumeRoleRequest &request) const; void assumeRoleAsync( const Model::AssumeRoleRequest &request, const AssumeRoleAsyncHandler &handler, const std::shared_ptr<const AsyncCallerContext> &context = nullptr) const; AssumeRoleOutcomeCallable assumeRoleCallable(const Model::AssumeRoleRequest &request) const; GetCallerIdentityOutcome getCallerIdentity(const Model::GetCallerIdentityRequest &request) const; void getCallerIdentityAsync( const Model::GetCallerIdentityRequest &request, const GetCallerIdentityAsyncHandler &handler, const std::shared_ptr<const AsyncCallerContext> &context = nullptr) const; GetCallerIdentityOutcomeCallable getCallerIdentityCallable( const Model::GetCallerIdentityRequest &request) const; using RpcServiceClient::makeRequest; }; } // namespace Sts } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSCLIENT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/sts/StsClient.h
C++
apache-2.0
3,419
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSREQUEST_H_ #define CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSREQUEST_H_ #include <alibabacloud/core/RpcServiceRequest.h> #include <string> namespace AlibabaCloud { namespace Sts { class ALIBABACLOUD_CORE_EXPORT StsRequest : public RpcServiceRequest { public: explicit StsRequest(const std::string &action); virtual ~StsRequest(); private: }; } // namespace Sts } // namespace AlibabaCloud #endif // CORE_INCLUDE_ALIBABACLOUD_CORE_STS_STSREQUEST_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/sts/StsRequest.h
C++
apache-2.0
1,123
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLEREQUEST_H_ #define ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLEREQUEST_H_ #include <alibabacloud/core/sts/StsRequest.h> #include <string> namespace AlibabaCloud { namespace Sts { namespace Model { class ALIBABACLOUD_CORE_EXPORT AssumeRoleRequest : public StsRequest { public: AssumeRoleRequest(); ~AssumeRoleRequest(); int durationSeconds() const; std::string policy() const; std::string roleArn() const; std::string roleSessionName() const; void setDurationSeconds(int durationSeconds); void setPolicy(const std::string &policy); void setRoleArn(const std::string &roleArn); void setRoleSessionName(const std::string &roleSessionName); }; } // namespace Model } // namespace Sts } // namespace AlibabaCloud #endif // !ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLEREQUEST_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/sts/model/AssumeRoleRequest.h
C++
apache-2.0
1,456
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLERESULT_H_ #define ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLERESULT_H_ #include <alibabacloud/core/ServiceResult.h> namespace AlibabaCloud { namespace Sts { namespace Model { class ALIBABACLOUD_CORE_EXPORT AssumeRoleResult : public ServiceResult { public: struct AssumedRoleUser { std::string arn; std::string assumedRoleId; }; struct Credentials { std::string accessKeyId; std::string accessKeySecret; std::string expiration; std::string securityToken; }; AssumeRoleResult(); explicit AssumeRoleResult(const std::string &payload); ~AssumeRoleResult(); AssumedRoleUser assumedRoleUser() const; Credentials credentials() const; private: void parse(const std::string &payload); AssumedRoleUser assumedRoleUser_; Credentials credentials_; }; } // namespace Model } // namespace Sts } // namespace AlibabaCloud #endif // !ALIBABACLOUD_CORE_STS_MODEL_ASSUMEROLERESULT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/sts/model/AssumeRoleResult.h
C++
apache-2.0
1,586
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYREQUEST_H_ #define ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYREQUEST_H_ #include <alibabacloud/core/sts/StsRequest.h> #include <string> namespace AlibabaCloud { namespace Sts { namespace Model { class ALIBABACLOUD_CORE_EXPORT GetCallerIdentityRequest : public StsRequest { public: GetCallerIdentityRequest(); ~GetCallerIdentityRequest(); private: }; } // namespace Model } // namespace Sts } // namespace AlibabaCloud #endif // !ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYREQUEST_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/sts/model/GetCallerIdentityRequest.h
C++
apache-2.0
1,173
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYRESULT_H_ #define ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYRESULT_H_ #include <alibabacloud/core/ServiceResult.h> namespace AlibabaCloud { namespace Sts { namespace Model { class ALIBABACLOUD_CORE_EXPORT GetCallerIdentityResult : public ServiceResult { public: GetCallerIdentityResult(); explicit GetCallerIdentityResult(const std::string &payload); ~GetCallerIdentityResult(); std::string accountId(); std::string arn() const; std::string userId() const; private: void parse(const std::string &payload); std::string accountId_; std::string arn_; std::string userId_; }; } // namespace Model } // namespace Sts } // namespace AlibabaCloud #endif // !ALIBABACLOUD_CORE_STS_MODEL_GETCALLERIDENTITYRESULT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/include/alibabacloud/core/sts/model/GetCallerIdentityResult.h
C++
apache-2.0
1,413
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "Executor.h" #include <alibabacloud/core/AlibabaCloud.h> static AlibabaCloud::Executor *executor = nullptr; void AlibabaCloud::InitializeSdk() { if (IsSdkInitialized()) return; executor = new Executor; executor->start(); } bool AlibabaCloud::IsSdkInitialized() { return executor != nullptr; } void AlibabaCloud::ShutdownSdk() { if (!IsSdkInitialized()) return; executor->shutdown(); delete executor; executor = nullptr; }
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/AlibabaCloud.cc
C++
apache-2.0
1,084
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/AsyncCallerContext.h> #include <alibabacloud/core/Utils.h> namespace AlibabaCloud { AsyncCallerContext::AsyncCallerContext() : uuid_(GenerateUuid()) {} AsyncCallerContext::AsyncCallerContext(const std::string &uuid) : uuid_(uuid) {} AsyncCallerContext::~AsyncCallerContext() {} std::string AsyncCallerContext::uuid() const { return uuid_; } void AsyncCallerContext::setUuid(const std::string &uuid) { uuid_ = uuid; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/AsyncCallerContext.cc
C++
apache-2.0
1,105
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/AlibabaCloud.h> #include <alibabacloud/core/ClientConfiguration.h> namespace AlibabaCloud { ClientConfiguration::ClientConfiguration(const std::string &regionId, const NetworkProxy &proxy) : regionId_(regionId), proxy_(proxy), endpoint_(), connectTimeout_(kDefaultConnectTimeout), readTimeout_(kDefaultReadTimeout) {} ClientConfiguration::~ClientConfiguration() {} std::string ClientConfiguration::endpoint() const { return endpoint_; } NetworkProxy ClientConfiguration::proxy() const { return proxy_; } std::string ClientConfiguration::regionId() const { return regionId_; } void ClientConfiguration::setEndpoint(const std::string &endpoint) { endpoint_ = endpoint; } void ClientConfiguration::setProxy(const NetworkProxy &proxy) { proxy_ = proxy; } void ClientConfiguration::setRegionId(const std::string &regionId) { regionId_ = regionId; } long ClientConfiguration::connectTimeout() const { return connectTimeout_; } long ClientConfiguration::readTimeout() const { return readTimeout_; } void ClientConfiguration::setConnectTimeout(const long connectTimeout) { connectTimeout_ = connectTimeout; } void ClientConfiguration::setReadTimeout(const long readTimeout) { readTimeout_ = readTimeout; } bool ClientConfiguration::rejectUnauthorized() const { return rejectUnauthorized_; } void ClientConfiguration::setRejectUnauthorized(const bool rejectUnauthorized) { rejectUnauthorized_ = rejectUnauthorized; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/ClientConfiguration.cc
C++
apache-2.0
2,176
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <algorithm> #include <alibabacloud/core/AlibabaCloud.h> #include <alibabacloud/core/CommonClient.h> #include <alibabacloud/core/SimpleCredentialsProvider.h> #include <alibabacloud/core/location/LocationClient.h> #include <ctime> #include <iomanip> #include <sstream> #include <cstring> #ifdef __cplusplus extern "C" { #endif #if USE_AOS_TIME_POSIX_API #if ESP_PLATFORM #if MICROPY_PY_UCLOUD_AI #include "mpconfigport.h" #include "shared/timeutils/timeutils.h" extern void timeutils_seconds_since_2000_to_struct_time(mp_uint_t t, timeutils_struct_time_t *tm); #endif #include <sys/time.h> #else #include <posix/timer.h> #endif #endif #ifdef __cplusplus } #endif #include <alibabacloud/core/Utils.h> namespace AlibabaCloud { namespace { const std::string SERVICE_NAME = "Common"; } CommonClient::CommonClient(const Credentials &credentials, const ClientConfiguration &configuration) : CoreClient(SERVICE_NAME, configuration), credentialsProvider_( std::make_shared<SimpleCredentialsProvider>(credentials)), signer_(std::make_shared<HmacSha1Signer>()) {} CommonClient::CommonClient( const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration) : CoreClient(SERVICE_NAME, configuration), credentialsProvider_(credentialsProvider), signer_(std::make_shared<HmacSha1Signer>()) {} CommonClient::CommonClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration) : CoreClient(SERVICE_NAME, configuration), credentialsProvider_(std::make_shared<SimpleCredentialsProvider>( accessKeyId, accessKeySecret)), signer_(std::make_shared<HmacSha1Signer>()) {} CommonClient::~CommonClient() {} CommonClient::JsonOutcome CommonClient::makeRequest(const std::string &endpoint, const CommonRequest &msg, HttpRequest::Method method) const { auto outcome = AttemptRequest(endpoint, msg, method); if (outcome.isSuccess()) return JsonOutcome( std::string(outcome.result().body(), outcome.result().bodySize())); else return JsonOutcome(outcome.error()); } CommonClient::CommonResponseOutcome CommonClient::commonResponse(const CommonRequest &request) const { auto outcome = makeRequest(request.domain(), request, request.httpMethod()); if (outcome.isSuccess()) return CommonResponseOutcome(CommonResponse(outcome.result())); else return CommonResponseOutcome(Error(outcome.error())); } void CommonClient::commonResponseAsync( const CommonRequest &request, const CommonResponseAsyncHandler &handler, const std::shared_ptr<const AsyncCallerContext> &context) const { auto fn = [this, request, handler, context]() { handler(this, request, commonResponse(request), context); }; asyncExecute(new Runnable(fn)); } CommonClient::CommonResponseOutcomeCallable CommonClient::commonResponseCallable(const CommonRequest &request) const { auto task = std::make_shared<std::packaged_task<CommonResponseOutcome()>>( [this, request]() { return this->commonResponse(request); }); asyncExecute(new Runnable([task]() { (*task)(); })); return task->get_future(); } HttpRequest CommonClient::buildHttpRequest(const std::string &endpoint, const ServiceRequest &msg, HttpRequest::Method method) const { return buildHttpRequest(endpoint, static_cast<const CommonRequest &>(msg), //lk change dynamic_cast to static_cast method); } HttpRequest CommonClient::buildHttpRequest(const std::string &endpoint, const CommonRequest &msg, HttpRequest::Method method) const { if (msg.requestPattern() == CommonRequest::RpcPattern) return buildRpcHttpRequest(endpoint, msg, method); else return buildRoaHttpRequest(endpoint, msg, method); } HttpRequest CommonClient::buildRoaHttpRequest(const std::string &endpoint, const CommonRequest &msg, HttpRequest::Method method) const { const Credentials credentials = credentialsProvider_->getCredentials(); Url url; if (msg.scheme().empty()) { url.setScheme("https"); } else { url.setScheme(msg.scheme()); } url.setHost(endpoint); url.setPath(msg.resourcePath()); auto params = msg.headerParameters(); std::map<std::string, std::string> queryParams; for (const auto &p : params) { if (!p.second.empty()) queryParams[p.first] = p.second; } if (!queryParams.empty()) { std::stringstream queryString; for (const auto &p : queryParams) { if (p.second.empty()) queryString << "&" << p.first; else queryString << "&" << p.first << "=" << p.second; } url.setQuery(queryString.str().substr(1)); } HttpRequest request(url); request.setMethod(method); if (msg.connectTimeout() != kInvalidTimeout) { request.setConnectTimeout(msg.connectTimeout()); } else { request.setConnectTimeout(configuration().connectTimeout()); } if (msg.readTimeout() != kInvalidTimeout) { request.setReadTimeout(msg.readTimeout()); } else { request.setReadTimeout(configuration().readTimeout()); } if (msg.headerParameter("Accept").empty()) { request.setHeader("Accept", "application/json"); } else { request.setHeader("Accept", msg.headerParameter("Accept")); } std::stringstream ss; ss << msg.contentSize(); request.setHeader("Content-Length", ss.str()); if (msg.headerParameter("Content-Type").empty()) { request.setHeader("Content-Type", "application/octet-stream"); } else { request.setHeader("Content-Type", msg.headerParameter("Content-Type")); } request.setHeader("Content-MD5", ComputeContentMD5(msg.content(), msg.contentSize())); request.setBody(msg.content(), msg.contentSize()); #if USE_AOS_TIME_POSIX_API struct timespec currentTime; time_t t; clock_gettime(CLOCK_REALTIME, &currentTime); t = currentTime.tv_nsec/1000000000 + currentTime.tv_sec; #else std::time_t t = std::time(nullptr); #endif std::stringstream date; #if defined(__GNUG__) && __GNUC__ < 5 char tmbuff[26]; strftime(tmbuff, 26, "%a, %d %b %Y %T", std::gmtime(&t)); date << tmbuff << " GMT"; #else date << std::put_time(std::gmtime(&t), "%a, %d %b %Y %T GMT"); #endif request.setHeader("Date", date.str()); request.setHeader("Host", url.host()); request.setHeader("x-sdk-client", std::string("CPP/").append(ALIBABACLOUD_VERSION_STR)); request.setHeader("x-acs-region-id", configuration().regionId()); if (!credentials.sessionToken().empty()) request.setHeader("x-acs-security-token", credentials.sessionToken()); request.setHeader("x-acs-signature-method", signer_->name()); request.setHeader("x-acs-signature-nonce", GenerateUuid()); request.setHeader("x-acs-signature-version", signer_->version()); request.setHeader("x-acs-version", msg.version()); std::stringstream plaintext; plaintext << HttpMethodToString(method) << "\n" << request.header("Accept") << "\n" << request.header("Content-MD5") << "\n" << request.header("Content-Type") << "\n" << request.header("Date") << "\n" << canonicalizedHeaders(request.headers()); if (!url.hasQuery()) plaintext << url.path(); else plaintext << url.path() << "?" << url.query(); std::stringstream sign; sign << "acs " << credentials.accessKeyId() << ":" << signer_->generate(plaintext.str(), credentials.accessKeySecret()); request.setHeader("Authorization", sign.str()); return request; } HttpRequest CommonClient::buildRpcHttpRequest(const std::string &endpoint, const CommonRequest &msg, HttpRequest::Method method) const { const Credentials credentials = credentialsProvider_->getCredentials(); Url url; if (msg.scheme().empty()) { url.setScheme("https"); } else { url.setScheme(msg.scheme()); } url.setHost(endpoint); url.setPath(msg.resourcePath()); auto params = msg.queryParameters(); std::map<std::string, std::string> queryParams; for (const auto &p : params) { if (!p.second.empty()) queryParams[p.first] = p.second; } queryParams["AccessKeyId"] = credentials.accessKeyId(); queryParams["Format"] = "JSON"; queryParams["RegionId"] = configuration().regionId(); queryParams["SecurityToken"] = credentials.sessionToken(); queryParams["SignatureMethod"] = signer_->name(); queryParams["SignatureNonce"] = GenerateUuid(); queryParams["SignatureVersion"] = signer_->version(); #if USE_AOS_TIME_POSIX_API time_t t; struct timespec currentTime; clock_gettime(CLOCK_REALTIME, &currentTime); t = currentTime.tv_nsec/1000000000 + currentTime.tv_sec; #else std::time_t t = std::time(nullptr); #endif std::stringstream ss; #if defined(__GNUG__) && __GNUC__ < 5 char tmbuff[26]; strftime(tmbuff, 26, "%FT%TZ", std::gmtime(&t)); ss << tmbuff; #else #if ESP_PLATFORM && MICROPY_PY_UCLOUD_AI time_t now; struct tm *timeinfo = NULL; char GMT_DATA_TIME[30]; now = time(NULL); timeinfo = localtime(&now); memset(GMT_DATA_TIME, 0, sizeof(GMT_DATA_TIME)); strftime(GMT_DATA_TIME, sizeof(GMT_DATA_TIME), "%FT%TZ", timeinfo); ss << GMT_DATA_TIME; #else ss << std::put_time(std::gmtime(&t), "%FT%TZ"); #endif #endif queryParams["Timestamp"] = ss.str(); queryParams["Version"] = msg.version(); std::string bodyParamString; auto signParams = queryParams; auto bodyParams = msg.bodyParameters(); for (const auto &p : bodyParams) { bodyParamString += "&"; bodyParamString += (p.first + "=" + UrlEncode(p.second)); signParams[p.first] = p.second; } std::stringstream plaintext; plaintext << HttpMethodToString(method) << "&" << UrlEncode(url.path()) << "&" << UrlEncode(canonicalizedQuery(signParams)); queryParams["Signature"] = signer_->generate(plaintext.str(), credentials.accessKeySecret() + "&"); std::stringstream queryString; for (const auto &p : queryParams) queryString << "&" << p.first << "=" << UrlEncode(p.second); url.setQuery(queryString.str().substr(1)); HttpRequest request(url); if (msg.connectTimeout() != kInvalidTimeout) { request.setConnectTimeout(msg.connectTimeout()); } else { request.setConnectTimeout(configuration().connectTimeout()); } if (msg.readTimeout() != kInvalidTimeout) { request.setReadTimeout(msg.readTimeout()); } else { request.setReadTimeout(configuration().readTimeout()); } request.setMethod(method); request.setHeader("Host", url.host()); request.setHeader("x-sdk-client", std::string("CPP/").append(ALIBABACLOUD_VERSION_STR)); if (!bodyParamString.empty()) { request.setBody(bodyParamString.c_str() + 1, bodyParamString.size() - 1); } return request; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/CommonClient.cc
C++
apache-2.0
11,820
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/CommonRequest.h> namespace AlibabaCloud { CommonRequest::CommonRequest(RequestPattern pattern) : ServiceRequest("", ""), domain_(), queryParams_(), httpMethod_(HttpRequest::Get), requestPattern_(pattern) {} CommonRequest::~CommonRequest() {} std::string CommonRequest::domain() const { return domain_; } void CommonRequest::setDomain(const std::string &domain) { domain_ = domain; } CommonRequest::RequestPattern CommonRequest::requestPattern() const { return requestPattern_; } void CommonRequest::setRequestPattern(RequestPattern pattern) { requestPattern_ = pattern; } void CommonRequest::setHttpMethod(HttpRequest::Method method) { httpMethod_ = method; } HttpRequest::Method CommonRequest::httpMethod() const { return httpMethod_; } CommonRequest::ParameterValueType CommonRequest::queryParameter(const ParameterNameType &name) const { ParameterCollection::const_iterator it = queryParams_.find(name); if (it == queryParams_.end()) { return ParameterValueType(""); } return it->second; } CommonRequest::ParameterCollection CommonRequest::queryParameters() const { return queryParams_; } void CommonRequest::setQueryParameter(const ParameterNameType &name, const ParameterValueType &value) { queryParams_[name] = value; } CommonRequest::ParameterValueType CommonRequest::headerParameter(const ParameterNameType &name) const { const ParameterCollection::const_iterator it = headerParams_.find(name); if (it == headerParams_.end()) { return ParameterValueType(""); } return it->second; } CommonRequest::ParameterCollection CommonRequest::headerParameters() const { return headerParams_; } void CommonRequest::setHeaderParameter(const ParameterNameType &name, const ParameterValueType &value) { headerParams_[name] = value; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/CommonRequest.cc
C++
apache-2.0
2,549
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/CommonResponse.h> namespace AlibabaCloud { CommonResponse::CommonResponse() : payload_() {} CommonResponse::CommonResponse(const std::string &payload) : payload_(payload) {} CommonResponse::~CommonResponse() {} std::string CommonResponse::payload() const { return payload_; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/CommonResponse.cc
C++
apache-2.0
967
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "CurlHttpClient.h" #include "Executor.h" #include <alibabacloud/core/CoreClient.h> #include <alibabacloud/core/Signer.h> #include <alibabacloud/core/Utils.h> #include <json/json.h> /*! * \class AlibabaCloud::CoreClient CoreClient.h <alibabacloud/core/CoreClient.h> * */ namespace AlibabaCloud { CoreClient::CoreClient(const std::string &servicename, const ClientConfiguration &configuration) : serviceName_(servicename), configuration_(configuration), httpClient_(new CurlHttpClient) { httpClient_->setProxy(configuration.proxy()); httpClient_->setRejectUnauthorized(configuration.rejectUnauthorized()); } CoreClient::~CoreClient() { delete httpClient_; } ClientConfiguration CoreClient::configuration() const { return configuration_; } std::string CoreClient::serviceName() const { return serviceName_; } void CoreClient::asyncExecute(Runnable *r) const { Executor::instance()->execute(r); } HttpClient::HttpResponseOutcome CoreClient::AttemptRequest(const std::string &endpoint, const ServiceRequest &request, HttpRequest::Method method) const { auto r = buildHttpRequest(endpoint, request, method); auto outcome = httpClient_->makeRequest(r); if (!outcome.isSuccess()) return outcome; if (hasResponseError(outcome.result())) return HttpClient::HttpResponseOutcome(buildCoreError(outcome.result())); else return outcome; } Error CoreClient::buildCoreError(const HttpResponse &response) const { Json::Reader reader; Json::Value value; if (!reader.parse(std::string(response.body(), response.bodySize()), value)) { if (response.bodySize() > 0) { return Error("InvalidResponse", response.body()); } else { return Error("InvalidResponse", "body is empty"); } } Error error; error.setErrorCode(value["Code"].asString()); error.setErrorMessage(value["Message"].asString()); error.setHost(value["HostId"].asString()); error.setRequestId(value["RequestId"].asString()); if (value["Code"].asString().empty() || value["Message"].asString().empty()) { error.setDetail(std::string(response.body())); } return error; } bool CoreClient::hasResponseError(const HttpResponse &response) const { return response.statusCode() < 200 || response.statusCode() > 299; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/CoreClient.cc
C++
apache-2.0
2,995
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/Credentials.h> namespace AlibabaCloud { Credentials::Credentials(const std::string &accessKeyId, const std::string &accessKeySecret, const std::string &sessionToken) : accessKeyId_(accessKeyId), accessKeySecret_(accessKeySecret), sessionToken_(sessionToken) {} Credentials::~Credentials() {} std::string Credentials::accessKeyId() const { return accessKeyId_; } std::string Credentials::accessKeySecret() const { return accessKeySecret_; } void Credentials::setAccessKeyId(const std::string &accessKeyId) { accessKeyId_ = accessKeyId; } void Credentials::setAccessKeySecret(const std::string &accessKeySecret) { accessKeySecret_ = accessKeySecret; } void Credentials::setSessionToken(const std::string &sessionToken) { sessionToken_ = sessionToken; } std::string Credentials::sessionToken() const { return sessionToken_; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/Credentials.cc
C++
apache-2.0
1,580
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/CredentialsProvider.h>
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/CredentialsProvider.cc
C++
apache-2.0
676
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "CurlHttpClient.h" #include <alibabacloud/core/Utils.h> #include <cassert> #include <sstream> #include <string.h> #include <string> #include <vector> namespace AlibabaCloud { namespace { typedef struct { const char *data; const char *pos; const char *last; } uploadContext; static size_t readCallback(void *ptr, size_t size, size_t nmemb, void *stream) { uploadContext *ctx = (uploadContext *)stream; size_t len = 0; if (ctx->pos >= ctx->last) { return 0; } if ((size == 0) || (nmemb == 0) || (size * nmemb < 1)) { return 0; } len = ctx->last - ctx->pos; if (len > size * nmemb) { len = size * nmemb; } memcpy(ptr, ctx->pos, len); ctx->pos += len; return len; } size_t recvBody(char *ptr, size_t size, size_t nmemb, void *userdata) { std::ostringstream &out = *static_cast<std::ostringstream *>(userdata); out << std::string(ptr, nmemb * size); return nmemb * size; } size_t recvHeaders(char *buffer, size_t size, size_t nitems, void *userdata) { HttpResponse *response = static_cast<HttpResponse *>(userdata); std::string line(buffer); auto pos = line.find(':'); if (pos != line.npos) { std::string name = line.substr(0, pos); std::string value = line.substr(pos + 2); size_t p = 0; if ((p = value.rfind('\r')) != value.npos) value[p] = '\0'; response->setHeader(name, value); } return nitems * size; } void setCUrlProxy(CURL *curlHandle, const NetworkProxy &proxy) { if (proxy.type() == NetworkProxy::Type::None) return; long type; switch (proxy.type()) { case NetworkProxy::Type::Socks5: type = CURLPROXY_SOCKS5; break; case NetworkProxy::Type::Http: default: type = CURLPROXY_HTTP; break; } curl_easy_setopt(curlHandle, CURLOPT_PROXYTYPE, type); std::ostringstream out; out << proxy.hostName() << ":" << proxy.port(); curl_easy_setopt(curlHandle, CURLOPT_PROXY, out.str().c_str()); if (!proxy.user().empty()) { out.clear(); out << proxy.user() << ":" << proxy.password(); curl_easy_setopt(curlHandle, CURLOPT_PROXYUSERPWD, out.str().c_str()); } } } // namespace CurlHttpClient::CurlHttpClient() : HttpClient(), curlHandle_(curl_easy_init()) {} CurlHttpClient::~CurlHttpClient() { curl_easy_cleanup(curlHandle_); } HttpClient::HttpResponseOutcome CurlHttpClient::makeRequest(const HttpRequest &request) { curl_easy_reset(curlHandle_); HttpResponse response(request); long connect_timeout = request.connectTimeout(); long read_timeout = request.readTimeout(); std::string url = request.url().toString(); switch (request.method()) { case HttpRequest::Method::Get: break; case HttpRequest::Method::Post: { if (request.bodySize() > 0) { curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, request.body()); } else { curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, ""); } } break; case HttpRequest::Method::Put: { uploadContext *ctx = (uploadContext *)malloc(sizeof(uploadContext)); // this is impossible, as the size is 24 Bytes if (ctx == nullptr) { return HttpResponseOutcome( Error("MemoryAllocateError", "There is not enough memory for http transfer.")); } ctx->data = request.body(); ctx->pos = request.body(); ctx->last = ctx->pos + request.bodySize(); curl_easy_setopt(curlHandle_, CURLOPT_READFUNCTION, readCallback); curl_easy_setopt(curlHandle_, CURLOPT_UPLOAD, 1L); curl_easy_setopt(curlHandle_, CURLOPT_READDATA, ctx); } break; case HttpRequest::Method::Delete: { curl_easy_setopt(curlHandle_, CURLOPT_CUSTOMREQUEST, "DELETE"); if (request.bodySize() > 0) { curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, request.body()); } else { curl_easy_setopt(curlHandle_, CURLOPT_POSTFIELDS, ""); } } break; default: break; } //printf("url string: %s\n", url.c_str()); //printf("request.body: %s\n", request.body()); curl_easy_setopt(curlHandle_, CURLOPT_URL, url.c_str()); if (rejectUnauthorized()) { curl_easy_setopt(curlHandle_, CURLOPT_SSL_VERIFYPEER, 1L); curl_easy_setopt(curlHandle_, CURLOPT_SSL_VERIFYHOST, 2L); } else { curl_easy_setopt(curlHandle_, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(curlHandle_, CURLOPT_SSL_VERIFYHOST, 0L); } curl_easy_setopt(curlHandle_, CURLOPT_HEADERDATA, &response); curl_easy_setopt(curlHandle_, CURLOPT_HEADERFUNCTION, recvHeaders); if (connect_timeout > 0) { curl_easy_setopt(curlHandle_, CURLOPT_CONNECTTIMEOUT_MS, connect_timeout); } if (read_timeout > 0) { curl_easy_setopt(curlHandle_, CURLOPT_TIMEOUT_MS, read_timeout); } curl_slist *list = nullptr; auto headers = request.headers(); for (const auto &p : headers) { std::string str = p.first; str.append(": ").append(p.second); list = curl_slist_append(list, str.c_str()); } curl_easy_setopt(curlHandle_, CURLOPT_HTTPHEADER, list); std::ostringstream out; curl_easy_setopt(curlHandle_, CURLOPT_WRITEDATA, &out); curl_easy_setopt(curlHandle_, CURLOPT_WRITEFUNCTION, recvBody); setCUrlProxy(curlHandle_, proxy()); if (GetEnv("DEBUG") == "sdk") { curl_easy_setopt(curlHandle_, CURLOPT_VERBOSE, 1L); } CURLcode res = curl_easy_perform(curlHandle_); switch (res) { case CURLE_OK: { long response_code; curl_easy_getinfo(curlHandle_, CURLINFO_RESPONSE_CODE, &response_code); response.setStatusCode(response_code); response.setBody(out.str().c_str(), out.str().length()); return HttpResponseOutcome(response); } case CURLE_SSL_CONNECT_ERROR: return HttpResponseOutcome( Error("SSLConnectError", "A problem occurred somewhere in the SSL/TLS handshake.")); case CURLE_OPERATION_TIMEDOUT: return HttpResponseOutcome( Error("OperationTimeoutError", "Timeout (connectTimeout: " + std::to_string(connect_timeout) + "ms, readTimeout: " + std::to_string(read_timeout) + "ms) when connect or read data: " + HttpMethodToString(request.method()) + " " + request.url().toString())); default: { return HttpResponseOutcome( Error("NetworkError", "Failed to connect to host or proxy: " + HttpMethodToString(request.method()) + " " + request.url().toString())); } } curl_slist_free_all(list); } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/CurlHttpClient.cc
C++
apache-2.0
7,105
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_SRC_CURLHTTPCLIENT_H_ #define CORE_SRC_CURLHTTPCLIENT_H_ #include <alibabacloud/core/HttpClient.h> #include <curl/curl.h> namespace AlibabaCloud { class CurlHttpClient : public HttpClient { public: CurlHttpClient(); ~CurlHttpClient(); HttpResponseOutcome makeRequest(const HttpRequest &request) override; private: CURL *curlHandle_; }; } // namespace AlibabaCloud #endif // CORE_SRC_CURLHTTPCLIENT_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/CurlHttpClient.h
C++
apache-2.0
1,052
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "EcsMetadataFetcher.h" #include "CurlHttpClient.h" #include <alibabacloud/core/Url.h> #include <memory> #include <sstream> namespace AlibabaCloud { EcsMetadataFetcher::EcsMetadataFetcher() {} EcsMetadataFetcher::~EcsMetadataFetcher() {} std::string EcsMetadataFetcher::roleName() const { return roleName_; } void EcsMetadataFetcher::setRoleName(const std::string &roleName) { roleName_ = roleName; } std::string EcsMetadataFetcher::getMetadata() { return getMetadata(METADATA_SERVICE_HOST, URL_IN_ECS_METADATA); } std::string EcsMetadataFetcher::getMetadata(const std::string host, const std::string in_path) { std::stringstream path; path << in_path << roleName_; Url credentialUrl; credentialUrl.setHost(host); credentialUrl.setPath(path.str()); auto client = std::make_shared<CurlHttpClient>(); HttpRequest request; request.setUrl(credentialUrl); auto outcome = client->makeRequest(request); if (outcome.isSuccess()) return std::string(outcome.result().body(), outcome.result().bodySize()); else return outcome.error().errorCode(); } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/EcsMetadataFetcher.cc
C++
apache-2.0
1,789
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_SRC_ECSMETADATAFETCHER_H_ #define CORE_SRC_ECSMETADATAFETCHER_H_ #include <string> namespace { const int DEFAULT_TIMEOUT_IN_MILLISECONDS = 5000; const char *const METADATA_SERVICE_HOST = "100.100.100.200"; const char *const URL_IN_ECS_METADATA = "/latest/meta-data/ram/security-credentials/"; } // namespace namespace AlibabaCloud { class EcsMetadataFetcher { public: EcsMetadataFetcher(); ~EcsMetadataFetcher(); std::string roleName() const; void setRoleName(const std::string &roleName); std::string getMetadata(const std::string host, const std::string path); virtual std::string getMetadata(); private: std::string roleName_; }; } // namespace AlibabaCloud #endif // CORE_SRC_ECSMETADATAFETCHER_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/EcsMetadataFetcher.h
C++
apache-2.0
1,364
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <algorithm> #include <alibabacloud/core/EndpointProvider.h> #include <condition_variable> #include <iomanip> #include <json/json.h> #include <mutex> #include <sstream> #include <thread> #if USE_AOS_TIME_POSIX_API #if ESP_PLATFORM #include <sys/time.h> #else #include <posix/timer.h> #endif #endif #ifndef WIN32 #include "LocalEndpoints.h" #include <alibabacloud/core/Utils.h> #else #include "LocalEndpointsForWindows.h" #endif namespace AlibabaCloud { namespace { #if defined(WIN32) && defined(_MSC_VER) #define strcasecmp _stricmp #define strncasecmp _strnicmp #else #include <strings.h> #endif std::mutex mutex; std::condition_variable cv; bool local_endpoints_loaded = false; bool local_endpoints_loading = false; typedef std::string productType; typedef std::string regionType; typedef std::string endpointType; typedef std::string mappingType; typedef std::vector<regionType> regionsType; typedef std::map<productType, endpointType> regionalType; typedef struct { regionsType regions; regionalType regional; } productInfoType; static std::vector<regionType> allRegions; static std::vector<productType> allProductsInLocalEndpoints; static std::map<productType, productInfoType> allLocalEndpoints; static void LoadLocalEndpoints() { Json::Reader reader; Json::Value value; std::unique_lock<std::mutex> lock(mutex); if (local_endpoints_loaded) { return; } #ifdef WIN32 std::string LOCAL_ENDPOINTS_CONFIG = WIN_LOCAL_ENDPOINTS_CONFIG_1 + WIN_LOCAL_ENDPOINTS_CONFIG_2 + WIN_LOCAL_ENDPOINTS_CONFIG_3; #endif if (!reader.parse(LOCAL_ENDPOINTS_CONFIG, value)) { return; } cv.wait(lock, [] { return !local_endpoints_loading; }); // continue if loading completed local_endpoints_loading = true; auto regions = value["regions"]; for (const auto &region : regions) { allRegions.push_back(region.asString()); } auto products = value["products"]; for (const auto &product : products) { allProductsInLocalEndpoints.push_back(product.asString()); } auto endpoints = value["endpoints"]; for (auto &product : allProductsInLocalEndpoints) { auto endpoint_per_product = endpoints[product]; productInfoType p; auto regions = endpoint_per_product["regions"]; auto regional = endpoint_per_product["regional"]; for (auto &r : regions) { const std::string region = r.asString(); p.regions.push_back(region); p.regional[region] = endpoint_per_product["regional"][region].asString(); } allLocalEndpoints[product] = p; } local_endpoints_loaded = true; local_endpoints_loading = false; lock.unlock(); cv.notify_one(); } } // namespace EndpointProvider::EndpointProvider( const std::shared_ptr<Location::LocationClient> &locationClient, const std::string regionId, const std::string product, const std::string serviceCode, int durationSeconds) : LocationClient(locationClient), regionId_(regionId), product_(product), serviceCode_(serviceCode), durationSeconds_(durationSeconds), cachedMutex_(), cachedEndpoint_(), expiry_() { transform(product_.begin(), product_.end(), product_.begin(), ::tolower); loadLocalProductsInfo(); } EndpointProvider::EndpointProvider(const Credentials &credentials, const ClientConfiguration &configuration, const std::string &regionId, const std::string &product, const std::string &serviceCode, int durationSeconds) : LocationClient(credentials, configuration), regionId_(regionId), product_(product), serviceCode_(serviceCode), durationSeconds_(durationSeconds), cachedMutex_(), cachedEndpoint_(), expiry_() { transform(product_.begin(), product_.end(), product_.begin(), ::tolower); loadLocalProductsInfo(); } EndpointProvider::~EndpointProvider() {} bool EndpointProvider::loadLocalProductsInfo() { LoadLocalEndpoints(); return true; } std::string EndpointProvider::localEndpoint(const std::string regionId, const std::string product) { if (!local_endpoints_loaded) { // impossible return std::string(); } std::vector<regionType>::iterator allRegionsit; allRegionsit = std::find(allRegions.begin(), allRegions.end(), regionId); if (allRegionsit == allRegions.end()) { return std::string(); } std::vector<productType>::iterator allProductsInLocalEndpointsit; allProductsInLocalEndpointsit = std::find(allProductsInLocalEndpoints.begin(), allProductsInLocalEndpoints.end(), product); if (allProductsInLocalEndpointsit == allProductsInLocalEndpoints.end()) { return std::string(); } std::vector<regionType> vec = allLocalEndpoints[product].regions; std::vector<regionType>::iterator it; it = std::find(vec.begin(), vec.end(), regionId); if (it == vec.end()) { return std::string(); } return allLocalEndpoints[product].regional[regionId]; } bool EndpointProvider::checkExpiry() const { auto now = std::chrono::system_clock::now(); auto diff = std::chrono::duration_cast<std::chrono::seconds>(now - expiry_).count(); return (diff > 0 - 60); } EndpointProvider::EndpointOutcome EndpointProvider::getEndpoint() { // 1st priority: user specified via configuration if (!configuration().endpoint().empty()) { return EndpointOutcome(configuration().endpoint()); } // 2nd priority: local configuration std::string endpoint = localEndpoint(regionId_, product_); if (!endpoint.empty()) { return EndpointOutcome(endpoint); } // service code is mandatory for location service. if (serviceCode_.empty()) { return EndpointOutcome( Error("InvalidRegionId", "Product[" + product_ + "] at region[" + regionId_ + "] does not exist.")); } // 3rd priority: request from location service EndpointOutcome outcome = loadRemoteEndpoint(); if (outcome.isSuccess()) { return outcome; } if (outcome.error().errorCode() == "Illegal Parameter") { return EndpointOutcome(Error("InvalidProduct", "Prodcut[" + serviceCode_ + "] does not exist.")); } return outcome; } EndpointProvider::EndpointOutcome EndpointProvider::loadRemoteEndpoint() { if (checkExpiry()) { std::lock_guard<std::mutex> locker(cachedMutex_); if (checkExpiry()) { Location::Model::DescribeEndpointsRequest request; request.setId(regionId_); request.setServiceCode(serviceCode_); request.setType("openAPI"); auto outcome = describeEndpoints(request); if (!outcome.isSuccess()) return EndpointOutcome(outcome.error()); auto all = outcome.result().endpoints(); if (all.size() > 0) cachedEndpoint_ = all.front().endpoint; #if USE_AOS_TIME_POSIX_API struct timespec currentTime; time_t t; clock_gettime(CLOCK_REALTIME, &currentTime); t = currentTime.tv_nsec/1000000000 + currentTime.tv_sec + durationSeconds_; #else std::time_t t = std::time(nullptr) + durationSeconds_; #endif expiry_ = std::chrono::system_clock::from_time_t(t); } } return EndpointOutcome(cachedEndpoint_); } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/EndpointProvider.cc
C++
apache-2.0
8,049
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/Error.h> namespace AlibabaCloud { Error::Error(std::string code, const std::string message) : errorCode_(code), message_(message), host_(), requestId_(), detail_() {} std::string Error::errorCode() const { return errorCode_; } std::string Error::errorMessage() const { return message_; } std::string Error::host() const { return host_; } std::string Error::requestId() const { return requestId_; } std::string Error::detail() const { return detail_; } void Error::setErrorCode(const std::string &code) { errorCode_ = code; } void Error::setErrorMessage(const std::string &message) { message_ = message; } void Error::setHost(const std::string &host) { host_ = host; } void Error::setRequestId(const std::string &request) { requestId_ = request; } void Error::setDetail(const std::string &detail) { detail_ = detail; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/Error.cc
C++
apache-2.0
1,507
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "Executor.h" #include <alibabacloud/core/Runnable.h> namespace AlibabaCloud { Executor *Executor::self_ = nullptr; Executor::Executor() : cvMutex_(), shutdown_(true), tasksQueue_(), tasksQueueMutex_(), thread_() { self_ = this; } Executor::~Executor() { self_ = nullptr; shutdown(); } Executor *Executor::instance() { return self_; } bool Executor::start() { if (!isShutdown()) return true; auto threadMain = [this]() { while (!shutdown_) { while (!tasksQueue_.empty()) { Runnable *task = nullptr; { std::lock_guard<std::mutex> lock(tasksQueueMutex_); if (!tasksQueue_.empty()) { task = tasksQueue_.front(); tasksQueue_.pop(); } } if (task) { task->run(); delete task; } } if (!shutdown_) { std::unique_lock<std::mutex> lk(cvMutex_); cv_.wait(lk); } } }; shutdown_ = false; thread_ = std::thread(threadMain); return true; } bool Executor::isShutdown() const { return shutdown_; } void Executor::execute(Runnable *task) { if (isShutdown()) return; std::lock_guard<std::mutex> locker(tasksQueueMutex_); tasksQueue_.push(task); wakeUp(); } void Executor::wakeUp() { std::unique_lock<std::mutex> lk(cvMutex_); cv_.notify_one(); } void Executor::shutdown() { if (isShutdown()) return; { std::lock_guard<std::mutex> locker(tasksQueueMutex_); while (tasksQueue_.size() > 0) { auto task = tasksQueue_.front(); delete task; tasksQueue_.pop(); } } shutdown_ = true; wakeUp(); if (thread_.joinable()) thread_.join(); } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/Executor.cc
C++
apache-2.0
2,349
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef CORE_SRC_EXECUTOR_H_ #define CORE_SRC_EXECUTOR_H_ #include <atomic> #include <condition_variable> #include <mutex> #include <queue> #include <thread> #include <vector> namespace AlibabaCloud { class Runnable; class Executor { public: Executor(); ~Executor(); static Executor *instance(); void execute(Runnable *task); bool isShutdown() const; bool start(); void shutdown(); void wakeUp(); private: static Executor *self_; std::atomic<bool> shutdown_; std::queue<Runnable *> tasksQueue_; std::mutex tasksQueueMutex_; std::thread thread_; std::condition_variable cv_; std::mutex cvMutex_; }; } // namespace AlibabaCloud #endif // CORE_SRC_EXECUTOR_H_
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/Executor.h
C++
apache-2.0
1,317
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/HmacSha1Signer.h> #ifdef _WIN32 #include <wincrypt.h> #include <windows.h> #elif defined(USE_CRYPTO_MBEDTLS) #include "mbedtls/compat-1.3.h" #include "mbedtls/sha1.h" #include "mbedtls/base64.h" #include "mbedtls/md.h" #else #include <openssl/hmac.h> #endif namespace AlibabaCloud { HmacSha1Signer::HmacSha1Signer() : Signer(HmacSha1, "HMAC-SHA1", "1.0") {} HmacSha1Signer::~HmacSha1Signer() {} std::string HmacSha1Signer::generate(const std::string &src, const std::string &secret) const { if (src.empty()) return std::string(); #ifdef _WIN32 typedef struct _my_blob { BLOBHEADER hdr; DWORD dwKeySize; BYTE rgbKeyData[]; } my_blob; DWORD kbLen = sizeof(my_blob) + secret.size(); my_blob *kb = (my_blob *)LocalAlloc(LPTR, kbLen); kb->hdr.bType = PLAINTEXTKEYBLOB; kb->hdr.bVersion = CUR_BLOB_VERSION; kb->hdr.reserved = 0; kb->hdr.aiKeyAlg = CALG_RC2; kb->dwKeySize = secret.size(); memcpy(&kb->rgbKeyData, secret.c_str(), secret.size()); HCRYPTPROV hProv = 0; HCRYPTKEY hKey = 0; HCRYPTHASH hHmacHash = 0; BYTE pbHash[32]; DWORD dwDataLen = 32; HMAC_INFO HmacInfo; ZeroMemory(&HmacInfo, sizeof(HmacInfo)); HmacInfo.HashAlgid = CALG_SHA1; CryptAcquireContext(&hProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_NEWKEYSET); CryptImportKey(hProv, (BYTE *)kb, kbLen, 0, CRYPT_IPSEC_HMAC_KEY, &hKey); CryptCreateHash(hProv, CALG_HMAC, hKey, 0, &hHmacHash); CryptSetHashParam(hHmacHash, HP_HMAC_INFO, (BYTE *)&HmacInfo, 0); CryptHashData(hHmacHash, (BYTE *)(src.c_str()), src.size(), 0); CryptGetHashParam(hHmacHash, HP_HASHVAL, pbHash, &dwDataLen, 0); LocalFree(kb); CryptDestroyHash(hHmacHash); CryptDestroyKey(hKey); CryptReleaseContext(hProv, 0); DWORD dlen = 0; CryptBinaryToString(pbHash, dwDataLen, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, NULL, &dlen); char *dest = new char[dlen]; CryptBinaryToString(pbHash, dwDataLen, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, dest, &dlen); std::string ret = std::string(dest, dlen); delete dest; return ret; #elif defined(USE_CRYPTO_MBEDTLS) unsigned char md[20]; unsigned int mdLen = 20; size_t olen = 0; mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA1), reinterpret_cast<const unsigned char*>(secret.c_str()),static_cast<int>(secret.size()), reinterpret_cast<const unsigned char*>(src.c_str()), src.size(), (unsigned char *)md); char encodedData[100]; mbedtls_base64_encode((unsigned char*)encodedData, sizeof(encodedData), &olen, md, mdLen); return encodedData; #else unsigned char md[EVP_MAX_BLOCK_LENGTH]; unsigned int mdLen = EVP_MAX_BLOCK_LENGTH; if (HMAC(EVP_sha1(), secret.c_str(), secret.size(), reinterpret_cast<const unsigned char *>(src.c_str()), src.size(), md, &mdLen) == nullptr) return std::string(); char encodedData[100]; EVP_EncodeBlock(reinterpret_cast<unsigned char *>(encodedData), md, mdLen); return encodedData; #endif } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/HmacSha1Signer.cc
C++
apache-2.0
3,814
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/HttpClient.h> #include <cassert> #include <sstream> #include <vector> namespace AlibabaCloud { HttpClient::HttpClient() : proxy_() {} HttpClient::~HttpClient() {} NetworkProxy HttpClient::proxy() const { return proxy_; } void HttpClient::setProxy(const NetworkProxy &proxy) { proxy_ = proxy; } bool HttpClient::rejectUnauthorized() const { return rejectUnauthorized_; } void HttpClient::setRejectUnauthorized(const bool &rejectUnauthorized) { rejectUnauthorized_ = rejectUnauthorized; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/HttpClient.cc
C++
apache-2.0
1,178
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <algorithm> #include <alibabacloud/core/HttpMessage.h> namespace AlibabaCloud { namespace { #if defined(WIN32) && defined(_MSC_VER) #define strcasecmp _stricmp #define strncasecmp _strnicmp #else #include <strings.h> #endif std::string KnownHeaderMapper[]{"Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language", "Authorization", "Connection", "Content-Length", "Content-MD5", "Content-Type", "Date", "Host", "Server", "User-Agent"}; } // namespace HttpMessage::HttpMessage() : body_(nullptr), bodySize_(0), headers_() {} HttpMessage::HttpMessage(const HttpMessage &other) : body_(nullptr), bodySize_(other.bodySize_), headers_(other.headers_) { setBody(other.body_, other.bodySize_); } HttpMessage::HttpMessage(HttpMessage &&other) { *this = std::move(other); } HttpMessage &HttpMessage::operator=(const HttpMessage &other) { if (this != &other) { body_ = nullptr; bodySize_ = 0; headers_ = other.headers_; setBody(other.body_, other.bodySize_); } return *this; } HttpMessage &HttpMessage::operator=(HttpMessage &&other) { if (this != &other) *this = std::move(other); return *this; } void HttpMessage::addHeader(const HeaderNameType &name, const HeaderValueType &value) { setHeader(name, value); } void HttpMessage::addHeader(KnownHeader header, const HeaderValueType &value) { setHeader(header, value); } HttpMessage::HeaderValueType HttpMessage::header(const HeaderNameType &name) const { auto it = headers_.find(name); if (it != headers_.end()) return it->second; else return std::string(); } HttpMessage::HeaderCollection HttpMessage::headers() const { return headers_; } void HttpMessage::removeHeader(const HeaderNameType &name) { headers_.erase(name); } void HttpMessage::removeHeader(KnownHeader header) { removeHeader(KnownHeaderMapper[header]); } void HttpMessage::setHeader(const HeaderNameType &name, const HeaderValueType &value) { headers_[name] = value; } void HttpMessage::setHeader(KnownHeader header, const std::string &value) { setHeader(KnownHeaderMapper[header], value); } HttpMessage::~HttpMessage() { setBody(nullptr, 0); } const char *HttpMessage::body() const { return body_; } size_t HttpMessage::bodySize() const { return bodySize_; } bool HttpMessage::hasBody() const { return (bodySize_ != 0); } HttpMessage::HeaderValueType HttpMessage::header(KnownHeader header) const { return this->header(KnownHeaderMapper[header]); } void HttpMessage::setBody(const char *data, size_t size) { if (body_) delete[] body_; body_ = nullptr; bodySize_ = 0; if (size) { bodySize_ = size; body_ = new char[size + 1]; std::copy(data, data + size, body_); body_[size] = '\0'; } } bool HttpMessage::nocaseLess::operator()(const std::string &s1, const std::string &s2) const { return strcasecmp(s1.c_str(), s2.c_str()) < 0; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/HttpMessage.cc
C++
apache-2.0
4,007
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/AlibabaCloud.h> #include <alibabacloud/core/HttpRequest.h> namespace AlibabaCloud { HttpRequest::HttpRequest(const Url &url, Method method) : HttpMessage(), url_(url), method_(method), connectTimeout_(kDefaultConnectTimeout), readTimeout_(kDefaultReadTimeout) {} HttpRequest::~HttpRequest() {} HttpRequest::Method HttpRequest::method() const { return method_; } void HttpRequest::setMethod(Method method) { method_ = method; } void HttpRequest::setUrl(const Url &url) { url_ = url; } Url HttpRequest::url() const { return url_; } long HttpRequest::connectTimeout() const { return connectTimeout_; } long HttpRequest::readTimeout() const { return readTimeout_; } void HttpRequest::setConnectTimeout(const long connectTimeout) { connectTimeout_ = connectTimeout; } void HttpRequest::setReadTimeout(const long readTimeout) { readTimeout_ = readTimeout; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/HttpRequest.cc
C++
apache-2.0
1,565
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/HttpResponse.h> namespace { #define INVALID_STATUS_CODE -1 } // namespace namespace AlibabaCloud { HttpResponse::HttpResponse() : HttpMessage(), request_(), statusCode_(INVALID_STATUS_CODE) {} HttpResponse::HttpResponse(const HttpRequest &request) : HttpMessage(), request_(request), statusCode_(INVALID_STATUS_CODE) {} HttpResponse::~HttpResponse() {} HttpRequest HttpResponse::request() const { return request_; } void HttpResponse::setStatusCode(int code) { statusCode_ = code; } int HttpResponse::statusCode() const { return statusCode_; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/HttpResponse.cc
C++
apache-2.0
1,242
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "EcsMetadataFetcher.h" #include <alibabacloud/core/InstanceProfileCredentialsProvider.h> #include <alibabacloud/core/Utils.h> #include <chrono> #include <iomanip> #include <json/json.h> #include <mutex> #include <sstream> namespace AlibabaCloud { InstanceProfileCredentialsProvider::InstanceProfileCredentialsProvider( const std::string &roleName, int durationSeconds) : CredentialsProvider(), EcsMetadataFetcher(), durationSeconds_(durationSeconds), cachedMutex_(), cachedCredentials_("", ""), expiry_() { setRoleName(roleName); } InstanceProfileCredentialsProvider::~InstanceProfileCredentialsProvider() {} Credentials InstanceProfileCredentialsProvider::getCredentials() { loadCredentials(); std::lock_guard<std::mutex> locker(cachedMutex_); return cachedCredentials_; } bool InstanceProfileCredentialsProvider::checkExpiry() const { auto now = std::chrono::system_clock::now(); auto diff = std::chrono::duration_cast<std::chrono::seconds>(now - expiry_).count(); return (diff > 0 - 60); } void InstanceProfileCredentialsProvider::loadCredentials() { if (checkExpiry()) { std::lock_guard<std::mutex> locker(cachedMutex_); if (checkExpiry()) { auto outcome = getMetadata(); Json::Value value; Json::Reader reader; if (reader.parse(outcome, value)) { if (value["Code"].empty() && value["AccessKeyId"].empty() && value["AccessKeySecret"].empty() && value["SecurityToken"].empty() && value["Expiration"].empty()) { cachedCredentials_ = Credentials("", ""); return; } auto code = value["Code"].asString(); auto accessKeyId = value["AccessKeyId"].asString(); auto accessKeySecret = value["AccessKeySecret"].asString(); auto securityToken = value["SecurityToken"].asString(); auto expiration = value["Expiration"].asString(); cachedCredentials_ = Credentials(accessKeyId, accessKeySecret, securityToken); std::tm tm = {}; #if defined(__GNUG__) && __GNUC__ < 5 strptime(expiration.c_str(), "%Y-%m-%dT%H:%M:%SZ", &tm); #else std::stringstream ss(expiration); ss >> std::get_time(&tm, "%Y-%m-%dT%H:%M:%SZ"); #endif expiry_ = std::chrono::system_clock::from_time_t(std::mktime(&tm)); } } } } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/InstanceProfileCredentialsProvider.cc
C++
apache-2.0
3,003
#include <string.h> const std::string LOCAL_ENDPOINTS_CONFIG = "{" " \"products\": [" " \"domain\"," " \"chatbot\"," " \"iot\"," " \"rtc\"," " \"nlp\"," " \"oss\"," " \"imagesearch\"" " ]," " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"cn-chengdu\"" " ]," " \"endpoints\": {" " \"domain\": {" " \"regions\": [" " \"cn-shenzhen\"," " \"cn-shanghai\"," " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-shenzhen\": \"domain.aliyuncs.com\"," " \"cn-shanghai\": \"domain.aliyuncs.com\"," " \"cn-hangzhou\": \"domain.aliyuncs.com\"" " }" " }," " \"cloudapi\": {" " \"regions\": [" " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " ]," " \"regional\": {" " \"cn-beijing\": \"apigateway.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"apigateway.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"apigateway.cn-hangzhou.aliyuncs.com\"," " }" " }," " \"chatbot\": {" " \"regions\": [" " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " ]," " \"regional\": {" " \"cn-beijing\": \"chatbot.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"chatbot.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"chatbot.cn-hangzhou.aliyuncs.com\"," " }" " }," " \"iot\": {" " \"regions\": [" " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " ]," " \"regional\": {" " \"cn-beijing\": \"iot.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"iot.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"iot.cn-hangzhou.aliyuncs.com\"," " }" " \"rtc\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"rtc.aliyuncs.com\"" " }" " }," " \"nlp\": {" " \"regions\": [" " \"cn-shanghai\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"nlp.cn-shanghai.aliyuncs.com\"" " }" " }," " \"oss\": {" " \"regions\": [" " \"cn-beijing\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " ]," " \"regional\": {" " \"cn-beijing\": \"oss-cn-beijing.aliyuncs.com\"," " \"cn-hangzhou\": \"oss-cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"oss-cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"oss-cn-hongkong.aliyuncs.com\"," " }" " }," " \"vod\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"cn-shenzhen\"," " \"cn-beijing\"," " ]," " \"regional\": {" " \"cn-shanghai\": \"vod.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"vod.cn-shanghai.aliyuncs.com\"," " \"cn-shenzhen\": \"vod.cn-shanghai.aliyuncs.com\"," " }" " }," " \"imagesearch\": {" " \"regions\": [" " \"cn-shanghai\"," " \"ap-northeast-1\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"imagesearch.cn-shanghai.aliyuncs.com\"," " }" " }" " }" "}";
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/LocalEndpoints.h
C++
apache-2.0
3,607
#include <string.h> const std::string WIN_LOCAL_ENDPOINTS_CONFIG_1 = "{" " \"products\": [" " \"domain\"," " \"cdn\"," " \"ram\"," " \"cbn\"," " \"drds\"," " \"emr\"," " \"sts\"," " \"cs\"," " \"cr\"," " \"hbase\"," " \"ros\"," " \"ess\"," " \"gpdb\"," " \"dds\"," " \"jaq\"," " \"cloudauth\"," " \"live\"," " \"hpc\"," " \"ddosbasic\"," " \"dm\"," " \"domain-intl\"," " \"cloudwf\"," " \"ecs\"," " \"vpc\"," " \"r-kvstore\"," " \"cds\"," " \"aegis\"," " \"rds\"," " \"petadata\"," " \"httpdns\"," " \"green\"," " \"alidns\"," " \"push\"," " \"itaas\"," " \"cms\"," " \"slb\"," " \"cloudapi\"," " \"chatbot\"," " \"batchcompute\"," " \"iot\"," " \"arms\"," " \"csb\"," " \"polardb\"," " \"ccc\"," " \"cloudphoto\"," " \"bastionhost\"," " \"xianzhi\"," " \"rtc\"," " \"nlp\"," " \"trademark\"," " \"sca\"," " \"iovcc\"," " \"ddosrewards\"," " \"ons\"," " \"pts\"," " \"ddosdip\"," " \"ehs\"," " \"waf\"," " \"cloudfirewall\"," " \"baas\"," " \"imm\"," " \"qualitycheck\"," " \"ims\"," " \"oas\"," " \"drdspre\"," " \"oss\"," " \"ddoscoo\"," " \"smartag\"," " \"actiontrail\"," " \"ots\"," " \"cas\"," " \"mts\"," " \"pvtz\"," " \"ensdisk\"," " \"onsvip\"," " \"hdm\"," " \"luban\"," " \"vod\"," " \"imagesearch\"," " \"ddos\"," " \"sas-api\"," " \"odpsmayi\"," " \"gameshield\"," " \"kvstore\"," " \"ddosbgp\"," " \"clouddesktop\"," " \"alidnsgtm\"," " \"yunmarket\"," " \"pcdn\"," " \"nas\"," " \"ivision\"," " \"ens\"," " \"kms\"," " \"odpsplusmayi\"," " \"hcs_sgw\"," " \"emas\"," " \"eci\"," " \"hsm\"," " \"fc\"," " \"cloudap\"," " \"openanalytics\"," " \"hcs_mgw\"," " \"dcdn\"," " \"elasticsearch\"," " \"cps\"," " \"dts\"," " \"dysmsapi\"," " \"dybaseapi\"," " \"bssopenapi\"," " \"faas\"," " \"dmsenterprise\"," " \"alikafka\"," " \"foas\"," " \"alidfs\"," " \"airec\"," " \"scdn\"," " \"saf\"," " \"linkwan\"," " \"linkedmall\"," " \"vs\"," " \"ccs\"," " \"hitsdb\"," " \"uis\"," " \"alimt\"," " \"cccvn\"," " \"drdspost\"" " ]," " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"endpoints\": {" " \"domain\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"domain.aliyuncs.com\"," " \"us-east-1\": \"domain.aliyuncs.com\"," " \"ap-northeast-1\": \"domain.aliyuncs.com\"," " \"ap-southeast-5\": \"domain.aliyuncs.com\"," " \"cn-hongkong\": \"domain.aliyuncs.com\"," " \"cn-shenzhen\": \"domain.aliyuncs.com\"," " \"ap-southeast-3\": \"domain.aliyuncs.com\"," " \"ap-southeast-2\": \"domain.aliyuncs.com\"," " \"ap-south-1\": \"domain.aliyuncs.com\"," " \"cn-huhehaote\": \"domain.aliyuncs.com\"," " \"cn-qingdao\": \"domain.aliyuncs.com\"," " \"cn-beijing\": \"domain.aliyuncs.com\"," " \"cn-shanghai\": \"domain.aliyuncs.com\"," " \"cn-hangzhou\": \"domain.aliyuncs.com\"," " \"ap-southeast-1\": \"domain-intl.aliyuncs.com\"," " \"us-west-1\": \"domain.aliyuncs.com\"," " \"eu-central-1\": \"domain.aliyuncs.com\"," " \"cn-zhangjiakou\": \"domain.aliyuncs.com\"," " \"cn-chengdu\": \"domain.aliyuncs.com\"," " \"eu-west-1\": \"domain.aliyuncs.com\"" " }" " }," " \"cdn\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"cdn.aliyuncs.com\"," " \"us-east-1\": \"cdn.aliyuncs.com\"," " \"ap-northeast-1\": \"cdn.aliyuncs.com\"," " \"ap-southeast-5\": \"cdn.aliyuncs.com\"," " \"cn-hongkong\": \"cdn.aliyuncs.com\"," " \"cn-shenzhen\": \"cdn.aliyuncs.com\"," " \"ap-southeast-3\": \"cdn.aliyuncs.com\"," " \"ap-southeast-2\": \"cdn.aliyuncs.com\"," " \"ap-south-1\": \"cdn.aliyuncs.com\"," " \"cn-huhehaote\": \"cdn.aliyuncs.com\"," " \"cn-qingdao\": \"cdn.aliyuncs.com\"," " \"cn-beijing\": \"cdn.aliyuncs.com\"," " \"cn-shanghai\": \"cdn.aliyuncs.com\"," " \"cn-hangzhou\": \"cdn.aliyuncs.com\"," " \"ap-southeast-1\": \"cdn.aliyuncs.com\"," " \"us-west-1\": \"cdn.aliyuncs.com\"," " \"eu-central-1\": \"cdn.aliyuncs.com\"," " \"cn-zhangjiakou\": \"cdn.aliyuncs.com\"," " \"cn-chengdu\": \"cdn.aliyuncs.com\"," " \"eu-west-1\": \"cdn.aliyuncs.com\"" " }" " }," " \"ram\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"ram.aliyuncs.com\"," " \"us-east-1\": \"ram.aliyuncs.com\"," " \"ap-northeast-1\": \"ram.aliyuncs.com\"," " \"ap-southeast-5\": \"ram.aliyuncs.com\"," " \"cn-hongkong\": \"ram.aliyuncs.com\"," " \"cn-shenzhen\": \"ram.aliyuncs.com\"," " \"ap-southeast-3\": \"ram.aliyuncs.com\"," " \"ap-southeast-2\": \"ram.aliyuncs.com\"," " \"ap-south-1\": \"ram.aliyuncs.com\"," " \"cn-huhehaote\": \"ram.aliyuncs.com\"," " \"cn-qingdao\": \"ram.aliyuncs.com\"," " \"cn-beijing\": \"ram.aliyuncs.com\"," " \"cn-shanghai\": \"ram.aliyuncs.com\"," " \"cn-hangzhou\": \"ram.aliyuncs.com\"," " \"ap-southeast-1\": \"ram.aliyuncs.com\"," " \"us-west-1\": \"ram.aliyuncs.com\"," " \"eu-central-1\": \"ram.aliyuncs.com\"," " \"cn-zhangjiakou\": \"ram.aliyuncs.com\"," " \"cn-chengdu\": \"ram.aliyuncs.com\"," " \"eu-west-1\": \"ram.aliyuncs.com\"" " }" " }," " \"cbn\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"cbn.aliyuncs.com\"," " \"us-east-1\": \"cbn.aliyuncs.com\"," " \"ap-northeast-1\": \"cbn.aliyuncs.com\"," " \"ap-southeast-5\": \"cbn.aliyuncs.com\"," " \"cn-hongkong\": \"cbn.aliyuncs.com\"," " \"cn-shenzhen\": \"cbn.aliyuncs.com\"," " \"ap-southeast-3\": \"cbn.aliyuncs.com\"," " \"ap-southeast-2\": \"cbn.aliyuncs.com\"," " \"ap-south-1\": \"cbn.aliyuncs.com\"," " \"cn-huhehaote\": \"cbn.aliyuncs.com\"," " \"cn-qingdao\": \"cbn.aliyuncs.com\"," " \"cn-beijing\": \"cbn.aliyuncs.com\"," " \"cn-shanghai\": \"cbn.aliyuncs.com\"," " \"cn-hangzhou\": \"cbn.aliyuncs.com\"," " \"ap-southeast-1\": \"cbn.aliyuncs.com\"," " \"us-west-1\": \"cbn.aliyuncs.com\"," " \"eu-central-1\": \"cbn.aliyuncs.com\"," " \"cn-zhangjiakou\": \"cbn.aliyuncs.com\"," " \"cn-chengdu\": \"cbn.aliyuncs.com\"," " \"eu-west-1\": \"cbn.aliyuncs.com\"" " }" " }," " \"drds\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"drds.aliyuncs.com\"," " \"us-east-1\": \"drds.aliyuncs.com\"," " \"ap-northeast-1\": \"drds.aliyuncs.com\"," " \"ap-southeast-5\": \"drds.aliyuncs.com\"," " \"cn-hongkong\": \"drds.aliyuncs.com\"," " \"cn-shenzhen\": \"drds.aliyuncs.com\"," " \"ap-southeast-3\": \"drds.aliyuncs.com\"," " \"ap-southeast-2\": \"drds.aliyuncs.com\"," " \"ap-south-1\": \"drds.aliyuncs.com\"," " \"cn-huhehaote\": \"drds.aliyuncs.com\"," " \"cn-qingdao\": \"drds.aliyuncs.com\"," " \"cn-beijing\": \"drds.aliyuncs.com\"," " \"cn-shanghai\": \"drds.aliyuncs.com\"," " \"cn-hangzhou\": \"drds.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"drds.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"drds.aliyuncs.com\"," " \"eu-central-1\": \"drds.aliyuncs.com\"," " \"cn-zhangjiakou\": \"drds.aliyuncs.com\"," " \"cn-chengdu\": \"drds.aliyuncs.com\"," " \"eu-west-1\": \"drds.aliyuncs.com\"" " }" " }," " \"emr\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"emr.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"emr.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"emr.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"emr.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"emr.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"emr.aliyuncs.com\"," " \"ap-southeast-3\": \"emr.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"emr.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"emr.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"emr.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"emr.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"emr.aliyuncs.com\"," " \"cn-shanghai\": \"emr.aliyuncs.com\"," " \"cn-hangzhou\": \"emr.aliyuncs.com\"," " \"ap-southeast-1\": \"emr.aliyuncs.com\"," " \"us-west-1\": \"emr.aliyuncs.com\"," " \"eu-central-1\": \"emr.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"emr.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"emr.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"emr.eu-west-1.aliyuncs.com\"" " }" " }," " \"sts\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"sts.aliyuncs.com\"," " \"us-east-1\": \"sts.aliyuncs.com\"," " \"ap-northeast-1\": \"sts.aliyuncs.com\"," " \"ap-southeast-5\": \"sts.aliyuncs.com\"," " \"cn-hongkong\": \"sts.aliyuncs.com\"," " \"cn-shenzhen\": \"sts.aliyuncs.com\"," " \"ap-southeast-3\": \"sts.aliyuncs.com\"," " \"ap-southeast-2\": \"sts.aliyuncs.com\"," " \"ap-south-1\": \"sts.aliyuncs.com\"," " \"cn-huhehaote\": \"sts.aliyuncs.com\"," " \"cn-qingdao\": \"sts.aliyuncs.com\"," " \"cn-beijing\": \"sts.aliyuncs.com\"," " \"cn-shanghai\": \"sts.aliyuncs.com\"," " \"cn-hangzhou\": \"sts.aliyuncs.com\"," " \"ap-southeast-1\": \"sts.aliyuncs.com\"," " \"us-west-1\": \"sts.aliyuncs.com\"," " \"eu-central-1\": \"sts.aliyuncs.com\"," " \"cn-zhangjiakou\": \"sts.aliyuncs.com\"," " \"cn-chengdu\": \"sts.aliyuncs.com\"," " \"eu-west-1\": \"sts.aliyuncs.com\"" " }" " }," " \"cs\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"cs.aliyuncs.com\"," " \"us-east-1\": \"cs.aliyuncs.com\"," " \"ap-northeast-1\": \"cs.aliyuncs.com\"," " \"ap-southeast-5\": \"cs.aliyuncs.com\"," " \"cn-hongkong\": \"cs.aliyuncs.com\"," " \"cn-shenzhen\": \"cs.aliyuncs.com\"," " \"ap-southeast-3\": \"cs.aliyuncs.com\"," " \"ap-southeast-2\": \"cs.aliyuncs.com\"," " \"ap-south-1\": \"cs.aliyuncs.com\"," " \"cn-huhehaote\": \"cs.aliyuncs.com\"," " \"cn-qingdao\": \"cs.aliyuncs.com\"," " \"cn-beijing\": \"cs.aliyuncs.com\"," " \"cn-shanghai\": \"cs.aliyuncs.com\"," " \"cn-hangzhou\": \"cs.aliyuncs.com\"," " \"ap-southeast-1\": \"cs.aliyuncs.com\"," " \"us-west-1\": \"cs.aliyuncs.com\"," " \"eu-central-1\": \"cs.aliyuncs.com\"," " \"cn-zhangjiakou\": \"cs.aliyuncs.com\"," " \"cn-chengdu\": \"cs.aliyuncs.com\"," " \"eu-west-1\": \"cs.aliyuncs.com\"" " }" " }," " \"cr\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"cr.aliyuncs.com\"," " \"us-east-1\": \"cr.aliyuncs.com\"," " \"ap-northeast-1\": \"cr.aliyuncs.com\"," " \"ap-southeast-5\": \"cr.aliyuncs.com\"," " \"cn-hongkong\": \"cr.aliyuncs.com\"," " \"cn-shenzhen\": \"cr.aliyuncs.com\"," " \"ap-southeast-3\": \"cr.aliyuncs.com\"," " \"ap-southeast-2\": \"cr.aliyuncs.com\"," " \"ap-south-1\": \"cr.aliyuncs.com\"," " \"cn-huhehaote\": \"cr.aliyuncs.com\"," " \"cn-qingdao\": \"cr.aliyuncs.com\"," " \"cn-beijing\": \"cr.aliyuncs.com\"," " \"cn-shanghai\": \"cr.aliyuncs.com\"," " \"cn-hangzhou\": \"cr.aliyuncs.com\"," " \"ap-southeast-1\": \"cr.aliyuncs.com\"," " \"us-west-1\": \"cr.aliyuncs.com\"," " \"eu-central-1\": \"cr.aliyuncs.com\"," " \"cn-zhangjiakou\": \"cr.aliyuncs.com\"," " \"cn-chengdu\": \"cr.aliyuncs.com\"," " \"eu-west-1\": \"cr.aliyuncs.com\"" " }" " }," " \"hbase\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"hbase.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"hbase.aliyuncs.com\"," " \"ap-northeast-1\": \"hbase.aliyuncs.com\"," " \"ap-southeast-5\": \"hbase.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"hbase.aliyuncs.com\"," " \"cn-shenzhen\": \"hbase.aliyuncs.com\"," " \"ap-southeast-3\": \"hbase.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"hbase.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"hbase.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"hbase.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"hbase.aliyuncs.com\"," " \"cn-beijing\": \"hbase.aliyuncs.com\"," " \"cn-shanghai\": \"hbase.aliyuncs.com\"," " \"cn-hangzhou\": \"hbase.aliyuncs.com\"," " \"ap-southeast-1\": \"hbase.aliyuncs.com\"," " \"us-west-1\": \"hbase.aliyuncs.com\"," " \"eu-central-1\": \"hbase.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"hbase.aliyuncs.com\"," " \"cn-chengdu\": \"hbase.aliyuncs.com\"," " \"eu-west-1\": \"hbase.aliyuncs.com\"" " }" " }," " \"ros\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"ros.aliyuncs.com\"," " \"us-east-1\": \"ros.aliyuncs.com\"," " \"ap-northeast-1\": \"ros.aliyuncs.com\"," " \"ap-southeast-5\": \"ros.aliyuncs.com\"," " \"cn-hongkong\": \"ros.aliyuncs.com\"," " \"cn-shenzhen\": \"ros.aliyuncs.com\"," " \"ap-southeast-3\": \"ros.aliyuncs.com\"," " \"ap-southeast-2\": \"ros.aliyuncs.com\"," " \"ap-south-1\": \"ros.aliyuncs.com\"," " \"cn-huhehaote\": \"ros.aliyuncs.com\"," " \"cn-qingdao\": \"ros.aliyuncs.com\"," " \"cn-beijing\": \"ros.aliyuncs.com\"," " \"cn-shanghai\": \"ros.aliyuncs.com\"," " \"cn-hangzhou\": \"ros.aliyuncs.com\"," " \"ap-southeast-1\": \"ros.aliyuncs.com\"," " \"us-west-1\": \"ros.aliyuncs.com\"," " \"eu-central-1\": \"ros.aliyuncs.com\"," " \"cn-zhangjiakou\": \"ros.aliyuncs.com\"," " \"cn-chengdu\": \"ros.aliyuncs.com\"," " \"eu-west-1\": \"ros.aliyuncs.com\"" " }" " }," " \"ess\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"ess.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"ess.aliyuncs.com\"," " \"ap-northeast-1\": \"ess.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"ess.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"ess.aliyuncs.com\"," " \"cn-shenzhen\": \"ess.aliyuncs.com\"," " \"ap-southeast-3\": \"ess.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"ess.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"ess.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"ess.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"ess.aliyuncs.com\"," " \"cn-beijing\": \"ess.aliyuncs.com\"," " \"cn-shanghai\": \"ess.aliyuncs.com\"," " \"cn-hangzhou\": \"ess.aliyuncs.com\"," " \"ap-southeast-1\": \"ess.aliyuncs.com\"," " \"us-west-1\": \"ess.aliyuncs.com\"," " \"eu-central-1\": \"ess.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"ess.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"ess.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"ess.eu-west-1.aliyuncs.com\"" " }" " }," " \"gpdb\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"gpdb.aliyuncs.com\"," " \"us-east-1\": \"gpdb.aliyuncs.com\"," " \"ap-northeast-1\": \"gpdb.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"gpdb.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"gpdb.aliyuncs.com\"," " \"cn-shenzhen\": \"gpdb.aliyuncs.com\"," " \"ap-southeast-3\": \"gpdb.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"gpdb.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"gpdb.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"gpdb.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"gpdb.aliyuncs.com\"," " \"cn-beijing\": \"gpdb.aliyuncs.com\"," " \"cn-shanghai\": \"gpdb.aliyuncs.com\"," " \"cn-hangzhou\": \"gpdb.aliyuncs.com\"," " \"ap-southeast-1\": \"gpdb.aliyuncs.com\"," " \"us-west-1\": \"gpdb.aliyuncs.com\"," " \"eu-central-1\": \"gpdb.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"gpdb.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"gpdb.aliyuncs.com\"," " \"eu-west-1\": \"gpdb.eu-west-1.aliyuncs.com\"" " }" " }," " \"dds\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"mongodb.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"mongodb.aliyuncs.com\"," " \"ap-northeast-1\": \"mongodb.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"mongodb.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"mongodb.aliyuncs.com\"," " \"cn-shenzhen\": \"mongodb.aliyuncs.com\"," " \"ap-southeast-3\": \"mongodb.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"mongodb.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"mongodb.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"mongodb.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"mongodb.aliyuncs.com\"," " \"cn-beijing\": \"mongodb.aliyuncs.com\"," " \"cn-shanghai\": \"mongodb.aliyuncs.com\"," " \"cn-hangzhou\": \"mongodb.aliyuncs.com\"," " \"ap-southeast-1\": \"mongodb.aliyuncs.com\"," " \"us-west-1\": \"mongodb.aliyuncs.com\"," " \"eu-central-1\": \"mongodb.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"mongodb.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"mongodb.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"mongodb.eu-west-1.aliyuncs.com\"" " }" " }," " \"jaq\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"jaq.aliyuncs.com\"," " \"us-east-1\": \"jaq.aliyuncs.com\"," " \"ap-northeast-1\": \"jaq.aliyuncs.com\"," " \"ap-southeast-5\": \"jaq.aliyuncs.com\"," " \"cn-hongkong\": \"jaq.aliyuncs.com\"," " \"cn-shenzhen\": \"jaq.aliyuncs.com\"," " \"ap-southeast-3\": \"jaq.aliyuncs.com\"," " \"ap-southeast-2\": \"jaq.aliyuncs.com\"," " \"ap-south-1\": \"jaq.aliyuncs.com\"," " \"cn-huhehaote\": \"jaq.aliyuncs.com\"," " \"cn-qingdao\": \"jaq.aliyuncs.com\"," " \"cn-beijing\": \"jaq.aliyuncs.com\"," " \"cn-shanghai\": \"jaq.aliyuncs.com\"," " \"cn-hangzhou\": \"jaq.aliyuncs.com\"," " \"ap-southeast-1\": \"jaq.aliyuncs.com\"," " \"us-west-1\": \"jaq.aliyuncs.com\"," " \"eu-central-1\": \"jaq.aliyuncs.com\"," " \"cn-zhangjiakou\": \"jaq.aliyuncs.com\"," " \"cn-chengdu\": \"jaq.aliyuncs.com\"," " \"eu-west-1\": \"jaq.aliyuncs.com\"" " }" " }," " \"cloudauth\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"cloudauth.aliyuncs.com\"," " \"us-east-1\": \"cloudauth.aliyuncs.com\"," " \"ap-northeast-1\": \"cloudauth.aliyuncs.com\"," " \"ap-southeast-5\": \"cloudauth.aliyuncs.com\"," " \"cn-hongkong\": \"cloudauth.aliyuncs.com\"," " \"cn-shenzhen\": \"cloudauth.aliyuncs.com\"," " \"ap-southeast-3\": \"cloudauth.aliyuncs.com\"," " \"ap-southeast-2\": \"cloudauth.aliyuncs.com\"," " \"ap-south-1\": \"cloudauth.aliyuncs.com\"," " \"cn-huhehaote\": \"cloudauth.aliyuncs.com\"," " \"cn-qingdao\": \"cloudauth.aliyuncs.com\"," " \"cn-beijing\": \"cloudauth.aliyuncs.com\"," " \"cn-shanghai\": \"cloudauth.aliyuncs.com\"," " \"cn-hangzhou\": \"cloudauth.aliyuncs.com\"," " \"ap-southeast-1\": \"cloudauth.aliyuncs.com\"," " \"us-west-1\": \"cloudauth.aliyuncs.com\"," " \"eu-central-1\": \"cloudauth.aliyuncs.com\"," " \"cn-zhangjiakou\": \"cloudauth.aliyuncs.com\"," " \"cn-chengdu\": \"cloudauth.aliyuncs.com\"," " \"eu-west-1\": \"cloudauth.aliyuncs.com\"" " }" " }," " \"live\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"live.aliyuncs.com\"," " \"us-east-1\": \"live.aliyuncs.com\"," " \"ap-northeast-1\": \"live.aliyuncs.com\"," " \"ap-southeast-5\": \"live.aliyuncs.com\"," " \"cn-hongkong\": \"live.aliyuncs.com\"," " \"cn-shenzhen\": \"live.aliyuncs.com\"," " \"ap-southeast-3\": \"live.aliyuncs.com\"," " \"ap-southeast-2\": \"live.aliyuncs.com\"," " \"ap-south-1\": \"live.aliyuncs.com\"," " \"cn-huhehaote\": \"live.aliyuncs.com\"," " \"cn-qingdao\": \"live.aliyuncs.com\"," " \"cn-beijing\": \"live.aliyuncs.com\"," " \"cn-shanghai\": \"live.aliyuncs.com\"," " \"cn-hangzhou\": \"live.aliyuncs.com\"," " \"ap-southeast-1\": \"live.aliyuncs.com\"," " \"us-west-1\": \"live.aliyuncs.com\"," " \"eu-central-1\": \"live.aliyuncs.com\"," " \"cn-zhangjiakou\": \"live.aliyuncs.com\"," " \"cn-chengdu\": \"live.aliyuncs.com\"," " \"eu-west-1\": \"live.aliyuncs.com\"" " }" " }," " \"hpc\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"hpc.aliyuncs.com\"," " \"us-east-1\": \"hpc.aliyuncs.com\"," " \"ap-northeast-1\": \"hpc.aliyuncs.com\"," " \"ap-southeast-5\": \"hpc.aliyuncs.com\"," " \"cn-hongkong\": \"hpc.aliyuncs.com\"," " \"cn-shenzhen\": \"hpc.aliyuncs.com\"," " \"ap-southeast-3\": \"hpc.aliyuncs.com\"," " \"ap-southeast-2\": \"hpc.aliyuncs.com\"," " \"ap-south-1\": \"hpc.aliyuncs.com\"," " \"cn-huhehaote\": \"hpc.aliyuncs.com\"," " \"cn-qingdao\": \"hpc.aliyuncs.com\"," " \"cn-beijing\": \"hpc.aliyuncs.com\"," " \"cn-shanghai\": \"hpc.aliyuncs.com\"," " \"cn-hangzhou\": \"hpc.aliyuncs.com\"," " \"ap-southeast-1\": \"hpc.aliyuncs.com\"," " \"us-west-1\": \"hpc.aliyuncs.com\"," " \"eu-central-1\": \"hpc.aliyuncs.com\"," " \"cn-zhangjiakou\": \"hpc.aliyuncs.com\"," " \"cn-chengdu\": \"hpc.aliyuncs.com\"," " \"eu-west-1\": \"hpc.aliyuncs.com\"" " }" " }," " \"ddosbasic\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"antiddos-openapi.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"antiddos.aliyuncs.com\"," " \"ap-northeast-1\": " "\"antiddos-openapi.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": " "\"antiddos-openapi.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"antiddos.aliyuncs.com\"," " \"cn-shenzhen\": \"antiddos.aliyuncs.com\"," " \"ap-southeast-3\": " "\"antiddos-openapi.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": " "\"antiddos-openapi.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"antiddos-openapi.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"antiddos-openapi.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"antiddos.aliyuncs.com\"," " \"cn-beijing\": \"antiddos.aliyuncs.com\"," " \"cn-shanghai\": \"antiddos.aliyuncs.com\"," " \"cn-hangzhou\": \"antiddos.aliyuncs.com\"," " \"ap-southeast-1\": \"antiddos.aliyuncs.com\"," " \"us-west-1\": \"antiddos.aliyuncs.com\"," " \"eu-central-1\": \"antiddos-openapi.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": " "\"antiddos-openapi.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"antiddos.aliyuncs.com\"," " \"eu-west-1\": \"antiddos-openapi.eu-west-1.aliyuncs.com\"" " }" " }," " \"dm\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"dm.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"dm.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"dm.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"dm.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"dm.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"dm.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"dm.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"dm.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"dm.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"dm.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"dm.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"dm.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"dm.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"dm.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"dm.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"dm.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"dm.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"dm.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"dm.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"dm.eu-west-1.aliyuncs.com\"" " }" " }," " \"domain-intl\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"domain-intl.aliyuncs.com\"," " \"us-east-1\": \"domain-intl.aliyuncs.com\"," " \"ap-northeast-1\": \"domain-intl.aliyuncs.com\"," " \"ap-southeast-5\": \"domain-intl.aliyuncs.com\"," " \"cn-hongkong\": \"domain-intl.aliyuncs.com\"," " \"cn-shenzhen\": \"domain-intl.aliyuncs.com\"," " \"ap-southeast-3\": \"domain-intl.aliyuncs.com\"," " \"ap-southeast-2\": \"domain-intl.aliyuncs.com\"," " \"ap-south-1\": \"domain-intl.aliyuncs.com\"," " \"cn-huhehaote\": \"domain-intl.aliyuncs.com\"," " \"cn-qingdao\": \"domain-intl.aliyuncs.com\"," " \"cn-beijing\": \"domain-intl.aliyuncs.com\"," " \"cn-shanghai\": \"domain-intl.aliyuncs.com\"," " \"cn-hangzhou\": \"domain-intl.aliyuncs.com\"," " \"ap-southeast-1\": \"domain-intl.aliyuncs.com\"," " \"us-west-1\": \"domain-intl.aliyuncs.com\"," " \"eu-central-1\": \"domain-intl.aliyuncs.com\"," " \"cn-zhangjiakou\": \"domain-intl.aliyuncs.com\"," " \"cn-chengdu\": \"domain-intl.aliyuncs.com\"," " \"eu-west-1\": \"domain-intl.aliyuncs.com\"" " }" " }," " \"cloudwf\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"cloudwf.aliyuncs.com\"," " \"us-east-1\": \"cloudwf.aliyuncs.com\"," " \"ap-northeast-1\": \"cloudwf.aliyuncs.com\"," " \"ap-southeast-5\": \"cloudwf.aliyuncs.com\"," " \"cn-hongkong\": \"cloudwf.aliyuncs.com\"," " \"cn-shenzhen\": \"cloudwf.aliyuncs.com\"," " \"ap-southeast-3\": \"cloudwf.aliyuncs.com\"," " \"ap-southeast-2\": \"cloudwf.aliyuncs.com\"," " \"ap-south-1\": \"cloudwf.aliyuncs.com\"," " \"cn-huhehaote\": \"cloudwf.aliyuncs.com\"," " \"cn-qingdao\": \"cloudwf.aliyuncs.com\"," " \"cn-beijing\": \"cloudwf.aliyuncs.com\"," " \"cn-shanghai\": \"cloudwf.aliyuncs.com\"," " \"cn-hangzhou\": \"cloudwf.aliyuncs.com\"," " \"ap-southeast-1\": \"cloudwf.aliyuncs.com\"," " \"us-west-1\": \"cloudwf.aliyuncs.com\"," " \"eu-central-1\": \"cloudwf.aliyuncs.com\"," " \"cn-zhangjiakou\": \"cloudwf.aliyuncs.com\"," " \"cn-chengdu\": \"cloudwf.aliyuncs.com\"," " \"eu-west-1\": \"cloudwf.aliyuncs.com\"" " }" " }," " \"ecs\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"ecs.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"ecs-cn-hangzhou.aliyuncs.com\"," " \"ap-northeast-1\": \"ecs.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"ecs.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"ecs-cn-hangzhou.aliyuncs.com\"," " \"cn-shenzhen\": \"ecs-cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-3\": \"ecs.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"ecs.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"ecs.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"ecs.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"ecs-cn-hangzhou.aliyuncs.com\"," " \"cn-beijing\": \"ecs-cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"ecs-cn-hangzhou.aliyuncs.com\"," " \"cn-hangzhou\": \"ecs-cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"ecs-cn-hangzhou.aliyuncs.com\"," " \"us-west-1\": \"ecs-cn-hangzhou.aliyuncs.com\"," " \"eu-central-1\": \"ecs.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"ecs.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"ecs-cn-hangzhou.aliyuncs.com\"," " \"eu-west-1\": \"ecs.eu-west-1.aliyuncs.com\"" " }" " }," " \"vpc\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"vpc.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"vpc.aliyuncs.com\"," " \"ap-northeast-1\": \"vpc.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"vpc.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"vpc.aliyuncs.com\"," " \"cn-shenzhen\": \"vpc.aliyuncs.com\"," " \"ap-southeast-3\": \"vpc.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"vpc.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"vpc.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"vpc.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"vpc.aliyuncs.com\"," " \"cn-beijing\": \"vpc.aliyuncs.com\"," " \"cn-shanghai\": \"vpc.aliyuncs.com\"," " \"cn-hangzhou\": \"vpc.aliyuncs.com\"," " \"ap-southeast-1\": \"vpc.aliyuncs.com\"," " \"us-west-1\": \"vpc.aliyuncs.com\"," " \"eu-central-1\": \"vpc.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"vpc.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"vpc.aliyuncs.com\"," " \"eu-west-1\": \"vpc.eu-west-1.aliyuncs.com\"" " }" " }," " \"r-kvstore\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"r-kvstore.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"r-kvstore.aliyuncs.com\"," " \"ap-northeast-1\": \"r-kvstore.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"r-kvstore.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"r-kvstore.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"r-kvstore.aliyuncs.com\"," " \"ap-southeast-3\": \"r-kvstore.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"r-kvstore.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"r-kvstore.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"r-kvstore.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"r-kvstore.aliyuncs.com\"," " \"cn-beijing\": \"r-kvstore.aliyuncs.com\"," " \"cn-shanghai\": \"r-kvstore.aliyuncs.com\"," " \"cn-hangzhou\": \"r-kvstore.aliyuncs.com\"," " \"ap-southeast-1\": \"r-kvstore.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"r-kvstore.aliyuncs.com\"," " \"eu-central-1\": \"r-kvstore.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"r-kvstore.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"r-kvstore.aliyuncs.com\"," " \"eu-west-1\": \"r-kvstore.eu-west-1.aliyuncs.com\"" " }" " }," " \"cds\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"cds.cn-beijing.aliyuncs.com\"," " \"us-east-1\": \"cds.cn-beijing.aliyuncs.com\"," " \"ap-northeast-1\": \"cds.cn-beijing.aliyuncs.com\"," " \"ap-southeast-5\": \"cds.cn-beijing.aliyuncs.com\"," " \"cn-hongkong\": \"cds.cn-beijing.aliyuncs.com\"," " \"cn-shenzhen\": \"cds.cn-beijing.aliyuncs.com\"," " \"ap-southeast-3\": \"cds.cn-beijing.aliyuncs.com\"," " \"ap-southeast-2\": \"cds.cn-beijing.aliyuncs.com\"," " \"ap-south-1\": \"cds.cn-beijing.aliyuncs.com\"," " \"cn-huhehaote\": \"cds.cn-beijing.aliyuncs.com\"," " \"cn-qingdao\": \"cds.cn-beijing.aliyuncs.com\"," " \"cn-beijing\": \"cds.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"cds.cn-beijing.aliyuncs.com\"," " \"cn-hangzhou\": \"cds.cn-beijing.aliyuncs.com\"," " \"ap-southeast-1\": \"cds.cn-beijing.aliyuncs.com\"," " \"us-west-1\": \"cds.cn-beijing.aliyuncs.com\"," " \"eu-central-1\": \"cds.cn-beijing.aliyuncs.com\"," " \"cn-zhangjiakou\": \"cds.cn-beijing.aliyuncs.com\"," " \"cn-chengdu\": \"cds.cn-beijing.aliyuncs.com\"," " \"eu-west-1\": \"cds.cn-beijing.aliyuncs.com\"" " }" " }," " \"aegis\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"us-east-1\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"ap-northeast-1\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-5\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"cn-hongkong\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"cn-shenzhen\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-3\": \"aegis.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"ap-south-1\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"cn-huhehaote\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"cn-qingdao\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"cn-beijing\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"cn-hangzhou\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"us-west-1\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"eu-central-1\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"cn-zhangjiakou\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"cn-chengdu\": \"aegis.cn-hangzhou.aliyuncs.com\"," " \"eu-west-1\": \"aegis.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"rds\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"rds.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"rds.aliyuncs.com\"," " \"ap-northeast-1\": \"rds.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"rds.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"rds.aliyuncs.com\"," " \"cn-shenzhen\": \"rds.aliyuncs.com\"," " \"ap-southeast-3\": \"rds.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"rds.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"rds.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"rds.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"rds.aliyuncs.com\"," " \"cn-beijing\": \"rds.aliyuncs.com\"," " \"cn-shanghai\": \"rds.aliyuncs.com\"," " \"cn-hangzhou\": \"rds.aliyuncs.com\"," " \"ap-southeast-1\": \"rds.aliyuncs.com\"," " \"us-west-1\": \"rds.aliyuncs.com\"," " \"eu-central-1\": \"rds.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"rds.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"rds.aliyuncs.com\"," " \"eu-west-1\": \"rds.eu-west-1.aliyuncs.com\"" " }" " }," " \"petadata\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"petadata.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"petadata.aliyuncs.com\"," " \"ap-northeast-1\": \"petadata.aliyuncs.com\"," " \"ap-southeast-5\": \"petadata.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"petadata.aliyuncs.com\"," " \"cn-shenzhen\": \"petadata.aliyuncs.com\"," " \"ap-southeast-3\": \"petadata.aliyuncs.com\"," " \"ap-southeast-2\": \"petadata.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"petadata.aliyuncs.com\"," " \"cn-huhehaote\": \"petadata.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"petadata.aliyuncs.com\"," " \"cn-beijing\": \"petadata.aliyuncs.com\"," " \"cn-shanghai\": \"petadata.aliyuncs.com\"," " \"cn-hangzhou\": \"petadata.aliyuncs.com\"," " \"ap-southeast-1\": \"petadata.aliyuncs.com\"," " \"us-west-1\": \"petadata.aliyuncs.com\"," " \"eu-central-1\": \"petadata.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"petadata.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"petadata.aliyuncs.com\"," " \"eu-west-1\": \"petadata.aliyuncs.com\"" " }" " }," " \"httpdns\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"httpdns-api.aliyuncs.com\"," " \"us-east-1\": \"httpdns-api.aliyuncs.com\"," " \"ap-northeast-1\": \"httpdns-api.aliyuncs.com\"," " \"ap-southeast-5\": \"httpdns-api.aliyuncs.com\"," " \"cn-hongkong\": \"httpdns-api.aliyuncs.com\"," " \"cn-shenzhen\": \"httpdns-api.aliyuncs.com\"," " \"ap-southeast-3\": \"httpdns-api.aliyuncs.com\"," " \"ap-southeast-2\": \"httpdns-api.aliyuncs.com\"," " \"ap-south-1\": \"httpdns-api.aliyuncs.com\"," " \"cn-huhehaote\": \"httpdns-api.aliyuncs.com\"," " \"cn-qingdao\": \"httpdns-api.aliyuncs.com\"," " \"cn-beijing\": \"httpdns-api.aliyuncs.com\"," " \"cn-shanghai\": \"httpdns-api.aliyuncs.com\"," " \"cn-hangzhou\": \"httpdns-api.aliyuncs.com\"," " \"ap-southeast-1\": \"httpdns-api.aliyuncs.com\"," " \"us-west-1\": \"httpdns-api.aliyuncs.com\"," " \"eu-central-1\": \"httpdns-api.aliyuncs.com\"," " \"cn-zhangjiakou\": \"httpdns-api.aliyuncs.com\"," " \"cn-chengdu\": \"httpdns-api.aliyuncs.com\"," " \"eu-west-1\": \"httpdns-api.aliyuncs.com\"" " }" " }," " \"green\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"green.aliyuncs.com\"," " \"us-east-1\": \"green.aliyuncs.com\"," " \"ap-northeast-1\": \"green.aliyuncs.com\"," " \"ap-southeast-5\": \"green.aliyuncs.com\"," " \"cn-hongkong\": \"green.aliyuncs.com\"," " \"cn-shenzhen\": \"green.aliyuncs.com\"," " \"ap-southeast-3\": \"green.aliyuncs.com\"," " \"ap-southeast-2\": \"green.aliyuncs.com\"," " \"ap-south-1\": \"green.aliyuncs.com\"," " \"cn-huhehaote\": \"green.aliyuncs.com\"," " \"cn-qingdao\": \"green.aliyuncs.com\"," " \"cn-beijing\": \"green.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"green.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"green.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"green.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"green.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"green.aliyuncs.com\"," " \"cn-zhangjiakou\": \"green.aliyuncs.com\"," " \"cn-chengdu\": \"green.aliyuncs.com\"," " \"eu-west-1\": \"green.aliyuncs.com\"" " }" " }," " \"alidns\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"alidns.aliyuncs.com\"," " \"us-east-1\": \"alidns.aliyuncs.com\"," " \"ap-northeast-1\": \"alidns.aliyuncs.com\"," " \"ap-southeast-5\": \"alidns.aliyuncs.com\"," " \"cn-hongkong\": \"alidns.aliyuncs.com\"," " \"cn-shenzhen\": \"alidns.aliyuncs.com\"," " \"ap-southeast-3\": \"alidns.aliyuncs.com\"," " \"ap-southeast-2\": \"alidns.aliyuncs.com\"," " \"ap-south-1\": \"alidns.aliyuncs.com\"," " \"cn-huhehaote\": \"alidns.aliyuncs.com\"," " \"cn-qingdao\": \"alidns.aliyuncs.com\"," " \"cn-beijing\": \"alidns.aliyuncs.com\"," " \"cn-shanghai\": \"alidns.aliyuncs.com\"," " \"cn-hangzhou\": \"alidns.aliyuncs.com\"," " \"ap-southeast-1\": \"alidns.aliyuncs.com\"," " \"us-west-1\": \"alidns.aliyuncs.com\"," " \"eu-central-1\": \"alidns.aliyuncs.com\"," " \"cn-zhangjiakou\": \"alidns.aliyuncs.com\"," " \"cn-chengdu\": \"alidns.aliyuncs.com\"," " \"eu-west-1\": \"alidns.aliyuncs.com\"" " }" " }," " \"push\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"cloudpush.aliyuncs.com\"," " \"us-east-1\": \"cloudpush.aliyuncs.com\"," " \"ap-northeast-1\": \"cloudpush.aliyuncs.com\"," " \"ap-southeast-5\": \"cloudpush.aliyuncs.com\"," " \"cn-hongkong\": \"cloudpush.aliyuncs.com\"," " \"cn-shenzhen\": \"cloudpush.aliyuncs.com\"," " \"ap-southeast-3\": \"cloudpush.aliyuncs.com\"," " \"ap-southeast-2\": \"cloudpush.aliyuncs.com\"," " \"ap-south-1\": \"cloudpush.aliyuncs.com\"," " \"cn-huhehaote\": \"cloudpush.aliyuncs.com\"," " \"cn-qingdao\": \"cloudpush.aliyuncs.com\"," " \"cn-beijing\": \"cloudpush.aliyuncs.com\"," " \"cn-shanghai\": \"cloudpush.aliyuncs.com\"," " \"cn-hangzhou\": \"cloudpush.aliyuncs.com\"," " \"ap-southeast-1\": \"cloudpush.aliyuncs.com\"," " \"us-west-1\": \"cloudpush.aliyuncs.com\"," " \"eu-central-1\": \"cloudpush.aliyuncs.com\"," " \"cn-zhangjiakou\": \"cloudpush.aliyuncs.com\"," " \"cn-chengdu\": \"cloudpush.aliyuncs.com\"," " \"eu-west-1\": \"cloudpush.aliyuncs.com\"" " }" " }," " \"itaas\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"itaas.aliyuncs.com\"," " \"us-east-1\": \"itaas.aliyuncs.com\"," " \"ap-northeast-1\": \"itaas.aliyuncs.com\"," " \"ap-southeast-5\": \"itaas.aliyuncs.com\"," " \"cn-hongkong\": \"itaas.aliyuncs.com\"," " \"cn-shenzhen\": \"itaas.aliyuncs.com\"," " \"ap-southeast-3\": \"itaas.aliyuncs.com\"," " \"ap-southeast-2\": \"itaas.aliyuncs.com\"," " \"ap-south-1\": \"itaas.aliyuncs.com\"," " \"cn-huhehaote\": \"itaas.aliyuncs.com\"," " \"cn-qingdao\": \"itaas.aliyuncs.com\"," " \"cn-beijing\": \"itaas.aliyuncs.com\"," " \"cn-shanghai\": \"itaas.aliyuncs.com\"," " \"cn-hangzhou\": \"itaas.aliyuncs.com\"," " \"ap-southeast-1\": \"itaas.aliyuncs.com\"," " \"us-west-1\": \"itaas.aliyuncs.com\"," " \"eu-central-1\": \"itaas.aliyuncs.com\"," " \"cn-zhangjiakou\": \"itaas.aliyuncs.com\"," " \"cn-chengdu\": \"itaas.aliyuncs.com\"," " \"eu-west-1\": \"itaas.aliyuncs.com\"" " }" " }," " \"cms\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"us-east-1\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"ap-northeast-1\": \"metrics.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"metrics.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"cn-shenzhen\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-3\": \"metrics.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"ap-south-1\": \"metrics.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"metrics.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"cn-beijing\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"cn-hangzhou\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"us-west-1\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"eu-central-1\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"cn-zhangjiakou\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"cn-chengdu\": \"metrics.cn-hangzhou.aliyuncs.com\"," " \"eu-west-1\": \"metrics.eu-west-1.aliyuncs.com\"" " }" " }," " \"slb\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"slb.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"slb.aliyuncs.com\"," " \"ap-northeast-1\": \"slb.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"slb.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"slb.aliyuncs.com\"," " \"cn-shenzhen\": \"slb.aliyuncs.com\"," " \"ap-southeast-3\": \"slb.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"slb.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"slb.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"slb.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"slb.aliyuncs.com\"," " \"cn-beijing\": \"slb.aliyuncs.com\"," " \"cn-shanghai\": \"slb.aliyuncs.com\"," " \"cn-hangzhou\": \"slb.aliyuncs.com\"," " \"ap-southeast-1\": \"slb.aliyuncs.com\"," " \"us-west-1\": \"slb.aliyuncs.com\"," " \"eu-central-1\": \"slb.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"slb.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"slb.aliyuncs.com\"," " \"eu-west-1\": \"slb.eu-west-1.aliyuncs.com\"" " }" " }," " \"cloudapi\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"apigateway.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"apigateway.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"apigateway.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"apigateway.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"apigateway.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"apigateway.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"apigateway.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"apigateway.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"apigateway.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"apigateway.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"apigateway.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"apigateway.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"apigateway.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"apigateway.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"apigateway.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"apigateway.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"apigateway.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"apigateway.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"apigateway.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"apigateway.eu-west-1.aliyuncs.com\"" " }" " }," " \"chatbot\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"chatbot.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"chatbot.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"chatbot.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"chatbot.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"chatbot.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"chatbot.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"chatbot.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"chatbot.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"chatbot.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"chatbot.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"chatbot.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"chatbot.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"chatbot.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"chatbot.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"chatbot.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"chatbot.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"chatbot.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"chatbot.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"chatbot.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"chatbot.eu-west-1.aliyuncs.com\"" " }" " }," " \"batchcompute\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"batchcompute.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"batchcompute.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"batchcompute.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"batchcompute.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"batchcompute.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"batchcompute.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"batchcompute.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"batchcompute.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"batchcompute.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"batchcompute.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"batchcompute.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"batchcompute.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"batchcompute.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"batchcompute.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"batchcompute.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"batchcompute.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"batchcompute.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"batchcompute.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"batchcompute.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"batchcompute.eu-west-1.aliyuncs.com\"" " }" " }," " \"iot\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"iot.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"iot.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"iot.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"iot.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"iot.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"iot.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"iot.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"iot.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"iot.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"iot.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"iot.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"iot.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"iot.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"iot.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"iot.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"iot.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"iot.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"iot.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"iot.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"iot.eu-west-1.aliyuncs.com\"" " }" " }," " \"arms\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"arms.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"arms.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"arms.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"arms.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"arms.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"arms.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"arms.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"arms.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"arms.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"arms.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"arms.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"arms.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"arms.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"arms.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"arms.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"arms.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"arms.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"arms.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"arms.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"arms.eu-west-1.aliyuncs.com\"" " }" " }," " \"csb\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"csb.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"csb.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"csb.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"csb.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"csb.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"csb.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"csb.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"csb.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"csb.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"csb.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"csb.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"csb.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"csb.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"csb.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"csb.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"csb.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"csb.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"csb.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"csb.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"csb.eu-west-1.aliyuncs.com\"" " }" " },"; const std::string WIN_LOCAL_ENDPOINTS_CONFIG_2 = " \"polardb\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"polardb.aliyuncs.com\"," " \"us-east-1\": \"polardb.aliyuncs.com\"," " \"ap-northeast-1\": \"polardb.aliyuncs.com\"," " \"ap-southeast-5\": \"polardb.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"polardb.aliyuncs.com\"," " \"cn-shenzhen\": \"polardb.aliyuncs.com\"," " \"ap-southeast-3\": \"polardb.aliyuncs.com\"," " \"ap-southeast-2\": \"polardb.aliyuncs.com\"," " \"ap-south-1\": \"polardb.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"polardb.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"polardb.aliyuncs.com\"," " \"cn-beijing\": \"polardb.aliyuncs.com\"," " \"cn-shanghai\": \"polardb.aliyuncs.com\"," " \"cn-hangzhou\": \"polardb.aliyuncs.com\"," " \"ap-southeast-1\": \"polardb.aliyuncs.com\"," " \"us-west-1\": \"polardb.aliyuncs.com\"," " \"eu-central-1\": \"polardb.aliyuncs.com\"," " \"cn-zhangjiakou\": \"polardb.aliyuncs.com\"," " \"cn-chengdu\": \"polardb.aliyuncs.com\"," " \"eu-west-1\": \"polardb.aliyuncs.com\"" " }" " }," " \"ccc\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"ccc.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"ccc.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"ccc.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"ccc.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"ccc.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"ccc.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"ccc.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"ccc.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"ccc.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"ccc.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"ccc.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"ccc.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"ccc.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"ccc.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"ccc.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"ccc.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"ccc.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"ccc.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"ccc.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"ccc.eu-west-1.aliyuncs.com\"" " }" " }," " \"cloudphoto\": {" " \"regions\": [" " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"me-east-1\": \"cloudphoto.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"cloudphoto.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"cloudphoto.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"cloudphoto.ap-southeast-5.aliyuncs.com\"," " \"cn-hongkong\": \"cloudphoto.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"cloudphoto.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"cloudphoto.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"cloudphoto.ap-southeast-2.aliyuncs.com\"," " \"ap-south-1\": \"cloudphoto.ap-south-1.aliyuncs.com\"," " \"cn-huhehaote\": \"cloudphoto.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"cloudphoto.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"cloudphoto.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"cloudphoto.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"cloudphoto.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"cloudphoto.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"cloudphoto.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"cloudphoto.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"cloudphoto.cn-zhangjiakou.aliyuncs.com\"," " \"cn-chengdu\": \"cloudphoto.cn-chengdu.aliyuncs.com\"," " \"eu-west-1\": \"cloudphoto.eu-west-1.aliyuncs.com\"" " }" " }," " \"bastionhost\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"yundun-bastionhost.aliyuncs.com\"" " }" " }," " \"xianzhi\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"xianzhi.aliyuncs.com\"" " }" " }," " \"rtc\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"rtc.aliyuncs.com\"" " }" " }," " \"nlp\": {" " \"regions\": [" " \"cn-shanghai\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"nlp.cn-shanghai.aliyuncs.com\"" " }" " }," " \"trademark\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"trademark.aliyuncs.com\"" " }" " }," " \"sca\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"qualitycheck.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"iovcc\": {" " \"regions\": [" " \"cn-shanghai\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"iovcc.cn-shanghai.aliyuncs.com\"" " }" " }," " \"ddosrewards\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"ddosright.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"ons\": {" " \"regions\": [" " \"us-west-1\"," " \"cn-beijing\"," " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-2\"," " \"cn-shanghai\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"," " \"ap-south-1\"," " \"eu-central-1\"," " \"cn-qingdao\"," " \"cn-zhangjiakou\"," " \"cn-huhehaote\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"us-west-1\": \"ons.us-west-1.aliyuncs.com\"," " \"cn-beijing\": \"ons.cn-beijing.aliyuncs.com\"," " \"me-east-1\": \"ons.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"ons.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"ons.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-2\": \"ons.ap-southeast-2.aliyuncs.com\"," " \"cn-shanghai\": \"ons.cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"ons.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"ons.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"ons.ap-southeast-3.aliyuncs.com\"," " \"cn-hangzhou\": \"ons.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"ons.ap-southeast-1.aliyuncs.com\"," " \"ap-south-1\": \"ons.cn-hangzhou.aliyuncs.com\"," " \"eu-central-1\": \"ons.eu-central-1.aliyuncs.com\"," " \"cn-qingdao\": \"ons.cn-qingdao.aliyuncs.com\"," " \"cn-zhangjiakou\": \"ons.cn-zhangjiakou.aliyuncs.com\"," " \"cn-huhehaote\": \"ons.cn-huhehaote.aliyuncs.com\"," " \"eu-west-1\": \"ons.eu-west-1.aliyuncs.com\"" " }" " }," " \"pts\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"pts.aliyuncs.com\"" " }" " }," " \"ddosdip\": {" " \"regions\": [" " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"ap-southeast-1\": \"ddosdip.ap-southeast-1.aliyuncs.com\"" " }" " }," " \"ehs\": {" " \"regions\": [" " \"cn-huhehaote\"," " \"cn-beijing\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-1\"," " \"cn-qingdao\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"ap-southeast-2\"" " ]," " \"regional\": {" " \"cn-huhehaote\": \"ehpc.cn-huhehaote.aliyuncs.com\"," " \"cn-beijing\": \"ehpc.cn-beijing.aliyuncs.com\"," " \"cn-hangzhou\": \"ehpc.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"ehpc.cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"ehpc.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"ehpc.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-1\": \"ehpc.ap-southeast-1.aliyuncs.com\"," " \"cn-qingdao\": \"ehpc.cn-qingdao.aliyuncs.com\"," " \"eu-central-1\": \"ehpc.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"ehpc.cn-zhangjiakou.aliyuncs.com\"," " \"ap-southeast-2\": \"ehpc.ap-southeast-2.aliyuncs.com\"" " }" " }," " \"waf\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"wafopenapi.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"cloudfirewall\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"cloudfw.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"baas\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"ap-northeast-1\"," " \"ap-southeast-1\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-shenzhen\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"baas.cn-hangzhou.aliyuncs.com\"," " \"ap-northeast-1\": \"baas.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-1\": \"baas.ap-southeast-1.aliyuncs.com\"," " \"cn-beijing\": \"baas.aliyuncs.com\"," " \"cn-shanghai\": \"baas.aliyuncs.com\"," " \"cn-shenzhen\": \"baas.aliyuncs.com\"" " }" " }," " \"imm\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"cn-shenzhen\"," " \"cn-beijing\"," " \"ap-southeast-1\"," " \"cn-zhangjiakou\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"imm.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"imm.cn-hangzhou.aliyuncs.com\"," " \"cn-shenzhen\": \"imm.cn-shenzhen.aliyuncs.com\"," " \"cn-beijing\": \"imm.cn-beijing.aliyuncs.com\"," " \"ap-southeast-1\": \"imm.ap-southeast-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"imm.cn-zhangjiakou.aliyuncs.com\"" " }" " }," " \"qualitycheck\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"qualitycheck.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"ims\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"ims.aliyuncs.com\"" " }" " }," " \"oas\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"cn-shenzhen\"," " \"cn-beijing\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"cn-hangzhou.oas.aliyuncs.com\"," " \"cn-shenzhen\": \"cn-shenzhen.oas.aliyuncs.com\"," " \"cn-beijing\": \"cn-beijing.oas.aliyuncs.com\"" " }" " }," " \"drdspre\": {" " \"regions\": [" " \"ap-southeast-1\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-shenzhen\"," " \"cn-hongkong\"" " ]," " \"regional\": {" " \"ap-southeast-1\": \"drds.ap-southeast-1.aliyuncs.com\"," " \"cn-qingdao\": \"drds.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"drds.cn-beijing.aliyuncs.com\"," " \"cn-hangzhou\": \"drds.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"drds.cn-shanghai.aliyuncs.com\"," " \"cn-shenzhen\": \"drds.cn-shenzhen.aliyuncs.com\"," " \"cn-hongkong\": \"drds.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"oss\": {" " \"regions\": [" " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-1\"," " \"us-west-1\"" " ]," " \"regional\": {" " \"cn-qingdao\": \"oss-cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"oss-cn-beijing.aliyuncs.com\"," " \"cn-hangzhou\": \"oss-cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"oss-cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"oss-cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"oss-cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-1\": \"oss-ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"oss-us-west-1.aliyuncs.com\"" " }" " }," " \"ddoscoo\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"ddoscoo.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"smartag\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hongkong\"," " \"ap-southeast-1\"," " \"ap-southeast-2\"," " \"ap-southeast-3\"," " \"ap-southeast-5\"," " \"eu-central-1\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"smartag.cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"smartag.cn-hongkong.aliyuncs.com\"," " \"ap-southeast-1\": \"smartag.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-2\": \"smartag.ap-southeast-2.aliyuncs.com\"," " \"ap-southeast-3\": \"smartag.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-5\": \"smartag.ap-southeast-5.aliyuncs.com\"," " \"eu-central-1\": \"smartag.eu-central-1.aliyuncs.com\"" " }" " }," " \"actiontrail\": {" " \"regions\": [" " \"cn-huhehaote\"," " \"ap-south-1\"," " \"cn-beijing\"," " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-2\"," " \"cn-shanghai\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"cn-hangzhou\"," " \"ap-southeast-5\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"cn-qingdao\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"cn-huhehaote\": \"actiontrail.cn-huhehaote.aliyuncs.com\"," " \"ap-south-1\": \"actiontrail.ap-south-1.aliyuncs.com\"," " \"cn-beijing\": \"actiontrail.cn-beijing.aliyuncs.com\"," " \"me-east-1\": \"actiontrail.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"actiontrail.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"actiontrail.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-2\": \"actiontrail.ap-southeast-2.aliyuncs.com\"," " \"cn-shanghai\": \"actiontrail.cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"actiontrail.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"actiontrail.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"actiontrail.ap-southeast-3.aliyuncs.com\"," " \"cn-hangzhou\": \"actiontrail.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-5\": \"actiontrail.ap-southeast-5.aliyuncs.com\"," " \"ap-southeast-1\": \"actiontrail.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"actiontrail.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"actiontrail.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"actiontrail.cn-zhangjiakou.aliyuncs.com\"," " \"cn-qingdao\": \"actiontrail.cn-qingdao.aliyuncs.com\"," " \"eu-west-1\": \"actiontrail.eu-west-1.aliyuncs.com\"" " }" " }," " \"ots\": {" " \"regions\": [" " \"cn-huhehaote\"," " \"cn-beijing\"," " \"me-east-1\"," " \"cn-hangzhou\"," " \"ap-northeast-1\"," " \"cn-shanghai\"," " \"ap-southeast-1\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-southeast-5\"," " \"ap-south-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"eu-west-1\"," " \"us-west-1\"," " \"us-east-1\"" " ]," " \"regional\": {" " \"cn-huhehaote\": \"ots.cn-huhehaote.aliyuncs.com\"," " \"cn-beijing\": \"ots.cn-beijing.aliyuncs.com\"," " \"me-east-1\": \"ots.me-east-1.aliyuncs.com\"," " \"cn-hangzhou\": \"ots.cn-hangzhou.aliyuncs.com\"," " \"ap-northeast-1\": \"ots.ap-northeast-1.aliyuncs.com\"," " \"cn-shanghai\": \"ots.cn-shanghai.aliyuncs.com\"," " \"ap-southeast-1\": \"ots.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-3\": \"ots.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-2\": \"ots.ap-southeast-2.aliyuncs.com\"," " \"ap-southeast-5\": \"ots.ap-southeast-5.aliyuncs.com\"," " \"ap-south-1\": \"ots.ap-south-1.aliyuncs.com\"," " \"eu-central-1\": \"ots.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"ots.cn-zhangjiakou.aliyuncs.com\"," " \"eu-west-1\": \"ots.eu-west-1.aliyuncs.com\"," " \"us-west-1\": \"ots.us-west-1.aliyuncs.com\"," " \"us-east-1\": \"ots.us-east-1.aliyuncs.com\"" " }" " }," " \"cas\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"ap-southeast-2\"," " \"ap-northeast-1\"," " \"eu-central-1\"," " \"me-east-1\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"cas.aliyuncs.com\"," " \"ap-southeast-2\": \"cas.ap-southeast-2.aliyuncs.com\"," " \"ap-northeast-1\": \"cas.ap-northeast-1.aliyuncs.com\"," " \"eu-central-1\": \"cas.eu-central-1.aliyuncs.com\"," " \"me-east-1\": \"cas.me-east-1.aliyuncs.com\"" " }" " }," " \"mts\": {" " \"regions\": [" " \"ap-south-1\"," " \"cn-beijing\"," " \"cn-hangzhou\"," " \"ap-northeast-1\"," " \"cn-shanghai\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"ap-south-1\": \"mts.ap-south-1.aliyuncs.com\"," " \"cn-beijing\": \"mts.cn-beijing.aliyuncs.com\"," " \"cn-hangzhou\": \"mts.cn-hangzhou.aliyuncs.com\"," " \"ap-northeast-1\": \"mts.ap-northeast-1.aliyuncs.com\"," " \"cn-shanghai\": \"mts.cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"mts.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"mts.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-1\": \"mts.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"mts.us-west-1.aliyuncs.com\"," " \"eu-central-1\": \"mts.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"mts.cn-zhangjiakou.aliyuncs.com\"," " \"eu-west-1\": \"mts.eu-west-1.aliyuncs.com\"" " }" " }," " \"pvtz\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"pvtz.aliyuncs.com\"," " \"ap-southeast-1\": \"pvtz.aliyuncs.com\"" " }" " }," " \"ensdisk\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"ens.aliyuncs.com\"" " }" " }," " \"onsvip\": {" " \"regions\": [" " \"cn-beijing\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-shenzhen\"," " \"ap-southeast-1\"," " \"cn-qingdao\"" " ]," " \"regional\": {" " \"cn-beijing\": \"ons.cn-beijing.aliyuncs.com\"," " \"cn-hangzhou\": \"ons.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"ons.cn-shanghai.aliyuncs.com\"," " \"cn-shenzhen\": \"ons.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-1\": \"ons.ap-southeast-1.aliyuncs.com\"," " \"cn-qingdao\": \"ons.cn-qingdao.aliyuncs.com\"" " }" " }," " \"hdm\": {" " \"regions\": [" " \"cn-shanghai\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"hdm-api.aliyuncs.com\"" " }" " }," " \"luban\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"luban.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"luban.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"vod\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"cn-shenzhen\"," " \"cn-beijing\"," " \"ap-southeast-1\"," " \"eu-central-1\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"vod.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"vod.cn-shanghai.aliyuncs.com\"," " \"cn-shenzhen\": \"vod.cn-shanghai.aliyuncs.com\"," " \"cn-beijing\": \"vod.cn-shanghai.aliyuncs.com\"," " \"ap-southeast-1\": \"vod.ap-southeast-1.aliyuncs.com\"," " \"eu-central-1\": \"vod.eu-central-1.aliyuncs.com\"" " }" " }," " \"imagesearch\": {" " \"regions\": [" " \"ap-southeast-1\"," " \"ap-southeast-2\"," " \"cn-shanghai\"," " \"ap-northeast-1\"" " ]," " \"regional\": {" " \"ap-southeast-1\": \"imagesearch.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-2\": \"imagesearch.ap-southeast-2.aliyuncs.com\"," " \"cn-shanghai\": \"imagesearch.cn-shanghai.aliyuncs.com\"," " \"ap-northeast-1\": \"imagesearch.ap-northeast-1.aliyuncs.com\"" " }" " }," " \"ddos\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"cn-hongkong\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"ddospro.cn-hangzhou.aliyuncs.com\"," " \"cn-hongkong\": \"ddospro.cn-hongkong.aliyuncs.com\"" " }" " }," " \"sas-api\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"sas.aliyuncs.com\"" " }" " }," " \"odpsmayi\": {" " \"regions\": [" " \"cn-shanghai\"," " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"bsb.cloud.alipay.com\"," " \"ap-southeast-1\": \"bsb.cloud.alipay.com\"" " }" " }," " \"gameshield\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"cn-zhangjiakou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"gameshield.aliyuncs.com\"," " \"cn-zhangjiakou\": \"gameshield.cn-zhangjiakou.aliyuncs.com\"" " }" " }," " \"kvstore\": {" " \"regions\": [" " \"ap-northeast-1\"" " ]," " \"regional\": {" " \"ap-northeast-1\": \"r-kvstore.ap-northeast-1.aliyuncs.com\"" " }" " }," " \"ddosbgp\": {" " \"regions\": [" " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"us-west-1\"," " \"cn-zhangjiakou\"" " ]," " \"regional\": {" " \"cn-huhehaote\": \"ddosbgp.cn-hangzhou.aliyuncs.com\"," " \"cn-qingdao\": \"ddosbgp.cn-hangzhou.aliyuncs.com\"," " \"cn-beijing\": \"ddosbgp.cn-hangzhou.aliyuncs.com\"," " \"cn-hangzhou\": \"ddosbgp.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"ddosbgp.cn-hangzhou.aliyuncs.com\"," " \"cn-hongkong\": \"ddosbgp.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"ddosbgp.cn-hangzhou.aliyuncs.com\"," " \"us-west-1\": \"ddosbgp.us-west-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"ddosbgp.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"clouddesktop\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"cn-shenzhen\"," " \"cn-beijing\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"clouddesktop.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"clouddesktop.cn-hangzhou.aliyuncs.com\"," " \"cn-shenzhen\": \"clouddesktop.cn-shenzhen.aliyuncs.com\"," " \"cn-beijing\": \"clouddesktop.cn-beijing.aliyuncs.com\"" " }" " }," " \"alidnsgtm\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"alidns.aliyuncs.com\"," " \"ap-southeast-1\": \"alidns.aliyuncs.com\"" " }" " }," " \"yunmarket\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"market.aliyuncs.com\"" " }" " }," " \"pcdn\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"pcdn.aliyuncs.com\"" " }" " }," " \"nas\": {" " \"regions\": [" " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"us-east-1\"," " \"ap-southeast-2\"," " \"cn-shanghai\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"cn-hangzhou\"," " \"ap-southeast-5\"," " \"ap-southeast-1\"," " \"ap-south-1\"," " \"eu-central-1\"," " \"cn-zhangjiakou\"," " \"ap-northeast-1\"," " \"us-west-1\"" " ]," " \"regional\": {" " \"cn-huhehaote\": \"nas.cn-huhehaote.aliyuncs.com\"," " \"cn-qingdao\": \"nas.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"nas.cn-beijing.aliyuncs.com\"," " \"us-east-1\": \"nas.us-east-1.aliyuncs.com\"," " \"ap-southeast-2\": \"nas.ap-southeast-2.aliyuncs.com\"," " \"cn-shanghai\": \"nas.cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"nas.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"nas.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"nas.ap-southeast-3.aliyuncs.com\"," " \"cn-hangzhou\": \"nas.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-5\": \"nas.ap-southeast-5.aliyuncs.com\"," " \"ap-southeast-1\": \"nas.ap-southeast-1.aliyuncs.com\"," " \"ap-south-1\": \"nas.ap-south-1.aliyuncs.com\"," " \"eu-central-1\": \"nas.eu-central-1.aliyuncs.com\"," " \"cn-zhangjiakou\": \"nas.cn-zhangjiakou.aliyuncs.com\"," " \"ap-northeast-1\": \"nas.ap-northeast-1.aliyuncs.com\"," " \"us-west-1\": \"nas.us-west-1.aliyuncs.com\"" " }" " }," " \"ivision\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"cn-beijing\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"ivision.cn-hangzhou.aliyuncs.com\"," " \"cn-beijing\": \"ivision.cn-beijing.aliyuncs.com\"" " }" " }," " \"ens\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"ens.aliyuncs.com\"" " }" " }," " \"kms\": {" " \"regions\": [" " \"cn-huhehaote\"," " \"us-west-1\"," " \"cn-beijing\"," " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-2\"," " \"cn-zhangjiakou\"," " \"cn-shanghai\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"cn-hangzhou\"," " \"ap-southeast-5\"," " \"ap-southeast-1\"," " \"ap-south-1\"," " \"eu-central-1\"," " \"cn-qingdao\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"cn-huhehaote\": \"kms.cn-huhehaote.aliyuncs.com\"," " \"us-west-1\": \"kms.us-west-1.aliyuncs.com\"," " \"cn-beijing\": \"kms.cn-beijing.aliyuncs.com\"," " \"me-east-1\": \"kms.me-east-1.aliyuncs.com\"," " \"us-east-1\": \"kms.us-east-1.aliyuncs.com\"," " \"ap-northeast-1\": \"kms.ap-northeast-1.aliyuncs.com\"," " \"ap-southeast-2\": \"kms.ap-southeast-2.aliyuncs.com\"," " \"cn-zhangjiakou\": \"kms.cn-zhangjiakou.aliyuncs.com\"," " \"cn-shanghai\": \"kms.cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"kms.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"kms.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"kms.ap-southeast-3.aliyuncs.com\"," " \"cn-hangzhou\": \"kms.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-5\": \"kms.ap-southeast-5.aliyuncs.com\"," " \"ap-southeast-1\": \"kms.ap-southeast-1.aliyuncs.com\"," " \"ap-south-1\": \"kms.ap-south-1.aliyuncs.com\"," " \"eu-central-1\": \"kms.eu-central-1.aliyuncs.com\"," " \"cn-qingdao\": \"kms.cn-qingdao.aliyuncs.com\"," " \"eu-west-1\": \"kms.eu-west-1.aliyuncs.com\"" " }" " }," " \"odpsplusmayi\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"bsb.cloud.alipay.com\"," " \"cn-hangzhou\": \"bsb.cloud.alipay.com\"," " \"ap-southeast-1\": \"bsb.cloud.alipay.com\"" " }" " }," " \"hcs_sgw\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-zhangjiakou\"," " \"cn-shenzhen\"," " \"cn-hongkong\"," " \"ap-southeast-1\"," " \"ap-southeast-2\"," " \"eu-central-1\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"sgw.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"sgw.cn-shanghai.aliyuncs.com\"," " \"cn-qingdao\": \"sgw.cn-shanghai.aliyuncs.com\"," " \"cn-beijing\": \"sgw.cn-shanghai.aliyuncs.com\"," " \"cn-zhangjiakou\": \"sgw.cn-shanghai.aliyuncs.com\"," " \"cn-shenzhen\": \"sgw.cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"sgw.cn-shanghai.aliyuncs.com\"," " \"ap-southeast-1\": \"sgw.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-2\": \"sgw.ap-southeast-2.aliyuncs.com\"," " \"eu-central-1\": \"sgw.eu-central-1.aliyuncs.com\"" " }" " }," " \"emas\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"mhub.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"mhub.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"eci\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"us-west-1\"," " \"cn-beijing\"," " \"cn-shenzhen\"," " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"eci.aliyuncs.com\"," " \"cn-hangzhou\": \"eci.aliyuncs.com\"," " \"us-west-1\": \"eci.aliyuncs.com\"," " \"cn-beijing\": \"eci.aliyuncs.com\"," " \"cn-shenzhen\": \"eci.aliyuncs.com\"," " \"ap-southeast-1\": \"eci.aliyuncs.com\"" " }" " }," " \"hsm\": {" " \"regions\": [" " \"cn-beijing\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"cn-beijing\": \"hsm.aliyuncs.com\"," " \"cn-hangzhou\": \"hsm.aliyuncs.com\"," " \"cn-shanghai\": \"hsm.aliyuncs.com\"," " \"cn-hongkong\": \"hsm.aliyuncs.com\"," " \"cn-shenzhen\": \"hsm.aliyuncs.com\"," " \"ap-southeast-1\": \"hsm.aliyuncs.com\"" " }" " }," " \"fc\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"cn-shenzhen\"," " \"cn-beijing\"," " \"ap-southeast-2\"," " \"cn-huhehaote\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"cn-shanghai.fc.aliyuncs.com\"," " \"cn-hangzhou\": \"cn-hangzhou.fc.aliyuncs.com\"," " \"cn-shenzhen\": \"cn-shenzhen.fc.aliyuncs.com\"," " \"cn-beijing\": \"cn-beijing.fc.aliyuncs.com\"," " \"ap-southeast-2\": \"ap-southeast-2.fc.aliyuncs.com\"," " \"cn-huhehaote\": \"cn-huhehaote.fc.aliyuncs.com\"" " }" " }," " \"cloudap\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"cloudwf.aliyuncs.com\"" " }" " }," " \"openanalytics\": {" " \"regions\": [" " \"cn-beijing\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"ap-southeast-1\"," " \"ap-southeast-3\"," " \"cn-zhangjiakou\"," " \"cn-shenzhen\"," " \"eu-west-1\"" " ]," " \"regional\": {" " \"cn-beijing\": \"openanalytics.cn-beijing.aliyuncs.com\"," " \"cn-hangzhou\": \"openanalytics.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"openanalytics.cn-shanghai.aliyuncs.com\"," " \"ap-southeast-1\": \"openanalytics.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-3\": \"openanalytics.ap-southeast-3.aliyuncs.com\"," " \"cn-zhangjiakou\": \"openanalytics.cn-zhangjiakou.aliyuncs.com\"," " \"cn-shenzhen\": \"openanalytics.cn-shenzhen.aliyuncs.com\"," " \"eu-west-1\": \"openanalytics.eu-west-1.aliyuncs.com\"" " }" " }," " \"hcs_mgw\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"mgw.cn-shanghai.aliyuncs.com\"," " \"cn-hangzhou\": \"mgw.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"mgw.ap-southeast-1.aliyuncs.com\"" " }" " }," " \"dcdn\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"dcdn.aliyuncs.com\"," " \"ap-southeast-1\": \"dcdn.aliyuncs.com\"" " }" " }," " \"elasticsearch\": {" " \"regions\": [" " \"ap-south-1\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-hongkong\"," " \"cn-shenzhen\"," " \"ap-southeast-3\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-zhangjiakou\"," " \"ap-southeast-2\"," " \"ap-southeast-5\"," " \"ap-northeast-1\"," " \"eu-central-1\"" " ]," " \"regional\": {" " \"ap-south-1\": \"elasticsearch.ap-south-1.aliyuncs.com\"," " \"cn-hangzhou\": \"elasticsearch.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"elasticsearch.cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"elasticsearch.cn-hongkong.aliyuncs.com\"," " \"cn-shenzhen\": \"elasticsearch.cn-shenzhen.aliyuncs.com\"," " \"ap-southeast-3\": \"elasticsearch.ap-southeast-3.aliyuncs.com\"," " \"ap-southeast-1\": \"elasticsearch.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"elasticsearch.us-west-1.aliyuncs.com\"," " \"cn-qingdao\": \"elasticsearch.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"elasticsearch.cn-beijing.aliyuncs.com\"," " \"cn-zhangjiakou\": \"elasticsearch.cn-zhangjiakou.aliyuncs.com\"," " \"ap-southeast-2\": \"elasticsearch.ap-southeast-2.aliyuncs.com\"," " \"ap-southeast-5\": \"elasticsearch.ap-southeast-5.aliyuncs.com\"," " \"ap-northeast-1\": \"elasticsearch.ap-northeast-1.aliyuncs.com\"," " \"eu-central-1\": \"elasticsearch.eu-central-1.aliyuncs.com\"" " }" " }," " \"cps\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"cloudpush.aliyuncs.com\"" " }" " }," " \"dts\": {" " \"regions\": [" " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-zhangjiakou\"," " \"cn-huhehaote\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-shenzhen\"," " \"cn-hongkong\"," " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"cn-qingdao\": \"dts.aliyuncs.com\"," " \"cn-beijing\": \"dts.aliyuncs.com\"," " \"cn-zhangjiakou\": \"dts.aliyuncs.com\"," " \"cn-huhehaote\": \"dts.aliyuncs.com\"," " \"cn-hangzhou\": \"dts.aliyuncs.com\"," " \"cn-shanghai\": \"dts.aliyuncs.com\"," " \"cn-shenzhen\": \"dts.aliyuncs.com\"," " \"cn-hongkong\": \"dts.aliyuncs.com\"," " \"ap-southeast-1\": \"dts.aliyuncs.com\"" " }" " }," " \"dysmsapi\": {" " \"regions\": [" " \"cn-shenzhen\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"cn-hongkong\"," " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"" " ]," " \"regional\": {" " \"cn-shenzhen\": \"dysmsapi.aliyuncs.com\"," " \"cn-huhehaote\": \"dysmsapi.aliyuncs.com\"," " \"cn-qingdao\": \"dysmsapi.aliyuncs.com\"," " \"cn-beijing\": \"dysmsapi.aliyuncs.com\"," " \"cn-shanghai\": \"dysmsapi.aliyuncs.com\"," " \"cn-hangzhou\": \"dysmsapi.aliyuncs.com\"," " \"cn-zhangjiakou\": \"dysmsapi.aliyuncs.com\"," " \"cn-chengdu\": \"dysmsapi.aliyuncs.com\"," " \"cn-hongkong\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"," " \"me-east-1\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"," " \"us-east-1\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"," " \"ap-northeast-1\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-3\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-2\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"," " \"ap-south-1\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-1\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"," " \"eu-central-1\": \"dysmsapi.ap-southeast-1.aliyuncs.com\"" " }" " }," " \"dybaseapi\": {" " \"regions\": [" " \"cn-shenzhen\"," " \"cn-huhehaote\"," " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-shanghai\"," " \"cn-hangzhou\"," " \"cn-zhangjiakou\"," " \"cn-chengdu\"," " \"cn-hongkong\"," " \"me-east-1\"," " \"us-east-1\"," " \"ap-northeast-1\"," " \"ap-southeast-5\"," " \"ap-southeast-3\"," " \"ap-southeast-2\"," " \"ap-south-1\"," " \"ap-southeast-1\"," " \"us-west-1\"," " \"eu-central-1\"" " ]," " \"regional\": {" " \"cn-shenzhen\": \"dybaseapi.aliyuncs.com\"," " \"cn-huhehaote\": \"dybaseapi.aliyuncs.com\"," " \"cn-qingdao\": \"dybaseapi.aliyuncs.com\"," " \"cn-beijing\": \"dybaseapi.aliyuncs.com\"," " \"cn-shanghai\": \"dybaseapi.aliyuncs.com\"," " \"cn-hangzhou\": \"dybaseapi.aliyuncs.com\"," " \"cn-zhangjiakou\": \"dybaseapi.aliyuncs.com\"," " \"cn-chengdu\": \"dybaseapi.aliyuncs.com\"," " \"cn-hongkong\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"," " \"me-east-1\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"," " \"us-east-1\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"," " \"ap-northeast-1\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-3\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-2\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"," " \"ap-south-1\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-1\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"," " \"eu-central-1\": \"dybaseapi.ap-southeast-1.aliyuncs.com\"" " }" " }," " \"bssopenapi\": {" " \"regions\": [" " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-zhangjiakou\"," " \"cn-huhehaote\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-shenzhen\"," " \"cn-hongkong\"," " \"ap-southeast-1\"," " \"ap-southeast-2\"," " \"ap-southeast-3\"," " \"ap-southeast-5\"," " \"ap-northeast-1\"," " \"us-west-1\"," " \"us-east-1\"," " \"eu-central-1\"," " \"eu-west-1\"," " \"me-east-1\"," " \"ap-south-1\"" " ]," " \"regional\": {" " \"cn-qingdao\": \"business.aliyuncs.com\"," " \"cn-beijing\": \"business.aliyuncs.com\"," " \"cn-zhangjiakou\": \"business.aliyuncs.com\"," " \"cn-huhehaote\": \"business.aliyuncs.com\"," " \"cn-hangzhou\": \"business.aliyuncs.com\"," " \"cn-shanghai\": \"business.aliyuncs.com\"," " \"cn-shenzhen\": \"business.aliyuncs.com\"," " \"cn-hongkong\": \"business.aliyuncs.com\"," " \"ap-southeast-1\": \"business.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-2\": \"business.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-3\": \"business.ap-southeast-1.aliyuncs.com\"," " \"ap-southeast-5\": \"business.ap-southeast-1.aliyuncs.com\"," " \"ap-northeast-1\": \"business.ap-southeast-1.aliyuncs.com\"," " \"us-west-1\": \"business.ap-southeast-1.aliyuncs.com\"," " \"us-east-1\": \"business.ap-southeast-1.aliyuncs.com\"," " \"eu-central-1\": \"business.ap-southeast-1.aliyuncs.com\"," " \"eu-west-1\": \"business.ap-southeast-1.aliyuncs.com\"," " \"me-east-1\": \"business.ap-southeast-1.aliyuncs.com\"," " \"ap-south-1\": \"business.ap-southeast-1.aliyuncs.com\"" " }" " },"; const std::string WIN_LOCAL_ENDPOINTS_CONFIG_3 = " \"faas\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"cn-shenzhen\"," " \"cn-shanghai\"," " \"cn-beijing\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"faas.cn-hangzhou.aliyuncs.com\"," " \"cn-shenzhen\": \"faas.cn-shenzhen.aliyuncs.com\"," " \"cn-shanghai\": \"faas.cn-shanghai.aliyuncs.com\"," " \"cn-beijing\": \"faas.cn-beijing.aliyuncs.com\"" " }" " }," " \"dmsenterprise\": {" " \"regions\": [" " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-shenzhen\"," " \"ap-northeast-1\"" " ]," " \"regional\": {" " \"cn-qingdao\": \"dms-enterprise.aliyuncs.com\"," " \"cn-beijing\": \"dms-enterprise.aliyuncs.com\"," " \"cn-hangzhou\": \"dms-enterprise.aliyuncs.com\"," " \"cn-shanghai\": \"dms-enterprise.aliyuncs.com\"," " \"cn-shenzhen\": \"dms-enterprise.aliyuncs.com\"," " \"ap-northeast-1\": \"dms-enterprise.aliyuncs.com\"" " }" " }," " \"alikafka\": {" " \"regions\": [" " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-zhangjiakou\"," " \"cn-huhehaote\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-shenzhen\"," " \"cn-hongkong\"" " ]," " \"regional\": {" " \"cn-qingdao\": \"alikafka.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"alikafka.cn-beijing.aliyuncs.com\"," " \"cn-zhangjiakou\": \"alikafka.cn-zhangjiakou.aliyuncs.com\"," " \"cn-huhehaote\": \"alikafka.cn-huhehaote.aliyuncs.com\"," " \"cn-hangzhou\": \"alikafka.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"alikafka.cn-shanghai.aliyuncs.com\"," " \"cn-shenzhen\": \"alikafka.cn-shenzhen.aliyuncs.com\"," " \"cn-hongkong\": \"alikafka.cn-hongkong.aliyuncs.com\"" " }" " }," " \"foas\": {" " \"regions\": [" " \"cn-qingdao\"," " \"cn-beijing\"," " \"cn-zhangjiakou\"," " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-shenzhen\"," " \"ap-northeast-1\"" " ]," " \"regional\": {" " \"cn-qingdao\": \"foas.cn-qingdao.aliyuncs.com\"," " \"cn-beijing\": \"foas.cn-beijing.aliyuncs.com\"," " \"cn-zhangjiakou\": \"foas.cn-zhangjiakou.aliyuncs.com\"," " \"cn-hangzhou\": \"foas.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"foas.cn-shanghai.aliyuncs.com\"," " \"cn-shenzhen\": \"foas.cn-shenzhen.aliyuncs.com\"," " \"ap-northeast-1\": \"foas.ap-northeast-1.aliyuncs.com\"" " }" " }," " \"alidfs\": {" " \"regions\": [" " \"cn-beijing\"," " \"cn-shanghai\"" " ]," " \"regional\": {" " \"cn-beijing\": \"dfs.cn-beijing.aliyuncs.com\"," " \"cn-shanghai\": \"dfs.cn-shanghai.aliyuncs.com\"" " }" " }," " \"airec\": {" " \"regions\": [" " \"cn-beijing\"," " \"cn-hangzhou\"," " \"cn-shanghai\"" " ]," " \"regional\": {" " \"cn-beijing\": \"airec.cn-beijing.aliyuncs.com\"," " \"cn-hangzhou\": \"airec.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"airec.cn-shanghai.aliyuncs.com\"" " }" " }," " \"scdn\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"scdn.aliyuncs.com\"" " }" " }," " \"saf\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"cn-shanghai\"," " \"cn-shenzhen\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"saf.cn-shanghai.aliyuncs.com\"," " \"cn-shanghai\": \"saf.cn-shanghai.aliyuncs.com\"," " \"cn-shenzhen\": \"saf.cn-shenzhen.aliyuncs.com\"" " }" " }," " \"linkwan\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"cn-shanghai\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"linkwan.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"linkwan.cn-shanghai.aliyuncs.com\"" " }" " }," " \"linkedmall\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"cn-shanghai\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"linkedmall.aliyuncs.com\"," " \"cn-shanghai\": \"linkedmall.aliyuncs.com\"" " }" " }," " \"vs\": {" " \"regions\": [" " \"cn-hangzhou\"," " \"cn-shanghai\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"vs.cn-hangzhou.aliyuncs.com\"," " \"cn-shanghai\": \"vs.cn-shanghai.aliyuncs.com\"" " }" " }," " \"ccs\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"ccs.aliyuncs.com\"" " }" " }," " \"hitsdb\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"hitsdb.aliyuncs.com\"" " }" " }," " \"uis\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"uis.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"alimt\": {" " \"regions\": [" " \"cn-hangzhou\"" " ]," " \"regional\": {" " \"cn-hangzhou\": \"mt.cn-hangzhou.aliyuncs.com\"" " }" " }," " \"cccvn\": {" " \"regions\": [" " \"cn-shanghai\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"voicenavigator.cn-shanghai.aliyuncs.com\"" " }" " }," " \"drdspost\": {" " \"regions\": [" " \"cn-shanghai\"," " \"cn-hongkong\"," " \"ap-southeast-1\"" " ]," " \"regional\": {" " \"cn-shanghai\": \"drds.cn-shanghai.aliyuncs.com\"," " \"cn-hongkong\": \"drds.cn-hangzhou.aliyuncs.com\"," " \"ap-southeast-1\": \"drds.ap-southeast-1.aliyuncs.com\"" " }" " }" " }" "}";
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/LocalEndpointsForWindows.h
C++
apache-2.0
144,050
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/NetworkProxy.h> namespace AlibabaCloud { NetworkProxy::NetworkProxy(Type type, const std::string &hostName, uint16_t port, const std::string &user, const std::string &password) : hostName_(hostName), password_(password), port_(port), type_(type), user_(user) {} NetworkProxy::~NetworkProxy() {} std::string NetworkProxy::hostName() const { return hostName_; } std::string NetworkProxy::password() const { return password_; } uint16_t NetworkProxy::port() const { return port_; } void NetworkProxy::setHostName(const std::string &hostName) { hostName_ = hostName; } void NetworkProxy::setPassword(const std::string &password) { password_ = password; } void NetworkProxy::setPort(uint16_t port) { port_ = port; } void NetworkProxy::setType(NetworkProxy::Type type) { type_ = type; } void NetworkProxy::setUser(const std::string &user) { user_ = user; } NetworkProxy::Type NetworkProxy::type() const { return type_; } std::string NetworkProxy::user() const { return user_; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/NetworkProxy.cc
C++
apache-2.0
1,735
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/Outcome.h>
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/Outcome.cc
C++
apache-2.0
664
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <algorithm> #include <alibabacloud/core/AlibabaCloud.h> #include <alibabacloud/core/HmacSha1Signer.h> #include <alibabacloud/core/RoaServiceClient.h> #include <alibabacloud/core/Utils.h> #include <iomanip> #include <sstream> #if USE_AOS_TIME_POSIX_API #if ESP_PLATFORM #include <sys/time.h> #else #include <posix/timer.h> #endif #endif namespace AlibabaCloud { RoaServiceClient::RoaServiceClient( const std::string &servicename, const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration, const std::shared_ptr<Signer> &signer) : CoreClient(servicename, configuration), credentialsProvider_(credentialsProvider), signer_(signer) {} RoaServiceClient::~RoaServiceClient() {} RoaServiceClient::JsonOutcome RoaServiceClient::makeRequest(const std::string &endpoint, const RoaServiceRequest &request, HttpRequest::Method method) const { if (method == HttpRequest::Method::Get) { method = request.method(); } auto outcome = AttemptRequest(endpoint, request, method); if (outcome.isSuccess()) return JsonOutcome( std::string(outcome.result().body(), outcome.result().bodySize())); else return JsonOutcome(outcome.error()); } HttpRequest RoaServiceClient::buildHttpRequest(const std::string &endpoint, const ServiceRequest &msg, HttpRequest::Method method) const { return buildHttpRequest(endpoint, static_cast<const RoaServiceRequest &>(msg), method); //lk change dynamic_cast to static_cast } HttpRequest RoaServiceClient::buildHttpRequest(const std::string &endpoint, const RoaServiceRequest &msg, HttpRequest::Method method) const { const Credentials credentials = credentialsProvider_->getCredentials(); Url url; if (msg.scheme().empty()) { url.setScheme("https"); } else { url.setScheme(msg.scheme()); } url.setHost(endpoint); url.setPath(msg.resourcePath()); auto params = msg.parameters(); std::map<std::string, std::string> queryParams; for (const auto &p : params) { if (!p.second.empty()) queryParams[p.first] = p.second; } if (!queryParams.empty()) { std::stringstream queryString; for (const auto &p : queryParams) { if (p.second.empty()) queryString << "&" << p.first; else queryString << "&" << p.first << "=" << p.second; } url.setQuery(queryString.str().substr(1)); } HttpRequest request(url); request.setMethod(method); if (msg.connectTimeout() != kInvalidTimeout) { request.setConnectTimeout(msg.connectTimeout()); } else { request.setConnectTimeout(configuration().connectTimeout()); } if (msg.readTimeout() != kInvalidTimeout) { request.setReadTimeout(msg.readTimeout()); } else { request.setReadTimeout(configuration().readTimeout()); } for (const auto &h : msg.headers()) { if (!h.second.empty()) { request.setHeader(h.first, h.second); } } if (msg.parameter("Accept").empty()) { request.setHeader("Accept", "application/json"); } else { request.setHeader("Accept", msg.parameter("Accept")); } if (msg.hasContent()) { std::stringstream ss; ss << msg.contentSize(); request.setHeader("Content-Length", ss.str()); if (msg.parameter("Content-Type").empty()) { request.setHeader("Content-Type", "application/octet-stream"); } else { request.setHeader("Content-Type", msg.parameter("Content-Type")); } request.setHeader("Content-MD5", ComputeContentMD5(msg.content(), msg.contentSize())); request.setBody(msg.content(), msg.contentSize()); } else { if (msg.parameter("Content-Type").empty()) { request.setHeader("Content-Type", "application/x-www-form-urlencoded"); auto body_params = msg.bodyParameters(); std::stringstream sbody; for (const auto &p : body_params) { sbody << "&" << p.first << "=" << UrlEncode(p.second); } request.setBody(sbody.str().c_str(), sbody.str().size()); request.setHeader("Content-Length", std::to_string(request.bodySize())); request.setHeader("Content-MD5", ComputeContentMD5(request.body(), request.bodySize())); } else { request.setHeader("Content-MD5", ComputeContentMD5(msg.content(), msg.contentSize())); } } #if USE_AOS_TIME_POSIX_API struct timespec currentTime; time_t t; clock_gettime(CLOCK_REALTIME, &currentTime); t = currentTime.tv_nsec/1000000000 + currentTime.tv_sec; #else std::time_t t = std::time(nullptr); #endif std::stringstream date; #if defined(__GNUG__) && __GNUC__ < 5 char tmbuff[26]; strftime(tmbuff, 26, "%a, %d %b %Y %T", std::gmtime(&t)); date << tmbuff << " GMT"; #else date << std::put_time(std::gmtime(&t), "%a, %d %b %Y %T GMT"); #endif request.setHeader("Date", date.str()); request.setHeader("Host", url.host()); request.setHeader("x-sdk-client", std::string("CPP/").append(ALIBABACLOUD_VERSION_STR)); request.setHeader("x-acs-region-id", configuration().regionId()); if (!credentials.sessionToken().empty()) request.setHeader("x-acs-security-token", credentials.sessionToken()); request.setHeader("x-acs-signature-method", signer_->name()); request.setHeader("x-acs-signature-nonce", GenerateUuid()); request.setHeader("x-acs-signature-version", signer_->version()); request.setHeader("x-acs-version", msg.version()); std::stringstream plaintext; plaintext << HttpMethodToString(method) << "\n" << request.header("Accept") << "\n" << request.header("Content-MD5") << "\n" << request.header("Content-Type") << "\n" << request.header("Date") << "\n" << canonicalizedHeaders(request.headers()); if (!url.hasQuery()) plaintext << url.path(); else plaintext << url.path() << "?" << url.query(); std::stringstream sign; sign << "acs " << credentials.accessKeyId() << ":" << signer_->generate(plaintext.str(), credentials.accessKeySecret()); request.setHeader("Authorization", sign.str()); return request; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/RoaServiceClient.cc
C++
apache-2.0
6,998
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <algorithm> #include <alibabacloud/core/RoaServiceRequest.h> #include <alibabacloud/core/Utils.h> #include <iomanip> #include <sstream> namespace AlibabaCloud { RoaServiceRequest::RoaServiceRequest(const std::string &product, const std::string &version) : ServiceRequest(product, version) {} RoaServiceRequest::~RoaServiceRequest() {} } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/RoaServiceRequest.cc
C++
apache-2.0
1,042
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <algorithm> #include <alibabacloud/core/AlibabaCloud.h> #include <alibabacloud/core/HmacSha1Signer.h> #include <alibabacloud/core/RpcServiceClient.h> #include <alibabacloud/core/Utils.h> #include <iomanip> #include <sstream> #include <cstring> #ifdef __cplusplus extern "C" { #endif #if USE_AOS_TIME_POSIX_API #if ESP_PLATFORM #if MICROPY_PY_UCLOUD_AI #include "mpconfigport.h" #include "shared/timeutils/timeutils.h" extern void timeutils_seconds_since_2000_to_struct_time(mp_uint_t t, timeutils_struct_time_t *tm); #endif #include <sys/time.h> #else #include <posix/timer.h> #endif #endif #ifdef __cplusplus } #endif namespace AlibabaCloud { RpcServiceClient::RpcServiceClient( const std::string &servicename, const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration, const std::shared_ptr<Signer> &signer) : CoreClient(servicename, configuration), credentialsProvider_(credentialsProvider), signer_(signer) {} RpcServiceClient::~RpcServiceClient() {} RpcServiceClient::JsonOutcome RpcServiceClient::makeRequest(const std::string &endpoint, const RpcServiceRequest &request, HttpRequest::Method method) const { if (method == HttpRequest::Method::Get) { method = request.method(); } auto outcome = AttemptRequest(endpoint, request, method); if (outcome.isSuccess()) return JsonOutcome( std::string(outcome.result().body(), outcome.result().bodySize())); else return JsonOutcome(outcome.error()); } HttpRequest RpcServiceClient::buildHttpRequest(const std::string &endpoint, const ServiceRequest &msg, HttpRequest::Method method) const { return buildHttpRequest(endpoint, static_cast<const RpcServiceRequest &>(msg), method); //lk change dynamic_cast to static_cast } HttpRequest RpcServiceClient::buildHttpRequest(const std::string &endpoint, const RpcServiceRequest &msg, HttpRequest::Method method) const { const Credentials credentials = credentialsProvider_->getCredentials(); Url url; if (msg.scheme().empty()) { url.setScheme("https"); } else { url.setScheme(msg.scheme()); } url.setHost(endpoint); url.setPath(msg.resourcePath()); std::map<std::string, std::string> signParams; auto params = msg.parameters(); for (const auto &p : params) { if (!p.second.empty()) signParams[p.first] = p.second; } signParams["AccessKeyId"] = credentials.accessKeyId(); signParams["Format"] = "JSON"; signParams["RegionId"] = configuration().regionId(); signParams["SecurityToken"] = credentials.sessionToken(); signParams["SignatureMethod"] = signer_->name(); signParams["SignatureNonce"] = GenerateUuid(); signParams["SignatureVersion"] = signer_->version(); #if USE_AOS_TIME_POSIX_API time_t t; struct timespec currentTime; clock_gettime(CLOCK_REALTIME, &currentTime); t = currentTime.tv_nsec/1000000000 + currentTime.tv_sec; #else std::time_t t = std::time(nullptr); #endif std::stringstream ss; #if defined(__GNUG__) && __GNUC__ < 5 char tmbuff[26]; strftime(tmbuff, 26, "%FT%TZ", std::gmtime(&t)); ss << tmbuff; #else #if ESP_PLATFORM && MICROPY_PY_UCLOUD_AI time_t now; struct tm *timeinfo = NULL; char GMT_DATA_TIME[30]; now = time(NULL); timeinfo = localtime(&now); memset(GMT_DATA_TIME, 0, sizeof(GMT_DATA_TIME)); strftime(GMT_DATA_TIME, sizeof(GMT_DATA_TIME), "%FT%TZ", timeinfo); ss << GMT_DATA_TIME; #else ss << std::put_time(std::gmtime(&t), "%FT%TZ"); #endif #endif signParams["Timestamp"] = ss.str(); signParams["Version"] = msg.version(); std::map<std::string, std::string> query; for (const auto &p : signParams) { query[p.first] = p.second; } auto body_params = msg.bodyParameters(); for (const auto &p : body_params) { signParams[p.first] = p.second; } std::stringstream plaintext; plaintext << HttpMethodToString(method) << "&" << UrlEncode(url.path()) << "&" << UrlEncode(canonicalizedQuery(signParams)); query["Signature"] = signer_->generate(plaintext.str(), credentials.accessKeySecret() + "&"); std::stringstream queryString; for (const auto &p : query) queryString << "&" << p.first << "=" << UrlEncode(p.second); url.setQuery(queryString.str().substr(1)); HttpRequest request(url); if (msg.connectTimeout() != kInvalidTimeout) { request.setConnectTimeout(msg.connectTimeout()); } else { request.setConnectTimeout(configuration().connectTimeout()); } for (const auto &h : msg.headers()) { if (!h.second.empty()) { request.setHeader(h.first, h.second); } } if (msg.readTimeout() != kInvalidTimeout) { request.setReadTimeout(msg.readTimeout()); } else { request.setReadTimeout(configuration().readTimeout()); } request.setMethod(method); request.setHeader("Host", url.host()); request.setHeader("x-sdk-client", std::string("CPP/").append(ALIBABACLOUD_VERSION_STR)); std::stringstream tmp; for (const auto &p : body_params) tmp << "&" << p.first << "=" << UrlEncode(p.second); if (tmp.str().length() > 0) { std::string body = tmp.str().substr(1); request.setBody(body.c_str(), body.length()); } return request; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/RpcServiceClient.cc
C++
apache-2.0
6,097
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/RpcServiceRequest.h> namespace AlibabaCloud { RpcServiceRequest::RpcServiceRequest(const std::string &product, const std::string &version, const std::string &action) : ServiceRequest(product, version) { setActionName(action); setHeader(std::string("x-acs-action"), action); } RpcServiceRequest::~RpcServiceRequest() {} std::string RpcServiceRequest::actionName() const { return parameter("Action"); } void RpcServiceRequest::setActionName(const std::string &name) { setParameter("Action", name); } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/RpcServiceRequest.cc
C++
apache-2.0
1,271
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/Runnable.h> namespace AlibabaCloud { Runnable::Runnable(const std::function<void()> f) : f_(f) {} void Runnable::run() const { f_(); } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/Runnable.cc
C++
apache-2.0
820
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/AlibabaCloud.h> #include <alibabacloud/core/ServiceRequest.h> #include <alibabacloud/core/Utils.h> namespace AlibabaCloud { ServiceRequest::ServiceRequest(const std::string &product, const std::string &version) : content_(nullptr), contentSize_(0), params_(), product_(product), resourcePath_("/"), version_(version), scheme_("https"), connectTimeout_(kInvalidTimeout), readTimeout_(kInvalidTimeout), method_(HttpRequest::Method::Get) { setHeader(std::string("x-acs-version"), version); } ServiceRequest::ServiceRequest(const ServiceRequest &other) : content_(nullptr), contentSize_(other.contentSize_), params_(other.params_), product_(other.product_), resourcePath_(other.resourcePath_), version_(other.version_), scheme_(other.scheme_), connectTimeout_(other.connectTimeout_), readTimeout_(other.readTimeout_) { setContent(other.content_, other.contentSize_); } ServiceRequest::ServiceRequest(ServiceRequest &&other) { *this = std::move(other); } ServiceRequest &ServiceRequest::operator=(const ServiceRequest &other) { if (this != &other) { content_ = nullptr; contentSize_ = 0; params_ = other.params_; connectTimeout_ = other.connectTimeout_; readTimeout_ = other.readTimeout_; setContent(other.content_, other.contentSize_); } return *this; } ServiceRequest &ServiceRequest::operator=(ServiceRequest &&other) { if (this != &other) *this = std::move(other); return *this; } ServiceRequest::~ServiceRequest() { if (content_) delete content_; } const char *ServiceRequest::content() const { return content_; } size_t ServiceRequest::contentSize() const { return contentSize_; } bool ServiceRequest::hasContent() const { return (contentSize_ != 0); } void ServiceRequest::setContent(const char *data, size_t size) { if (content_) delete content_; content_ = nullptr; contentSize_ = 0; if (size) { contentSize_ = size; content_ = new char[size]; std::copy(data, data + size, content_); } } void ServiceRequest::addParameter(const ParameterNameType &name, const ParameterValueType &value) { setParameter(name, value); } ServiceRequest::ParameterValueType ServiceRequest::parameter(const ParameterNameType &name) const { ParameterCollection::const_iterator it = params_.find(name); if (it == params_.end()) { return ParameterValueType(""); } return it->second; } ServiceRequest::ParameterValueType ServiceRequest::coreParameter(const ParameterNameType &name) const { return parameter(name); } ServiceRequest::ParameterCollection ServiceRequest::parameters() const { return params_; } ServiceRequest::ParameterCollection ServiceRequest::bodyParameters() const { return body_params_; } void ServiceRequest::removeParameter(const ParameterNameType &name) { params_.erase(name); } void ServiceRequest::setParameter(const ParameterNameType &name, const ParameterValueType &value) { params_[name] = value; } void ServiceRequest::setCoreParameter(const ParameterNameType &name, const ParameterValueType &value) { setParameter(name, value); } void ServiceRequest::setBodyParameter(const ParameterNameType &name, const ParameterValueType &value) { body_params_[name] = value; } void ServiceRequest::setParameters(const ParameterCollection &params) { params_ = params; } void ServiceRequest::setJsonParameters(const ParameterNameType &name, const ParameterCollection &params) { params_ = params; params_ = params; setParameter(name, AlibabaCloud::MapToJson(params)); } std::string ServiceRequest::version() const { return version_; } HttpRequest::Method ServiceRequest::method() const { return method_; } void ServiceRequest::setVersion(const std::string &version) { version_ = version; } std::string ServiceRequest::product() const { return product_; } void ServiceRequest::setProduct(const std::string &product) { product_ = product; } std::string ServiceRequest::resourcePath() const { return resourcePath_; } void ServiceRequest::setResourcePath(const std::string &path) { resourcePath_ = path; } void ServiceRequest::setScheme(const std::string scheme) { scheme_ = scheme; } std::string ServiceRequest::scheme() const { return scheme_; } long ServiceRequest::connectTimeout() const { return connectTimeout_; } long ServiceRequest::readTimeout() const { return readTimeout_; } void ServiceRequest::setConnectTimeout(const long connectTimeout) { connectTimeout_ = connectTimeout; } void ServiceRequest::setReadTimeout(const long readTimeout) { readTimeout_ = readTimeout; } void ServiceRequest::setMethod(const HttpRequest::Method method) { method_ = method; } void ServiceRequest::setHeader( const ServiceRequest::ParameterNameType &name, const ServiceRequest::ParameterValueType &value) { headers_[name] = value; } ServiceRequest::ParameterValueType ServiceRequest::getHeader(const ServiceRequest::ParameterNameType &name) { return headers_[name]; } void ServiceRequest::removeHeader( const ServiceRequest::ParameterNameType &name) { headers_.erase(name); } ServiceRequest::ParameterCollection ServiceRequest::headers() const { return headers_; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/ServiceRequest.cc
C++
apache-2.0
6,072
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/ServiceResult.h> namespace AlibabaCloud { ServiceResult::ServiceResult() : requestId_() {} ServiceResult::~ServiceResult() {} std::string ServiceResult::requestId() const { return requestId_; } void ServiceResult::setRequestId(const std::string &requestId) { requestId_ = requestId; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/ServiceResult.cc
C++
apache-2.0
974
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/Signer.h> namespace AlibabaCloud { Signer::Signer(Type type, const std::string &name, const std::string &version) : type_(type), name_(name), version_(version) {} Signer::~Signer() {} std::string Signer::name() const { return name_; } Signer::Type Signer::type() const { return type_; } std::string Signer::version() const { return version_; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/Signer.cc
C++
apache-2.0
1,036
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/SimpleCredentialsProvider.h> namespace AlibabaCloud { SimpleCredentialsProvider::SimpleCredentialsProvider( const Credentials &credentials) : CredentialsProvider(), credentials_(credentials) {} SimpleCredentialsProvider::SimpleCredentialsProvider( const std::string &accessKeyId, const std::string &accessKeySecret) : CredentialsProvider(), credentials_(accessKeyId, accessKeySecret) {} SimpleCredentialsProvider::~SimpleCredentialsProvider() {} Credentials SimpleCredentialsProvider::getCredentials() { return credentials_; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/SimpleCredentialsProvider.cc
C++
apache-2.0
1,230
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/StsAssumeRoleCredentialsProvider.h> #include <iomanip> #include <sstream> namespace AlibabaCloud { StsAssumeRoleCredentialsProvider::StsAssumeRoleCredentialsProvider( const Credentials &credentials, const ClientConfiguration &configuration, const std::string &roleArn, const std::string &roleSessionName, const std::string &policy, int durationSeconds) : CredentialsProvider(), StsClient(credentials, configuration), roleArn_(roleArn), roleSessionName_(roleSessionName), policy_(policy), durationSeconds_(durationSeconds), cachedMutex_(), cachedCredentials_("", ""), expiry_() {} StsAssumeRoleCredentialsProvider::~StsAssumeRoleCredentialsProvider() {} Credentials StsAssumeRoleCredentialsProvider::getCredentials() { loadCredentials(); std::lock_guard<std::mutex> locker(cachedMutex_); return cachedCredentials_; } bool StsAssumeRoleCredentialsProvider::checkExpiry() const { auto now = std::chrono::system_clock::now(); auto diff = std::chrono::duration_cast<std::chrono::seconds>(now - expiry_).count(); return (diff > 0 - 60); } void StsAssumeRoleCredentialsProvider::loadCredentials() { if (checkExpiry()) { std::lock_guard<std::mutex> locker(cachedMutex_); if (checkExpiry()) { Sts::Model::AssumeRoleRequest request; request.setRoleArn(roleArn_); request.setRoleSessionName(roleSessionName_); request.setPolicy(policy_); request.setDurationSeconds(durationSeconds_); auto assumeRoleOutcome = assumeRole(request); if (assumeRoleOutcome.isSuccess()) { const auto stsCredentials = assumeRoleOutcome.result().credentials(); cachedCredentials_ = Credentials(stsCredentials.accessKeyId, stsCredentials.accessKeySecret, stsCredentials.securityToken); std::tm tm = {}; #if defined(__GNUG__) && __GNUC__ < 5 strptime(stsCredentials.expiration.c_str(), "%Y-%m-%dT%H:%M:%SZ", &tm); #else std::stringstream ss(stsCredentials.expiration); ss >> std::get_time(&tm, "%Y-%m-%dT%H:%M:%SZ"); #endif expiry_ = std::chrono::system_clock::from_time_t(std::mktime(&tm)); } } } } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/StsAssumeRoleCredentialsProvider.cc
C++
apache-2.0
2,908
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <algorithm> #include <alibabacloud/core/Url.h> #include <sstream> namespace AlibabaCloud { namespace { #define INVALID_PORT -1 } // namespace Url::Url(const std::string &url) : scheme_(), userName_(), password_(), host_(), path_(), port_(INVALID_PORT), query_(), fragment_() { if (!url.empty()) fromString(url); } Url::~Url() {} bool Url::operator==(const Url &url) const { return scheme_ == url.scheme_ && userName_ == url.userName_ && password_ == url.password_ && host_ == url.host_ && path_ == url.path_ && port_ == url.port_ && query_ == url.query_ && fragment_ == url.fragment_; } bool Url::operator!=(const Url &url) const { return !(*this == url); } std::string Url::authority() const { if (!isValid()) return std::string(); std::ostringstream out; std::string str = userInfo(); if (!str.empty()) out << str << "@"; out << host_; if (port_ != INVALID_PORT) out << ":" << port_; return out.str(); } void Url::clear() { scheme_.clear(); userName_.clear(); password_.clear(); host_.clear(); path_.clear(); port_ = INVALID_PORT; query_.clear(); fragment_.clear(); } std::string Url::fragment() const { return fragment_; } void Url::fromString(const std::string &url) { clear(); if (url.empty()) return; std::string str = url; std::string::size_type pos = 0; std::string authority, fragment, path, query, scheme; pos = str.find("://"); if (pos != str.npos) { scheme = str.substr(0, pos); str.erase(0, pos + 3); } pos = str.find('#'); if (pos != str.npos) { fragment = str.substr(pos + 1); str.erase(pos); } pos = str.find('?'); if (pos != str.npos) { query = str.substr(pos + 1); str.erase(pos); } pos = str.find('/'); if (pos != str.npos) { path = str.substr(pos); str.erase(pos); } else { path = "/"; } authority = str; setScheme(scheme); setAuthority(authority); setPath(path); setQuery(query); setFragment(fragment); } bool Url::hasFragment() const { return !fragment_.empty(); } bool Url::hasQuery() const { return !query_.empty(); } std::string Url::host() const { return host_; } bool Url::isEmpty() const { return scheme_.empty() && userName_.empty() && password_.empty() && host_.empty() && path_.empty() && (port_ == INVALID_PORT) && query_.empty() && fragment_.empty(); } bool Url::isValid() const { if (isEmpty()) return false; if (host_.empty()) return false; bool valid = true; if (userName_.empty()) valid = password_.empty(); return valid; } int Url::port() const { return port_; } std::string Url::password() const { return password_; } std::string Url::path() const { return path_; } std::string Url::query() const { return query_; } std::string Url::scheme() const { return scheme_; } void Url::setAuthority(const std::string &authority) { if (authority.empty()) { setUserInfo(""); setHost(""); setPort(INVALID_PORT); return; } std::string userinfo, host, port; std::string::size_type pos = 0, prevpos = 0; pos = authority.find('@'); if (pos != authority.npos) { userinfo = authority.substr(0, pos); prevpos = pos + 1; } else { pos = 0; } pos = authority.find(':', prevpos); if (pos == authority.npos) { host = authority.substr(prevpos); } else { host = authority.substr(prevpos, pos - prevpos); port = authority.substr(pos + 1); } setUserInfo(userinfo); setHost(host); setPort(!port.empty() ? atoi(port.c_str()) : INVALID_PORT); } void Url::setFragment(const std::string &fragment) { fragment_ = fragment; } void Url::setHost(const std::string &host) { if (host.empty()) { host_.clear(); return; } host_ = host; std::transform(host_.begin(), host_.end(), host_.begin(), ::tolower); } void Url::setPassword(const std::string &password) { password_ = password; } void Url::setPath(const std::string &path) { path_ = path; } void Url::setPort(int port) { port_ = port; } void Url::setQuery(const std::string &query) { query_ = query; } void Url::setScheme(const std::string &scheme) { if (scheme.empty()) { scheme_.clear(); return; } scheme_ = scheme; std::transform(scheme_.begin(), scheme_.end(), scheme_.begin(), ::tolower); } void Url::setUserInfo(const std::string &userInfo) { if (userInfo.empty()) { userName_.clear(); password_.clear(); return; } auto pos = userInfo.find(':'); if (pos == userInfo.npos) { userName_ = userInfo; } else { userName_ = userInfo.substr(0, pos); password_ = userInfo.substr(pos + 1); } } void Url::setUserName(const std::string &userName) { userName_ = userName; } std::string Url::toString() const { if (!isValid()) return std::string(); std::ostringstream out; if (!scheme_.empty()) out << scheme_ << "://"; std::string str = authority(); if (!str.empty()) out << authority(); if (path_.empty()) out << "/"; else out << path_; if (hasQuery()) out << "?" << query_; if (hasFragment()) out << "#" << fragment_; return out.str(); } std::string Url::userInfo() const { if (!isValid()) return std::string(); std::ostringstream out; out << userName_; if (!password_.empty()) out << ":" << password_; return out.str(); } std::string Url::userName() const { return userName_; } } // namespace AlibabaCloud
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/Url.cc
C++
apache-2.0
6,062
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <algorithm> #include <alibabacloud/core/Utils.h> #include <sstream> #include <stdlib.h> #include <aos/kernel.h> #ifdef _WIN32 #include <Windows.h> #elif defined(USE_CRYPTO_MBEDTLS) #include "mbedtls/md.h" #include "mbedtls/compat-1.3.h" #include "mbedtls/sha1.h" #include "mbedtls/base64.h" #include "mbedtls/md5.h" #else #include <openssl/hmac.h> #include <openssl/md5.h> #include <uuid/uuid.h> #endif #include <curl/curl.h> #include <json/json.h> #include <time.h> std::string AlibabaCloud::GenerateUuid() { #ifdef _WIN32 char *data; UUID uuidhandle; UuidCreate(&uuidhandle); UuidToString(&uuidhandle, reinterpret_cast<RPC_CSTR *>(&data)); std::string uuid(data); RpcStringFree(reinterpret_cast<RPC_CSTR *>(&data)); return uuid; #else #if 0 uuid_t uu; uuid_generate(uu); char buf[36]; uuid_unparse(uu, buf); return buf; #else char buf[36]; unsigned int seed = (unsigned int)aos_now(); srand(seed); sprintf(buf,"680c83c1-fa94-4b90-a364-%d",rand()); std::string uuid(buf); return uuid; #endif #endif } std::string AlibabaCloud::UrlEncode(const std::string &src) { CURL *curl = curl_easy_init(); char *output = curl_easy_escape(curl, src.c_str(), src.size()); std::string result(output); curl_free(output); curl_easy_cleanup(curl); return result; } std::string AlibabaCloud::UrlDecode(const std::string &src) { CURL *curl = curl_easy_init(); int outlength = 0; char *output = curl_easy_unescape(curl, src.c_str(), src.size(), &outlength); std::string result(output, outlength); curl_free(output); curl_easy_cleanup(curl); return result; } std::string AlibabaCloud::ComputeContentMD5(const char *data, size_t size) { #ifdef _WIN32 HCRYPTPROV hProv = 0; HCRYPTHASH hHash = 0; BYTE pbHash[16]; DWORD dwDataLen = 16; CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash); CryptHashData(hHash, (BYTE *)(data), size, 0); CryptGetHashParam(hHash, HP_HASHVAL, pbHash, &dwDataLen, 0); CryptDestroyHash(hHash); CryptReleaseContext(hProv, 0); DWORD dlen = 0; CryptBinaryToString(pbHash, dwDataLen, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, NULL, &dlen); char *dest = new char[dlen]; CryptBinaryToString(pbHash, dwDataLen, CRYPT_STRING_BASE64 | CRYPT_STRING_NOCRLF, dest, &dlen); std::string ret = std::string(dest, dlen); delete dest; return ret; #elif defined(USE_CRYPTO_MBEDTLS) unsigned char md_data[16]; unsigned int mdLen = 16; mbedtls_md5_context ctx; unsigned int olen = 0; mbedtls_md5_ret((const unsigned char*)data, size, md_data); char encodedData[100]; mbedtls_base64_encode((unsigned char*)encodedData, sizeof(encodedData), &olen, md_data, mdLen); return encodedData; #else unsigned char md[MD5_DIGEST_LENGTH]; MD5(reinterpret_cast<const unsigned char *>(data), size, (unsigned char *)&md); char encodedData[100]; EVP_EncodeBlock(reinterpret_cast<unsigned char *>(encodedData), md, MD5_DIGEST_LENGTH); return encodedData; #endif } void AlibabaCloud::StringReplace(std::string &src, const std::string &s1, const std::string &s2) { std::string::size_type pos = 0; while ((pos = src.find(s1, pos)) != std::string::npos) { src.replace(pos, s1.length(), s2); pos += s2.length(); } } std::string AlibabaCloud::HttpMethodToString(HttpRequest::Method method) { switch (method) { case HttpRequest::Method::Head: return "HEAD"; break; case HttpRequest::Method::Post: return "POST"; break; case HttpRequest::Method::Put: return "PUT"; break; case HttpRequest::Method::Delete: return "DELETE"; break; case HttpRequest::Method::Connect: return "CONNECT"; break; case HttpRequest::Method::Options: return "OPTIONS"; break; case HttpRequest::Method::Patch: return "PATCH"; break; case HttpRequest::Method::Trace: return "TRACE"; break; case HttpRequest::Method::Get: default: return "GET"; break; } } std::string AlibabaCloud::canonicalizedQuery( const std::map<std::string, std::string> &params) { if (params.empty()) return std::string(); std::stringstream ss; for (const auto &p : params) { std::string key = UrlEncode(p.first); StringReplace(key, "+", "%20"); StringReplace(key, "*", "%2A"); StringReplace(key, "%7E", "~"); std::string value = UrlEncode(p.second); StringReplace(value, "+", "%20"); StringReplace(value, "*", "%2A"); StringReplace(value, "%7E", "~"); ss << "&" << key << "=" << value; } return ss.str().substr(1); } std::string AlibabaCloud::canonicalizedHeaders( const HttpMessage::HeaderCollection &headers) { std::map<std::string, std::string> materials; for (const auto &p : headers) { std::string key = p.first; std::transform(key.begin(), key.end(), key.begin(), ::tolower); if (key.find("x-acs-") != 0) continue; std::string value = p.second; StringReplace(value, "\t", " "); StringReplace(value, "\n", " "); StringReplace(value, "\r", " "); StringReplace(value, "\f", " "); materials[key] = value; } if (materials.empty()) return std::string(); std::stringstream ss; for (const auto &p : materials) ss << p.first << ":" << p.second << "\n"; return ss.str(); } std::string AlibabaCloud::GetEnv(const std::string env) { #ifdef _WIN32 char *buf = nullptr; size_t sz = 0; if (_dupenv_s(&buf, &sz, env.c_str()) == 0 && buf != nullptr) { std::string var(buf); free(buf); return var; } else { if (buf) { free(buf); } return std::string(); } #else char *var = getenv(env.c_str()); if (var) { return std::string(var); } return std::string(); #endif } std::string AlibabaCloud::MapToJson(const std::map<std::string, std::string> &maps) { Json::Value jsonObject; Json::FastWriter writer; for (std::map<std::string, std::string>::const_iterator iter = maps.begin(); iter != maps.end(); ++iter) { jsonObject[iter->first] = iter->second; } std::string unformat_str = writer.write(jsonObject); return unformat_str.substr(0, unformat_str.length() - 1); } std::map<std::string, std::string> AlibabaCloud::JsonToMap(const std::string &json) { Json::Reader reader; Json::Value value; std::map<std::string, std::string> maps; if (json.length() > 0) { if (reader.parse(json, value)) { Json::Value::Members members = value.getMemberNames(); for (Json::Value::Members::iterator it = members.begin(); it != members.end(); ++it) { Json::ValueType vt = value[*it].type(); switch (vt) { case Json::stringValue: { maps.insert( std::pair<std::string, std::string>(*it, value[*it].asString())); break; } case Json::intValue: { int inttmp = value[*it].asInt(); maps.insert( std::pair<std::string, std::string>(*it, std::to_string(inttmp))); break; } case Json::arrayValue: { std::string strid; for (unsigned int i = 0; i < value[*it].size(); i++) { strid += value[*it][i].asString(); strid += ","; } if (!strid.empty()) { strid = strid.substr(0, strid.size() - 1); } maps.insert(std::pair<std::string, std::string>(*it, strid)); break; } default: { break; } } } } } return maps; }
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/Utils.cc
C++
apache-2.0
8,253
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/SimpleCredentialsProvider.h> #include <alibabacloud/core/location/LocationClient.h> using namespace AlibabaCloud; using namespace AlibabaCloud::Location; namespace { const std::string SERVICE_NAME = "Location"; const std::string ENDPOINT = "location.aliyuncs.com"; } // namespace LocationClient::LocationClient(const Credentials &credentials, const ClientConfiguration &configuration) : RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration) {} LocationClient::LocationClient( const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration) : RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) {} LocationClient::LocationClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration) : RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>( accessKeyId, accessKeySecret), configuration) {} LocationClient::LocationClient( const std::shared_ptr<Location::LocationClient> &locationClient) : RpcServiceClient(SERVICE_NAME, locationClient->credentialsProvider(), locationClient->configuration()) {} LocationClient::~LocationClient() {} LocationClient::DescribeEndpointsOutcome LocationClient::describeEndpoints( const Model::DescribeEndpointsRequest &request) const { auto outcome = makeRequest(ENDPOINT, request); if (outcome.isSuccess()) return DescribeEndpointsOutcome( Model::DescribeEndpointsResult(outcome.result())); else return DescribeEndpointsOutcome(outcome.error()); } void LocationClient::describeEndpointsAsync( const Model::DescribeEndpointsRequest &request, const DescribeEndpointsAsyncHandler &handler, const std::shared_ptr<const AsyncCallerContext> &context) const { std::async(std::launch::async, [this, request, handler, context]() { handler(this, request, describeEndpoints(request), context); }); } LocationClient::DescribeEndpointsOutcomeCallable LocationClient::describeEndpointsCallable( const Model::DescribeEndpointsRequest &request) const { auto task = std::make_shared<std::packaged_task<DescribeEndpointsOutcome()>>( [this, request]() { return this->describeEndpoints(request); }); asyncExecute(new Runnable([task]() { (*task)(); })); return task->get_future(); }
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/location/LocationClient.cc
C++
apache-2.0
3,264
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/location/LocationRequest.h> using namespace AlibabaCloud::Location; LocationRequest::LocationRequest(const std::string &action) : RpcServiceRequest("location", "2015-06-12", action) {} LocationRequest::~LocationRequest() {}
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/location/LocationRequest.cc
C++
apache-2.0
884
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/location/model/DescribeEndpointsRequest.h> using namespace AlibabaCloud::Location; using namespace AlibabaCloud::Location::Model; DescribeEndpointsRequest::DescribeEndpointsRequest() : LocationRequest("DescribeEndpoints") {} DescribeEndpointsRequest::~DescribeEndpointsRequest() {} std::string DescribeEndpointsRequest::serviceCode() const { return parameter("ServiceCode"); } void DescribeEndpointsRequest::setServiceCode(const std::string &serviceCode) { setParameter("ServiceCode", serviceCode); } std::string DescribeEndpointsRequest::id() const { return parameter("Id"); } void DescribeEndpointsRequest::setId(const std::string &id) { setParameter("Id", id); } std::string DescribeEndpointsRequest::type() const { return parameter("Type"); } void DescribeEndpointsRequest::setType(const std::string &type) { setParameter("Type", type); }
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/location/model/DescribeEndpointsRequest.cc
C++
apache-2.0
1,517
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/Utils.h> #include <alibabacloud/core/location/model/DescribeEndpointsResult.h> #include <json/json.h> using namespace AlibabaCloud::Location; using namespace AlibabaCloud::Location::Model; DescribeEndpointsResult::DescribeEndpointsResult() : ServiceResult() {} DescribeEndpointsResult::DescribeEndpointsResult(const std::string &payload) : ServiceResult() { parse(payload); } DescribeEndpointsResult::~DescribeEndpointsResult() {} void DescribeEndpointsResult::parse(const std::string &payload) { Json::Reader reader; Json::Value value; reader.parse(payload, value); setRequestId(value["RequestId"].asString()); success_ = value["Success"].asBool(); auto allEndpoints = value["Endpoints"]["Endpoint"]; for (const auto &item : allEndpoints) { Endpoint region; region.endpoint = item["Endpoint"].asString(); region.id = item["Id"].asString(); region.namespace_ = item["Namespace"].asString(); region.serivceCode = item["SerivceCode"].asString(); region.type = item["Type"].asString(); auto allProtocols = item["Protocols"]["Protocols"]; for (const auto &item : allProtocols) { region.protocols.push_back(item.asString()); } endpoints_.push_back(region); } } std::vector<DescribeEndpointsResult::Endpoint> DescribeEndpointsResult::endpoints() const { return endpoints_; } void DescribeEndpointsResult::setEndpoints( const std::vector<Endpoint> &endpoints) { endpoints_ = endpoints; } bool DescribeEndpointsResult::success() const { return success_; } void DescribeEndpointsResult::setSuccess(const bool &success) { success_ = success; }
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/location/model/DescribeEndpointsResult.cc
C++
apache-2.0
2,276
/* * Copyright 1999-2019 Alibaba Cloud All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include <alibabacloud/core/EndpointProvider.h> #include <alibabacloud/core/SimpleCredentialsProvider.h> #include <alibabacloud/core/sts/StsClient.h> using namespace AlibabaCloud; using namespace AlibabaCloud::Sts; using namespace AlibabaCloud::Sts::Model; namespace { const std::string SERVICE_NAME = "Sts"; const std::string ENDPOINT = "sts.aliyuncs.com"; } // namespace StsClient::StsClient(const Credentials &credentials, const ClientConfiguration &configuration) : RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration) {} StsClient::StsClient( const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration) : RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) {} StsClient::StsClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration) : RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>( accessKeyId, accessKeySecret), configuration) {} StsClient::~StsClient() {} StsClient::AssumeRoleOutcome StsClient::assumeRole(const Model::AssumeRoleRequest &request) const { auto outcome = makeRequest(ENDPOINT, request); if (outcome.isSuccess()) return AssumeRoleOutcome(AssumeRoleResult(outcome.result())); else return AssumeRoleOutcome(Error(outcome.error())); } void StsClient::assumeRoleAsync( const Model::AssumeRoleRequest &request, const AssumeRoleAsyncHandler &handler, const std::shared_ptr<const AsyncCallerContext> &context) const { auto fn = [this, request, handler, context]() { handler(this, request, assumeRole(request), context); }; asyncExecute(new Runnable(fn)); } StsClient::AssumeRoleOutcomeCallable StsClient::assumeRoleCallable(const Model::AssumeRoleRequest &request) const { auto task = std::make_shared<std::packaged_task<AssumeRoleOutcome()>>( [this, request]() { return this->assumeRole(request); }); asyncExecute(new Runnable([task]() { (*task)(); })); return task->get_future(); } StsClient::GetCallerIdentityOutcome StsClient::getCallerIdentity(const GetCallerIdentityRequest &request) const { auto outcome = makeRequest(ENDPOINT, request); if (outcome.isSuccess()) return GetCallerIdentityOutcome(GetCallerIdentityResult(outcome.result())); else return GetCallerIdentityOutcome(Error(outcome.error())); } void StsClient::getCallerIdentityAsync( const GetCallerIdentityRequest &request, const GetCallerIdentityAsyncHandler &handler, const std::shared_ptr<const AsyncCallerContext> &context) const { auto fn = [this, request, handler, context]() { handler(this, request, getCallerIdentity(request), context); }; asyncExecute(new Runnable(fn)); } StsClient::GetCallerIdentityOutcomeCallable StsClient::getCallerIdentityCallable( const GetCallerIdentityRequest &request) const { auto task = std::make_shared<std::packaged_task<GetCallerIdentityOutcome()>>( [this, request]() { return this->getCallerIdentity(request); }); asyncExecute(new Runnable([task]() { (*task)(); })); return task->get_future(); }
YifuLiu/AliOS-Things
components/ucloud_ai/src/model/aliyun-openapi/core/src/sts/StsClient.cc
C++
apache-2.0
3,965