rest_api_v1.yaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # Copyright IBM Corp, All Rights Reserved.
  2. #
  3. # SPDX-License-Identifier: Apache-2.0
  4. #
  5. # this is an example of the Cello API
  6. # as a demonstration of an API spec in YAML
  7. swagger: '2.0'
  8. info:
  9. title: Cello API
  10. description: Cello API for the rest server calling
  11. contact:
  12. name: Baohua Yang
  13. url: https://github.com/yeasy/cello
  14. email: yangbaohua@gmail.com
  15. license:
  16. name: Apache 2.0
  17. url: http://www.apache.org/licenses/LICENSE-2.0.html
  18. version: "1.1.0"
  19. # the domain of the service
  20. host: 9.186.100.88:80
  21. # array of all schemes that your API supports
  22. schemes:
  23. - http
  24. # will be prefixed to all paths
  25. basePath: /v2
  26. produces:
  27. - application/json
  28. paths:
  29. /cluster_apply:
  30. get:
  31. summary: Apply a new cluster for use.
  32. description: |
  33. The endpoint returns information about the new cluster
  34. The response includes the uuid, display name and other details .
  35. parameters:
  36. - name: user_id
  37. in: query
  38. description: The id to specify the user.
  39. required: true
  40. type: string
  41. tags:
  42. - Cluster_apply
  43. responses:
  44. 200:
  45. description: An instance of clusters.
  46. schema:
  47. $ref: '#/definitions/Cluster'
  48. 404:
  49. description: Entity not found.
  50. default:
  51. description: Unexpected error
  52. schema:
  53. $ref: '#/definitions/Error'
  54. /cluster_release:
  55. get:
  56. summary: Release a cluster, no use it more.
  57. description: |
  58. The endpoint returns information about the action.
  59. The response includes message about result.
  60. parameters:
  61. - name: user_id
  62. in: query
  63. description: The id to specify the user.
  64. required: true
  65. type: string
  66. tags:
  67. - Cluster_release
  68. responses:
  69. 200:
  70. description: message tell success.
  71. schema:
  72. type: string
  73. 404:
  74. description: Entity not found.
  75. default:
  76. description: Unexpected error
  77. schema:
  78. $ref: '#/definitions/Error'
  79. definitions:
  80. Cluster:
  81. type: object
  82. required: [id, user_id, api_url]
  83. properties:
  84. id:
  85. type: string
  86. description: Unique identifier representing a specific cluster.
  87. user_id:
  88. type: string
  89. description: User id who owns this cluster, empty by default
  90. api_url:
  91. type: string
  92. description: Cluster REST URL representing the cluster.
  93. host_id:
  94. type: string
  95. description: Which host the cluster is at.
  96. name:
  97. type: string
  98. description: Display name of cluster.
  99. Error:
  100. type: object
  101. required: [code]
  102. properties:
  103. code:
  104. type: integer
  105. format: int32
  106. message:
  107. type: string
  108. fields:
  109. type: string