|
1 | 1 | <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> |
3 | 3 | </p> |
4 | 4 |
|
5 | 5 | <h1 align="center">G42 Cloud C++ Software Development Kit (C++ SDK)</h1> |
@@ -265,13 +265,6 @@ globalCredentials->withAk(ak) |
265 | 265 | .withSk(sk) |
266 | 266 | .withDomainId(domainId); |
267 | 267 | ``` |
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 | | -
|
275 | 268 |
|
276 | 269 | #### 2.2 Use Temporary AK&SK [:top:](#user-manual-top) |
277 | 270 |
|
@@ -311,55 +304,6 @@ std::unique_ptr<Vpc::V2::VpcClient> vpcApi_v2 = Vpc::V2::VpcClient::newBuilder() |
311 | 304 | .build(); |
312 | 305 | ``` |
313 | 306 |
|
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 | | -
|
363 | 307 | ### 4. Send Requests and Handle Responses [:top:](#user-manual-top) |
364 | 308 |
|
365 | 309 | ``` cpp |
|
0 commit comments