Skip to content

Commit

Permalink
release 3.0.3-beta source code for cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Huaweicloud-SDK committed Jan 25, 2021
1 parent b20b1a9 commit f4db5ee
Show file tree
Hide file tree
Showing 23 changed files with 805 additions and 12 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 3.0.3-beta 2021-01-25
## HuaweiCloud SDK Core
- ### Features
- None
- ### Bug Fix
- Support using default config.
- ### Change
- The default value of `ConnectionTimeout` is set to 60 seconds.
- The default value of `ReadTimeout` is set to 120 seconds.

## HuaweiCloud SDK ECS
- ### Features
- Support more interface: UpdateAutoTerminateTimeServer.
- ### Bug Fix
- None
- ### Change
- None


# 3.0.2-beta 2021-01-15
## HuaweiCloud SDK Core
- ### Features
Expand All @@ -9,7 +28,7 @@

# 3.0.1-beta 2020-12-31
## First Release
- ### Supported Services
- ### Supported Services
- `Elastic Cloud Server`(ECS) service.
- `Elastic IP`(EIP) service.
- `Virtual Private Cloud`(VPC) service.
20 changes: 19 additions & 1 deletion CHANGELOG_CN.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# 3.0.3-beta 2021-01-25
## HuaweiCloud SDK Core
- ### 新增特性
-
- ### 解决问题
- 支持创建默认Config
- ### 特性变更
- 设置默认ConnectionTimeout为60秒
- 设置默认ReadTimeout为120秒

## HuaweiCloud SDK ECS
- ### 新增特性
- 新增支持接口:修改云服务器云主机销毁时间
- ### 解决问题
-
- ### 特性变更
-

# 3.0.2-beta 2021-01-15
## HuaweiCloud SDK Core
- ### 新增特性
Expand All @@ -10,7 +28,7 @@

# 3.0.1-beta 2020-12-31
## 首次发布
- ### 已支持服务
- ### 已支持服务
- 弹性云服务器(ECS)
- 弹性公网IP服务(EIP)
- 虚拟私有云服务(VPC)
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@ else()
set(LIB_TYPE STATIC)
endif()

# USE ONE SERVICE
SET(BUILD_SERVICE vpc)
SET(SERVICE_VERSION v2)

if(BUILD_SERVICE STREQUAL "")
add_subdirectory(core)
else()
add_subdirectory(core)
add_subdirectory(${BUILD_SERVICE})
add_subdirectory(${BUILD_SERVICE}/src/${SERVICE_VERSION})
message(STATUS "'BUILD_SERVICE'=${BUILD_SERVICE}")
endif()
endif()

