Name: cloud-swagger-mock
Owner: Hortonworks Inc
Description: null
Created: 2018-05-15 12:22:29.0
Updated: 2018-05-15 16:33:36.0
Pushed: 2018-05-15 16:33:35.0
Homepage: null
Size: 4
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Install Swagger Codegen CLI.
CLI is also available as Docker Image. You can read further here.
To get a list of available general options, you can run help generate
.
Supported config options can be different per language. Running config-help -l {lang}
will show available options.
The documentation to generate a server stub for a couple different frameworks.
generate-api
Change basePath: "/api"
to basePath: "/cb"
at /api/swagger.yaml.
Introduce brand new Services for Cloudbreak Info and Health.
tags
section::
paths
:s:
o:
gs:
"info"
mmary: "retrieve Cloudbreak version for user"
scription: "Cloudbreak version information."
erationId: "getCloudbreakInfo"
hemes:
"http"
"https"
nsumes:
"application/json"
oduces:
"application/json"
rameters: []
sponses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Info"
swagger-router-controller: "Info"
lth:
gs:
"health"
mmary: "retrieve Cloudbreak server status for user"
scription: "Cloudbreak server status."
erationId: "getCloudbreakHealth"
hemes:
"http"
"https"
nsumes:
"application/json"
oduces:
"application/json"
rameters: []
sponses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Info"
swagger-router-controller: "Info"
definitions
:nitions:
…:
: "object"
Extend all the paths:
with /api
, for example change /v1/accountpreferences/isplatformselectiondisabled
to /api/v1/accountpreferences/isplatformselectiondisabled
Introduce brand new Services for Cloudbreak Info and Health here as well. The new files should be Info.js and InfoService.js.
For existing services here is an example for V1credentialsService
:
Json
file at responses/credentials/openstack.jsongetPublicsCredential
method of V1credentialsService
:For existing services here is an example for V1credentialsService.js
:
rts.getPublicsCredential = function(args, res, next) {
*
retrieve public and private (owned) credentials
Cloudbreak is launching Hadoop clusters on the user's behalf - on different cloud providers. One key point is that Cloudbreak does not store your Cloud provider account details (such as username, password, keys, private SSL certificates, etc). We work around the concept that Identity and Access Management is fully controlled by you - the end user. The Cloudbreak deployer is purely acting on behalf of the end user - without having access to the user's account.
returns List
*/
r openstack_data = require('../responses/credentials/openstack.json');
r aws_data = require('../responses/credentials/aws.json');
r azure_data = require('../responses/credentials/azure.json');
r gcp_data = require('../responses/credentials/gcp.json');
r response_array = [];
sponse_array.push(openstack_data,aws_data,azure_data,gcp_data);
r examples = {};
amples['application/json'] = response_array;
(Object.keys(examples).length > 0) {
res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(examples[Object.keys(examples)[0]] || {}, null, 2));
else {
res.end();
You can find at Docker Hub
You can build your own Cloudbreak Mock image locally with:
er build -t hortonworks/cloudbreak-mock:latest .
First, initialize Cloudbreak Mock by updating the CBD Profile file with the following content:
rt DOCKER_IMAGE_CLOUDBREAK=hortonworks/cloudbreak-mock
rt DOCKER_TAG_CLOUDBREAK=latest
To start the Cloudbreak Mock application use the following command:
start
This will start all the needed Docker containers and initialize the mock application.