Skip to content

Commit c770153

Browse files
fix(generated): improve _up examples
Generated SDK source code using: - Generator version 3.107.1 - Specification version 1.0.0-dev0.1.30 - Automation (cloudant-sdks) version e8e7dee
1 parent 05f70d6 commit c770153

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

examples/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,12 +549,19 @@ _GET `/_up`_
549549
```py
550550
# section: code
551551
from ibmcloudant.cloudant_v1 import CloudantV1
552+
from ibm_cloud_sdk_core.api_exception import ApiException
552553

553554
service = CloudantV1.new_instance()
555+
try:
556+
response = service.get_up_information()
554557

555-
response = service.get_up_information().get_result()
556-
557-
print(response)
558+
print("Service is up and healthy")
559+
print(response.get_result())
560+
except ApiException as ae:
561+
if ae.code == 503:
562+
print(f"Service is unavailable, status code: {ae.code}")
563+
else:
564+
print(f"Issue performing health check, status code: {ae.code}, message: {ae.http_response.reason}")
558565
```
559566

560567
## getUuids
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# section: code
22
from ibmcloudant.cloudant_v1 import CloudantV1
3+
from ibm_cloud_sdk_core.api_exception import ApiException
34

45
service = CloudantV1.new_instance()
6+
try:
7+
response = service.get_up_information()
58

6-
response = service.get_up_information().get_result()
7-
8-
print(response)
9+
print("Service is up and healthy")
10+
print(response.get_result())
11+
except ApiException as ae:
12+
if ae.code == 503:
13+
print(f"Service is unavailable, status code: {ae.code}")
14+
else:
15+
print(f"Issue performing health check, status code: {ae.code}, message: {ae.http_response.reason}")
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# section: code
2+
from ibmcloudant.cloudant_v1 import CloudantV1
3+
from ibm_cloud_sdk_core.api_exception import ApiException
4+
5+
service = CloudantV1.new_instance()
6+
try:
7+
response = service.head_up_information()
8+
9+
print("Service is up and healthy")
10+
except ApiException as ae:
11+
if ae.code == 503:
12+
print(f"Service is unavailable, status code: {ae.code}")
13+
else:
14+
print(f"Issue performing health check, status code: {ae.code}, message: {ae.http_response.reason}")

0 commit comments

Comments
 (0)