File tree Expand file tree Collapse file tree 9 files changed +37
-12
lines changed
samples/src/main/java/com/otc/sdk/samples Expand file tree Collapse file tree 9 files changed +37
-12
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ For documentation see: [otc-java-sdk-v1](https://opentelekomcloud-community.gith
2222> Open documentation in browser: < http://127.0.0.1:8889>
2323
2424
25+ # # References
26+
27+ Code is an OTC adapted version of [java-sdk-core-3.2.6.jar](https://obs.cn-north-1.myhuaweicloud.com/apig-sdk/ApiGateway-java-sdk.zip) included in folder ApiGateway-java-sdk-3.2.6/libs/.
28+
2529# # Warranty Disclaimer
2630
2731THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT
Original file line number Diff line number Diff line change 4242 <scope >compile</scope >
4343 </dependency >
4444
45- <!-- if this dependency is added, additional log entries will apear in log output -->
45+ <!-- if this dependency is added, additional log entries will appear in log output -->
4646 <!--
4747 <dependency>
4848 <groupId>org.slf4j</groupId>
Original file line number Diff line number Diff line change 11OTC Java SDK v1 documentation
22=============================
33
4- The `OTC Java SDK v1 ` provides functionality to use the
5- OpenTelekomCloud API in Java.
4+ This is the community version of OTC Java SDK v1.
65
7- Especially methods for signing requests using AK/SK
6+ The `OTC Java SDK v1 ` provides functionality
7+ for *Access Key * and *Secret Access Key * (AK/SK) request signing
8+ used in OpenTelekomCloud API calls
89
910.. toctree ::
1011 :includehidden:
@@ -19,6 +20,13 @@ Source Code
1920
2021For source code, see :github_repo_master: `OTC Java SDK v1 on Github <> `.
2122
23+ References
24+ ----------
25+
26+ Code is an OTC adapted version of
27+ `java-sdk-core-3.2.6.jar <https://obs.cn-north-1.myhuaweicloud.com/apig-sdk/ApiGateway-java-sdk.zip >`_
28+ included in folder *ApiGateway-java-sdk-3.2.6/libs/ *.
29+
2230Disclaimer
2331----------
2432
Original file line number Diff line number Diff line change @@ -22,12 +22,21 @@ To run samples following environment variables have to be set:
2222 - Secret key
2323 - see: :api_usage: `Generating an AK and SK<guidelines/calling_apis/ak_sk_authentication/generating_an_ak_and_sk.html> ` in API usage guide.
2424
25+ * - OTC_SDK_REGION
26+ - Region (e.g. eu-de)
27+ - for available regions, see: `Regions <https://docs.otc.t-systems.com/regions-and-endpoints/index.html#region >`_.
28+
2529 * - OTC_SDK_PROJECTID
2630 - Project Id
2731 - see: :api_usage: `Obtaining a Project ID<guidelines/calling_apis/obtaining_required_information.html> ` in API usage guide.
2832
2933 * - OTC_IAM_ENDPOINT
30- - https://iam.eu-de.otc.t-systems.com
3134 - IAM Endpoint
35+ - e.g. https://iam.eu-de.otc.t-systems.com or https://iam.eu-nl.otc.t-systems.com
3236
3337For samples, see :github_repo_master: `Samples folder <samples> `
38+
39+ .. note ::
40+ Samples in folder :github_repo_master: `demo <samples/src/main/java/com/otc/sdk/samples/demo> `
41+ are to demonstrate on how to use the OTC SDK for various use cases, including HTTP requests and WebSocket communication.
42+ They are not working examples and require additional setup or configuration to run successfully.
Original file line number Diff line number Diff line change @@ -51,11 +51,11 @@ public static void main(String[] args) throws Exception {
5151 // Sign the request.
5252 HttpRequestBase signedRequest = Client .sign (httpClientRequest , Constant .SIGNATURE_ALGORITHM_SDK_HMAC_SHA256 );
5353 if (Constant .DO_VERIFY ) {
54- // creat httpClient and verify ssl certificate
54+ // create httpClient and verify ssl certificate
5555 HostName .setUrlHostName (httpClientRequest .getHost ());
5656 client = (CloseableHttpClient ) SSLCipherSuiteUtil .createHttpClientWithVerify (Constant .INTERNATIONAL_PROTOCOL );
5757 } else {
58- // creat httpClient and do not verify ssl certificate
58+ // create httpClient and do not verify ssl certificate
5959 client = (CloseableHttpClient ) SSLCipherSuiteUtil .createHttpClient (Constant .INTERNATIONAL_PROTOCOL );
6060 }
6161 HttpResponse response = client .execute (signedRequest );
Original file line number Diff line number Diff line change @@ -49,11 +49,11 @@ public static void main(String[] args) throws Exception {
4949 okhttp3 .Request signedRequest = Client .signOkhttp (webSocketRequest , Constant .SIGNATURE_ALGORITHM_SDK_HMAC_SHA256 );
5050 OkHttpClient webSocketClient ;
5151 if (Constant .DO_VERIFY ) {
52- // creat okhttpClient and verify ssl certificate
52+ // create okhttpClient and verify ssl certificate
5353 HostName .setUrlHostName (webSocketRequest .getHost ());
5454 webSocketClient = SSLCipherSuiteUtil .createOkHttpClientWithVerify (Constant .INTERNATIONAL_PROTOCOL );
5555 } else {
56- // creat okhttpClient and do not verify ssl certificate
56+ // create okhttpClient and do not verify ssl certificate
5757 webSocketClient = SSLCipherSuiteUtil .createOkHttpClient (Constant .INTERNATIONAL_PROTOCOL );
5858 }
5959 WebSocketListener webSocketListener = new WebSocketListener () {
Original file line number Diff line number Diff line change @@ -51,12 +51,13 @@ public static void main(String[] args) throws Exception {
5151 String ak = System .getenv ("OTC_SDK_AK" );
5252 String sk = System .getenv ("OTC_SDK_SK" );
5353 String projectId = System .getenv ("OTC_SDK_PROJECTID" );
54+ String region = System .getenv ("OTC_SDK_REGION" );
5455
5556 httpClientRequest .setKey (ak );
5657 httpClientRequest .setSecret (sk );
5758 httpClientRequest .setMethod (HttpMethodName .GET .toString ());
5859
59- String url = String .format ("https://functiongraph.eu-de .otc.t-systems.com/v2/%s/fgs/functions" , projectId );
60+ String url = String .format ("https://functiongraph.%s .otc.t-systems.com/v2/%s/fgs/functions" , region , projectId );
6061
6162 httpClientRequest .setUrl (url );
6263 httpClientRequest .addHeader ("Content-type" , "application/json;charset=utf8" );
Original file line number Diff line number Diff line change @@ -46,11 +46,13 @@ public static void main(String[] args) throws Exception {
4646 String ak = System .getenv ("OTC_SDK_AK" );
4747 String sk = System .getenv ("OTC_SDK_SK" );
4848 String projectId = System .getenv ("OTC_SDK_PROJECTID" );
49+ String region = System .getenv ("OTC_SDK_REGION" );
50+
4951 OkHttpRequest .setKey (ak );
5052 OkHttpRequest .setSecret (sk );
5153 OkHttpRequest .setMethod (HttpMethodName .GET .toString ());
5254
53- String url = String .format ("https://functiongraph.eu-de .otc.t-systems.com/v2/%s/fgs/functions" , projectId );
55+ String url = String .format ("https://functiongraph.%s .otc.t-systems.com/v2/%s/fgs/functions" , region , projectId );
5456 OkHttpRequest .setUrl (url );
5557
5658 OkHttpRequest .addHeader ("Content-type" , "application/json;charset=utf8" );
Original file line number Diff line number Diff line change @@ -51,12 +51,13 @@ public static void main(String[] args) throws Exception {
5151 String ak = System .getenv ("OTC_SDK_AK" );
5252 String sk = System .getenv ("OTC_SDK_SK" );
5353 String projectId = System .getenv ("OTC_SDK_PROJECTID" );
54+ String region = System .getenv ("OTC_SDK_REGION" );
5455
5556 httpClientRequest .setKey (ak );
5657 httpClientRequest .setSecret (sk );
5758 httpClientRequest .setMethod (HttpMethodName .GET .toString ());
5859
59- String url = String .format ("https://vpc.eu-de .otc.t-systems.com/v1/%s/vpcs" , projectId );
60+ String url = String .format ("https://vpc.%s .otc.t-systems.com/v1/%s/vpcs" , region , projectId );
6061
6162 httpClientRequest .setUrl (url );
6263 httpClientRequest .addHeader ("Content-type" , "application/json;charset=utf8" );
You can’t perform that action at this time.
0 commit comments