Created
July 20, 2018 05:39
-
-
Save SangHakLee/789a3f45f436b4864759e9830e845563 to your computer and use it in GitHub Desktop.
OAS 3.0
This file contains 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
openapi: 3.0.0 | |
servers: | |
- url: //10.222.222.227/api/v1 | |
description: Dev server | |
- url: //gcloud.gabia.com/v1 | |
description: Prod server | |
info: | |
title: gCloud API | |
description: gCloud API 입니다. | |
contact: | |
name: API Support | |
url: 'http://gcloud.gabia.com/support' | |
email: gcloud@gabia.com | |
version: 0.1.0 | |
paths: | |
/vps: | |
post: | |
tags: | |
- VPS | |
summary: VPS 생성 | |
description: "| cpu \t| memory \t| volume \t|\n|:---:\t|:------:\t|:------:\t|\n| 2 \t| 2 \t| 50 \t|\n| 4 \t| 4 \t| 100 \t|\n- `cpu`, `memory`, `volume`은 표에 나온 규칙만 가능합니다.\n - 2 / 2 / 50 (가능)\n - 2 / 4 / 50 (불가)\n - 1 / 2 / 50 (불가)\n" | |
operationId: createVps | |
x-code-samples: | |
- lang: Node.js | |
source: | | |
const fetch = require('node-fetch'); | |
fetch('https://cpapi.gabia.com/v1/servers', { | |
headers: { | |
'Content-Type': 'application/json', | |
'authorization': 'Bearer {YOUR-JWT-TOKEN}' | |
}, | |
method: 'POST', | |
body: JSON.stringify({ | |
'user_id': 'gabia', | |
'cpu': 2, | |
'memory': 2, | |
'volume': 50, | |
'img_id': 'img_787', | |
'server_seqno': 1, | |
}) | |
}) | |
.then(res => res.json()) | |
.then(json => console.log(json)); | |
security: | |
- bearerAuth: [] | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/CreateVps' | |
responses: | |
'201': | |
description: Created | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Vps' | |
'400': | |
$ref: '#/components/schemas/BadRequest' | |
'401': | |
$ref: '#/components/schemas/Unauthorized' | |
'403': | |
$ref: '#/components/schemas/Forbidden' | |
'404': | |
$ref: '#/components/schemas/NotFound' | |
'409': | |
$ref: '#/components/schemas/Conflict' | |
'429': | |
$ref: '#/components/schemas/TooManyRequests' | |
'/vps/{svr_id}/action': | |
patch: | |
tags: | |
- VPS | |
summary: VPS 상태 변경 | |
operationId: updateVpsAction | |
parameters: | |
- name: svr_id | |
in: path | |
schema: | |
type: string | |
pattern: '^(vm_)+[1-9]{1}\d*$' | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/UpdateVpsAction' | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Vps' | |
'400': | |
$ref: '#/components/schemas/BadRequest' | |
'401': | |
$ref: '#/components/schemas/Unauthorized' | |
'403': | |
$ref: '#/components/schemas/Forbidden' | |
'404': | |
$ref: '#/components/schemas/NotFound' | |
'409': | |
$ref: '#/components/schemas/Conflict' | |
'429': | |
$ref: '#/components/schemas/TooManyRequests' | |
'/vps/{svr_id}/network': | |
patch: | |
tags: | |
- VPS | |
summary: VPS 네트워크 변경 | |
operationId: updateVpsNetwork | |
parameters: | |
- name: svr_id | |
in: path | |
schema: | |
type: string | |
pattern: '^(vm_)+[1-9]{1}\d*$' | |
requestBody: | |
required: true | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/UpdateVpsNetwork' | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Vps' | |
'400': | |
$ref: '#/components/schemas/BadRequest' | |
'401': | |
$ref: '#/components/schemas/Unauthorized' | |
'403': | |
$ref: '#/components/schemas/Forbidden' | |
'404': | |
$ref: '#/components/schemas/NotFound' | |
'409': | |
$ref: '#/components/schemas/Conflict' | |
'429': | |
$ref: '#/components/schemas/TooManyRequests' | |
'/vps/{svr_id}/password': | |
patch: | |
tags: | |
- VPS | |
summary: VPS 비밀번호 변경 | |
operationId: updateVpsPassword | |
parameters: | |
- name: svr_id | |
in: path | |
schema: | |
type: string | |
pattern: '^(vm_)+[1-9]{1}\d*$' | |
responses: | |
'200': | |
description: OK | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Vps' | |
'400': | |
$ref: '#/components/schemas/BadRequest' | |
'401': | |
$ref: '#/components/schemas/Unauthorized' | |
'403': | |
$ref: '#/components/schemas/Forbidden' | |
'404': | |
$ref: '#/components/schemas/NotFound' | |
'409': | |
$ref: '#/components/schemas/Conflict' | |
'429': | |
$ref: '#/components/schemas/TooManyRequests' | |
tags: | |
- name: VPS | |
description: virtual private server | |
components: | |
schemas: | |
Vps: | |
properties: | |
user_id: | |
type: string | |
svr_id: | |
type: string | |
pattern: '^(vm_)+[1-9]{1}\d*$' | |
readOnly: true | |
cpu: | |
type: integer | |
enum: | |
- 2 | |
- 4 | |
memory: | |
type: integer | |
enum: | |
- 2 | |
- 4 | |
volume: | |
type: integer | |
enum: | |
- 50 | |
- 100 | |
status: | |
type: string | |
enum: | |
- '01' | |
- '03' | |
- '04' | |
readOnly: true | |
type: | |
type: string | |
enum: | |
- vps | |
readOnly: true | |
server_seqno: | |
type: integer | |
minimum: 1 | |
goods_seqno: | |
type: integer | |
enum: | |
- 4361 | |
- 4421 | |
img_id: | |
type: string | |
pattern: '^(img_)+[1-9]{1}\d*$' | |
enum: | |
- img_787 | |
- img_788 | |
- img_789 | |
- img_790 | |
- img_1838 | |
- img_1839 | |
- img_1840 | |
- img_1850 | |
- img_1851 | |
regdate: | |
type: string | |
format: date | |
updatedate: | |
type: string | |
format: date | |
deletedate: | |
type: string | |
format: date | |
CreateVps: | |
required: | |
- user_id | |
- cpu | |
- memory | |
- volume | |
- img_id | |
- server_seqno | |
- goods_seqno | |
properties: | |
user_id: | |
description: 사용자 ID | |
type: string | |
cpu: | |
type: integer | |
enum: | |
- 2 | |
- 4 | |
memory: | |
type: integer | |
enum: | |
- 2 | |
- 4 | |
volume: | |
type: integer | |
enum: | |
- 50 | |
- 100 | |
img_id: | |
description: gCloud 이미지 ID | |
type: string | |
pattern: '^(img_)+[1-9]{1}\d*$' | |
enum: | |
- img_787 | |
- img_788 | |
- img_789 | |
- img_790 | |
- img_1838 | |
- img_1839 | |
- img_1840 | |
- img_1850 | |
- img_1851 | |
server_seqno: | |
description: | | |
IDC 서버의 `servicebasic_seqno` | |
type: integer | |
minimum: 1 | |
UpdateVps: | |
properties: | |
type: | |
description: 타입 | |
type: string | |
UpdateVpsAction: | |
required: | |
- type | |
properties: | |
type: | |
description: > | |
- **start**: 정지된 상태(status: 01)의 g클라우드 서버를 시작된 상태(status: 03)로 변경할 수 | |
있습니다. 이미 시작 상태인 경우 요청을 할 수 없으며, 요청 성공 시에는 일시적으로 시작되고 있는 상태(status: | |
05)가 된 후에 시작된 상태(status: 03)로 변경됩니다. | |
- **stop**: 시작된 상태(status: 03)의 g클라우드 서버를 정지된 상태(status: 01)로 변경할 수 | |
있습니다. | |
- **reboot**: 시작된 상태(status: 03)의 g클라우드 서버를 재시작할 수 있습니다. | |
- **kill**: 시작된 상태(status: 03)의 g클라우드 서버를 강제종료 할 수 있습니다. | |
type: string | |
enum: | |
- start | |
- stop | |
- reboot | |
- kill | |
UpdateVpsNetwork: | |
required: | |
- type | |
properties: | |
type: | |
description: | | |
- **start**: 네트워크 활성화 | |
- **stop**: 네트워크 비활성화 | |
type: string | |
enum: | |
- start | |
- stop | |
Error: | |
required: | |
- code | |
- message | |
properties: | |
code: | |
type: integer | |
default: -1 | |
message: | |
type: string | |
default: error | |
href: | |
type: string | |
format: url | |
default: 'http://api.gcloud.com/errors' | |
BadRequest: | |
description: Bad Request | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
Unauthorized: | |
description: Unauthorized | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
Forbidden: | |
description: Forbidden | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
NotFound: | |
description: Not Found | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
Conflict: | |
description: Conflict | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
TooManyRequests: | |
description: Too Many Requests | |
headers: | |
Retry-After: | |
description: >- | |
How long the user agent should wait before making a follow-up | |
request. | |
schema: | |
type: integer | |
example: 3600 | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/Error' | |
requestBodies: | |
UpdateVps: | |
description: Pet object that needs to be added to the store | |
required: true | |
content: | |
application/json: | |
schema: | |
- $ref: '#/components/schemas/UpdateVps' | |
securitySchemes: | |
bearerAuth: | |
type: http | |
description: | | |
Authentication by [JWT](https://jwt.io) | |
scheme: bearer | |
bearerFormat: JWT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment