Skip to content

Commit fd89107

Browse files
committed
release 0.0.3-beta source code for cpp
1 parent a3ead7b commit fd89107

File tree

261 files changed

+44694
-58
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+44694
-58
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# 0.0.3-beta 2023-01-06
2+
3+
### G42Cloud SDK IMS
4+
5+
- _Features_
6+
- New Support IMS
7+
- _Bug Fix_
8+
- None
9+
- _Change_
10+
- None
11+
112
# 0.0.2-beta 2022-11-29
213

314
### G42Cloud SDK Core

README.md

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<a href="https://www.g42cloud.com/"><img width="450px" height="102px" src="https://auth.g42cloud.com//authui/20220614193554/public/custom/images/logo.svg"></a>
2+
<a href="https://www.g42cloud.com/"><img src="https://upload.wikimedia.org/wikipedia/en/4/43/Group_42_Logo.jpg"></a>
33
</p>
44

55
<h1 align="center">G42 Cloud C++ Software Development Kit (C++ SDK)</h1>
@@ -265,13 +265,6 @@ globalCredentials->withAk(ak)
265265
.withSk(sk)
266266
.withDomainId(domainId);
267267
```
268-
**Notice**:
269-
270-
- projectId/domainId supports **automatic acquisition** in version `0.0.26-beta` or later, if you want to use this
271-
feature, you need to provide the ak and sk of your account and the id of the region, and then build your client
272-
instance with method `WithRegion()`, detailed example could refer
273-
to [3.2 Initialize client with specified Region](#32-initialize-the-serviceclient-with-specified-region-recommended-top)
274-
275268
276269
#### 2.2 Use Temporary AK&SK [:top:](#user-manual-top)
277270
@@ -311,55 +304,6 @@ std::unique_ptr<Vpc::V2::VpcClient> vpcApi_v2 = Vpc::V2::VpcClient::newBuilder()
311304
.build();
312305
```
313306

314-
**where:**
315-
316-
- `endpoint` varies by services and regions,
317-
see [Regions and Endpoints](https://docs.g42cloud.com/endpoint/index.html) to obtain correct endpoint.
318-
- When you meet some trouble in getting projectId using the specified region way, you could use this way instead.
319-
320-
#### 3.2 Initialize the {Service}Client with specified Region **(Recommended)** [:top:](#user-manual-top)
321-
322-
* Region Services
323-
324-
```c++
325-
// add dependency for the {{Service}}Region
326-
#include <G42Cloud/ecs/v2/EcsRegion.h>
327-
using namespace G42Cloud::Sdk::Ecs::V2;
328-
329-
// Initialize the credentials, projectId or domainId could be unassigned in this situation, take initializing BasicCredentials for example
330-
auto auth = std::make_unique<BasicCredentials>();
331-
auth->withAk(ak)
332-
.withSk(sk);
333-
// Initialize specified New{Service}Client, take initializing the region service ECS for example
334-
auto client = EcsClient::newBuilder()
335-
.withCredentials(std::unique_ptr<Credentials>(auth.release()))
336-
.withHttpConfig(httpConfig)
337-
.withFileLog(R"(.\log.txt)", true)
338-
.withStreamLog(true)
339-
.withRegion(EcsRegion::valueOf("ae-ad-1"))
340-
.build();
341-
```
342-
343-
* Global Services
344-
```
345-
no global service is supported up to now.
346-
```
347-
348-
**Notice:**
349-
350-
- If you use `region` to initialize {Service}Client, projectId/domainId supports automatic acquisition, you don't need
351-
to configure it when initializing Credentials.
352-
- Multiple ProjectId situation is **not supported**.
353-
- Supported region list: ae-ad-1. You may get exception such as `Unsupported regionId` if your
354-
region don't in the list above.
355-
356-
**Comparison of the two ways:**
357-
358-
| Initialization | Advantages | Disadvantage |
359-
| ------------------ | ------------------------------------------------------------ | ---------------------------------------------------- |
360-
| Specified Endpoint | The API can be invoked successfully once it has been published in the environment. | You need to prepare projectId and endpoint yourself. |
361-
| Specified Region | No need for projectId and endpoint, it supports automatic acquisition if you configure it in the right way. | The supported services and regions are limited. |
362-
363307
### 4. Send Requests and Handle Responses [:top:](#user-manual-top)
364308

365309
``` cpp

core/src/Client.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ std::unique_ptr<HttpResponse> Client::callApi(const std::string &method, const s
6262
std::string queryParamsHttp = getQueryParams(queryParams);
6363
RequestParams requestParams(method, scheme, host, uriHttp, queryParamsHttp, false, body);
6464

65-
requestParams.addHeader(Header("User-Agent", "g42cloud-sdk-cpp/3.0"));
65+
requestParams.addHeader(Header("User-Agent", "g42cloud-usdk-cpp/3.0"));
6666
addHeaderParams(requestParams, headerParams);
6767
credentials_->processAuthRequest(requestParams);
6868

0 commit comments

Comments
 (0)