Skip to content

Commit f439cc6

Browse files
committed
BUG-94365 Update Info and Health services
1 parent fe2294e commit f439cc6

File tree

2 files changed

+80
-6
lines changed

2 files changed

+80
-6
lines changed

mock/README.md

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,83 @@ java -jar /usr/local/Cellar/swagger-codegen/2.2.3/libexec/swagger-codegen-cli.ja
4242
* `/usr/local/Cellar/swagger-codegen/2.2.3/libexec/swagger-codegen-cli.jar`: the Swagger Codegen CLI path on OS X. This can be vary on different OSs and with different installs. You can read more about this at [Swagger Codegen CLI Installation](https://github.com/swagger-api/swagger-codegen#table-of-contents).
4343
* `javascript_api_client`: the destination folder for the generated client. This is also can be vary based on your decision.
4444

45-
## Fix basePath in the generated Swagger YML
46-
Change `basePath: "/api"` to `basePath: "/cb/api"` at [/api/swagger.yaml](api/swagger.yaml).
45+
## Upgrade Swagger YML
46+
47+
### Base Path
48+
Change `basePath: "/api"` to `basePath: "/cb"` at [/api/swagger.yaml](api/swagger.yaml).
49+
50+
### New Info and Health Services
51+
Introduce brand new Services for Cloudbreak Info and Health.
52+
53+
1. In the `tags` section:
54+
```
55+
tags:
56+
- name: "info"
57+
- name: "health"
58+
```
59+
2. In the beginning of the `paths`:
60+
```
61+
paths:
62+
/info:
63+
get:
64+
tags:
65+
- "info"
66+
summary: "retrieve Cloudbreak version for user"
67+
description: "Cloudbreak version information."
68+
operationId: "getCloudbreakInfo"
69+
schemes:
70+
- "http"
71+
- "https"
72+
consumes:
73+
- "application/json"
74+
produces:
75+
- "application/json"
76+
parameters: []
77+
responses:
78+
200:
79+
description: "successful operation"
80+
schema:
81+
$ref: "#/definitions/Info"
82+
x-swagger-router-controller: "Info"
83+
/health:
84+
get:
85+
tags:
86+
- "health"
87+
summary: "retrieve Cloudbreak server status for user"
88+
description: "Cloudbreak server status."
89+
operationId: "getCloudbreakHealth"
90+
schemes:
91+
- "http"
92+
- "https"
93+
consumes:
94+
- "application/json"
95+
produces:
96+
- "application/json"
97+
parameters: []
98+
responses:
99+
200:
100+
description: "successful operation"
101+
schema:
102+
$ref: "#/definitions/Info"
103+
x-swagger-router-controller: "Info"
104+
```
105+
3. In the end of `definitions`:
106+
```
107+
definitions:
108+
```
109+
...
110+
```
111+
Info:
112+
type: "object"
113+
```
114+
115+
### Extend Paths
116+
Exend all the `paths:` with `/api`, for example change `/v1/accountpreferences/isplatformselectiondisabled:` to `/api/v1/accountpreferences/isplatformselectiondisabled:`
47117

48118
## Provide responses to all the needed Services
49-
Here is an example for `V1credentialsService.js`:
119+
Introduce brand new Services for Cloudbreak Info and Health here as well. The new files should be [Info.js](controllers/Info.js) and [InfoService.js](controllers/InfoService.js).
120+
121+
For existing services here is an example for `V1credentialsService.js`:
50122
```
51123
exports.getPublicsCredential = function(args, res, next) {
52124
/**

mock/api/swagger.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ info:
1818
title: "Cloudbreak API"
1919
basePath: "/cb"
2020
tags:
21+
- name: "info"
22+
- name: "health"
2123
- name: "v1clusters"
2224
- name: "v1recipes"
2325
- name: "v1smartsensesubscriptions"
@@ -8146,7 +8148,7 @@ definitions:
81468148
type: "string"
81478149
description: "definition of allowed subnet in CIDR format"
81488150
pattern: "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\\
8149-
/api/([0-9]|[1-2][0-9]|3[0-2]))$"
8151+
/([0-9]|[1-2][0-9]|3[0-2]))$"
81508152
ports:
81518153
type: "string"
81528154
description: "comma separated list of accessible ports"
@@ -9974,7 +9976,7 @@ definitions:
99749976
type: "string"
99759977
description: "definition of allowed subnet in CIDR format"
99769978
pattern: "^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\\\
9977-
/api/([0-9]|[1-2][0-9]|3[0-2]))$"
9979+
/([0-9]|[1-2][0-9]|3[0-2]))$"
99789980
ports:
99799981
type: "string"
99809982
description: "comma separated list of accessible ports"
@@ -10205,7 +10207,7 @@ definitions:
1020510207
type: "string"
1020610208
description: "url of the endpoint"
1020710209
pattern: "^(https?:\\/\\/)((([\\da-z\\.-]+)\\.([a-z]{2,6}))|localhost|[1-9][0-9]{0,2}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})(:[1-9][0-9]{1,4})?\\\
10208-
/api/([\\/\\w\\.-]*)\\/?$"
10210+
/([\\/\\w\\.-]*)\\/?$"
1020910211
StackV2Request:
1021010212
type: "object"
1021110213
required:

0 commit comments

Comments
 (0)