From 889cbb77910c16579c87539adef8482401be169c Mon Sep 17 00:00:00 2001 From: Iggy Jackson Date: Sun, 4 Feb 2024 22:28:30 +0000 Subject: [PATCH] Remove xattr config and alpine tools dependency * Remove the old way of handling configuration via xattrs * this seemed clever at the time and it worked fine, but it was finicky and there really aren't great tools for copying that around (despite what some utils say, they just didn't work as expected) * move to a new way of keeping config in separate directory structure * static files are still separate, so they can still be served via any web server * Remove alpine tools dependency * we now use the alpine go package to handle generating apkindexes * no longer requires having apk and abuild-sign binaries available * Reorganize the directory and URL structure * the above changes requires some minor changes to the dir/url structure * you know me, while I was there... --- Dockerfile | 2 +- README.md | 90 ++- Taskfile.yml | 2 + cmd/api/main.go | 15 +- go.mod | 83 +-- go.sum | 246 ++------ internal/openapi/api.gen.go | 1135 ++++++++++++++++++++++------------ internal/openapi/fs.go | 360 ++++++++++- internal/openapi/packages.go | 327 ++-------- openapi/packages.yaml | 291 +++++---- 10 files changed, 1458 insertions(+), 1093 deletions(-) diff --git a/Dockerfile b/Dockerfile index f6ebf93..8d832c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ RUN ["go", "build", "./cmd/api"] # we need edge because we built packages for edge FROM alpine:edge -LABEL maintainer="iggy@atlascloud.xyz" +LABEL maintainer="packages@atlascloud.xyz" LABEL org.opencontainers.image.source=https://github.com/atlascloud/packages LABEL org.opencontainers.image.description="API for managing packages service" diff --git a/README.md b/README.md index d087f8a..bfd62bb 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,22 @@ host packages for distributions -## Notes - -Currently we call out to apk, so you either need to run this in an alpine container/host or have a -standalone apk binary in your path - ## Functionality + ### Implemented +* organizations + * support for multiple orgs per server + * organization level tokens * distributions * get info * get versions * NOTE: only alpine is currently supported -* organizations - * support for multiple orgs per server - * organization level tokens -* repos - * support for multiple repos per org +* repository versions +* repositories + * support for multiple repos per distribution/version +* architectures +* packages ### Planned @@ -34,5 +33,72 @@ standalone apk binary in your path * aliases * version aliases * 10.0 -> buster - * 20.04 -> bionic - * \ No newline at end of file + * 20.04 -> focal + +## directory layout + +### conceptual +* root + * static + * orgs + * distros - public keys + * distroversion + * repos + * packages (.apk/.deb/.rpm/etc) + * config + * orgs - pkg/repo signing private keys / tokens + * tokens - org level tokens + * distros - pkg/repo signing private keys / tokens + * distroversion - pkg/repo signing private keys / tokens + * repos - pkg/repo signing private keys / tokens + +### examples +* /srv/packages + * /static + * /atlascloud + * /alpine + * /somekey.pub + * /edge + * /key.pub + * /main + * /community + * /3.19 + * /main + * /ubuntu + * /repokey.pub + * /dists + * /24.04 -> noble + * /main + * /universe + * /multiverse + * /restricted + * /pool + * /main + * /a,/b,/c... - debs + * /multiverse + * /a,/b,/c... + * /fedora + * /linux + * /releases + * /39 + * /Server + * x86_64 + * /os + * /Packages + * /a,/b,/c - rpms + * /config + * /atlascloud + * /tokens + * /alpine + * /privkey.key + * /tokens + * /name + * /2 + * /edge + * /privkey.key + * /main + * /priv.key + +### TODO +* server wide tokens for doing things like creating orgs, etc + diff --git a/Taskfile.yml b/Taskfile.yml index 24d572d..7e129c3 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -20,6 +20,8 @@ tasks: # -o /local/gen/packages build: + env: + CGO_ENABLED: 0 cmds: - go build ./cmd/api diff --git a/cmd/api/main.go b/cmd/api/main.go index 4dac569..798ad1a 100644 --- a/cmd/api/main.go +++ b/cmd/api/main.go @@ -17,7 +17,7 @@ import ( ) func main() { - var port = flag.Int("port", 8888, "Port for test HTTP server") + var port = flag.Int("port", 8888, "Port for HTTP server") flag.Parse() swagger, err := repoApi.GetSwagger() @@ -36,7 +36,7 @@ func main() { // This is how you set up a basic Echo router e := echo.New() // Enable metrics middleware - p := prometheus.NewPrometheus("echo", nil) + p := prometheus.NewPrometheus("packages", nil) p.Use(e) // Log all requests @@ -50,14 +50,11 @@ func main() { validatorOptions := &echomiddleware.Options{} validatorOptions.Options.AuthenticationFunc = func(ctx context.Context, input *openapi3filter.AuthenticationInput) error { - // log.Debug(). - // Interface("ctx", ctx). - // Interface("input.PathParams", input.RequestValidationInput.PathParams). - // Interface("input.Route", input.RequestValidationInput.Route). - // Msg("authenticator input") orgName := input.RequestValidationInput.PathParams["org"] - repoName := input.RequestValidationInput.PathParams["slug"] - validTokens := repoApi.GetValidTokens(orgName, repoName) + validTokens := repoApi.GetValidTokens(orgName) + if input.RequestValidationInput.Request.Header.Get("Authorization") == "" { + return errors.New("no auth token") + } token := strings.Split(input.RequestValidationInput.Request.Header["Authorization"][0], " ")[1] for _, t := range validTokens { if token == t { diff --git a/go.mod b/go.mod index c3ef66a..4d0942f 100644 --- a/go.mod +++ b/go.mod @@ -2,98 +2,57 @@ module github.com/iggy/packages go 1.20 +// replace gitlab.alpinelinux.org/alpine/go => /home/iggy/projects/gitlab.alpinelinux.org/iggy/go + require ( - github.com/deepmap/oapi-codegen v1.16.2 github.com/getkin/kin-openapi v0.123.0 github.com/labstack/echo-contrib v0.15.0 github.com/labstack/echo/v4 v4.11.4 github.com/oapi-codegen/echo-middleware v1.0.1 - github.com/pkg/xattr v0.4.9 - github.com/rs/zerolog v1.31.0 + github.com/oapi-codegen/runtime v1.1.1 + github.com/rs/zerolog v1.32.0 github.com/steinfletcher/apitest v1.5.15 + github.com/viant/afs v1.25.0 + gitlab.alpinelinux.org/alpine/go v0.9.0 ) require ( - github.com/BurntSushi/toml v1.3.2 // indirect - github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect - github.com/CloudyKit/jet/v6 v6.2.0 // indirect - github.com/Joker/jade v1.1.3 // indirect - github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 // indirect - github.com/andybalholm/brotli v1.0.6 // indirect + github.com/MakeNowJust/heredoc/v2 v2.0.1 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect - github.com/aymerick/douceur v0.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bytedance/sonic v1.10.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect - github.com/chenzhuoyu/iasm v0.9.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/fatih/structs v1.1.0 // indirect - github.com/flosch/pongo2/v4 v4.0.2 // indirect - github.com/gabriel-vasile/mimetype v1.4.3 // indirect - github.com/gin-contrib/sse v0.1.0 // indirect - github.com/gin-gonic/gin v1.9.1 // indirect + github.com/go-errors/errors v1.5.1 // indirect github.com/go-openapi/jsonpointer v0.20.2 // indirect - github.com/go-openapi/swag v0.22.8 // indirect - github.com/go-playground/locales v0.14.1 // indirect - github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.15.5 // indirect - github.com/goccy/go-json v0.10.2 // indirect + github.com/go-openapi/swag v0.22.9 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect - github.com/golang/snappy v0.0.4 // indirect - github.com/gomarkdown/markdown v0.0.0-20230922112808-5421fefb8386 // indirect - github.com/google/uuid v1.4.0 // indirect - github.com/gorilla/css v1.0.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/gorilla/mux v1.8.1 // indirect github.com/invopop/yaml v0.2.0 // indirect - github.com/iris-contrib/schema v0.0.6 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/json-iterator/go v1.1.12 // indirect - github.com/kataras/blocks v0.0.8 // indirect - github.com/kataras/golog v0.1.9 // indirect - github.com/kataras/iris/v12 v12.2.7 // indirect - github.com/kataras/pio v0.0.12 // indirect - github.com/kataras/sitemap v0.0.6 // indirect - github.com/kataras/tunnel v0.0.4 // indirect - github.com/klauspost/compress v1.17.2 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/labstack/gommon v0.4.2 // indirect - github.com/leodido/go-urn v1.2.4 // indirect - github.com/mailgun/raymond/v2 v2.0.48 // 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/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect - github.com/microcosm-cc/bluemonday v1.0.26 // indirect - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect - github.com/prometheus/client_golang v1.17.0 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect - github.com/prometheus/common v0.45.0 // indirect + github.com/prometheus/common v0.46.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect - github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/schollz/closestmatch v2.1.0+incompatible // indirect - github.com/sirupsen/logrus v1.9.3 // indirect - github.com/tdewolff/minify/v2 v2.19.10 // indirect - github.com/tdewolff/parse/v2 v2.6.8 // indirect - github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - github.com/ugorji/go/codec v1.2.11 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect - github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect - github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - github.com/yosssi/ace v0.0.5 // indirect - golang.org/x/arch v0.5.0 // indirect - golang.org/x/crypto v0.17.0 // indirect - golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/protobuf v1.31.0 // indirect + google.golang.org/protobuf v1.32.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) + +// replace gitlab.alpinelinux.org/alpine/go => gitlab.alpinelinux.org/abemedia/go v0.8.1-0.20231202003941-ea851dc19408 diff --git a/go.sum b/go.sum index e171d33..f578afc 100644 --- a/go.sum +++ b/go.sum @@ -1,134 +1,51 @@ -github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= -github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= -github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= -github.com/CloudyKit/jet/v6 v6.2.0 h1:EpcZ6SR9n28BUGtNJSvlBqf90IpjeFr36Tizxhn/oME= -github.com/CloudyKit/jet/v6 v6.2.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4= -github.com/Joker/hpp v1.0.0 h1:65+iuJYdRXv/XyN62C1uEmmOx3432rNG/rKlX6V7Kkc= -github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= -github.com/Joker/jade v1.1.3 h1:Qbeh12Vq6BxURXT1qZBRHsDxeURB8ztcL6f3EXSGeHk= -github.com/Joker/jade v1.1.3/go.mod h1:T+2WLyt7VH6Lp0TRxQrUYEs64nRc83wkMQrfeIQKduM= +github.com/MakeNowJust/heredoc/v2 v2.0.1 h1:rlCHh70XXXv7toz95ajQWOWQnN4WNLt0TdpZYIR/J6A= +github.com/MakeNowJust/heredoc/v2 v2.0.1/go.mod h1:6/2Abh5s+hc3g9nbWLe9ObDIOhaRrqsyY9MWy+4JdRM= github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= -github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 h1:KkH3I3sJuOLP3TjA/dfr4NAY8bghDwnXiU7cTKxQqo0= -github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06/go.mod h1:7erjKLwalezA0k99cWs5L11HWOAPNjdUZ6RxH1BXbbM= -github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= -github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI= -github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/apapsch/go-jsonmerge/v2 v2.0.0 h1:axGnT1gRIfimI7gJifB699GoE/oq+F2MU7Dml6nw9rQ= github.com/apapsch/go-jsonmerge/v2 v2.0.0/go.mod h1:lvDnEdqiQrp0O42VQGgmlKpxL1AP2+08jFMw88y4klk= -github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= -github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= -github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= -github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM= -github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE= -github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= -github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0= -github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA= -github.com/chenzhuoyu/iasm v0.9.0 h1:9fhXjVzq5hUy2gkhhgHl95zG2cEAhw9OSGs8toWWAwo= -github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deepmap/oapi-codegen v1.16.2 h1:xGHx0dNqYfy9gE8a7AVgVM8Sd5oF9SEgePzP+UPAUXI= -github.com/deepmap/oapi-codegen v1.16.2/go.mod h1:rdYoEA2GE+riuZ91DvpmBX9hJbQpuY9wchXpfQ3n+ho= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/flosch/pongo2/v4 v4.0.2 h1:gv+5Pe3vaSVmiJvh/BZa82b7/00YUGm0PIyVVLop0Hw= -github.com/flosch/pongo2/v4 v4.0.2/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= -github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= -github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/getkin/kin-openapi v0.123.0 h1:zIik0mRwFNLyvtXK274Q6ut+dPh6nlxBp0x7mNrPhs8= github.com/getkin/kin-openapi v0.123.0/go.mod h1:wb1aSZA/iWmorQP9KTAS/phLj/t17B5jT7+fS8ed9NM= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= -github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU= +github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk= +github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= -github.com/go-openapi/swag v0.22.8 h1:/9RjDSQ0vbFR+NyjGMkFTsA1IA0fmhKSThmfGZjicbw= -github.com/go-openapi/swag v0.22.8/go.mod h1:6QT22icPLEqAM/z/TChgb4WAveCHF92+2gF0CNjHpPI= -github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= -github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= -github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= -github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24= -github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE= +github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= -github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= -github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/gomarkdown/markdown v0.0.0-20230922112808-5421fefb8386 h1:EcQR3gusLHN46TAD+G+EbaaqJArt5vHhNpXAa12PQf4= -github.com/gomarkdown/markdown v0.0.0-20230922112808-5421fefb8386/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= -github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= -github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= -github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/imkira/go-interpol v1.1.0 h1:KIiKr0VSG2CUW1hl1jpiyuzuJeKUUpC8iM1AIE7N1Vk= github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY= github.com/invopop/yaml v0.2.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= -github.com/iris-contrib/httpexpect/v2 v2.15.2 h1:T9THsdP1woyAqKHwjkEsbCnMefsAFvk8iJJKokcJ3Go= -github.com/iris-contrib/schema v0.0.6 h1:CPSBLyx2e91H2yJzPuhGuifVRnZBBJ3pCOMbOvPZaTw= -github.com/iris-contrib/schema v0.0.6/go.mod h1:iYszG0IOsuIsfzjymw1kMzTL8YQcCWlm65f3wX8J5iA= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= -github.com/kataras/blocks v0.0.8 h1:MrpVhoFTCR2v1iOOfGng5VJSILKeZZI+7NGfxEh3SUM= -github.com/kataras/blocks v0.0.8/go.mod h1:9Jm5zx6BB+06NwA+OhTbHW1xkMOYxahnqTN5DveZ2Yg= -github.com/kataras/golog v0.1.9 h1:vLvSDpP7kihFGKFAvBSofYo7qZNULYSHOH2D7rPTKJk= -github.com/kataras/golog v0.1.9/go.mod h1:jlpk/bOaYCyqDqH18pgDHdaJab72yBE6i0O3s30hpWY= -github.com/kataras/iris/v12 v12.2.7 h1:C9KWZmZT5pB5f2ot1XYWDBdi5XeTz0CGweHRXCDARZg= -github.com/kataras/iris/v12 v12.2.7/go.mod h1:mD76k/tIBFy8pHTFIgUPrVrkI4lTKvFbIcfbStJSBnA= -github.com/kataras/pio v0.0.12 h1:o52SfVYauS3J5X08fNjlGS5arXHjW/ItLkyLcKjoH6w= -github.com/kataras/pio v0.0.12/go.mod h1:ODK/8XBhhQ5WqrAhKy+9lTPS7sBf6O3KcLhc9klfRcY= -github.com/kataras/sitemap v0.0.6 h1:w71CRMMKYMJh6LR2wTgnk5hSgjVNB9KL60n5e2KHvLY= -github.com/kataras/sitemap v0.0.6/go.mod h1:dW4dOCNs896OR1HmG+dMLdT7JjDk7mYBzoIRwuj5jA4= -github.com/kataras/tunnel v0.0.4 h1:sCAqWuJV7nPzGrlb0os3j49lk2JhILT0rID38NHNLpA= -github.com/kataras/tunnel v0.0.4/go.mod h1:9FkU4LaeifdMWqZu7o20ojmW4B7hdhv2CMLwfnHGpYw= -github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= -github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= -github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/labstack/echo-contrib v0.15.0 h1:9K+oRU265y4Mu9zpRDv3X+DGTqUALY6oRHCSZZKCRVU= github.com/labstack/echo-contrib v0.15.0/go.mod h1:lei+qt5CLB4oa7VHTE0yEfQSEB9XTJI1LUqko9UWvo4= github.com/labstack/echo/v4 v4.11.4 h1:vDZmA+qNeh1pd/cCkEicDMrjtrnMGQ1QFI9gWN1zGq8= github.com/labstack/echo/v4 v4.11.4/go.mod h1:noh7EvLwqDsmh/X/HWKPUl1AjzJrhyptRyEbQJfxen8= github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= -github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= -github.com/mailgun/raymond/v2 v2.0.48 h1:5dmlB680ZkFG2RN/0lvTAghrSxIESeu9/2aeDqACtjw= -github.com/mailgun/raymond/v2 v2.0.48/go.mod h1:lsgvL50kgt1ylcFJYZiULi5fjPBkkhNfj4KA0W54Z18= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= @@ -137,154 +54,71 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 h1:jWpvCLoY8Z/e3VKvlsiIGKtc+UG6U5vzxaoagmhXfyg= -github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQthUoa9bqDv0ER0wrtXnBruoNd7aNjkbP+k= -github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58= -github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs= -github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw= github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oapi-codegen/echo-middleware v1.0.1 h1:edYGScq1phCcuDoz9AqA9eHX+tEI1LNL5PL1lkkQh1k= github.com/oapi-codegen/echo-middleware v1.0.1/go.mod h1:DBQKRn+D/vfXOFbaX5GRwFttoJY64JH6yu+pdt7wU3o= -github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro= +github.com/oapi-codegen/runtime v1.1.1/go.mod h1:SK9X900oXmPWilYR5/WKPzt3Kqxn/uS/+lbpREv+eCg= github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX50IvK2s= github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/xattr v0.4.9 h1:5883YPCtkSd8LFbs13nXplj9g9tlrwoJRjgpgMu1/fE= -github.com/pkg/xattr v0.4.9/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= -github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.5.0 h1:VQw1hfvPvk3Uv6Qf29VrPF32JB6rtbgI6cYPYQjL0Qw= github.com/prometheus/client_model v0.5.0/go.mod h1:dTiFglRmd66nLR9Pv9f0mZi7B7fk5Pm3gvsjB5tr+kI= -github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lneoxM= -github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= +github.com/prometheus/common v0.46.0 h1:doXzt5ybi1HBKpsZOL0sSkaNHJJqkyfEWZGGqqScV0Y= +github.com/prometheus/common v0.46.0/go.mod h1:Tp0qkxpb9Jsg54QMe+EAmqXkSV7Evdy1BTn+g2pa/hQ= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= -github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= -github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sanity-io/litter v1.5.5 h1:iE+sBxPBzoK6uaEP5Lt3fHNgpKcHXc/A2HGETy0uJQo= -github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiyyjYS17cCYRqP13/SHk= -github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= -github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= -github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= +github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= github.com/steinfletcher/apitest v1.5.15 h1:AAdTN0yMbf0VMH/PMt9uB2I7jljepO6i+5uhm1PjH3c= github.com/steinfletcher/apitest v1.5.15/go.mod h1:mF+KnYaIkuHM0C4JgGzkIIOJAEjo+EA5tTjJ+bHXnQc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/tdewolff/minify/v2 v2.19.10 h1:79Z2DJ9p0zSBj2BxD5fyLkIwhhRZnWSOeK3C52ljAu4= -github.com/tdewolff/minify/v2 v2.19.10/go.mod h1:IX+vt5HNKc+RFIQj7aI4D6RQ9p41vjay9lGorpHNC34= -github.com/tdewolff/parse/v2 v2.6.8 h1:mhNZXYCx//xG7Yq2e/kVLNZw4YfYmeHbhx+Zc0OvFMA= -github.com/tdewolff/parse/v2 v2.6.8/go.mod h1:XHDhaU6IBgsryfdnpzUXBlT6leW/l25yrFBTEb4eIyM= -github.com/tdewolff/test v1.0.9 h1:SswqJCmeN4B+9gEAi/5uqT0qpi1y2/2O47V/1hhGZT0= -github.com/tdewolff/test v1.0.9/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= -github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= -github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= -github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= -github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= -github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= -github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 h1:6fRhSjgLCkTD3JnJxvaJ4Sj+TYblw757bqYgZaOq5ZY= -github.com/yosssi/ace v0.0.5 h1:tUkIP/BLdKqrlrPwcmH0shwEEhTRHoGnc1wFIWmaBUA= -github.com/yosssi/ace v0.0.5/go.mod h1:ALfIzm2vT7t5ZE7uoIZqF3TQ7SAOyupFZnkrF5id+K0= -github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA= -github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= -github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/arch v0.5.0 h1:jpGode6huXQxcskEIpOCvrU+tzo81b6+oFLUYXWtH/Y= -golang.org/x/arch v0.5.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= -golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= -golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= -golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/viant/afs v1.25.0 h1:5N/gGht4clZck42MBcCkzWTmENfG1xGnoMJ4sfXTrhI= +github.com/viant/afs v1.25.0/go.mod h1:bo/jkTH8sBUhG0PQcPsuskvjb/5uEzgiwygGwtaDw8Q= +gitlab.alpinelinux.org/alpine/go v0.9.0 h1:iOuE0Rcnv73eDvURbWBK+710AsTU7T9LQE/5A5NzK+k= +gitlab.alpinelinux.org/alpine/go v0.9.0/go.mod h1:xtWRMSFi7DK43eMNirDFAJG2fEQCstIKI19rWjJB8Tg= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE= +golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= -google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= +google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -moul.io/http2curl/v2 v2.3.0 h1:9r3JfDzWPcbIklMOs2TnIFzDYvfAZvjeavG6EzP7jYs= -nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/internal/openapi/api.gen.go b/internal/openapi/api.gen.go index 44cb1b6..1e82938 100644 --- a/internal/openapi/api.gen.go +++ b/internal/openapi/api.gen.go @@ -1,6 +1,6 @@ // Package api provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version v1.9.1 DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT. package api import ( @@ -11,15 +11,15 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/url" "path" "strings" - "github.com/deepmap/oapi-codegen/pkg/runtime" "github.com/getkin/kin-openapi/openapi3" "github.com/labstack/echo/v4" + "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" ) const ( @@ -27,13 +27,10 @@ const ( ) // Architecture defines model for Architecture. -type Architecture string +type Architecture = string // Distribution defines model for Distribution. -type Distribution string - -// DistroVersion defines model for DistroVersion. -type DistroVersion string +type Distribution = string // Error defines model for Error. type Error struct { @@ -43,25 +40,25 @@ type Error struct { // NewRepo defines model for NewRepo. type NewRepo struct { - // Description of the repo to add - not functional - just for ease of use + // Description Description of the repo to add - not functional - just for ease of use Description *string `json:"description,omitempty"` - // Name of the repo to add + // Name Name of the repo to add Name string `json:"name"` } // Organization defines model for Organization. type Organization struct { - // name of the organization - Name *string `json:"name,omitempty"` + // Distributions the list of repos that belong to this org (this data may be dependent on auth) + Distributions *[]Distribution `json:"distributions,omitempty"` - // the list of repos that belong to this org (this data may be dependent on auth) - Repos *[]Repo `json:"repos,omitempty"` + // Name name of the organization + Name *string `json:"name,omitempty"` } // Package defines model for Package. type Package struct { - // name of the package + // Name name of the package Name string `json:"name"` Release *string `json:"release,omitempty"` Version *string `json:"version,omitempty"` @@ -69,27 +66,29 @@ type Package struct { // Repo defines model for Repo. type Repo struct { - // list of architectures in this repo + // Architectures list of architectures in this repo Architectures *[]Architecture `json:"architectures,omitempty"` - // Description of the repo - not functional - just for ease of use + // Description Description of the repo - not functional - just for ease of use Description *string `json:"description,omitempty"` - // Name of the repo + // Name Name of the repo Name string `json:"name"` +} - // computed from repo/version - Repo string `json:"repo"` +// RepoVersion defines model for RepoVersion. +type RepoVersion = string - // the distro version the repo belongs to - Version string `json:"version"` +// CreatePackageMultipartBody defines parameters for CreatePackage. +type CreatePackageMultipartBody struct { + Package *openapi_types.File `json:"package,omitempty"` } -// CreateRepoJSONBody defines parameters for CreateRepo. -type CreateRepoJSONBody NewRepo - // CreateRepoJSONRequestBody defines body for CreateRepo for application/json ContentType. -type CreateRepoJSONRequestBody CreateRepoJSONBody +type CreateRepoJSONRequestBody = NewRepo + +// CreatePackageMultipartRequestBody defines body for CreatePackage for multipart/form-data ContentType. +type CreatePackageMultipartRequestBody CreatePackageMultipartBody // RequestEditorFn is the function signature for the RequestEditor callback function type RequestEditorFn func(ctx context.Context, req *http.Request) error @@ -164,12 +163,6 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { - // ListDistros request - ListDistros(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListDistroVersions request - ListDistroVersions(ctx context.Context, distro string, reqEditors ...RequestEditorFn) (*http.Response, error) - // GetHealthPing request GetHealthPing(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -185,29 +178,38 @@ type ClientInterface interface { // GetOrganization request GetOrganization(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*http.Response, error) - // CreateRepo request with any body + // CreateRepoWithBody request with any body CreateRepoWithBody(ctx context.Context, org string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateRepo(ctx context.Context, org string, body CreateRepoJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListDistros request + ListDistros(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetOrgDistro request + GetOrgDistro(ctx context.Context, org string, distro string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // ListVersions request + ListVersions(ctx context.Context, org string, distro string, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListRepos request - ListRepos(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*http.Response, error) + ListRepos(ctx context.Context, org string, distro string, version string, reqEditors ...RequestEditorFn) (*http.Response, error) // FindRepoByName request - FindRepoByName(ctx context.Context, org string, repo string, reqEditors ...RequestEditorFn) (*http.Response, error) + FindRepoByName(ctx context.Context, org string, distro string, version string, repo string, reqEditors ...RequestEditorFn) (*http.Response, error) - // ListVersions request - ListVersions(ctx context.Context, org string, repo string, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListArches request + ListArches(ctx context.Context, org string, distro string, version string, repo string, reqEditors ...RequestEditorFn) (*http.Response, error) // ListPackagesByRepo request - ListPackagesByRepo(ctx context.Context, org string, repo string, ver string, reqEditors ...RequestEditorFn) (*http.Response, error) + ListPackagesByRepo(ctx context.Context, org string, distro string, version string, repo string, arch string, reqEditors ...RequestEditorFn) (*http.Response, error) - // CreatePackage request with any body - CreatePackageWithBody(ctx context.Context, org string, repo string, ver string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // CreatePackageWithBody request with any body + CreatePackageWithBody(ctx context.Context, org string, distro string, version string, repo string, arch string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) } -func (c *Client) ListDistros(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListDistrosRequest(c.Server) +func (c *Client) GetHealthPing(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetHealthPingRequest(c.Server) if err != nil { return nil, err } @@ -218,8 +220,8 @@ func (c *Client) ListDistros(ctx context.Context, reqEditors ...RequestEditorFn) return c.Client.Do(req) } -func (c *Client) ListDistroVersions(ctx context.Context, distro string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListDistroVersionsRequest(c.Server, distro) +func (c *Client) GetHealthReady(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetHealthReadyRequest(c.Server) if err != nil { return nil, err } @@ -230,8 +232,8 @@ func (c *Client) ListDistroVersions(ctx context.Context, distro string, reqEdito return c.Client.Do(req) } -func (c *Client) GetHealthPing(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetHealthPingRequest(c.Server) +func (c *Client) HeadHealthReady(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewHeadHealthReadyRequest(c.Server) if err != nil { return nil, err } @@ -242,8 +244,8 @@ func (c *Client) GetHealthPing(ctx context.Context, reqEditors ...RequestEditorF return c.Client.Do(req) } -func (c *Client) GetHealthReady(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetHealthReadyRequest(c.Server) +func (c *Client) ListOrganizations(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListOrganizationsRequest(c.Server) if err != nil { return nil, err } @@ -254,8 +256,8 @@ func (c *Client) GetHealthReady(ctx context.Context, reqEditors ...RequestEditor return c.Client.Do(req) } -func (c *Client) HeadHealthReady(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewHeadHealthReadyRequest(c.Server) +func (c *Client) GetOrganization(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetOrganizationRequest(c.Server, org) if err != nil { return nil, err } @@ -266,8 +268,8 @@ func (c *Client) HeadHealthReady(ctx context.Context, reqEditors ...RequestEdito return c.Client.Do(req) } -func (c *Client) ListOrganizations(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListOrganizationsRequest(c.Server) +func (c *Client) CreateRepoWithBody(ctx context.Context, org string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateRepoRequestWithBody(c.Server, org, contentType, body) if err != nil { return nil, err } @@ -278,8 +280,8 @@ func (c *Client) ListOrganizations(ctx context.Context, reqEditors ...RequestEdi return c.Client.Do(req) } -func (c *Client) GetOrganization(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetOrganizationRequest(c.Server, org) +func (c *Client) CreateRepo(ctx context.Context, org string, body CreateRepoJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateRepoRequest(c.Server, org, body) if err != nil { return nil, err } @@ -290,8 +292,8 @@ func (c *Client) GetOrganization(ctx context.Context, org string, reqEditors ... return c.Client.Do(req) } -func (c *Client) CreateRepoWithBody(ctx context.Context, org string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateRepoRequestWithBody(c.Server, org, contentType, body) +func (c *Client) ListDistros(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListDistrosRequest(c.Server, org) if err != nil { return nil, err } @@ -302,8 +304,8 @@ func (c *Client) CreateRepoWithBody(ctx context.Context, org string, contentType return c.Client.Do(req) } -func (c *Client) CreateRepo(ctx context.Context, org string, body CreateRepoJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateRepoRequest(c.Server, org, body) +func (c *Client) GetOrgDistro(ctx context.Context, org string, distro string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetOrgDistroRequest(c.Server, org, distro) if err != nil { return nil, err } @@ -314,8 +316,8 @@ func (c *Client) CreateRepo(ctx context.Context, org string, body CreateRepoJSON return c.Client.Do(req) } -func (c *Client) ListRepos(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListReposRequest(c.Server, org) +func (c *Client) ListVersions(ctx context.Context, org string, distro string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListVersionsRequest(c.Server, org, distro) if err != nil { return nil, err } @@ -326,8 +328,8 @@ func (c *Client) ListRepos(ctx context.Context, org string, reqEditors ...Reques return c.Client.Do(req) } -func (c *Client) FindRepoByName(ctx context.Context, org string, repo string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewFindRepoByNameRequest(c.Server, org, repo) +func (c *Client) ListRepos(ctx context.Context, org string, distro string, version string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListReposRequest(c.Server, org, distro, version) if err != nil { return nil, err } @@ -338,8 +340,8 @@ func (c *Client) FindRepoByName(ctx context.Context, org string, repo string, re return c.Client.Do(req) } -func (c *Client) ListVersions(ctx context.Context, org string, repo string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListVersionsRequest(c.Server, org, repo) +func (c *Client) FindRepoByName(ctx context.Context, org string, distro string, version string, repo string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewFindRepoByNameRequest(c.Server, org, distro, version, repo) if err != nil { return nil, err } @@ -350,8 +352,8 @@ func (c *Client) ListVersions(ctx context.Context, org string, repo string, reqE return c.Client.Do(req) } -func (c *Client) ListPackagesByRepo(ctx context.Context, org string, repo string, ver string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListPackagesByRepoRequest(c.Server, org, repo, ver) +func (c *Client) ListArches(ctx context.Context, org string, distro string, version string, repo string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListArchesRequest(c.Server, org, distro, version, repo) if err != nil { return nil, err } @@ -362,8 +364,8 @@ func (c *Client) ListPackagesByRepo(ctx context.Context, org string, repo string return c.Client.Do(req) } -func (c *Client) CreatePackageWithBody(ctx context.Context, org string, repo string, ver string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreatePackageRequestWithBody(c.Server, org, repo, ver, contentType, body) +func (c *Client) ListPackagesByRepo(ctx context.Context, org string, distro string, version string, repo string, arch string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListPackagesByRepoRequest(c.Server, org, distro, version, repo, arch) if err != nil { return nil, err } @@ -374,8 +376,20 @@ func (c *Client) CreatePackageWithBody(ctx context.Context, org string, repo str return c.Client.Do(req) } -// NewListDistrosRequest generates requests for ListDistros -func NewListDistrosRequest(server string) (*http.Request, error) { +func (c *Client) CreatePackageWithBody(ctx context.Context, org string, distro string, version string, repo string, arch string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreatePackageRequestWithBody(c.Server, org, distro, version, repo, arch, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +// NewGetHealthPingRequest generates requests for GetHealthPing +func NewGetHealthPingRequest(server string) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -383,7 +397,7 @@ func NewListDistrosRequest(server string) (*http.Request, error) { return nil, err } - operationPath := fmt.Sprintf("/distributions") + operationPath := fmt.Sprintf("/health/ping") if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -401,23 +415,43 @@ func NewListDistrosRequest(server string) (*http.Request, error) { return req, nil } -// NewListDistroVersionsRequest generates requests for ListDistroVersions -func NewListDistroVersionsRequest(server string, distro string) (*http.Request, error) { +// NewGetHealthReadyRequest generates requests for GetHealthReady +func NewGetHealthReadyRequest(server string) (*http.Request, error) { var err error - var pathParam0 string + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "distro", runtime.ParamLocationPath, distro) + operationPath := fmt.Sprintf("/health/ready") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } + return req, nil +} + +// NewHeadHealthReadyRequest generates requests for HeadHealthReady +func NewHeadHealthReadyRequest(server string) (*http.Request, error) { + var err error + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/distributions/%s/versions", pathParam0) + operationPath := fmt.Sprintf("/health/ready") if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -427,7 +461,7 @@ func NewListDistroVersionsRequest(server string, distro string) (*http.Request, return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("HEAD", queryURL.String(), nil) if err != nil { return nil, err } @@ -435,8 +469,8 @@ func NewListDistroVersionsRequest(server string, distro string) (*http.Request, return req, nil } -// NewGetHealthPingRequest generates requests for GetHealthPing -func NewGetHealthPingRequest(server string) (*http.Request, error) { +// NewListOrganizationsRequest generates requests for ListOrganizations +func NewListOrganizationsRequest(server string) (*http.Request, error) { var err error serverURL, err := url.Parse(server) @@ -444,7 +478,7 @@ func NewGetHealthPingRequest(server string) (*http.Request, error) { return nil, err } - operationPath := fmt.Sprintf("/health/ping") + operationPath := fmt.Sprintf("/orgs") if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -462,16 +496,23 @@ func NewGetHealthPingRequest(server string) (*http.Request, error) { return req, nil } -// NewGetHealthReadyRequest generates requests for GetHealthReady -func NewGetHealthReadyRequest(server string) (*http.Request, error) { +// NewGetOrganizationRequest generates requests for GetOrganization +func NewGetOrganizationRequest(server string, org string) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "org", runtime.ParamLocationPath, org) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/health/ready") + operationPath := fmt.Sprintf("/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -489,16 +530,34 @@ func NewGetHealthReadyRequest(server string) (*http.Request, error) { return req, nil } -// NewHeadHealthReadyRequest generates requests for HeadHealthReady -func NewHeadHealthReadyRequest(server string) (*http.Request, error) { +// NewCreateRepoRequest calls the generic CreateRepo builder with application/json body +func NewCreateRepoRequest(server string, org string, body CreateRepoJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateRepoRequestWithBody(server, org, "application/json", bodyReader) +} + +// NewCreateRepoRequestWithBody generates requests for CreateRepo with any type of body +func NewCreateRepoRequestWithBody(server string, org string, contentType string, body io.Reader) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "org", runtime.ParamLocationPath, org) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/health/ready") + operationPath := fmt.Sprintf("/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -508,24 +567,33 @@ func NewHeadHealthReadyRequest(server string) (*http.Request, error) { return nil, err } - req, err := http.NewRequest("HEAD", queryURL.String(), nil) + req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } + req.Header.Add("Content-Type", contentType) + return req, nil } -// NewListOrganizationsRequest generates requests for ListOrganizations -func NewListOrganizationsRequest(server string) (*http.Request, error) { +// NewListDistrosRequest generates requests for ListDistros +func NewListDistrosRequest(server string, org string) (*http.Request, error) { var err error + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "org", runtime.ParamLocationPath, org) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/o") + operationPath := fmt.Sprintf("/%s/distros", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -543,8 +611,8 @@ func NewListOrganizationsRequest(server string) (*http.Request, error) { return req, nil } -// NewGetOrganizationRequest generates requests for GetOrganization -func NewGetOrganizationRequest(server string, org string) (*http.Request, error) { +// NewGetOrgDistroRequest generates requests for GetOrgDistro +func NewGetOrgDistroRequest(server string, org string, distro string) (*http.Request, error) { var err error var pathParam0 string @@ -554,12 +622,19 @@ func NewGetOrganizationRequest(server string, org string) (*http.Request, error) return nil, err } + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "distro", runtime.ParamLocationPath, distro) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/o/%s", pathParam0) + operationPath := fmt.Sprintf("/%s/%s", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -577,19 +652,8 @@ func NewGetOrganizationRequest(server string, org string) (*http.Request, error) return req, nil } -// NewCreateRepoRequest calls the generic CreateRepo builder with application/json body -func NewCreateRepoRequest(server string, org string, body CreateRepoJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateRepoRequestWithBody(server, org, "application/json", bodyReader) -} - -// NewCreateRepoRequestWithBody generates requests for CreateRepo with any type of body -func NewCreateRepoRequestWithBody(server string, org string, contentType string, body io.Reader) (*http.Request, error) { +// NewListVersionsRequest generates requests for ListVersions +func NewListVersionsRequest(server string, org string, distro string) (*http.Request, error) { var err error var pathParam0 string @@ -599,12 +663,19 @@ func NewCreateRepoRequestWithBody(server string, org string, contentType string, return nil, err } + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "distro", runtime.ParamLocationPath, distro) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/o/%s", pathParam0) + operationPath := fmt.Sprintf("/%s/%s/versions", pathParam0, pathParam1) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -614,18 +685,16 @@ func NewCreateRepoRequestWithBody(server string, org string, contentType string, return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) - return req, nil } // NewListReposRequest generates requests for ListRepos -func NewListReposRequest(server string, org string) (*http.Request, error) { +func NewListReposRequest(server string, org string, distro string, version string) (*http.Request, error) { var err error var pathParam0 string @@ -635,12 +704,26 @@ func NewListReposRequest(server string, org string) (*http.Request, error) { return nil, err } + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "distro", runtime.ParamLocationPath, distro) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "version", runtime.ParamLocationPath, version) + if err != nil { + return nil, err + } + serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/o/%s/r", pathParam0) + operationPath := fmt.Sprintf("/%s/%s/%s/repos", pathParam0, pathParam1, pathParam2) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -659,7 +742,7 @@ func NewListReposRequest(server string, org string) (*http.Request, error) { } // NewFindRepoByNameRequest generates requests for FindRepoByName -func NewFindRepoByNameRequest(server string, org string, repo string) (*http.Request, error) { +func NewFindRepoByNameRequest(server string, org string, distro string, version string, repo string) (*http.Request, error) { var err error var pathParam0 string @@ -671,7 +754,21 @@ func NewFindRepoByNameRequest(server string, org string, repo string) (*http.Req var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "repo", runtime.ParamLocationPath, repo) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "distro", runtime.ParamLocationPath, distro) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "version", runtime.ParamLocationPath, version) + if err != nil { + return nil, err + } + + var pathParam3 string + + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "repo", runtime.ParamLocationPath, repo) if err != nil { return nil, err } @@ -681,7 +778,7 @@ func NewFindRepoByNameRequest(server string, org string, repo string) (*http.Req return nil, err } - operationPath := fmt.Sprintf("/o/%s/r/%s", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/%s/%s/%s/%s", pathParam0, pathParam1, pathParam2, pathParam3) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -699,8 +796,8 @@ func NewFindRepoByNameRequest(server string, org string, repo string) (*http.Req return req, nil } -// NewListVersionsRequest generates requests for ListVersions -func NewListVersionsRequest(server string, org string, repo string) (*http.Request, error) { +// NewListArchesRequest generates requests for ListArches +func NewListArchesRequest(server string, org string, distro string, version string, repo string) (*http.Request, error) { var err error var pathParam0 string @@ -712,7 +809,21 @@ func NewListVersionsRequest(server string, org string, repo string) (*http.Reque var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "repo", runtime.ParamLocationPath, repo) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "distro", runtime.ParamLocationPath, distro) + if err != nil { + return nil, err + } + + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "version", runtime.ParamLocationPath, version) + if err != nil { + return nil, err + } + + var pathParam3 string + + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "repo", runtime.ParamLocationPath, repo) if err != nil { return nil, err } @@ -722,7 +833,7 @@ func NewListVersionsRequest(server string, org string, repo string) (*http.Reque return nil, err } - operationPath := fmt.Sprintf("/o/%s/r/%s/v", pathParam0, pathParam1) + operationPath := fmt.Sprintf("/%s/%s/%s/%s/architectures", pathParam0, pathParam1, pathParam2, pathParam3) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -741,7 +852,7 @@ func NewListVersionsRequest(server string, org string, repo string) (*http.Reque } // NewListPackagesByRepoRequest generates requests for ListPackagesByRepo -func NewListPackagesByRepoRequest(server string, org string, repo string, ver string) (*http.Request, error) { +func NewListPackagesByRepoRequest(server string, org string, distro string, version string, repo string, arch string) (*http.Request, error) { var err error var pathParam0 string @@ -753,14 +864,28 @@ func NewListPackagesByRepoRequest(server string, org string, repo string, ver st var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "repo", runtime.ParamLocationPath, repo) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "distro", runtime.ParamLocationPath, distro) if err != nil { return nil, err } var pathParam2 string - pathParam2, err = runtime.StyleParamWithLocation("simple", false, "ver", runtime.ParamLocationPath, ver) + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "version", runtime.ParamLocationPath, version) + if err != nil { + return nil, err + } + + var pathParam3 string + + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "repo", runtime.ParamLocationPath, repo) + if err != nil { + return nil, err + } + + var pathParam4 string + + pathParam4, err = runtime.StyleParamWithLocation("simple", false, "arch", runtime.ParamLocationPath, arch) if err != nil { return nil, err } @@ -770,7 +895,7 @@ func NewListPackagesByRepoRequest(server string, org string, repo string, ver st return nil, err } - operationPath := fmt.Sprintf("/o/%s/r/%s/v/%s", pathParam0, pathParam1, pathParam2) + operationPath := fmt.Sprintf("/%s/%s/%s/%s/%s/pkgs", pathParam0, pathParam1, pathParam2, pathParam3, pathParam4) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -789,7 +914,7 @@ func NewListPackagesByRepoRequest(server string, org string, repo string, ver st } // NewCreatePackageRequestWithBody generates requests for CreatePackage with any type of body -func NewCreatePackageRequestWithBody(server string, org string, repo string, ver string, contentType string, body io.Reader) (*http.Request, error) { +func NewCreatePackageRequestWithBody(server string, org string, distro string, version string, repo string, arch string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -801,14 +926,28 @@ func NewCreatePackageRequestWithBody(server string, org string, repo string, ver var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "repo", runtime.ParamLocationPath, repo) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "distro", runtime.ParamLocationPath, distro) if err != nil { return nil, err } var pathParam2 string - pathParam2, err = runtime.StyleParamWithLocation("simple", false, "ver", runtime.ParamLocationPath, ver) + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "version", runtime.ParamLocationPath, version) + if err != nil { + return nil, err + } + + var pathParam3 string + + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "repo", runtime.ParamLocationPath, repo) + if err != nil { + return nil, err + } + + var pathParam4 string + + pathParam4, err = runtime.StyleParamWithLocation("simple", false, "arch", runtime.ParamLocationPath, arch) if err != nil { return nil, err } @@ -818,7 +957,7 @@ func NewCreatePackageRequestWithBody(server string, org string, repo string, ver return nil, err } - operationPath := fmt.Sprintf("/o/%s/r/%s/v/%s", pathParam0, pathParam1, pathParam2) + operationPath := fmt.Sprintf("/%s/%s/%s/%s/%s/pkgs", pathParam0, pathParam1, pathParam2, pathParam3, pathParam4) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -881,57 +1020,58 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { - // ListDistros request - ListDistrosWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDistrosResponse, error) - - // ListDistroVersions request - ListDistroVersionsWithResponse(ctx context.Context, distro string, reqEditors ...RequestEditorFn) (*ListDistroVersionsResponse, error) - - // GetHealthPing request + // GetHealthPingWithResponse request GetHealthPingWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthPingResponse, error) - // GetHealthReady request + // GetHealthReadyWithResponse request GetHealthReadyWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthReadyResponse, error) - // HeadHealthReady request + // HeadHealthReadyWithResponse request HeadHealthReadyWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*HeadHealthReadyResponse, error) - // ListOrganizations request + // ListOrganizationsWithResponse request ListOrganizationsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListOrganizationsResponse, error) - // GetOrganization request + // GetOrganizationWithResponse request GetOrganizationWithResponse(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*GetOrganizationResponse, error) - // CreateRepo request with any body + // CreateRepoWithBodyWithResponse request with any body CreateRepoWithBodyWithResponse(ctx context.Context, org string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateRepoResponse, error) CreateRepoWithResponse(ctx context.Context, org string, body CreateRepoJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateRepoResponse, error) - // ListRepos request - ListReposWithResponse(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*ListReposResponse, error) + // ListDistrosWithResponse request + ListDistrosWithResponse(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*ListDistrosResponse, error) - // FindRepoByName request - FindRepoByNameWithResponse(ctx context.Context, org string, repo string, reqEditors ...RequestEditorFn) (*FindRepoByNameResponse, error) + // GetOrgDistroWithResponse request + GetOrgDistroWithResponse(ctx context.Context, org string, distro string, reqEditors ...RequestEditorFn) (*GetOrgDistroResponse, error) - // ListVersions request - ListVersionsWithResponse(ctx context.Context, org string, repo string, reqEditors ...RequestEditorFn) (*ListVersionsResponse, error) + // ListVersionsWithResponse request + ListVersionsWithResponse(ctx context.Context, org string, distro string, reqEditors ...RequestEditorFn) (*ListVersionsResponse, error) - // ListPackagesByRepo request - ListPackagesByRepoWithResponse(ctx context.Context, org string, repo string, ver string, reqEditors ...RequestEditorFn) (*ListPackagesByRepoResponse, error) + // ListReposWithResponse request + ListReposWithResponse(ctx context.Context, org string, distro string, version string, reqEditors ...RequestEditorFn) (*ListReposResponse, error) + + // FindRepoByNameWithResponse request + FindRepoByNameWithResponse(ctx context.Context, org string, distro string, version string, repo string, reqEditors ...RequestEditorFn) (*FindRepoByNameResponse, error) + + // ListArchesWithResponse request + ListArchesWithResponse(ctx context.Context, org string, distro string, version string, repo string, reqEditors ...RequestEditorFn) (*ListArchesResponse, error) - // CreatePackage request with any body - CreatePackageWithBodyWithResponse(ctx context.Context, org string, repo string, ver string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePackageResponse, error) + // ListPackagesByRepoWithResponse request + ListPackagesByRepoWithResponse(ctx context.Context, org string, distro string, version string, repo string, arch string, reqEditors ...RequestEditorFn) (*ListPackagesByRepoResponse, error) + + // CreatePackageWithBodyWithResponse request with any body + CreatePackageWithBodyWithResponse(ctx context.Context, org string, distro string, version string, repo string, arch string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePackageResponse, error) } -type ListDistrosResponse struct { +type GetHealthPingResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *[]Distribution - JSONDefault *Error } // Status returns HTTPResponse.Status -func (r ListDistrosResponse) Status() string { +func (r GetHealthPingResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -939,22 +1079,20 @@ func (r ListDistrosResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListDistrosResponse) StatusCode() int { +func (r GetHealthPingResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type ListDistroVersionsResponse struct { +type GetHealthReadyResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *[]DistroVersion - JSONDefault *Error } // Status returns HTTPResponse.Status -func (r ListDistroVersionsResponse) Status() string { +func (r GetHealthReadyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -962,20 +1100,20 @@ func (r ListDistroVersionsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListDistroVersionsResponse) StatusCode() int { +func (r GetHealthReadyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetHealthPingResponse struct { +type HeadHealthReadyResponse struct { Body []byte HTTPResponse *http.Response } // Status returns HTTPResponse.Status -func (r GetHealthPingResponse) Status() string { +func (r HeadHealthReadyResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -983,20 +1121,22 @@ func (r GetHealthPingResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetHealthPingResponse) StatusCode() int { +func (r HeadHealthReadyResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetHealthReadyResponse struct { +type ListOrganizationsResponse struct { Body []byte HTTPResponse *http.Response + JSON200 *[]Organization + JSONDefault *Error } // Status returns HTTPResponse.Status -func (r GetHealthReadyResponse) Status() string { +func (r ListOrganizationsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1004,20 +1144,21 @@ func (r GetHealthReadyResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetHealthReadyResponse) StatusCode() int { +func (r ListOrganizationsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type HeadHealthReadyResponse struct { +type GetOrganizationResponse struct { Body []byte HTTPResponse *http.Response + JSON200 *map[string]interface{} } // Status returns HTTPResponse.Status -func (r HeadHealthReadyResponse) Status() string { +func (r GetOrganizationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1025,22 +1166,22 @@ func (r HeadHealthReadyResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r HeadHealthReadyResponse) StatusCode() int { +func (r GetOrganizationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type ListOrganizationsResponse struct { +type CreateRepoResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *[]Organization + JSON200 *[]Repo JSONDefault *Error } // Status returns HTTPResponse.Status -func (r ListOrganizationsResponse) Status() string { +func (r CreateRepoResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1048,21 +1189,45 @@ func (r ListOrganizationsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListOrganizationsResponse) StatusCode() int { +func (r CreateRepoResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetOrganizationResponse struct { +type ListDistrosResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *[]Distribution + JSONDefault *Error +} + +// Status returns HTTPResponse.Status +func (r ListDistrosResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListDistrosResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetOrgDistroResponse struct { Body []byte HTTPResponse *http.Response JSON200 *map[string]interface{} + JSONDefault *Error } // Status returns HTTPResponse.Status -func (r GetOrganizationResponse) Status() string { +func (r GetOrgDistroResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1070,22 +1235,22 @@ func (r GetOrganizationResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r GetOrganizationResponse) StatusCode() int { +func (r GetOrgDistroResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type CreateRepoResponse struct { +type ListVersionsResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *[]Repo + JSON200 *[]RepoVersion JSONDefault *Error } // Status returns HTTPResponse.Status -func (r CreateRepoResponse) Status() string { +func (r ListVersionsResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1093,7 +1258,7 @@ func (r CreateRepoResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r CreateRepoResponse) StatusCode() int { +func (r ListVersionsResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -1126,7 +1291,7 @@ func (r ListReposResponse) StatusCode() int { type FindRepoByNameResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *[]Repo + JSON200 *map[string]interface{} JSONDefault *Error } @@ -1146,15 +1311,15 @@ func (r FindRepoByNameResponse) StatusCode() int { return 0 } -type ListVersionsResponse struct { +type ListArchesResponse struct { Body []byte HTTPResponse *http.Response - JSON200 *[]DistroVersion + JSON200 *[]Architecture JSONDefault *Error } // Status returns HTTPResponse.Status -func (r ListVersionsResponse) Status() string { +func (r ListArchesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -1162,7 +1327,7 @@ func (r ListVersionsResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r ListVersionsResponse) StatusCode() int { +func (r ListArchesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -1215,24 +1380,6 @@ func (r CreatePackageResponse) StatusCode() int { return 0 } -// ListDistrosWithResponse request returning *ListDistrosResponse -func (c *ClientWithResponses) ListDistrosWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDistrosResponse, error) { - rsp, err := c.ListDistros(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListDistrosResponse(rsp) -} - -// ListDistroVersionsWithResponse request returning *ListDistroVersionsResponse -func (c *ClientWithResponses) ListDistroVersionsWithResponse(ctx context.Context, distro string, reqEditors ...RequestEditorFn) (*ListDistroVersionsResponse, error) { - rsp, err := c.ListDistroVersions(ctx, distro, reqEditors...) - if err != nil { - return nil, err - } - return ParseListDistroVersionsResponse(rsp) -} - // GetHealthPingWithResponse request returning *GetHealthPingResponse func (c *ClientWithResponses) GetHealthPingWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetHealthPingResponse, error) { rsp, err := c.GetHealthPing(ctx, reqEditors...) @@ -1295,9 +1442,36 @@ func (c *ClientWithResponses) CreateRepoWithResponse(ctx context.Context, org st return ParseCreateRepoResponse(rsp) } +// ListDistrosWithResponse request returning *ListDistrosResponse +func (c *ClientWithResponses) ListDistrosWithResponse(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*ListDistrosResponse, error) { + rsp, err := c.ListDistros(ctx, org, reqEditors...) + if err != nil { + return nil, err + } + return ParseListDistrosResponse(rsp) +} + +// GetOrgDistroWithResponse request returning *GetOrgDistroResponse +func (c *ClientWithResponses) GetOrgDistroWithResponse(ctx context.Context, org string, distro string, reqEditors ...RequestEditorFn) (*GetOrgDistroResponse, error) { + rsp, err := c.GetOrgDistro(ctx, org, distro, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetOrgDistroResponse(rsp) +} + +// ListVersionsWithResponse request returning *ListVersionsResponse +func (c *ClientWithResponses) ListVersionsWithResponse(ctx context.Context, org string, distro string, reqEditors ...RequestEditorFn) (*ListVersionsResponse, error) { + rsp, err := c.ListVersions(ctx, org, distro, reqEditors...) + if err != nil { + return nil, err + } + return ParseListVersionsResponse(rsp) +} + // ListReposWithResponse request returning *ListReposResponse -func (c *ClientWithResponses) ListReposWithResponse(ctx context.Context, org string, reqEditors ...RequestEditorFn) (*ListReposResponse, error) { - rsp, err := c.ListRepos(ctx, org, reqEditors...) +func (c *ClientWithResponses) ListReposWithResponse(ctx context.Context, org string, distro string, version string, reqEditors ...RequestEditorFn) (*ListReposResponse, error) { + rsp, err := c.ListRepos(ctx, org, distro, version, reqEditors...) if err != nil { return nil, err } @@ -1305,26 +1479,26 @@ func (c *ClientWithResponses) ListReposWithResponse(ctx context.Context, org str } // FindRepoByNameWithResponse request returning *FindRepoByNameResponse -func (c *ClientWithResponses) FindRepoByNameWithResponse(ctx context.Context, org string, repo string, reqEditors ...RequestEditorFn) (*FindRepoByNameResponse, error) { - rsp, err := c.FindRepoByName(ctx, org, repo, reqEditors...) +func (c *ClientWithResponses) FindRepoByNameWithResponse(ctx context.Context, org string, distro string, version string, repo string, reqEditors ...RequestEditorFn) (*FindRepoByNameResponse, error) { + rsp, err := c.FindRepoByName(ctx, org, distro, version, repo, reqEditors...) if err != nil { return nil, err } return ParseFindRepoByNameResponse(rsp) } -// ListVersionsWithResponse request returning *ListVersionsResponse -func (c *ClientWithResponses) ListVersionsWithResponse(ctx context.Context, org string, repo string, reqEditors ...RequestEditorFn) (*ListVersionsResponse, error) { - rsp, err := c.ListVersions(ctx, org, repo, reqEditors...) +// ListArchesWithResponse request returning *ListArchesResponse +func (c *ClientWithResponses) ListArchesWithResponse(ctx context.Context, org string, distro string, version string, repo string, reqEditors ...RequestEditorFn) (*ListArchesResponse, error) { + rsp, err := c.ListArches(ctx, org, distro, version, repo, reqEditors...) if err != nil { return nil, err } - return ParseListVersionsResponse(rsp) + return ParseListArchesResponse(rsp) } // ListPackagesByRepoWithResponse request returning *ListPackagesByRepoResponse -func (c *ClientWithResponses) ListPackagesByRepoWithResponse(ctx context.Context, org string, repo string, ver string, reqEditors ...RequestEditorFn) (*ListPackagesByRepoResponse, error) { - rsp, err := c.ListPackagesByRepo(ctx, org, repo, ver, reqEditors...) +func (c *ClientWithResponses) ListPackagesByRepoWithResponse(ctx context.Context, org string, distro string, version string, repo string, arch string, reqEditors ...RequestEditorFn) (*ListPackagesByRepoResponse, error) { + rsp, err := c.ListPackagesByRepo(ctx, org, distro, version, repo, arch, reqEditors...) if err != nil { return nil, err } @@ -1332,63 +1506,78 @@ func (c *ClientWithResponses) ListPackagesByRepoWithResponse(ctx context.Context } // CreatePackageWithBodyWithResponse request with arbitrary body returning *CreatePackageResponse -func (c *ClientWithResponses) CreatePackageWithBodyWithResponse(ctx context.Context, org string, repo string, ver string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePackageResponse, error) { - rsp, err := c.CreatePackageWithBody(ctx, org, repo, ver, contentType, body, reqEditors...) +func (c *ClientWithResponses) CreatePackageWithBodyWithResponse(ctx context.Context, org string, distro string, version string, repo string, arch string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePackageResponse, error) { + rsp, err := c.CreatePackageWithBody(ctx, org, distro, version, repo, arch, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseCreatePackageResponse(rsp) } -// ParseListDistrosResponse parses an HTTP response from a ListDistrosWithResponse call -func ParseListDistrosResponse(rsp *http.Response) (*ListDistrosResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) +// ParseGetHealthPingResponse parses an HTTP response from a GetHealthPingWithResponse call +func ParseGetHealthPingResponse(rsp *http.Response) (*GetHealthPingResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListDistrosResponse{ + response := &GetHealthPingResponse{ Body: bodyBytes, HTTPResponse: rsp, } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []Distribution - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + return response, nil +} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest +// ParseGetHealthReadyResponse parses an HTTP response from a GetHealthReadyWithResponse call +func ParseGetHealthReadyResponse(rsp *http.Response) (*GetHealthReadyResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + response := &GetHealthReadyResponse{ + Body: bodyBytes, + HTTPResponse: rsp, } return response, nil } -// ParseListDistroVersionsResponse parses an HTTP response from a ListDistroVersionsWithResponse call -func ParseListDistroVersionsResponse(rsp *http.Response) (*ListDistroVersionsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) +// ParseHeadHealthReadyResponse parses an HTTP response from a HeadHealthReadyWithResponse call +func ParseHeadHealthReadyResponse(rsp *http.Response) (*HeadHealthReadyResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListDistroVersionsResponse{ + response := &HeadHealthReadyResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseListOrganizationsResponse parses an HTTP response from a ListOrganizationsWithResponse call +func ParseListOrganizationsResponse(rsp *http.Response) (*ListOrganizationsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListOrganizationsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []DistroVersion + var dest []Organization if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1406,70 +1595,81 @@ func ParseListDistroVersionsResponse(rsp *http.Response) (*ListDistroVersionsRes return response, nil } -// ParseGetHealthPingResponse parses an HTTP response from a GetHealthPingWithResponse call -func ParseGetHealthPingResponse(rsp *http.Response) (*GetHealthPingResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) +// ParseGetOrganizationResponse parses an HTTP response from a GetOrganizationWithResponse call +func ParseGetOrganizationResponse(rsp *http.Response) (*GetOrganizationResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetHealthPingResponse{ + response := &GetOrganizationResponse{ Body: bodyBytes, HTTPResponse: rsp, } + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest map[string]interface{} + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + return response, nil } -// ParseGetHealthReadyResponse parses an HTTP response from a GetHealthReadyWithResponse call -func ParseGetHealthReadyResponse(rsp *http.Response) (*GetHealthReadyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) +// ParseCreateRepoResponse parses an HTTP response from a CreateRepoWithResponse call +func ParseCreateRepoResponse(rsp *http.Response) (*CreateRepoResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetHealthReadyResponse{ + response := &CreateRepoResponse{ Body: bodyBytes, HTTPResponse: rsp, } - return response, nil -} + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest []Repo + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest -// ParseHeadHealthReadyResponse parses an HTTP response from a HeadHealthReadyWithResponse call -func ParseHeadHealthReadyResponse(rsp *http.Response) (*HeadHealthReadyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: + var dest Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSONDefault = &dest - response := &HeadHealthReadyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, } return response, nil } -// ParseListOrganizationsResponse parses an HTTP response from a ListOrganizationsWithResponse call -func ParseListOrganizationsResponse(rsp *http.Response) (*ListOrganizationsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) +// ParseListDistrosResponse parses an HTTP response from a ListDistrosWithResponse call +func ParseListDistrosResponse(rsp *http.Response) (*ListDistrosResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListOrganizationsResponse{ + response := &ListDistrosResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []Organization + var dest []Distribution if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1487,15 +1687,15 @@ func ParseListOrganizationsResponse(rsp *http.Response) (*ListOrganizationsRespo return response, nil } -// ParseGetOrganizationResponse parses an HTTP response from a GetOrganizationWithResponse call -func ParseGetOrganizationResponse(rsp *http.Response) (*GetOrganizationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) +// ParseGetOrgDistroResponse parses an HTTP response from a GetOrgDistroWithResponse call +func ParseGetOrgDistroResponse(rsp *http.Response) (*GetOrgDistroResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetOrganizationResponse{ + response := &GetOrgDistroResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -1508,27 +1708,34 @@ func ParseGetOrganizationResponse(rsp *http.Response) (*GetOrganizationResponse, } response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: + var dest Error + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSONDefault = &dest + } return response, nil } -// ParseCreateRepoResponse parses an HTTP response from a CreateRepoWithResponse call -func ParseCreateRepoResponse(rsp *http.Response) (*CreateRepoResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) +// ParseListVersionsResponse parses an HTTP response from a ListVersionsWithResponse call +func ParseListVersionsResponse(rsp *http.Response) (*ListVersionsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CreateRepoResponse{ + response := &ListVersionsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []Repo + var dest []RepoVersion if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1548,7 +1755,7 @@ func ParseCreateRepoResponse(rsp *http.Response) (*CreateRepoResponse, error) { // ParseListReposResponse parses an HTTP response from a ListReposWithResponse call func ParseListReposResponse(rsp *http.Response) (*ListReposResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -1581,7 +1788,7 @@ func ParseListReposResponse(rsp *http.Response) (*ListReposResponse, error) { // ParseFindRepoByNameResponse parses an HTTP response from a FindRepoByNameWithResponse call func ParseFindRepoByNameResponse(rsp *http.Response) (*FindRepoByNameResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -1594,7 +1801,7 @@ func ParseFindRepoByNameResponse(rsp *http.Response) (*FindRepoByNameResponse, e switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []Repo + var dest map[string]interface{} if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1612,22 +1819,22 @@ func ParseFindRepoByNameResponse(rsp *http.Response) (*FindRepoByNameResponse, e return response, nil } -// ParseListVersionsResponse parses an HTTP response from a ListVersionsWithResponse call -func ParseListVersionsResponse(rsp *http.Response) (*ListVersionsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) +// ParseListArchesResponse parses an HTTP response from a ListArchesWithResponse call +func ParseListArchesResponse(rsp *http.Response) (*ListArchesResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListVersionsResponse{ + response := &ListArchesResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []DistroVersion + var dest []Architecture if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -1647,7 +1854,7 @@ func ParseListVersionsResponse(rsp *http.Response) (*ListVersionsResponse, error // ParseListPackagesByRepoResponse parses an HTTP response from a ListPackagesByRepoWithResponse call func ParseListPackagesByRepoResponse(rsp *http.Response) (*ListPackagesByRepoResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -1680,7 +1887,7 @@ func ParseListPackagesByRepoResponse(rsp *http.Response) (*ListPackagesByRepoRes // ParseCreatePackageResponse parses an HTTP response from a CreatePackageWithResponse call func ParseCreatePackageResponse(rsp *http.Response) (*CreatePackageResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) + bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err @@ -1714,12 +1921,6 @@ func ParseCreatePackageResponse(rsp *http.Response) (*CreatePackageResponse, err // ServerInterface represents all server handlers. type ServerInterface interface { - // (GET /distributions) - ListDistros(ctx echo.Context) error - - // (GET /distributions/{distro}/versions) - ListDistroVersions(ctx echo.Context, distro string) error - // (GET /health/ping) GetHealthPing(ctx echo.Context) error @@ -1729,70 +1930,50 @@ type ServerInterface interface { // (HEAD /health/ready) HeadHealthReady(ctx echo.Context) error - // (GET /o) + // (GET /orgs) ListOrganizations(ctx echo.Context) error - // (GET /o/{org}) + // (GET /{org}) GetOrganization(ctx echo.Context, org string) error - // (POST /o/{org}) + // (POST /{org}) CreateRepo(ctx echo.Context, org string) error - // (GET /o/{org}/r) - ListRepos(ctx echo.Context, org string) error + // (GET /{org}/distros) + ListDistros(ctx echo.Context, org string) error - // (GET /o/{org}/r/{repo}) - FindRepoByName(ctx echo.Context, org string, repo string) error + // (GET /{org}/{distro}) + GetOrgDistro(ctx echo.Context, org string, distro string) error - // (GET /o/{org}/r/{repo}/v) - ListVersions(ctx echo.Context, org string, repo string) error + // (GET /{org}/{distro}/versions) + ListVersions(ctx echo.Context, org string, distro string) error - // (GET /o/{org}/r/{repo}/v/{ver}) - ListPackagesByRepo(ctx echo.Context, org string, repo string, ver string) error + // (GET /{org}/{distro}/{version}/repos) + ListRepos(ctx echo.Context, org string, distro string, version string) error - // (POST /o/{org}/r/{repo}/v/{ver}) - CreatePackage(ctx echo.Context, org string, repo string, ver string) error -} + // (GET /{org}/{distro}/{version}/{repo}) + FindRepoByName(ctx echo.Context, org string, distro string, version string, repo string) error -// ServerInterfaceWrapper converts echo contexts to parameters. -type ServerInterfaceWrapper struct { - Handler ServerInterface -} + // (GET /{org}/{distro}/{version}/{repo}/architectures) + ListArches(ctx echo.Context, org string, distro string, version string, repo string) error -// ListDistros converts echo context to params. -func (w *ServerInterfaceWrapper) ListDistros(ctx echo.Context) error { - var err error + // (GET /{org}/{distro}/{version}/{repo}/{arch}/pkgs) + ListPackagesByRepo(ctx echo.Context, org string, distro string, version string, repo string, arch string) error - ctx.Set(BearerAuthScopes, []string{""}) - - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.ListDistros(ctx) - return err + // (POST /{org}/{distro}/{version}/{repo}/{arch}/pkgs) + CreatePackage(ctx echo.Context, org string, distro string, version string, repo string, arch string) error } -// ListDistroVersions converts echo context to params. -func (w *ServerInterfaceWrapper) ListDistroVersions(ctx echo.Context) error { - var err error - // ------------- Path parameter "distro" ------------- - var distro string - - err = runtime.BindStyledParameterWithLocation("simple", false, "distro", runtime.ParamLocationPath, ctx.Param("distro"), &distro) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter distro: %s", err)) - } - - ctx.Set(BearerAuthScopes, []string{""}) - - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.ListDistroVersions(ctx, distro) - return err +// ServerInterfaceWrapper converts echo contexts to parameters. +type ServerInterfaceWrapper struct { + Handler ServerInterface } // GetHealthPing converts echo context to params. func (w *ServerInterfaceWrapper) GetHealthPing(ctx echo.Context) error { var err error - // Invoke the callback with all the unmarshalled arguments + // Invoke the callback with all the unmarshaled arguments err = w.Handler.GetHealthPing(ctx) return err } @@ -1801,7 +1982,7 @@ func (w *ServerInterfaceWrapper) GetHealthPing(ctx echo.Context) error { func (w *ServerInterfaceWrapper) GetHealthReady(ctx echo.Context) error { var err error - // Invoke the callback with all the unmarshalled arguments + // Invoke the callback with all the unmarshaled arguments err = w.Handler.GetHealthReady(ctx) return err } @@ -1810,7 +1991,7 @@ func (w *ServerInterfaceWrapper) GetHealthReady(ctx echo.Context) error { func (w *ServerInterfaceWrapper) HeadHealthReady(ctx echo.Context) error { var err error - // Invoke the callback with all the unmarshalled arguments + // Invoke the callback with all the unmarshaled arguments err = w.Handler.HeadHealthReady(ctx) return err } @@ -1819,9 +2000,7 @@ func (w *ServerInterfaceWrapper) HeadHealthReady(ctx echo.Context) error { func (w *ServerInterfaceWrapper) ListOrganizations(ctx echo.Context) error { var err error - ctx.Set(BearerAuthScopes, []string{""}) - - // Invoke the callback with all the unmarshalled arguments + // Invoke the callback with all the unmarshaled arguments err = w.Handler.ListOrganizations(ctx) return err } @@ -1837,9 +2016,9 @@ func (w *ServerInterfaceWrapper) GetOrganization(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter org: %s", err)) } - ctx.Set(BearerAuthScopes, []string{""}) + ctx.Set(BearerAuthScopes, []string{}) - // Invoke the callback with all the unmarshalled arguments + // Invoke the callback with all the unmarshaled arguments err = w.Handler.GetOrganization(ctx, org) return err } @@ -1855,13 +2034,83 @@ func (w *ServerInterfaceWrapper) CreateRepo(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter org: %s", err)) } - ctx.Set(BearerAuthScopes, []string{""}) + ctx.Set(BearerAuthScopes, []string{}) - // Invoke the callback with all the unmarshalled arguments + // Invoke the callback with all the unmarshaled arguments err = w.Handler.CreateRepo(ctx, org) return err } +// ListDistros converts echo context to params. +func (w *ServerInterfaceWrapper) ListDistros(ctx echo.Context) error { + var err error + // ------------- Path parameter "org" ------------- + var org string + + err = runtime.BindStyledParameterWithLocation("simple", false, "org", runtime.ParamLocationPath, ctx.Param("org"), &org) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter org: %s", err)) + } + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.ListDistros(ctx, org) + return err +} + +// GetOrgDistro converts echo context to params. +func (w *ServerInterfaceWrapper) GetOrgDistro(ctx echo.Context) error { + var err error + // ------------- Path parameter "org" ------------- + var org string + + err = runtime.BindStyledParameterWithLocation("simple", false, "org", runtime.ParamLocationPath, ctx.Param("org"), &org) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter org: %s", err)) + } + + // ------------- Path parameter "distro" ------------- + var distro string + + err = runtime.BindStyledParameterWithLocation("simple", false, "distro", runtime.ParamLocationPath, ctx.Param("distro"), &distro) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter distro: %s", err)) + } + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.GetOrgDistro(ctx, org, distro) + return err +} + +// ListVersions converts echo context to params. +func (w *ServerInterfaceWrapper) ListVersions(ctx echo.Context) error { + var err error + // ------------- Path parameter "org" ------------- + var org string + + err = runtime.BindStyledParameterWithLocation("simple", false, "org", runtime.ParamLocationPath, ctx.Param("org"), &org) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter org: %s", err)) + } + + // ------------- Path parameter "distro" ------------- + var distro string + + err = runtime.BindStyledParameterWithLocation("simple", false, "distro", runtime.ParamLocationPath, ctx.Param("distro"), &distro) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter distro: %s", err)) + } + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.ListVersions(ctx, org, distro) + return err +} + // ListRepos converts echo context to params. func (w *ServerInterfaceWrapper) ListRepos(ctx echo.Context) error { var err error @@ -1873,10 +2122,26 @@ func (w *ServerInterfaceWrapper) ListRepos(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter org: %s", err)) } - ctx.Set(BearerAuthScopes, []string{""}) + // ------------- Path parameter "distro" ------------- + var distro string - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.ListRepos(ctx, org) + err = runtime.BindStyledParameterWithLocation("simple", false, "distro", runtime.ParamLocationPath, ctx.Param("distro"), &distro) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter distro: %s", err)) + } + + // ------------- Path parameter "version" ------------- + var version string + + err = runtime.BindStyledParameterWithLocation("simple", false, "version", runtime.ParamLocationPath, ctx.Param("version"), &version) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter version: %s", err)) + } + + ctx.Set(BearerAuthScopes, []string{}) + + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.ListRepos(ctx, org, distro, version) return err } @@ -1891,6 +2156,22 @@ func (w *ServerInterfaceWrapper) FindRepoByName(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter org: %s", err)) } + // ------------- Path parameter "distro" ------------- + var distro string + + err = runtime.BindStyledParameterWithLocation("simple", false, "distro", runtime.ParamLocationPath, ctx.Param("distro"), &distro) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter distro: %s", err)) + } + + // ------------- Path parameter "version" ------------- + var version string + + err = runtime.BindStyledParameterWithLocation("simple", false, "version", runtime.ParamLocationPath, ctx.Param("version"), &version) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter version: %s", err)) + } + // ------------- Path parameter "repo" ------------- var repo string @@ -1899,15 +2180,15 @@ func (w *ServerInterfaceWrapper) FindRepoByName(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter repo: %s", err)) } - ctx.Set(BearerAuthScopes, []string{""}) + ctx.Set(BearerAuthScopes, []string{}) - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.FindRepoByName(ctx, org, repo) + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.FindRepoByName(ctx, org, distro, version, repo) return err } -// ListVersions converts echo context to params. -func (w *ServerInterfaceWrapper) ListVersions(ctx echo.Context) error { +// ListArches converts echo context to params. +func (w *ServerInterfaceWrapper) ListArches(ctx echo.Context) error { var err error // ------------- Path parameter "org" ------------- var org string @@ -1917,6 +2198,22 @@ func (w *ServerInterfaceWrapper) ListVersions(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter org: %s", err)) } + // ------------- Path parameter "distro" ------------- + var distro string + + err = runtime.BindStyledParameterWithLocation("simple", false, "distro", runtime.ParamLocationPath, ctx.Param("distro"), &distro) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter distro: %s", err)) + } + + // ------------- Path parameter "version" ------------- + var version string + + err = runtime.BindStyledParameterWithLocation("simple", false, "version", runtime.ParamLocationPath, ctx.Param("version"), &version) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter version: %s", err)) + } + // ------------- Path parameter "repo" ------------- var repo string @@ -1925,10 +2222,10 @@ func (w *ServerInterfaceWrapper) ListVersions(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter repo: %s", err)) } - ctx.Set(BearerAuthScopes, []string{""}) + ctx.Set(BearerAuthScopes, []string{}) - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.ListVersions(ctx, org, repo) + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.ListArches(ctx, org, distro, version, repo) return err } @@ -1943,6 +2240,22 @@ func (w *ServerInterfaceWrapper) ListPackagesByRepo(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter org: %s", err)) } + // ------------- Path parameter "distro" ------------- + var distro string + + err = runtime.BindStyledParameterWithLocation("simple", false, "distro", runtime.ParamLocationPath, ctx.Param("distro"), &distro) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter distro: %s", err)) + } + + // ------------- Path parameter "version" ------------- + var version string + + err = runtime.BindStyledParameterWithLocation("simple", false, "version", runtime.ParamLocationPath, ctx.Param("version"), &version) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter version: %s", err)) + } + // ------------- Path parameter "repo" ------------- var repo string @@ -1951,18 +2264,18 @@ func (w *ServerInterfaceWrapper) ListPackagesByRepo(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter repo: %s", err)) } - // ------------- Path parameter "ver" ------------- - var ver string + // ------------- Path parameter "arch" ------------- + var arch string - err = runtime.BindStyledParameterWithLocation("simple", false, "ver", runtime.ParamLocationPath, ctx.Param("ver"), &ver) + err = runtime.BindStyledParameterWithLocation("simple", false, "arch", runtime.ParamLocationPath, ctx.Param("arch"), &arch) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter ver: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter arch: %s", err)) } - ctx.Set(BearerAuthScopes, []string{""}) + ctx.Set(BearerAuthScopes, []string{}) - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.ListPackagesByRepo(ctx, org, repo, ver) + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.ListPackagesByRepo(ctx, org, distro, version, repo, arch) return err } @@ -1977,6 +2290,22 @@ func (w *ServerInterfaceWrapper) CreatePackage(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter org: %s", err)) } + // ------------- Path parameter "distro" ------------- + var distro string + + err = runtime.BindStyledParameterWithLocation("simple", false, "distro", runtime.ParamLocationPath, ctx.Param("distro"), &distro) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter distro: %s", err)) + } + + // ------------- Path parameter "version" ------------- + var version string + + err = runtime.BindStyledParameterWithLocation("simple", false, "version", runtime.ParamLocationPath, ctx.Param("version"), &version) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter version: %s", err)) + } + // ------------- Path parameter "repo" ------------- var repo string @@ -1985,18 +2314,18 @@ func (w *ServerInterfaceWrapper) CreatePackage(ctx echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter repo: %s", err)) } - // ------------- Path parameter "ver" ------------- - var ver string + // ------------- Path parameter "arch" ------------- + var arch string - err = runtime.BindStyledParameterWithLocation("simple", false, "ver", runtime.ParamLocationPath, ctx.Param("ver"), &ver) + err = runtime.BindStyledParameterWithLocation("simple", false, "arch", runtime.ParamLocationPath, ctx.Param("arch"), &arch) if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter ver: %s", err)) + return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter arch: %s", err)) } - ctx.Set(BearerAuthScopes, []string{""}) + ctx.Set(BearerAuthScopes, []string{}) - // Invoke the callback with all the unmarshalled arguments - err = w.Handler.CreatePackage(ctx, org, repo, ver) + // Invoke the callback with all the unmarshaled arguments + err = w.Handler.CreatePackage(ctx, org, distro, version, repo, arch) return err } @@ -2028,48 +2357,50 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL Handler: si, } - router.GET(baseURL+"/distributions", wrapper.ListDistros) - router.GET(baseURL+"/distributions/:distro/versions", wrapper.ListDistroVersions) router.GET(baseURL+"/health/ping", wrapper.GetHealthPing) router.GET(baseURL+"/health/ready", wrapper.GetHealthReady) router.HEAD(baseURL+"/health/ready", wrapper.HeadHealthReady) - router.GET(baseURL+"/o", wrapper.ListOrganizations) - router.GET(baseURL+"/o/:org", wrapper.GetOrganization) - router.POST(baseURL+"/o/:org", wrapper.CreateRepo) - router.GET(baseURL+"/o/:org/r", wrapper.ListRepos) - router.GET(baseURL+"/o/:org/r/:repo", wrapper.FindRepoByName) - router.GET(baseURL+"/o/:org/r/:repo/v", wrapper.ListVersions) - router.GET(baseURL+"/o/:org/r/:repo/v/:ver", wrapper.ListPackagesByRepo) - router.POST(baseURL+"/o/:org/r/:repo/v/:ver", wrapper.CreatePackage) + router.GET(baseURL+"/orgs", wrapper.ListOrganizations) + router.GET(baseURL+"/:org", wrapper.GetOrganization) + router.POST(baseURL+"/:org", wrapper.CreateRepo) + router.GET(baseURL+"/:org/distros", wrapper.ListDistros) + router.GET(baseURL+"/:org/:distro", wrapper.GetOrgDistro) + router.GET(baseURL+"/:org/:distro/versions", wrapper.ListVersions) + router.GET(baseURL+"/:org/:distro/:version/repos", wrapper.ListRepos) + router.GET(baseURL+"/:org/:distro/:version/:repo", wrapper.FindRepoByName) + router.GET(baseURL+"/:org/:distro/:version/:repo/architectures", wrapper.ListArches) + router.GET(baseURL+"/:org/:distro/:version/:repo/:arch/pkgs", wrapper.ListPackagesByRepo) + router.POST(baseURL+"/:org/:distro/:version/:repo/:arch/pkgs", wrapper.CreatePackage) } // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+RZzW7bOBB+FYK7hy6gWGl682nTn20DFGmQAr0EOYylscVGIllylMQ1/O4LUpIlWVLk", - "FG2joDfZGs7vN5845IZHKtNKoiTL5xtuowQz8I+nJkoEYUS5Qfeb1hr5nFsyQq74NuBvhXte5CSUHBZQ", - "X9DYIYl3xijj3mijNBoS6E1HKvYml8pkQHzOhaRXJzyoFAhJuELjNGRoLaz6HNwG3OC3XBiM+fyq0FnL", - "X++UqcVXjMjpOse7S9Sq60+MNjJCV4G2fvK39S+mlowSZAa1YqQYxDE7YlIRW+YychKQsiP2NbfElsow", - "BItuTW6xDq7OjoQMu/bOIcMeQ10Fewnw2vrC/mRWIMV3qMJrx97vhGw4oZrre8JwTnbTyN3SVFhyarwI", - "owSILTBVcuWCokRYp5y98E8xELAM1myBLEaNMkZJTEkGOSX/8IALwszb+dvgks/5X2GN7bAEdugLvN15", - "CcbA2qeqk5YLiG5KZD02I7pc2puM1FW9txtuBzvl0FL2wxcandxTiKoILTEmZFEAV5pDk9uijE6Sgx/r", - "o1/eQEOY7a50IeeEMVsalfm1YVWz4MFydpEfe25kpUwdbQF/y0gd1tClq7W1Liy2AbcY5UbQ+rMrVIGB", - "BYJBc5pTsuN9t6j4u7adEGm+dTqEXKqCnCVBRO4RMxApn/MS7/ZfoBRslKo8nt2vv/OqAvzmzr6cRSqr", - "OoMRQsYDnpu0tGHnYVipme2p2UcOP7048+XvqC1zkYoIZdFkpQOnGqIE2cnsuGP17u5uBv71TJlVWK61", - "4cezN+/OP787OpkdzxLKUg9oNJn9tPyM5lZE2FDS9jgkZV0KBaVOqGQS5rqTnV6cNao15y9nx7Njp1tp", - "lKAFn/NX/q+Aa6DE1yqMG59a/88KabiRba61Mg6nrXXsRZQbg5LSddFBp6kWEh11Orbw/H0W8zn/KCwV", - "327r8WW1chlxBk+OjysMoPQugNapiPzi8Kst4F7wgXs6iDZaG4kuN3fK386Gf72EPKVHefaQQ8W2pMdy", - "LvFeY+RSi5XMNtirT7gpmntbkcN4xdpsYB+oyJdaRIOBDAmN5fOrPo5pfpKaHrqPa6rUDct106SQvpUp", - "qfu28Is3eYdMjkEjj/scdf3bELPbWR4AmV2YU0BLgpBSEmqXsBoZ7Yq/R/rgxS6c1GhOCe8p1CmIPb/x", - "HjLtSUgrr2e/XB2nnVfMCzc/HHx+dd303SDE63HnL73YT/DelIpG3feCTBm3aehGEPAEIe46/AEhnqbH", - "LudqlD+aW/B+9vi0J/Hre7Q1VhzQou0YptCnKtwos9oOZt/tiBgsVE4M5EgN3mOrBI+l770Zq4eqlVlN", - "j6cHMLDbmfaBgPmNpn+nle1J+xuDQMgk3lX7vXaqi/eXxaspZPlbjpZeq4IwfwqUq5OKngxeto4E2p5u", - "f0fNBybsHt7TalJ9HprBTr9Eyo1ksDuwaA4cVpAyAq0fSQoi6KXgSx/wn9H4zxgE4cY5tR3BQnEw4rmq", - "OA2AfjL6T8jYJeP1+rwY15+4+sHQuVV1lLhEipJ+W2WAzxhqrHJnkpALb0c3eg9OiD86Gz4Byvz46fiy", - "OvN5Toh73tNnF3Xh5hbNOOF1vn6WLcBizJQs6vogOMtDMPt6PY2d2ZNBtGO4OgN+vO1bf1I7se6o7k0O", - "6IsdjiZDyyMzB+w2fkIOffEL0YvdFdDUcO4x9gfgfGjqyvKUhAZD4VKZ7CgGgjaYhi/Pem/tdH1PuLuv", - "XggJZt17gzM6Au+uSJ5whnt8D0+mhVvnZ+1rrqvr7fV2XOL/AAAA///9P6IoFCEAAA==", + "H4sIAAAAAAAC/+xaS2/bOBD+KwR3D7uAY2XTS6DTpo9tAxRp4AK9BDmMpbHFViJZctTENfTfF6QkS7Lk", + "R4K2sdHcbHE0M5zvmxk+tOSRyrSSKMnycMltlGAG/ueFiRJBGFFu0P2nhUYecktGyDkvRvy1cL+nOQkl", + "BwXeGKOMG9FGaTQk0CuOVOwVzpTJgHjIhaQXZ3xUKxCScI7GacjQWpgPmS9G3ODXXBiMeXhT6mzkb1fK", + "1PQzRuR0XeHdBLXq+xOjjYzQ9TQ6f/nr5h9TM0YJMoNaMVIM4pidMKmIzXIZOQlI2Qn7nFtiM2UYgkX3", + "Tm6xmVwTHQkZ9u1dQYYDhvoK1gLgtQ1N+4OZgxTfoZ7e2txbGPaDwZ0XqbDkPHLeWEYJEJtiquTcuUaJ", + "sEyZOfvL/4qBgGWwYFNkMWqUMUpiSjLIKfmbj7ggzLydPw3OeMj/CBr+BRX5gg6xitWcwBhYbI6cbEVO", + "tSc9FLpemK4h+lIxrRuh3cZ09eoAxgZTx4LB7PiGxg5nzr7QDtMZWnk7AGkNZ0eMCVlC6UDeF6ZOgRiA", + "6VF59dMTar9Mco+8bI3Spvh/2oaixSg3ghYfXcRKMKYIBs1FTsmq3LqXyseNbwmR5oXTIeRMlVVTEkTk", + "fmIGIuUhr4hn/wVKwUapyuPx/eI7r0PBL9zzV+55TVJGCBkf8dyklRUbBkGtaLymaB1EfnF96ZEYUFzF", + "KxURypLxtRMaogTZ2fi0Z/fu7m4MfniszDyo3rXB+8tXb64+vjk5G5+OE8pS7mNpHBY8vFnu530AWvBi", + "1JYOgyBVEaSJshSen5+f88LhiiazH2Yf0XwTEbYUr+kjZR1AglInVBUM5kjALq4vW1wJuXP89GSKBP84", + "35VG6bwJ+Qs3wEdcAyWeD0GCkFISaMeZcMnn6CF2Ce2r12XMQ/4W6Z0Xu3ZSjptWKxcpJ3p2elrzA6V/", + "mfCeAp2CkE1L97y5h0x757XyetYZ28PbecW8cJvOPLy5df9r3w1CvNjt/MSL/QDvTaVop/tekCnjakp/", + "BiOeIMR9h98hxIfpsYu5MnPbivVwcW/3P0fa7gTfC0sf1iR2TBG0TkXkpYPPVq1NdK920VmI9NpFPxTd", + "OfjhGeQpPcizbQ6Vy9MBy7nEe40RYcywkhkAYqnMvNiIhCvbDKYqJwZyBx5vsQOHLw8GMqS63vUXZVsW", + "O8InLlDS9AFlyqpRNzkyOY5aUVqn5e0T8qFur4OEYL4b+jGt7EDYXxkEQibxrm5I3VCX45Ny6BCi/DVH", + "Sy9VWT9/CK3rfc5ABCedDUXX0+JXYF46tjv3/V7jqXO+yfLAb5PU5ro7QcqNZLDaLHX2VX7JVFaBwVr8", + "utL+e+T99t3d4XNhWZKh2EWGdgfo8GEbHcpWUBLi6fkw2mWyPa1hk3E9leNg4ebuc6g0DKpdx+5F4Upw", + "qAZ9agafSfcz2199YLBH5VsBdoCsW1bOFUGZGJvI57jVOSOwgpQR2G6KKwIxkPE6vH2qTrzB35Sng1Yr", + "LPY3XJ9UHGSGHPOioJUXS+fjrlVCeeJarhVmRmUMhvct/wkZu9i8XFyVx5PP5P+l5B9tugCo72hmSFEy", + "bK8C9LAzbfvCh9X+HEPKBb0bkAd0psXaxciju9SFiRJ8blOHl6mpUl88rPW9wTFl7fY7t34KdVPhGJJ3", + "6VwuAv1lbnf2zua8pcaSTcFizJQs2aVK1F3CNlzq52p1l2NfLiY16j8byPq+eQ8MV3M7mCL8XNQ6G7RH", + "VJejqmw9wy5FH2HYvfbQkrr1mB9W/VvITSvnUvR69Y3G5iP3LE9JaDAUzJTJTmIg6OZP9zsL3XwxsvqS", + "aSokmMU+X5xsTPMnPZ9/eFU6oJVh95Ku+6nFzW1xW/wfAAD//yABY6HtJgAA", } // GetSwagger returns the content of the embedded swagger specification file @@ -2077,16 +2408,16 @@ var swaggerSpec = []string{ func decodeSpec() ([]byte, error) { zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, "")) if err != nil { - return nil, fmt.Errorf("error base64 decoding spec: %s", err) + return nil, fmt.Errorf("error base64 decoding spec: %w", err) } zr, err := gzip.NewReader(bytes.NewReader(zipped)) if err != nil { - return nil, fmt.Errorf("error decompressing spec: %s", err) + return nil, fmt.Errorf("error decompressing spec: %w", err) } var buf bytes.Buffer _, err = buf.ReadFrom(zr) if err != nil { - return nil, fmt.Errorf("error decompressing spec: %s", err) + return nil, fmt.Errorf("error decompressing spec: %w", err) } return buf.Bytes(), nil @@ -2104,7 +2435,7 @@ func decodeSpecCached() func() ([]byte, error) { // Constructs a synthetic filesystem for resolving external references when loading openapi specifications. func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { - var res = make(map[string]func() ([]byte, error)) + res := make(map[string]func() ([]byte, error)) if len(pathToFile) > 0 { res[pathToFile] = rawSpec } @@ -2118,12 +2449,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { // Externally referenced files must be embedded in the corresponding golang packages. // Urls can be supported but this task was out of the scope. func GetSwagger() (swagger *openapi3.T, err error) { - var resolvePath = PathToRawSpec("") + resolvePath := PathToRawSpec("") loader := openapi3.NewLoader() loader.IsExternalRefsAllowed = true loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { - var pathToFile = url.String() + pathToFile := url.String() pathToFile = path.Clean(pathToFile) getSpec, ok := resolvePath[pathToFile] if !ok { diff --git a/internal/openapi/fs.go b/internal/openapi/fs.go index a578a99..3593776 100644 --- a/internal/openapi/fs.go +++ b/internal/openapi/fs.go @@ -1,44 +1,362 @@ package api import ( - "path/filepath" + "bytes" + "context" + "crypto/x509" + "encoding/pem" + "io" + "mime/multipart" + "os" "strings" - "github.com/pkg/xattr" "github.com/rs/zerolog/log" + "github.com/viant/afs" + "github.com/viant/afs/file" + "github.com/viant/afs/url" + "gitlab.alpinelinux.org/alpine/go/repository" ) // GetValidTokens - return an array of token strings -func GetValidTokens(org, repo string) []string { - // log.Debug().Interface("ctx", ctx).Msg("GetValidTokens: context") +// this is exported because it gets called in the auth validator in cmd/api/main.go +func GetValidTokens(org string) []string { + ctx := context.Background() var tokens []string - orgDir := filepath.Join(PackageBaseDirectory, org) + configURI := PackageBaseDirectory + "/config/" + org + "/tokens/" // filepath.join condenses the consectutive + tokenFS := afs.New() + err := tokenFS.Init(ctx, PackageBaseDirectory) + if err != nil { + log.Fatal().Err(err).Str("org", org).Str("uri", configURI).Msg("GetValidTokens: failed to create NewLocation") + } + + tokenList, err := tokenFS.List(ctx, configURI) + if err != nil { + log.Error().Err(err).Msg("failed to list the token dir") + } + for _, t := range tokenList { + if t.IsDir() { + continue + } + fd, err := tokenFS.Open(ctx, t) + if err != nil || fd == nil { + log.Error().Err(err).Msg("GetValidTokens: failed to create new file from token path") + } + var tok = make([]byte, 256) + c, err := fd.Read(tok) + if err != nil { + log.Error().Err(err).Int("read count", c).Msg("failed to read from fd") + } + tok = bytes.TrimSpace(tok[0:c]) + if len(tok) > 0 { + tokens = append(tokens, string(tok)) + } + } + + return tokens +} - // xattrs := make([]string, 1024) +func listOrgs() []Organization { + var orgs []Organization - xattrs, err := xattr.List(orgDir) + ctx := context.Background() + configURI := url.JoinUNC(PackageBaseDirectory, "static") + cfs := afs.New() + err := cfs.Init(ctx, configURI) if err != nil { - log.Warn().Err(err).Msg("failed to listxattrs on org") + log.Fatal().Err(err).Str("uri", configURI).Msg("listOrgs: failed to init afs") } - log.Warn().Strs("xattrs", xattrs).Str("path", orgDir).Msg("org level xattrs") - for _, xa := range xattrs { - if strings.HasPrefix(xa, "user.token") { - t, err := xattr.Get(orgDir, xa) - if err != nil { - log.Warn().Err(err).Msg("failed to get xattr") - continue + orgDirList, err := cfs.List(ctx, configURI) + if err != nil { + log.Error().Err(err).Msg("failed to list orgs") + } + for _, o := range orgDirList { + if o.URL() == url.Normalize(configURI, file.Scheme) { + continue + } + orgName := o.Name() + orgs = append(orgs, Organization{Name: &orgName}) + } + return orgs +} + +func orgExists(org string) bool { + orgs := listOrgs() + for _, o := range orgs { + if *o.Name == org { + return true + } + } + return false +} + +func listRepos(org, distro, version string) ([]Repo, error) { + ctx := context.Background() + configURI := url.JoinUNC(PackageBaseDirectory, "static", org, distro, version) + cfs := afs.New() + err := cfs.Init(ctx, configURI) + if err != nil { + log.Fatal().Err(err).Str("org", org).Str("uri", configURI).Str("distro", distro).Msg("failed to list repos") + } + result := []Repo{} + + // TODO should we use list instead of walk? + walkerF := func(ctx context.Context, baseURL string, parent string, info os.FileInfo, reader io.Reader) (toContinue bool, err error) { + if parent == "" { + // if parent is set that means we've recursed + result = append(result, Repo{Name: info.Name()}) + } + return true, nil + } + + err = cfs.Walk(ctx, configURI, walkerF) + if err != nil { + log.Error().Err(err).Msg("listRepos: failed to walk dirs") + } + + return result, nil +} + +func listPackages(org, distro, version, repo, arch string) ([]Package, error) { + ctx := context.Background() + configURI := url.JoinUNC(PackageBaseDirectory, "static", org, distro, version, repo, arch) + cfs := afs.New() + err := cfs.Init(ctx, configURI) + if err != nil { + log.Fatal().Err(err).Str("org", org).Str("uri", configURI).Str("distro", distro).Msg("failed to init afs") + } + result := []Package{} + + walkerF := func(ctx context.Context, baseURL string, parent string, info os.FileInfo, reader io.Reader) (toContinue bool, err error) { + if strings.HasSuffix(info.Name(), ".apk") { + if parent == "" { + // if parent is set that means we've recursed + result = append(result, Package{Name: info.Name()}) } - tokens = append(tokens, string(t)) } + return true, nil } - log.Info().Strs("tokens", tokens).Msg("org tokens") - return tokens + err = cfs.Walk(ctx, configURI, walkerF) + if err != nil { + log.Error().Err(err).Msg("listPackages: failed to walk dirs") + } + + return result, nil } -func listOrgs() []string { - // orgDir := filepath.Join(PackageBaseDirectory, org) +func getRepoInfo(org, distro, version, repo string) Repo { + ctx := context.Background() + configURI := url.JoinUNC(PackageBaseDirectory, "config", org, distro, version, repo) + cfs := afs.New() + err := cfs.Init(ctx, PackageBaseDirectory) + if err != nil { + log.Fatal().Err(err).Str("org", org).Str("uri", configURI).Str("distro", distro).Msg("getRepoInfo: failed to init afs") + } + + ex, err := cfs.Exists(ctx, configURI) + if err != nil { + log.Error().Err(err).Msg("failed to check existance of repo") + } + if ex { + return Repo{ + Name: repo, + Description: nil, + // Architectures: , + } + } else { + return Repo{} + } +} - return []string{"atlascloud"} +func listVersions(org, distro string) ([]RepoVersion, error) { + result := []RepoVersion{} + ctx := context.Background() + // this looks like it's hardcoding the scheme, but it's really just trying to duplicate the logic that afs.List() uses + configURI := url.Normalize(url.JoinUNC(PackageBaseDirectory, "config", org, distro), file.Scheme) + cfs := afs.New() + err := cfs.Init(ctx, PackageBaseDirectory) + if err != nil { + log.Fatal().Err(err).Str("org", org).Str("uri", configURI).Str("distro", distro).Msg("listVersions: failed to init afs") + } + vList, err := cfs.List(ctx, configURI) + if err != nil { + log.Error().Err(err).Msg("failed to list repoversions") + } + for _, vers := range vList { + if vers.URL() == configURI || !vers.IsDir() { + // we can skip the parent dir and files + continue + } + result = append(result, vers.Name()) + } + return result, nil +} +func listArches(org, distro, version, repo string) ([]Architecture, error) { + result := []Architecture{} + ctx := context.Background() + // this looks like it's hardcoding the scheme, but it's really just trying to duplicate the logic that afs.List() uses + configURI := url.Normalize(url.JoinUNC(PackageBaseDirectory, "static", org, distro, version, repo), file.Scheme) + cfs := afs.New() + err := cfs.Init(ctx, PackageBaseDirectory) + if err != nil { + log.Fatal().Err(err).Str("org", org).Str("uri", configURI).Str("distro", distro).Msg("listArches: failed to init afs") + } + aList, err := cfs.List(ctx, configURI) + if err != nil { + log.Error().Err(err).Msg("failed to list arch dir") + } + for _, a := range aList { + if a.URL() == configURI || !a.IsDir() { + // we can skip the parent dir and files + continue + } + result = append(result, a.Name()) + } + return result, nil +} + +func listDistros(org string) ([]Distribution, error) { + result := []Distribution{} + ctx := context.Background() + // this looks like it's hardcoding the scheme, but it's really just trying to duplicate the logic that afs.List() uses + configURI := url.Normalize(url.JoinUNC(PackageBaseDirectory, "static", org), file.Scheme) + cfs := afs.New() + err := cfs.Init(ctx, PackageBaseDirectory) + if err != nil { + log.Fatal().Err(err).Str("org", org).Str("uri", configURI).Msg("failed to list repos") + } + dList, err := cfs.List(ctx, configURI) + if err != nil { + log.Error().Err(err).Msg("failed to list repoversions") + } + for _, distro := range dList { + if distro.URL() == configURI || !distro.IsDir() { + // we can skip the parent dir and files + continue + } + result = append(result, distro.Name()) + } + return result, nil +} + +func writeUploadedPkg(f *multipart.FileHeader, org, distro, version, repo, arch string) { + log.Debug().Msg("writing uploaded package") + ctx := context.Background() + staticURI := url.JoinUNC(PackageBaseDirectory, "static", org, distro, version, repo, arch) + + pkgFile, err := f.Open() + if err != nil { + log.Error().Err(err).Msg("failed to open pkg file") + } + + cfs := afs.New() + err = cfs.Init(ctx, PackageBaseDirectory) + if err != nil { + log.Fatal().Err(err).Msg("generateAPKIndex: failed to init cfs") + } + outFileName := url.JoinUNC(staticURI, f.Filename) + _ = cfs.Delete(ctx, outFileName) // we don't care if delete fails as the file probably doesn't even exist + outFile, err := cfs.NewWriter(ctx, outFileName, 0644) + if err != nil { + log.Error().Err(err).Msg("failed to create outfile") + } + + c, err := io.Copy(outFile, pkgFile) + if err != nil || c == 0 { + log.Error().Err(err).Int64("count", c).Msg("failed to copy uploaded pkg file to outFile") + } +} + +// generateAPKIndex - (re)generate the APKINDEX file +// this runs in the background because it can take quite a while +// regenerate the APKINDEX +// TODO make sure we don't run this unnecessarily +func generateAPKIndex(org, distro, version, repo, arch string) { + log.Debug().Msg("generating APK index") + var apki repository.ApkIndex + apki.Description = "atlascloud main edge" + + ctx := context.Background() + configURI := url.JoinUNC(PackageBaseDirectory, "config", org, distro) + staticURI := url.JoinUNC(PackageBaseDirectory, "static", org, distro, version, repo, arch) + cfs := afs.New() + err := cfs.Init(ctx, PackageBaseDirectory) + if err != nil { + log.Fatal().Err(err).Msg("generateAPKIndex: failed to init cfs") + } + + walkerF := func(ctx context.Context, baseURL string, parent string, info os.FileInfo, reader io.Reader) (toContinue bool, err error) { + // log.Debug().Str("baseurl", baseURL).Str("parent", parent).Msg("generateAPKIndex: walker") + if strings.HasSuffix(info.Name(), ".apk") { + if parent == "" { + // if parent is set that means we've recursed + pkg, err := repository.ParsePackage(reader) + if err != nil { + log.Error().Err(err).Msg("generateAPKIndex: failed to parse package") + } + apki.Packages = append(apki.Packages, pkg) + } + } + return true, nil + } + + err = cfs.Walk(ctx, staticURI, walkerF) + if err != nil { + log.Error().Err(err).Str("URI", staticURI).Msg("failed to walk") + } + + distroDirContents, err := cfs.List(ctx, configURI) + if err != nil { + log.Error().Err(err).Str("uri", configURI).Msg("failed to list rsa key") + } + + // the afs matcher thing doesn't seem to work, so we have to find it the hard way + var keyFd io.ReadCloser + var keyName string + for _, f := range distroDirContents { + if strings.HasSuffix(f.Name(), ".rsa") { + keyFd, err = cfs.Open(ctx, f) + if err != nil { + log.Error().Err(err).Str("uri", configURI).Msg("failed to open rsa key") + } + keyName = f.Name() + } + } + + keyData, err := io.ReadAll(keyFd) + if err != nil { + log.Error().Err(err).Str("uri", configURI).Msg("failed to read rsa key") + } + + der, _ := pem.Decode(keyData) + + key, err := x509.ParsePKCS1PrivateKey(der.Bytes) + if err != nil { + log.Error().Err(err).Msg("failed to parse key from der") + } + + archive, err := repository.ArchiveFromIndex(&apki) + if err != nil { + log.Error().Err(err).Msg("failed to generate archive from index") + } + signedarchive, err := repository.SignArchive(archive, key, keyName+".pub") + if err != nil { + log.Error().Err(err).Msg("failed to sign archive") + } + sabytes, err := io.ReadAll(signedarchive) + if err != nil { + log.Error().Err(err).Msg("failed to read signed archive bytes") + } + + outFilePath := url.JoinUNC(staticURI, "APKINDEX.tar.gz") + _ = cfs.Delete(ctx, outFilePath) // we don't care if delete fails as the file may not even exist + outFile, err := cfs.NewWriter(ctx, outFilePath, 0644) + if err != nil { + log.Error().Err(err).Msg("failed to create outfile") + } + c, err := outFile.Write(sabytes) + if err != nil || c == 0 { + log.Error().Err(err).Int("count", c).Msg("failed to write signed archive") + } } diff --git a/internal/openapi/packages.go b/internal/openapi/packages.go index 75bf6b0..cfc9dac 100644 --- a/internal/openapi/packages.go +++ b/internal/openapi/packages.go @@ -1,16 +1,12 @@ package api import ( - "fmt" - "io" + "errors" "net/http" - "os" - "os/exec" - "path/filepath" - "strings" "github.com/labstack/echo/v4" "github.com/rs/zerolog/log" + "gitlab.alpinelinux.org/alpine/go/repository" ) // TODO @@ -18,12 +14,11 @@ import ( // * Beef up path traversal protection // PackageBaseDirectory - the base directory where packages are organized/stored -var PackageBaseDirectory = "/srv/packages" +var PackageBaseDirectory = "file:///srv/packages/" // PkgRepoAPI - a collection packages, repos, versions, etc type PkgRepoAPI struct { - Repos map[string]Repo - DistroVersions []*DistroVersion + Repos map[string]Repo } // NewPkgRepo - called by main function to @@ -50,36 +45,14 @@ func sendRepoError(ctx echo.Context, code int, message string) { } // ListRepos - list repos in an org -func (p *PkgRepoAPI) ListRepos(ctx echo.Context, org string) error { - var result []Repo - - repos, err := os.ReadDir(filepath.Join(PackageBaseDirectory, filepath.Clean(org), "alpine")) +func (p *PkgRepoAPI) ListRepos(ctx echo.Context, org, distro, version string) error { + // log.Debug().Str("org", org).Msg("ListRepos request") + result, err := listRepos(org, distro, version) if err != nil { - log.Warn().Err(err).Msg("failed to readdir org") - sendRepoError(ctx, http.StatusInternalServerError, fmt.Sprintf("ListRepos: %s", err)) + log.Error().Err(err).Msg("failed to listRepos") } - - for _, r := range repos { - log.Trace().Interface("repos -> r", r).Msg("repos loop") - if r.IsDir() { - nents, err := os.ReadDir(filepath.Join(PackageBaseDirectory, filepath.Clean(org), "alpine", r.Name())) - if err != nil { - log.Warn().Err(err).Msg("failed to readdir r.Name") - sendRepoError(ctx, http.StatusInternalServerError, fmt.Sprintf("ListRepos: %s", err)) - } - for _, ne := range nents { - // fmt.Println(e, ne) - r := Repo{ - Name: ne.Name(), - Version: r.Name(), - // Slug: slug.Make(fmt.Sprintf("%s %s", e.Name(), ne.Name())), - } - - // p.Repos[r.Slug] = r - - result = append(result, r) - } - } + if len(result) == 0 { + return ctx.JSON(http.StatusInternalServerError, Error{Code: http.StatusInternalServerError, Message: "org does not have any repos"}) } return ctx.JSON(http.StatusOK, result) @@ -95,46 +68,16 @@ func (p *PkgRepoAPI) CreateRepo(ctx echo.Context, org string) error { sendRepoError(ctx, http.StatusBadRequest, "Invalid format for NewRepo") } // We now have a repo, let's add it to our "database". + // TODO - // We handle repos, not NewRepos, which have an additional ID field - var repo Repo - repo.Name = newRepo.Name - - // Now, we have to return the NewRepo - err = ctx.JSON(http.StatusCreated, repo) - - // Return no error. This refers to the handler. Even if we return an HTTP - // error, but everything else is working properly, tell Echo that we serviced - // the error. We should only return errors from Echo handlers if the actual - // servicing of the error on the infrastructure level failed. Returning an - // HTTP/400 or HTTP/500 from here means Echo/HTTP are still working, so - // return nil or err if something bad actually happened - return err + return ctx.JSON(http.StatusCreated, Repo{Name: newRepo.Name}) } -// FindRepoByName - return a pkgrepo from an -func (p *PkgRepoAPI) FindRepoByName(ctx echo.Context, org, repo string) error { - var repoInfo []Repo - - repos, err := filepath.Glob(filepath.Join(PackageBaseDirectory, filepath.Clean(org), "alpine", "*", repo)) - if err != nil { - log.Warn().Err(err).Msg("failed to glob repo") - sendRepoError(ctx, http.StatusInternalServerError, fmt.Sprintf("ListRepos: %s", err)) - } - for _, ne := range repos { - // TODO seems like there should be a more foolproof way, but this works for now - spl := strings.Split(ne, "/") - r := Repo{ - Name: repo, - Version: spl[len(spl)-2 : len(spl)-1][0], - } - - // p.Repos[r.Slug] = r - - repoInfo = append(repoInfo, r) - } +// FindRepoByName - return a repo info from org, distro, version, repo name +func (p *PkgRepoAPI) FindRepoByName(ctx echo.Context, org, distro, version, repo string) error { + repoInfo := getRepoInfo(org, distro, version, repo) - return ctx.JSON(http.StatusOK, repoInfo) + return ctx.JSON(http.StatusOK, []Repo{repoInfo}) } // DeleteRepo - delete a repo @@ -157,226 +100,92 @@ func (p *PkgRepoAPI) HeadHealthReady(ctx echo.Context) error { return ctx.String(http.StatusOK, "ready") } -// ListDistroVersions - return a list of distroversions -func (p *PkgRepoAPI) ListDistroVersions(ctx echo.Context, distro string) error { - var d []DistroVersion - - ents, err := os.ReadDir(filepath.Join(PackageBaseDirectory, "atlascloud", filepath.Clean(distro))) - if err != nil { - sendRepoError(ctx, http.StatusInternalServerError, fmt.Sprintf("ListDistroVersions: %s", err)) - } - - for _, e := range ents { - log.Debug().Interface("e", e).Msg("range distros") - if e.IsDir() { - d = append(d, DistroVersion(e.Name())) - } - } - - return ctx.JSON(http.StatusOK, d) -} - -// func slugToPath(slug string) (string, error) { -// // TODO see if path actually exists, etc -// s := strings.SplitN(slug, "-", 2) -// v := s[0] -// r := s[1] - -// path := fmt.Sprintf("/%s/%s", v, r) - -// return path, nil -// } - -func parseAPKFilename(filename string) (string, string, string) { - firstPart := filename[0:strings.LastIndex(filename, "-")] - name := firstPart[:strings.LastIndex(firstPart, "-")] - version := firstPart[strings.LastIndex(firstPart, "-")+1:] - release := strings.TrimSuffix(filename[strings.LastIndex(filename, "-")+2:], ".apk") - - return name, version, release -} - -// ListPackagesByRepo - asdf -func (p *PkgRepoAPI) ListPackagesByRepo(ctx echo.Context, org, repo, ver string) error { - // log.Debug().Str("slug", slug).Msg("ListPackagesByRepo") - var pkgs []Package - - // pkgPath, err := slugToPath(slug) - // pkgPath := fmt.Sprintf("/%s/%s", ver, repo) - - // if err != nil { - // sendRepoError(ctx, http.StatusInternalServerError, fmt.Sprintf("Invalid slug: %s", err)) - // } - - ents, err := os.ReadDir(filepath.Join(PackageBaseDirectory, filepath.Clean(org), "alpine", filepath.Clean(ver), filepath.Clean(repo), "/x86_64")) +// ListPackagesByRepo - list packages in an org's repo +func (p *PkgRepoAPI) ListPackagesByRepo(ctx echo.Context, org, distro, version, repo, arch string) error { + pkgs, err := listPackages(org, distro, version, repo, arch) if err != nil { - log.Error().Err(err).Msg("ListPackagesByRepo: ReadDir") - sendRepoError(ctx, http.StatusInternalServerError, "ListPackagesByRepo: ReadDir error") - } - - for _, e := range ents { - // fmt.Println(e) - if !e.IsDir() && strings.HasSuffix(e.Name(), ".apk") { - // some example file names to deal with - // abuild-3.7.0_rc1-r0.apk - // shared-mime-info-lang-1.15-r0.apk - filename := e.Name() - - name, version, release := parseAPKFilename(filename) - - pkgs = append(pkgs, Package{ - Name: name, - Version: &version, - Release: &release, - }) - } + return ctx.JSON(http.StatusInternalServerError, Error{Message: "failed to get package list"}) } return ctx.JSON(http.StatusOK, pkgs) } -// generateAPKIndex - (re)generate the APKINDEX file -// this runs in the background because it can take quite a while -// regenerate the APKINDEX -// TODO make sure we don't run this unnecessarily -func generateAPKIndex(pkgDir string) { - // generate the index and sign it all in the background so the user isn't waiting around - // for a possibly long running task - apks, err := filepath.Glob(filepath.Join(pkgDir, "*.apk")) - if err != nil { - log.Warn().Err(err).Msg("failed to glob apks") - } - // c := exec.Command("/sbin/apk", "index", "-o", "APKINDEX.new.tar.gz", "-x", "APKINDEX.tar.gz", "-d", "atlascloud main edge") - args := []string{"index", "--no-warnings", "--rewrite-arch", "x86_64", "-o", "APKINDEX.new.tar.gz", "-d", "atlascloud main edge"} - args = append(args, apks...) - c := exec.Command("/sbin/apk", args...) - - c.Dir = pkgDir - stderr, err := c.StderrPipe() - if err != nil { - log.Error().Err(err).Msg("error setting up stderr for apk index command") - } - stdout, err := c.StdoutPipe() - if err != nil { - log.Error().Err(err).Msg("error setting up stdout for apk index command") - } - - err = c.Start() - if err != nil { - log.Error().Str("command", c.String()).Err(err).Msg("failed to run apk index") - return - } - - se, err := io.ReadAll(stderr) - if err != nil { - log.Error().Err(err).Msg("failed to read stderr") - } - log.Warn().Bytes("stderr", se).Msg("apk index stderr") - so, err := io.ReadAll(stdout) - if err != nil { - log.Error().Err(err).Msg("failed to read stdout") - } - log.Warn().Bytes("stdout", so).Msg("apk index stdout") - - keyFile := os.Getenv("KEY_FILE") - c = exec.Command("/usr/bin/abuild-sign", "-k", keyFile, "APKINDEX.new.tar.gz") - c.Dir = pkgDir - stderr, err = c.StderrPipe() - if err != nil { - log.Error().Err(err).Msg("error setting up stderr for abuild-sign command") - } - stdout, err = c.StdoutPipe() - if err != nil { - log.Error().Err(err).Msg("error setting up stdout for abuild-sign command") - } - - err = c.Start() - if err != nil { - log.Error().Str("command", c.String()).Err(err).Msg("failed to run abuild-sign") - return - } - se, err = io.ReadAll(stderr) - if err != nil { - log.Error().Err(err).Msg("failed to read stderr") - } - log.Warn().Bytes("stderr", se).Msg("abuild-sign stderr") - so, err = io.ReadAll(stdout) - if err != nil { - log.Error().Err(err).Msg("failed to read stdout") - } - log.Warn().Bytes("stdout", so).Msg("abuild-sign stdout") - - err = os.Rename(filepath.Join(pkgDir, "APKINDEX.new.tar.gz"), filepath.Join(pkgDir, "APKINDEX.tar.gz")) - if err != nil { - log.Error().Err(err).Msg("failed to rename apkindex file") - } - -} - // CreatePackage - Create a package in a repo and regenerate the index -func (p *PkgRepoAPI) CreatePackage(ctx echo.Context, org, repo, ver string) error { - arch := filepath.Clean(ctx.FormValue("architecture")) +func (p *PkgRepoAPI) CreatePackage(ctx echo.Context, org, distro, ver, repo, arch string) error { file, err := ctx.FormFile("package") if err != nil { log.Warn().Err(err).Msg("failed to get file from submitted data") } - pkgDir := filepath.Join(PackageBaseDirectory, filepath.Clean(org), "alpine", filepath.Clean(ver), filepath.Clean(repo), arch) - // log.Debug(). - // Interface("ctx", ctx). - // Interface("arch", arch). - // Interface("file", file). - // Str("org", org). - // Str("repo", repo). - // Str("ver", ver). - // Msg("echo context") - src, err := file.Open() if err != nil { log.Warn().Err(err).Msg("failed to open src file") } defer src.Close() - // Destination - dst, err := os.Create(filepath.Join(pkgDir, filepath.Clean(file.Filename))) + pkg, err := repository.ParsePackage(src) if err != nil { - log.Warn().Err(err).Msg("failed to create dst file") - } - defer dst.Close() - - // Copy - if _, err = io.Copy(dst, src); err != nil { - log.Warn().Err(err).Msg("failed to copy file from src to dst") + log.Error().Err(err).Msg("failed to parse package from uploaded file") + return ctx.JSON(http.StatusInternalServerError, errors.New("failed to parse upload")) } + src.Close() - go generateAPKIndex(pkgDir) + writeUploadedPkg(file, org, distro, ver, repo, arch) - name, version, release := parseAPKFilename(file.Filename) + go generateAPKIndex(org, distro, ver, repo, arch) - return ctx.JSON(http.StatusOK, &Package{Name: name, Version: &version, Release: &release}) + return ctx.JSON(http.StatusOK, &Package{Name: pkg.Name, Version: &pkg.Version}) // TODO do we really pkgrel? } // ListDistros - return a list of the supported distros -func (p *PkgRepoAPI) ListDistros(ctx echo.Context) error { - return ctx.JSON(http.StatusOK, []Distribution{"alpine"}) +func (p *PkgRepoAPI) ListDistros(ctx echo.Context, org string) error { + distros, err := listDistros(org) + if err != nil { + log.Error().Err(err).Msg("failed to listDistros") + return ctx.JSON(http.StatusInternalServerError, Error{Message: "failed to get a list of distros"}) + } + return ctx.JSON(http.StatusOK, distros) } -// ListOrganizations - return a list of the supported distros +// ListOrganizations - return a list of the organizations +// TODO this should probably only be available to the server tokens func (p *PkgRepoAPI) ListOrganizations(ctx echo.Context) error { orgs := listOrgs() - var ret []Organization - for i := range orgs { - ret = append(ret, Organization{Name: &orgs[i]}) - } - return ctx.JSON(http.StatusOK, ret) + return ctx.JSON(http.StatusOK, orgs) } // GetOrganization - get an org func (p *PkgRepoAPI) GetOrganization(ctx echo.Context, org string) error { - var orgName = "atlascloud" - return ctx.JSON(http.StatusOK, &Organization{Name: &orgName}) + ret := &Organization{} + if orgExists(org) { + // distros, err := listRepos(org, distro) + ret = &Organization{ + Name: &org, + Distributions: nil, + } + } + + return ctx.JSON(http.StatusOK, ret) } // ListVersions - list of versions in an org's repo -func (p *PkgRepoAPI) ListVersions(ctx echo.Context, org, repo string) error { - return ctx.JSON(http.StatusOK, DistroVersion("3.12")) +func (p *PkgRepoAPI) ListVersions(ctx echo.Context, org, distro string) error { + dvs, err := listVersions(org, distro) + if err != nil { + return ctx.JSON(http.StatusInternalServerError, Error{Message: "failed to list distro versions"}) + } + return ctx.JSON(http.StatusOK, dvs) +} + +func (p *PkgRepoAPI) GetOrgDistro(ctx echo.Context, org, distro string) error { + return ctx.JSON(http.StatusOK, []Distribution{}) +} + +func (p *PkgRepoAPI) ListArches(ctx echo.Context, org, distro, version, repo string) error { + arches, err := listArches(org, distro, version, repo) + if err != nil { + return ctx.JSON(http.StatusInternalServerError, Error{Message: "failed to get arch list"}) + } + + return ctx.JSON(http.StatusOK, arches) + } diff --git a/openapi/packages.yaml b/openapi/packages.yaml index cfdb65b..4c0d3cb 100644 --- a/openapi/packages.yaml +++ b/openapi/packages.yaml @@ -1,75 +1,29 @@ --- openapi: "3.0.0" info: - version: 1.0.0 + version: 2.0.0-beta1 title: Package Repo API - description: API for kws1.com package repo + description: API for AtlasCloud package repo termsOfService: https://atlascloud.xyz/tos contact: - name: kws1.com package team + name: AtlasCloud package team email: packages@atlascloud.xyz url: https://packages.atlascloud.xyz license: name: Apache 2.0 url: https://www.apache.org/licenses/LICENSE-2.0.html - # servers: - # - url: https://packages.atlascloud.xyz/api - # servers: - # - url: http://localhost:8888/api + servers: + - url: https://packages.atlascloud.xyz/api + - url: http://localhost:8888 security: - bearerAuth: [] paths: - /distributions: - get: - description: list of supported distributions (currently just Alpine) - operationId: list distros - responses: - "200": - description: distributions - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/Distribution" - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - /distributions/{distro}/versions: - get: - description: list of distro versions - operationId: list distro versions - parameters: - - name: distro - in: path - description: the name of the distribution to look up versions - required: true - schema: - type: string - responses: - "200": - description: versions - content: - application/json: - schema: - type: array - items: - $ref: "#/components/schemas/DistroVersion" - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - - /o: + /orgs: get: # TODO pagination description: list of organizations - operationId: list organizations + operationId: ListOrganizations + security: [] responses: "200": description: organizations @@ -85,10 +39,10 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - /o/{org}: + /{org}: get: description: info about an organizations - operationId: get organization + operationId: GetOrganization parameters: - name: org in: path @@ -107,7 +61,7 @@ paths: $ref: "#/components/schemas/Organization" post: description: Create new repo - operationId: createRepo + operationId: CreateRepo parameters: - name: org in: path @@ -137,10 +91,10 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - /o/{org}/r: + /{org}/distros: get: - description: Return a list of package repositories for an org - operationId: list repos + description: Return a list of distributions for an org + operationId: ListDistros parameters: - name: org in: path @@ -148,12 +102,6 @@ paths: required: true schema: type: string - # - name: arch - # in: query - # description: the arch of the package - # required: false - # schema: - # type: string responses: "200": description: repos @@ -162,17 +110,17 @@ paths: schema: type: array items: - $ref: "#/components/schemas/Repo" + $ref: "#/components/schemas/Distribution" default: description: unexpected error content: application/json: schema: $ref: "#/components/schemas/Error" - /o/{org}/r/{repo}: + /{org}/{distro}: get: - description: Returns repo info from a repo - operationId: find repo by name + description: Return info about a distribution for an org + operationId: GetOrgDistro parameters: - name: org in: path @@ -180,31 +128,31 @@ paths: required: true schema: type: string - - name: repo + - name: distro in: path - description: name of repo to fetch + description: the name of the distribution required: true schema: type: string responses: "200": - description: repo response + description: repos content: application/json: schema: - type: array + type: object items: - $ref: "#/components/schemas/Repo" + $ref: "#/components/schemas/Distribution" default: description: unexpected error content: application/json: schema: $ref: "#/components/schemas/Error" - /o/{org}/r/{repo}/v: + /{org}/{distro}/versions: get: description: list of versions - operationId: list versions + operationId: ListVersions parameters: - name: org in: path @@ -212,9 +160,9 @@ paths: required: true schema: type: string - - name: repo + - name: distro in: path - description: name of repo to look for packages + description: the name of the distribution required: true schema: type: string @@ -226,17 +174,17 @@ paths: schema: type: array items: - $ref: "#/components/schemas/DistroVersion" + $ref: "#/components/schemas/RepoVersion" default: description: unexpected error content: application/json: schema: $ref: "#/components/schemas/Error" - /o/{org}/r/{repo}/v/{ver}: + /{org}/{distro}/{version}/repos: get: - description: Returns a list of packages based on repo versions - operationId: list packages by repo + description: List package repositories for an organization and distribution + operationId: ListRepos parameters: - name: org in: path @@ -244,38 +192,37 @@ paths: required: true schema: type: string - - name: repo + - name: distro in: path - description: name of repo to look for packages + description: the name of the distribution required: true schema: type: string - - name: ver + - name: version in: path - description: version of repo to look for packages + description: the version of the distribution required: true schema: type: string responses: "200": - description: packages response + description: repos content: application/json: schema: type: array items: - $ref: "#/components/schemas/Package" + $ref: "#/components/schemas/Repo" default: description: unexpected error content: application/json: schema: $ref: "#/components/schemas/Error" - post: - description: Create a package in a repo - operationId: create package - security: - - bearerAuth: [] + /{org}/{distro}/{version}/{repo}: + get: + description: Returns repo info from a repo + operationId: FindRepoByName parameters: - name: org in: path @@ -283,18 +230,137 @@ paths: required: true schema: type: string + - name: distro + in: path + description: the name of the distribution + required: true + schema: + type: string + - name: version + in: path + description: the version of the distribution + required: true + schema: + type: string - name: repo in: path - description: repo of repo to look for packages + description: name of repo to fetch required: true schema: type: string - - name: ver + responses: + "200": + description: repo response + content: + application/json: + schema: + type: object + items: + $ref: "#/components/schemas/Repo" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /{org}/{distro}/{version}/{repo}/architectures: + get: + description: List package repository architectures for an organization and distribution + operationId: ListArches + parameters: + - name: org + in: path + description: the name of the organization + required: true + schema: + type: string + - name: distro in: path - description: version of repo to look for packages + description: the name of the distribution required: true schema: type: string + - name: version + in: path + description: the version of the distribution + required: true + schema: + type: string + - name: repo + in: path + description: name of repo to look for packages + required: true + schema: + type: string + responses: + "200": + description: architectures + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Architecture" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + + /{org}/{distro}/{version}/{repo}/{arch}/pkgs: + parameters: + - name: org + in: path + description: the name of the organization + required: true + schema: + type: string + - name: distro + in: path + description: the name of the distribution + required: true + schema: + type: string + - name: version + in: path + description: version of repo to look for packages + required: true + schema: + type: string + - name: repo + in: path + description: name of repo to look for packages + required: true + schema: + type: string + - name: arch + in: path + description: arch of repo to look for packages + required: true + schema: + type: string + get: + description: Returns a list of packages based on distro repo and version + operationId: ListPackagesByRepo + responses: + "200": + description: packages response + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Package" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + post: + description: Create a package in a repo + operationId: CreatePackage requestBody: description: package to add required: true @@ -303,8 +369,7 @@ paths: schema: type: object properties: - architecture: - type: string + # this is the actual file upload package: type: string format: binary @@ -352,7 +417,6 @@ paths: schema: type: string example: pong - /health/ready: get: security: [] @@ -386,19 +450,12 @@ components: type: string Distribution: type: string - DistroVersion: + RepoVersion: type: string - # type: object - # required: - # - name - # properties: - # name: - # type: string - # description: the version of the distro - DistroVersions: + RepoVersions: type: array items: - $ref: "#/components/schemas/DistroVersion" + $ref: "#/components/schemas/RepoVersion" Error: type: object required: @@ -428,18 +485,16 @@ components: description: type: string description: Description of the repo to add - not functional - just for ease of use - # Organization: - # type: string Organization: type: object properties: name: type: string description: name of the organization - repos: + distributions: type: array items: - $ref: "#/components/schemas/Repo" + $ref: "#/components/schemas/Distribution" description: the list of repos that belong to this org (this data may be dependent on auth) Package: type: object @@ -463,12 +518,6 @@ components: name: type: string description: Name of the repo - repo: - type: string - description: computed from repo/version - version: - type: string - description: the distro version the repo belongs to architectures: type: array description: list of architectures in this repo