Skip to content

Commit

Permalink
Add basic project structure and openapi spec
Browse files Browse the repository at this point in the history
  • Loading branch information
bkuen committed Dec 25, 2023
1 parent ebe2261 commit f5b5745
Show file tree
Hide file tree
Showing 14 changed files with 529 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

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

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Backup Wizard (bwizard)

[![Main workflow](https://github.com/DevStorageEU/backup-wizard/actions/workflows/go.yml/badge.svg)](https://github.com/DevStorageEU/backup-wizard/actions/workflows/go.yml)
[![made-with-go](https://img.shields.io/badge/Made%20with-Go-1f425f.svg)](https://go.dev/)
[![GitHub license](https://badgen.net/github/license/DevStorageEU/backup-wizard)](https://github.com/DevStorageEU/blob/main/LICENSE)
[![GitHub branches](https://badgen.net/github/branches/DevStorageEU/backup-wizard)](https://github.com/DevStorageEU/backup-wizard)
[![GitHub releases](https://badgen.net/github/releases/DevStorageEU/backup-wizard)](https://github.com/DevStorageEU/backup-wizard/releases/)
[![GitHub latest commit](https://badgen.net/github/last-commit/DevStorageEU/backup-wizard/main)](https://github.com/DevStorageEU/backup-wizard/commit/)
[![Open Source? Yes!](https://badgen.net/badge/Open%20Source%20%3F/Yes%21/blue?icon=github)](https://github.com/DevStorageEU/backup-wizard)

Thank you for choosing our central backup system to safeguard your valuable data.
This guide is here to help you seamlessly set up and leverage our system, designed with versatility in mind to cater to a wide array of devices.

This backup system is built to be both lightweight and powerful, ensuring a smooth and efficient backup process for your servers.
It utilizes industry-standard tools to provide reliable and secure data protection.

## Requirements


## Example


## Sponsors

This project is sponsored and maintained by [DevStorage<sup><small>®</small><sup>](https://devstorage.company)</img>

<img alt="DevStorage®" target="_blank" href="https://devstorage.company" src="https://cdn.devstorage.eu/e/header-blue-white.png" width="300">
9 changes: 9 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3'

tasks:
setup:
cmds:
- go install github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@latest
gen-http:
cmds:
- oapi-codegen -package wizard -generate types,server ./api/openapi/wizard/wizard.yml > ./api/openapi/wizard/wizard.gen.go
131 changes: 131 additions & 0 deletions api/openapi/wizard/wizard.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

130 changes: 130 additions & 0 deletions api/openapi/wizard/wizard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
openapi: 3.0.3
info:
version: 1.0.0
title: Backup Wizard API
description: An API to communicate with the backup wizard daemon
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
paths:
/devices:
get:
description: Returns a list of devices
responses:
'200':
description: Successfully returned a list of devices
content:
application/json:
schema:
type: object
required:
- success
- data
properties:
success:
type: boolean
data:
type: array
items:
$ref: "#/components/schemas/Device"
post:
description: Registers a new device
responses:
'200':
description: Successfully registered a new device and returned it
content:
application/json:
schema:
type: object
required:
- success
- data
properties:
success:
type: boolean
data:
$ref: "#/components/schemas/Device"
/devices/{id}:
get:
description: Returns the device matching the given id
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Successfully returned the device matching the given id
content:
application/json:
schema:
type: object
required:
- success
- data
properties:
success:
type: boolean
data:
$ref: "#/components/schemas/Device"

components:
schemas:
ProtectionStatus:
type: string
enum:
- ok
- warning
- error
DeviceKind:
type: string
enum:
- server
- computer
- mobile
OperatingSystem:
type: object
required:
- name
- cpu
- ram
- totalHardDrive
properties:
name:
type: string
cpu:
type: string
ram:
type: string
totalHardDrive:
type: string
Device:
type: object
required:
- id
- name
- kind
- protection
- ips
- agent
properties:
id:
type: string
format: uuid
name:
type: string
kind:
$ref: "#/components/schemas/DeviceKind"
protection:
$ref: "#/components/schemas/ProtectionStatus"
lastBackup:
type: string
format: date-time
ips:
type: array
items:
type: string
agent:
type: string
7 changes: 7 additions & 0 deletions cmd/bwizard/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "bwizard/internal/pkg/wizardapi"

func main() {
wizardapi.StartAPIServer()
}
Empty file added docker-compose.yml
Empty file.
Empty file added docs/.gitkeep
Empty file.
35 changes: 35 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module bwizard

go 1.21

require (
github.com/labstack/echo/v4 v4.11.4
github.com/oapi-codegen/echo-middleware v1.0.1
github.com/oapi-codegen/runtime v1.1.0
)

require (
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/getkin/kin-openapi v0.118.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/perimeterx/marshmallow v1.1.4 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit f5b5745

Please sign in to comment.