You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 11
Next »
This document will evolve as the API design and implementation evolves.
Requirements
This RESTful API service will expose the following resources to a user:
- Binary Images
- Container Images
- OS Images
Design
- Use nouns to describe resources
- In the top URL, identify version, bare-metal cluster name, and resource
- GET - This will be used to list image resources
- POST - This will be used to create image resources
- PUT - This will be used to upload image resources
- DELETE - This will be used to delete image resources
Implementation
Sample GET Implementation:
The sample API above was create using the swagger.yaml below.
swagger: "2.0" info: description: "Addresses deployment of workloads in the edge" version: "1.0.0" title: "Integrated Cloud Native RESTful API" schemes: - "http" consumes: - "application/json" produces: - "application/json" paths: /v1/baremetalcluster/{clustername}/images/: get: tags: - "Deployment of Images" summary: "List all Images." description: "Endpoint to list all Images." produces: - "application/json" parameters: - name: "clustername" in: "path" description: "Name of the cluster used to query" required: true type: "string" responses: 200: description: "successful operation" schema: $ref: "#/definitions/GETResponse" default: description: generic error response schema: $ref: "#/definitions/error" /v1/baremetalcluster/{clustername}/images/{name}: get: tags: - "Deployment of Images" summary: "Get details of an image." description: "Endpoint to get details of ICN available images." produces: - "application/json" parameters: - name: "clustername" in: "path" description: "Name of the cluster used to query" required: true type: "string" - name: "name" in: "path" description: "Name used to query" required: true type: "string" responses: 200: description: "successful operation" schema: $ref: "#/definitions/GETResponse" default: description: generic error response schema: $ref: "#/definitions/error" definitions: GETResponse: type: "object" properties: ID: type: "string" image_id: type: "string" repo: type: "string" tag: type: "string" description: type: "string" minLength: 1 error: type: "object" required: - "message" properties: code: type: "integer" format: "int64" message: type: "string" |
---|
|
Testing
Sample command to GET all binary images
curl -i http:
//localhost
:9015
/v1/baremetalcluster/{clustername}/binary_images/
curl -i http:
//localhost
:9015
/v1/baremetalcluster/{clustername}/binary_images/{name}