This repository has been archived by the owner on May 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clh: Add Generation tools for API client
cloud-hypervisor provides an API server to send commands in a qmp and Firecracker style over an Unix socket. The API is defined via OpenAPI, this commit adds scripts to help to generate a client using: https://github.com/OpenAPITools/openapi-generator This will make easy to update any change related with the API in the future. Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
- Loading branch information
Showing
4 changed files
with
444 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# | ||
# Copyright (c) 2019 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
all: | update-yaml generate-client-code | ||
|
||
generate-client-code: clean-generated-code | ||
docker run --rm \ | ||
--user $$(id -u):$$(id -g) \ | ||
-v $${PWD}:/local openapitools/openapi-generator-cli generate \ | ||
-i /local/cloud-hypervisor.yaml \ | ||
-g go \ | ||
-o /local/client | ||
|
||
update-yaml: | ||
curl -OL https://raw.githubusercontent.com/cloud-hypervisor/cloud-hypervisor/master/vmm/src/api/openapi/cloud-hypervisor.yaml | ||
|
||
clean-generated-code: | ||
rm "./client" -rf |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Cloud Hypervisor OpenAPI generated code | ||
|
||
This directory provide tools to generate code client based | ||
on `cloud-hypervisor` `OpenAPI` schema. | ||
|
||
## Update client to match latest Cloud Hypervisor server API | ||
|
||
Requirements: | ||
- docker: `openapi-generator` is executed in a docker container | ||
|
||
``` | ||
make all | ||
``` |
Oops, something went wrong.