...
Table of Contents | ||
---|---|---|
|
Motivation
...
The ICN RESTful API intends to provide access to resources inside the system using a uniform interface through the provision of one logical URI. As a constriant, "Servers and clients may also be replaced and developed independently, as long as the interface between them is not altered."
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 created using the swagger.yaml below.
...
Code Block | ||||
---|---|---|---|---|
| ||||
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" |
Proposed Usage
...
Proposed sample command to GET all binary images
...