Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Include swagger endpoint and docs #3

Merged
merged 2 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Update docs"

on:
push:
tags-ignore:
- '*'
branches-ignore:
- main
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21

- name: Update Swagger
run: |
go install github.com/swaggo/swag/cmd/swag@latest
swag init -g ./cmd/serve.go -o cmd/docs

- name: Update API.md
uses: addnab/docker-run-action@v3
with:
image: quay.io/goswagger/swagger:latest
options: -v ${{ github.workspace }}:/api
run: |
cd /api
swagger generate markdown -f cmd/docs/swagger.json --output api.md

- name: Add & Commit
uses: EndBug/[email protected]
with:
add: '["cmd/docs", "api.md"]'
author_name: "DO! DevOps bot"
author_email: "[email protected]"
message: "docs: Automatic docs update"
push: true
21 changes: 5 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,19 @@ Start the server by running

go run cmd/serve.go

# Configuration

The following environment variables are used for configuration:

* BASE_URL (required): The base URL of the vCenter to connect to like https://vcenter.company.com
* BIND_ADDRESS: Bind address to bind the server to [0.0.0.0:8080]
* LOG_LEVEL: Maximum log level to use (see (https://pkg.go.dev/github.com/sirupsen/logrus#readme-level-logging)) [INFO]
* TLS_INSECURE_SKIP_VERIFY: If set, will disable TLS verification for the API client
* VCENTER_PROXY_URL: Connect to the vCenter using this proxy
* EXTERNAL_BASE_URL: Base URL the service is hosted on. Will be used for the Swagger API docs

# APIs

## /vms

### GET

Return all VM names and their IDs

## /vms/:vm/tags

### GET

Return all assigned tags and their categories for the specified vm `:vm`.

## /vms/:vm/fqdn

### GET
The service includes a generated OpenAPI documentation available at `/swagger`.

Return the fqdn of the specified vm `:vm` from the VMware guest tools
See [the generated API documentation](api.md)
Loading
Loading