Created
March 7, 2016 10:20
-
-
Save sandromello/cbd2ab05281092e25af8 to your computer and use it in GitHub Desktop.
Koli API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: "2.0" | |
info: | |
description: | | |
Koli fucking box. | |
[Learn about Swagger](http://swagger.wordnik.com) or join the IRC channel `#swagger` on irc.freenode.net. | |
For this sample, you can use the api key `special-key` to test the authorization filters | |
version: "1.0.0" | |
title: Koli API | |
termsOfService: http://kolibox.io/terms/ | |
contact: | |
name: [email protected] | |
license: | |
name: Koli Inc. | |
url: http://kolibox.io/terms/licenses/LICENSE-2.0.html | |
host: api.kolibox.io | |
schemes: | |
- http | |
################################################################################ | |
# Parameters # | |
################################################################################ | |
parameters: | |
by: | |
in: query | |
name: by | |
description: Switchs the path parameters to `id` or `name`. Defaults to `id` | |
required: false | |
type: string | |
enum: | |
- name | |
- id | |
stack: | |
name: stack | |
in: path | |
description: The stack identifier. Defaults to `name` in POST method | |
type: string | |
required: true | |
layer: | |
name: layer | |
in: path | |
description: The layer identifier. Defaults to `name` in POST method | |
type: string | |
required: true | |
offset: | |
name: offset | |
in: query | |
description: The offset of the first record returned. Default is 0. | |
required: false | |
type: integer | |
format: int32 | |
limit: | |
name: limit | |
in: query | |
description: The number of records returned. Default (and max limit) is 10. | |
required: false | |
type: integer | |
format: int32 | |
################################################################################ | |
# Paths # | |
################################################################################ | |
paths: | |
/stacks: | |
get: | |
tags: | |
- stacks | |
summary: Find all existent stacks | |
description: Returns Stack objects | |
operationId: get_stacks | |
parameters: | |
- in: query | |
name: offset | |
description: The offset of the first record returned. Default is 0. | |
required: false | |
type: integer | |
format: int32 | |
- in: query | |
name: limit | |
description: The number of records returned. Default (and max limit) is 10. | |
required: false | |
type: integer | |
format: int32 | |
produces: | |
- application/json | |
responses: | |
"404": | |
description: Stacks not found | |
"200": | |
description: successful operation | |
schema: | |
type: array | |
items: | |
$ref: "#/definitions/Stack" | |
/stacks/{stack}: | |
post: | |
tags: | |
- stacks | |
summary: Add a new stack into cluster | |
description: "A stack it's a set of layers in which you can create applications" | |
operationId: add_stack | |
consumes: | |
- application/json | |
produces: | |
- application/json | |
parameters: | |
- $ref: '#/parameters/stack' | |
- in: body | |
name: body | |
description: Stack object that needs to the added | |
required: false | |
schema: | |
$ref: "#/definitions/Stack" | |
responses: | |
"409": | |
description: Stack already exists | |
"201": | |
description: Successful operation | |
schema: | |
type: array | |
items: | |
$ref: '#/definitions/Stack' | |
get: | |
tags: | |
- stacks | |
summary: Find stack by ID | |
description: Returns a stack | |
operationId: get_stack_by_id | |
produces: | |
- application/json | |
parameters: | |
- $ref: '#/parameters/by' | |
- $ref: '#/parameters/stack' | |
responses: | |
"404": | |
description: Stack not found | |
"200": | |
description: successful operation | |
schema: | |
$ref: "#/definitions/Stack" | |
"400": | |
description: Invalid ID supplied | |
put: | |
tags: | |
- stacks | |
summary: Updates a stack | |
description: "" | |
operationId: update_stack | |
consumes: | |
- application/json | |
produces: | |
- application/json | |
parameters: | |
- $ref: '#/parameters/by' | |
- $ref: '#/parameters/stack' | |
- in: body | |
name: body | |
description: Stack object that needs to the added | |
required: true | |
schema: | |
$ref: "#/definitions/Stack" | |
responses: | |
"405": | |
description: Invalid input | |
"404": | |
description: Stack not found | |
"204": | |
description: Successful operation | |
delete: | |
tags: | |
- stacks | |
summary: Deletes a stack | |
description: "" | |
operationId: delete_stack | |
produces: | |
- application/json | |
parameters: | |
- $ref: '#/parameters/by' | |
- $ref: '#/parameters/stack' | |
responses: | |
"404": | |
description: Stack not found | |
"409": | |
description: There're still objects associate with the stack | |
"204": | |
description: Successful operation | |
/stacks/{stack}/layers: | |
get: | |
tags: | |
- layers | |
summary: Find all existent layers | |
description: Returns all layers existent for the given stack | |
operationId: get_layers | |
parameters: | |
- $ref: '#/parameters/by' | |
- $ref: '#/parameters/stack' | |
- $ref: '#/parameters/offset' | |
- $ref: '#/parameters/limit' | |
produces: | |
- application/json | |
responses: | |
"404": | |
description: Layers not found | |
"200": | |
description: Successful operation | |
schema: | |
type: array | |
items: | |
$ref: "#/definitions/Layer" | |
/stacks/{stack}/layers/{layer}: | |
post: | |
tags: | |
- layers | |
summary: Add a new layer into stack | |
description: "" | |
operationId: add_layer | |
produces: | |
- application/json | |
consumes: | |
- application/json | |
parameters: | |
- $ref: '#/parameters/by' | |
- $ref: '#/parameters/stack' | |
- $ref: '#/parameters/layer' | |
- in: body | |
name: body | |
description: layer object definition | |
required: true | |
schema: | |
$ref: "#/definitions/Layer" | |
responses: | |
"201": | |
description: Successful operation | |
schema: | |
$ref: "#/definitions/Layer" | |
headers: | |
Location: | |
description: Returns the created resource uri | |
type: string | |
"409": | |
description: A layer with that name already exists | |
put: | |
tags: | |
- layers | |
summary: Updates a layer | |
description: "" | |
operationId: update_layer | |
consumes: | |
- application/json | |
produces: | |
- application/json | |
parameters: | |
- $ref: '#/parameters/by' | |
- $ref: '#/parameters/stack' | |
- $ref: '#/parameters/layer' | |
- in: body | |
name: body | |
description: Layer object that needs to be updated | |
required: true | |
schema: | |
$ref: "#/definitions/Layer" | |
responses: | |
"405": | |
description: Invalid input | |
"404": | |
description: Stack or layer not found | |
"204": | |
description: Successful operation | |
get: | |
tags: | |
- layers | |
summary: Find a specific layer | |
description: "" | |
operationId: get_layer | |
parameters: | |
- $ref: '#/parameters/by' | |
- $ref: '#/parameters/stack' | |
- $ref: '#/parameters/layer' | |
- $ref: '#/parameters/offset' | |
- $ref: '#/parameters/limit' | |
produces: | |
- application/json | |
responses: | |
"404": | |
description: Layer not found | |
"200": | |
description: Successful operation | |
schema: | |
$ref: "#/definitions/Layer" | |
delete: | |
tags: | |
- layers | |
summary: Deletes a layer | |
description: "" | |
operationId: delete_layer | |
produces: | |
- application/json | |
parameters: | |
- $ref: '#/parameters/by' | |
- $ref: '#/parameters/stack' | |
- $ref: '#/parameters/layer' | |
responses: | |
"204": | |
description: Successful operation | |
"404": | |
description: Object not found | |
/stacks/{stack}/layers/{layer}/state: | |
patch: | |
tags: | |
- layers | |
summary: Change the state of a layer. | |
description: "" | |
operationId: change_layer_state | |
produces: | |
- application/json | |
consumes: | |
- application/json | |
parameters: | |
- $ref: '#/parameters/by' | |
- $ref: '#/parameters/stack' | |
- $ref: '#/parameters/layer' | |
- in: query | |
name: activated | |
description: Set the status of the containers in the layer. | |
required: true | |
type: string | |
enum: | |
- '1' | |
- '0' | |
responses: | |
"204": | |
description: Successful operation | |
/stacks/{stack}/layers/{layer}/replicas/{size}: | |
patch: | |
tags: | |
- layers | |
summary: Change the ammount of the replicas in the layer | |
description: "" | |
operationId: change_layer_replica | |
consumes: | |
- application/json | |
parameters: | |
- $ref: '#/parameters/by' | |
- $ref: '#/parameters/stack' | |
- $ref: '#/parameters/layer' | |
- in: path | |
name: size | |
description: Size of the replicas | |
required: true | |
type: integer | |
format: int32 | |
responses: | |
"204": | |
description: Successful operation | |
"409": | |
description: Inconsistent state of replicas | |
################################################################################ | |
# Definitions # | |
################################################################################ | |
definitions: | |
Stack: | |
properties: | |
id: | |
type: integer | |
format: int64 | |
name: | |
type: string | |
description: User Status | |
Layer: | |
properties: | |
id: | |
type: integer | |
format: int64 | |
name: | |
type: string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment