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.
make generate-api
Change basePath: "/api" to basePath: "/cb" at /api/swagger.yaml.
Introduce brand new Services for Cloudbreak Info and Health.
tags section:tags:
- name: "info"
- name: "health"
paths:paths:
/info:
get:
tags:
- "info"
summary: "retrieve Cloudbreak version for user"
description: "Cloudbreak version information."
operationId: "getCloudbreakInfo"
schemes:
- "http"
- "https"
consumes:
- "application/json"
produces:
- "application/json"
parameters: []
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Info"
x-swagger-router-controller: "Info"
/health:
get:
tags:
- "health"
summary: "retrieve Cloudbreak server status for user"
description: "Cloudbreak server status."
operationId: "getCloudbreakHealth"
schemes:
- "http"
- "https"
consumes:
- "application/json"
produces:
- "application/json"
parameters: []
responses:
200:
description: "successful operation"
schema:
$ref: "#/definitions/Info"
x-swagger-router-controller: "Info"
definitions:definitions:
...
Info:
type: "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:
exports.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
**/
var openstack_data = require('../responses/credentials/openstack.json');
var aws_data = require('../responses/credentials/aws.json');
var azure_data = require('../responses/credentials/azure.json');
var gcp_data = require('../responses/credentials/gcp.json');
var response_array = [];
response_array.push(openstack_data,aws_data,azure_data,gcp_data);
var examples = {};
examples['application/json'] = response_array;
if (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:
docker build -t hortonworks/cloudbreak-mock:latest .
First, initialize Cloudbreak Mock by updating the CBD Profile file with the following content:
export DOCKER_IMAGE_CLOUDBREAK=hortonworks/cloudbreak-mock
export DOCKER_TAG_CLOUDBREAK=latest
To start the Cloudbreak Mock application use the following command:
cbd start
This will start all the needed Docker containers and initialize the mock application.
Content type
Image
Digest
Size
32.9 MB
Last updated
almost 7 years ago
docker pull hortonworks/cloud-swagger-mock