# USE MULTIPLE SERVICES(EXAMPLE: USE VPC ECS AND EIP)
# add_subdirectory(core)
# add_subdirectory(vpc/src/v2)
# add_subdirectory(eip/src/v2)
# add_subdirectory(ecs/src/v2)
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ This document introduces how to obtain and use HuaweiCloud C++ SDK.
5. Send a request and print response.
```c++
# 初始化请求,以调用接口 listVpcs 为例
# Initialize request
Vpc::V2::Model::ListVpcsRequest listRequest;
std::shared_ptr<Vpc::V2::Model::ListVpcsResponse> listRes = vpcApi->listVpcs(listRequest);
std::string responseBody = listRes->getHttpBody();
Expand Down Expand Up @@ -250,13 +250,42 @@ This document introduces how to obtain and use HuaweiCloud C++ SDK.
7. Asynchronous Requests
```cpp
# 采用c++ std::async接口实现,以listVpcs接口为例
# use c++ std::async
#inclue <future>
auto future = std::async(std::launch::async,
&Vpc::V2::VpcClient::listVpcs, vpcApi, listRequest);
auto listResponse = future.get();
```
8. Set CMakeLists.txt
use one service
```cmake
# USE ONE SERVICE
SET(BUILD_SERVICE vpc)
SET(SERVICE_VERSION v2)
if(BUILD_SERVICE STREQUAL "")
add_subdirectory(core)
else()
add_subdirectory(core)
add_subdirectory(${BUILD_SERVICE}/src/${SERVICE_VERSION})
message(STATUS "'BUILD_SERVICE'=${BUILD_SERVICE}")
endif()
```
use multiple services
```cmake
# USE MULTIPLE SERVICES(EXAMPLE: USE VPC ECS AND EIP)
add_subdirectory(core)
add_subdirectory(vpc/src/v2)
add_subdirectory(eip/src/v2)
add_subdirectory(ecs/src/v2)
```
## Code example
Expand Down Expand Up @@ -328,7 +357,7 @@ This document introduces how to obtain and use HuaweiCloud C++ SDK.
Linux:
```bash
$ g++ -o vpc_test vpc_test.cpp --std=c++11 -lvpc -lcore -lcrypto -lboost_system -lcpprest
$ g++ -o vpc_test vpc_test.cpp --std=c++14 -lvpc_v2 -lcore -lcrypto -lboost_system -lcpprest
$ ./vpc_test
# response
$
Expand Down
31 changes: 30 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,35 @@
auto listResponse = future.get();
```
8. 配置CMakeLists.txt
使用一个服务
```cmake
# USE ONE SERVICE
SET(BUILD_SERVICE vpc)
SET(SERVICE_VERSION v2)
if(BUILD_SERVICE STREQUAL "")
add_subdirectory(core)
else()
add_subdirectory(core)
add_subdirectory(${BUILD_SERVICE}/src/${SERVICE_VERSION})
message(STATUS "'BUILD_SERVICE'=${BUILD_SERVICE}")
endif()
```
使用多个服务
```cmake
# USE MULTIPLE SERVICES(EXAMPLE: USE VPC ECS AND EIP)
add_subdirectory(core)
add_subdirectory(vpc/src/v2)
add_subdirectory(eip/src/v2)
add_subdirectory(ecs/src/v2)
```
## 代码实例
Expand Down Expand Up @@ -334,7 +363,7 @@
Linux 下
```bash
$ g++ -o vpc_test vpc_test.cpp --std=c++11 -lvpc -lcore -lcrypto -lboost_system -lcpprest
$ g++ -o vpc_test vpc_test.cpp --std=c++14 -lvpc_v2 -lcore -lcrypto -lboost_system -lcpprest
$ ./vpc_test
# 返回结果
$
Expand Down
9 changes: 7 additions & 2 deletions core/include/huaweicloud/core/ClientBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ template <typename T> class HUAWEICLOUD_CORE_EXPORT ClientBuilder {

ClientBuilder& operator= (ClientBuilder &&that) noexcept = default;

ClientBuilder& withHttpConfig(const HttpConfig &httpConfig)
ClientBuilder &withHttpConfig(const HttpConfig &httpConfig)
{
httpConfig_ = std::make_unique<HttpConfig>(httpConfig);
return *this;
Expand Down Expand Up @@ -157,7 +157,12 @@ template <typename T> class HUAWEICLOUD_CORE_EXPORT ClientBuilder {
} else {
client->setCredentials(std::move(credentials_));
}
client->setHttpConfig(*std::move(httpConfig_));
if (!httpConfig_) {
HttpConfig httpConfig = HttpConfig();
client->setHttpConfig(httpConfig);
} else {
client->setHttpConfig(*std::move(httpConfig_));
}
client->setFileLog(std::move(filePath_), fileLog_);
client->setStreamLog(streamLog_);
client->setEndPoint(std::move(endPoint_));
Expand Down
4 changes: 2 additions & 2 deletions core/include/huaweicloud/core/http/HttpConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class HUAWEICLOUD_CORE_EXPORT HttpConfig {
std::string certFile_;

std::string keyFile_;
int readTimeout_ = 100;
int connectTimeout_ = 100;
int readTimeout_ = 120;
int connectTimeout_ = 60;
int poolConnections_ = 1;
int poolMaxsize_ = 1;
};
Expand Down
14 changes: 14 additions & 0 deletions ecs/include/huaweicloud/ecs/v2/EcsClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
#include <huaweicloud/ecs/v2/model/ShowServerResponse.h>
#include <huaweicloud/ecs/v2/model/ShowServerTagsRequest.h>
#include <huaweicloud/ecs/v2/model/ShowServerTagsResponse.h>
#include <huaweicloud/ecs/v2/model/UpdateAutoTerminateTimeServerRequest.h>
#include <huaweicloud/ecs/v2/model/UpdateAutoTerminateTimeServerRequestBody.h>
#include <huaweicloud/ecs/v2/model/UpdateAutoTerminateTimeServerResponse.h>
#include <huaweicloud/ecs/v2/model/UpdateServerMetadataRequest.h>
#include <huaweicloud/ecs/v2/model/UpdateServerMetadataRequestBody.h>
#include <huaweicloud/ecs/v2/model/UpdateServerMetadataResponse.h>
Expand Down Expand Up @@ -643,6 +646,17 @@ class HUAWEICLOUD_ECS_V2_EXPORT EcsClient : public Client
ShowServerTagsRequest &request
);
/// <summary>
/// 修改云服务器云主机销毁时间
/// </summary>
/// <remarks>
/// 修改按需服务器,设置定时销毁时间。如果设置的销毁时间为空,表示取消销毁时间。 该接口支持企业项目细粒度权限的校验,具体细粒度请参见 ecs:cloudServers:put。
/// </remarks>
/// <param name="serverId">云服务器ID。</param>
/// <param name="updateAutoTerminateTimeServerRequestBody">This is a auto create Body Object</param>
std::shared_ptr<UpdateAutoTerminateTimeServerResponse> updateAutoTerminateTimeServer(
UpdateAutoTerminateTimeServerRequest &request
);
/// <summary>
/// 修改云服务器
/// </summary>
/// <remarks>
Expand Down
11 changes: 11 additions & 0 deletions ecs/include/huaweicloud/ecs/v2/model/NovaCreateServersOption.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ class HUAWEICLOUD_ECS_V2_EXPORT NovaCreateServersOption
/////////////////////////////////////////////
/// NovaCreateServersOption members

/// <summary>
/// 弹性云服务器自动释放时间。 时间格式例如:2020-01-19T03:30:52Z
/// </summary>

std::string getAutoTerminateTime() const;
bool autoTerminateTimeIsSet() const;
void unsetautoTerminateTime();
void setAutoTerminateTime(const std::string& value);

/// <summary>
/// 镜像ID或者镜像资源的URL。 - 镜像ID示例:3b8d6fef-af77-42ab-b8b7-5a7f0f0af8f2 - 镜像URL示例:http://glance.openstack.example.com/images/3b8d6fef-af77-42ab-b8b7-5a7f0f0af8f2 - 指定卷作为系统卷创弹性云服务器时,不需填写该参数;非卷创建弹性云服务器时需填写有效的UUID参数,否则API将返回400错误。 &gt; 说明: &gt; - 对于部分规格的弹性云服务器,不能支持公有云平台提供的所有公共镜像。具体规格的镜像支持列表,请登录管理控制台,以“创建弹性云服务器”页面系统自动过滤的镜像信息为准,并在镜像服务页面查询镜像ID。 &gt; - 如果创建失败,请尝试修改参数配置。
/// </summary>
Expand Down Expand Up @@ -199,6 +208,8 @@ class HUAWEICLOUD_ECS_V2_EXPORT NovaCreateServersOption


protected:
std::string autoTerminateTime_;
bool autoTerminateTimeIsSet_;
std::string imageRef_;
bool imageRefIsSet_;
std::string flavorRef_;
Expand Down
11 changes: 11 additions & 0 deletions ecs/include/huaweicloud/ecs/v2/model/PostPaidServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ class HUAWEICLOUD_ECS_V2_EXPORT PostPaidServer
/////////////////////////////////////////////
/// PostPaidServer members

/// <summary>
/// 弹性云服务器自动释放时间。 时间格式例如:2020-01-19T03:30:52Z
/// </summary>

std::string getAutoTerminateTime() const;
bool autoTerminateTimeIsSet() const;
void unsetautoTerminateTime();
void setAutoTerminateTime(const std::string& value);

/// <summary>
/// 如果需要使用密码方式登录云服务器,可使用adminPass字段指定云服务器管理员帐户初始登录密码。其中,Linux管理员帐户为root,Windows管理员帐户为Administrator。具体使用方法请参见接口描述信息(设置登录鉴权方式)。 密码复杂度要求: - 长度为8-26位。 - 密码至少必须包含大写字母、小写字母、数字和特殊字符(!@$%^-_&#x3D;+[{}]:,./?)中的三种。 - 密码不能包含用户名或用户名的逆序。 - Windows系统密码不能包含用户名或用户名的逆序,不能包含用户名中超过两个连续字符的部分。
/// </summary>
Expand Down Expand Up @@ -240,6 +249,8 @@ class HUAWEICLOUD_ECS_V2_EXPORT PostPaidServer


protected:
std::string autoTerminateTime_;
bool autoTerminateTimeIsSet_;
std::string adminPass_;
bool adminPassIsSet_;
std::string availabilityZone_;
Expand Down
11 changes: 11 additions & 0 deletions ecs/include/huaweicloud/ecs/v2/model/PrePaidServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ class HUAWEICLOUD_ECS_V2_EXPORT PrePaidServer
/////////////////////////////////////////////
/// PrePaidServer members

/// <summary>
/// 弹性云服务器自动释放时间。 时间格式例如:2020-01-19T03:30:52Z
/// </summary>

std::string getAutoTerminateTime() const;
bool autoTerminateTimeIsSet() const;
void unsetautoTerminateTime();
void setAutoTerminateTime(const std::string& value);

/// <summary>
/// 待创建云服务器的系统镜像,需要指定已创建镜像的ID,ID格式为通用唯一识别码(Universally Unique Identifier,简称UUID)。
/// </summary>
Expand Down Expand Up @@ -240,6 +249,8 @@ class HUAWEICLOUD_ECS_V2_EXPORT PrePaidServer


protected:
std::string autoTerminateTime_;
bool autoTerminateTimeIsSet_;
std::string imageRef_;
bool imageRefIsSet_;
std::string flavorRef_;
Expand Down
11 changes: 11 additions & 0 deletions ecs/include/huaweicloud/ecs/v2/model/ServerDetail.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ class HUAWEICLOUD_ECS_V2_EXPORT ServerDetail
void unsetupdated();
void setUpdated(const std::string& value);

/// <summary>
/// 弹性云服务器自动释放时间。 时间格式例如:2020-01-19T03:30:52Z
/// </summary>

std::string getAutoTerminateTime() const;
bool autoTerminateTimeIsSet() const;
void unsetautoTerminateTime();
void setAutoTerminateTime(const std::string& value);

/// <summary>
/// 弹性云服务器所在主机的主机ID。
/// </summary>
Expand Down Expand Up @@ -451,6 +460,8 @@ class HUAWEICLOUD_ECS_V2_EXPORT ServerDetail
bool statusIsSet_;
std::string updated_;
bool updatedIsSet_;
std::string autoTerminateTime_;
bool autoTerminateTimeIsSet_;
std::string hostId_;
bool hostIdIsSet_;
std::string oSEXTSRVATTRhost_;
Expand Down
Loading

0 comments on commit f4db5ee

Please sign in to comment.