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 8337633..6e824c6 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 := &middleware.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 a76ac02..50640ba 100644 --- a/go.mod +++ b/go.mod @@ -1,68 +1,84 @@ module github.com/iggy/packages -go 1.19 +go 1.21 + +toolchain go1.21.5 + +// replace gitlab.alpinelinux.org/alpine/go => /home/iggy/projects/gitlab.alpinelinux.org/iggy/go require ( + github.com/aws/aws-sdk-go-v2 v1.24.1 + github.com/aws/aws-sdk-go-v2/config v1.26.3 + github.com/aws/aws-sdk-go-v2/credentials v1.16.14 + github.com/aws/aws-sdk-go-v2/service/s3 v1.48.0 github.com/deepmap/oapi-codegen v1.13.0 github.com/getkin/kin-openapi v0.118.0 github.com/labstack/echo-contrib v0.15.0 - github.com/labstack/echo/v4 v4.11.1 - github.com/pkg/xattr v0.4.9 + github.com/labstack/echo/v4 v4.11.4 + github.com/oapi-codegen/runtime v1.1.1 github.com/rs/zerolog v1.29.1 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/MakeNowJust/heredoc/v2 v2.0.1 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 // indirect + github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.10 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.10 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.10 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.18.6 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 // indirect + github.com/aws/smithy-go v1.19.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bytedance/sonic v1.9.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect - github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/gabriel-vasile/mimetype v1.4.2 // 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.19.5 // indirect - github.com/go-openapi/swag v0.21.1 // 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.14.0 // indirect - github.com/goccy/go-json v0.10.2 // indirect + github.com/go-openapi/swag v0.22.3 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/gorilla/mux v1.8.0 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/uuid v1.5.0 // indirect + github.com/gorilla/mux v1.8.1 // indirect github.com/invopop/yaml v0.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/cpuid/v2 v2.2.4 // indirect - github.com/labstack/gommon v0.4.0 // indirect - github.com/leodido/go-urn v1.2.4 // indirect + github.com/labstack/gommon v0.4.2 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // 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.0.8 // indirect github.com/perimeterx/marshmallow v1.1.4 // 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.14.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.40.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/rogpeppe/go-internal v1.10.0 // 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 - golang.org/x/arch v0.3.0 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect - golang.org/x/time v0.3.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect + golang.org/x/crypto v0.17.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect + 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 09e0866..4889dfe 100644 --- a/go.sum +++ b/go.sum @@ -1,63 +1,83 @@ +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/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/aws/aws-sdk-go-v2 v1.24.1 h1:xAojnj+ktS95YZlDf0zxWBkbFtymPeDP+rvUQIH3uAU= +github.com/aws/aws-sdk-go-v2 v1.24.1/go.mod h1:LNh45Br1YAkEKaAqvmE1m8FUx6a5b/V0oAKV7of29b4= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4 h1:OCs21ST2LrepDfD3lwlQiOqIGp6JiEUqG84GzTDoyJs= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4/go.mod h1:usURWEKSNNAcAZuzRn/9ZYPT8aZQkR7xcCtunK/LkJo= +github.com/aws/aws-sdk-go-v2/config v1.26.3 h1:dKuc2jdp10y13dEEvPqWxqLoc0vF3Z9FC45MvuQSxOA= +github.com/aws/aws-sdk-go-v2/config v1.26.3/go.mod h1:Bxgi+DeeswYofcYO0XyGClwlrq3DZEXli0kLf4hkGA0= +github.com/aws/aws-sdk-go-v2/credentials v1.16.14 h1:mMDTwwYO9A0/JbOCOG7EOZHtYM+o7OfGWfu0toa23VE= +github.com/aws/aws-sdk-go-v2/credentials v1.16.14/go.mod h1:cniAUh3ErQPHtCQGPT5ouvSAQ0od8caTO9OOuufZOAE= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 h1:c5I5iH+DZcH3xOIMlz3/tCKJDaHFwYEmxvlh2fAcFo8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11/go.mod h1:cRrYDYAMUohBJUtUnOhydaMHtiK/1NZ0Otc9lIb6O0Y= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 h1:vF+Zgd9s+H4vOXd5BMaPWykta2a6Ih0AKLq/X6NYKn4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10/go.mod h1:6BkRjejp/GR4411UGqkX8+wFMbFbqsUIimfK4XjOKR4= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 h1:nYPe006ktcqUji8S2mqXf9c/7NdiKriOwMvWQHgYztw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10/go.mod h1:6UV4SZkVvmODfXKql4LCbaZUpF7HO2BX38FgBf9ZOLw= +github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 h1:GrSw8s0Gs/5zZ0SX+gX4zQjRnRsMJDJ2sLur1gRBhEM= +github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2/go.mod h1:6fQQgfuGmw8Al/3M2IgIllycxV7ZW7WCdVSqfBeUiCY= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.10 h1:5oE2WzJE56/mVveuDZPJESKlg/00AaS2pY2QZcnxg4M= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.10/go.mod h1:FHbKWQtRBYUz4vO5WBWjzMD2by126ny5y/1EoaWoLfI= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 h1:/b31bi3YVNlkzkBrm9LfpaKoaYZUxIAj4sHfOTmLfqw= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4/go.mod h1:2aGXHFmbInwgP9ZfpmdIfOELL79zhdNYNmReK8qDfdQ= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.10 h1:L0ai8WICYHozIKK+OtPzVJBugL7culcuM4E4JOpIEm8= +github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.10/go.mod h1:byqfyxJBshFk0fF9YmK0M0ugIO8OWjzH2T3bPG4eGuA= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 h1:DBYTXwIGQSGs9w4jKm60F5dmCQ3EEruxdc0MFh+3EY4= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10/go.mod h1:wohMUQiFdzo0NtxbBg0mSRGZ4vL3n0dKjLTINdcIino= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.10 h1:KOxnQeWy5sXyS37fdKEvAsGHOr9fa/qvwxfJurR/BzE= +github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.10/go.mod h1:jMx5INQFYFYB3lQD9W0D8Ohgq6Wnl7NYOJ2TQndbulI= +github.com/aws/aws-sdk-go-v2/service/s3 v1.48.0 h1:PJTdBMsyvra6FtED7JZtDpQrIAflYDHFoZAu/sKYkwU= +github.com/aws/aws-sdk-go-v2/service/s3 v1.48.0/go.mod h1:4qXHrG1Ne3VGIMZPCB8OjH/pLFO94sKABIusjh0KWPU= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.6 h1:dGrs+Q/WzhsiUKh82SfTVN66QzyulXuMDTV/G8ZxOac= +github.com/aws/aws-sdk-go-v2/service/sso v1.18.6/go.mod h1:+mJNDdF+qiUlNKNC3fxn74WWNN+sOiGOEImje+3ScPM= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6 h1:Yf2MIo9x+0tyv76GljxzqA3WtC5mw7NmazD2chwjxE4= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6/go.mod h1:ykf3COxYI0UJmxcfcxcVuz7b6uADi1FkiUz6Eb7AgM8= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 h1:NzO4Vrau795RkUdSHKEwiR01FaGzGOH1EETJ+5QHnm0= +github.com/aws/aws-sdk-go-v2/service/sts v1.26.7/go.mod h1:6h2YuIoxaMSCFf5fi1EgZAwdfkGMgDY+DVfa61uLe4U= +github.com/aws/smithy-go v1.19.0 h1:KWFKQV80DpP3vJrrA9sVAHQ5gc2z8i4EzrLhLlWXcBM= +github.com/aws/smithy-go v1.19.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= 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.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= -github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= 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 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= 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.13.0 h1:cnFHelhsRQbYvanCUAbRSn/ZpkUb1HPRlQcu8YqSORQ= github.com/deepmap/oapi-codegen v1.13.0/go.mod h1:Amy7tbubKY9qkZOXqymI3Z6xSbndmu+atMJheLdyg44= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/getkin/kin-openapi v0.118.0 h1:z43njxPmJ7TaPpMSCQb7PN0dEYno4tyBPQcrFdHoLuM= github.com/getkin/kin-openapi v0.118.0/go.mod h1:l5e9PaFUo9fyLJCPGQeXI2ML8c3P8BHOEV2VaAVf/pc= -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.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU= -github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= -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.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= -github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= -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/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.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 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-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= +github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/invopop/yaml v0.1.0 h1:YW3WGUoJEXYfzWBjn00zIlrw7brGVD0fUKRYDPAPhrc= github.com/invopop/yaml v0.1.0/go.mod h1:2XuRLgs/ouIrW3XNzuNj7J3Nvu/Dig5MXvbCEdiBN3Q= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= @@ -65,36 +85,30 @@ github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFF 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/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= -github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= 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/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.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4= -github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ= -github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= -github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= -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/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/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= 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.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -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 v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -104,16 +118,15 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G 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/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +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.4 h1:pZLDH9RjlLGGorbXhcaQLhfuV0pFMNfPO55FuFkxqLw= github.com/perimeterx/marshmallow v1.1.4/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/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.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= @@ -134,62 +147,55 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ 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.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -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.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -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/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= 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.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= -golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +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.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= +golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +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-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/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-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +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.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= +golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= +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/xerrors v0.0.0-20191204190536-9bdfabe68543/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.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.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-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/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.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -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-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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= -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..ccc4ec1 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", + "R4K2sdHcbGs8r++bGT605JHKtJIoyfJwyW2UYAb+44WJEkEYUW7QfaeFRh5yS0bIOS9G/LVwn6c5CSUH", + "Bd4Yo4x7oo3SaEigVxyp2CucKZMB8ZALSS/O+KhWICThHI3TkKG1MB8yX4y4wa+5MBjz8KbU2cjfrpSp", + "6WeMyOm6wrsJatX3J0YbGaHrMDpf+evmG1MzRgkyg1oxUgzimJ0wqYjNchk5CUjZCfucW2IzZRiCRfef", + "3GITXJMdCRn27V1BhgOG+grWEuC1DYX9wcxBiu9Qh7cWewvDfjK48yIVlpxHzhvLKAFiU0yVnDvXKBGW", + "KTNnf/lPMRCwDBZsiixGjTJGSUxJBjklf/MRF4SZt/OnwRkP+R9Bw7+gIl/QIVaxigmMgcXmzMlW5lQ7", + "6KHU9dJ0DdGXimndDO02pqu/DmBsMHUsGKyOb2jscOXsC+0wnaFVtwOQ1nB2xJiQJZQO5H1h6jSIAZge", + "VVc/vaD2qyT3k5etUdqU/0/bULQY5UbQ4qPLWAnGFMGgucgpWbVb96fy58a3hEjzwukQcqbKrikJInIf", + "MQOR8pBXxLP/AqVgo1Tl8fh+8Z3XqeAX7vdX7veapIwQMj7iuUkrKzYMglrReE3ROoj84vrSIzGguMpX", + "KiKUJeNrJzRECbKz8Sl3GTEuozy8We7nQwBa8GLUlg6DIFURpImyFJ6fn5/z4nY9oru7uzF4w2Nl5kHl", + "lQ3eX756c/XxzcnZ+HScUJZ63qLJ7IfZRzTfRIQtJWuekLIOIEGpE6oaBnMkYBfXly2uhNypPz2ZIsE/", + "zoLSKF0cIX/hHvAR10CJ50OQIKSUBNpxJlzyOXqIXUH77nUZ85C/RXrnxa6dlOOm1crF40TPTk9rfqD0", + "fya8p0CnIGQz0j1v7iHT3nmtvJ51xvbwdl4xL9ymMw9vbt332neDEC92Oz/xYj/Ae1Mp2um+F2TKuJ7S", + "j2DEE4S47/A7hPgwPXY5V2ZuW7kebu7t+edI2w3wvbD0YU1iR4igdSoiLx18tmot0L3GRWch0hsX/VR0", + "Y/CPZ5Cn9CDPtjlULk8HLOcS7zVGhDHDSmYAiKUy82IjEq5tM5iqnBjIHXi8xQ4cvj0YyJDqTtlflG1Z", + "7AhfuEBJMweUKbtGPeTI5DhqZWmdlrdPyId6vA4Sgvlp6J9pZQfS/sogEDKJd/VA6qa6fD4pHx1Clr/m", + "aOmlKvvnD6F1vc8ZyOCks6Hoelr8CsxLx3bXvt9rPHXNN1Ue+G2S2tx3J0i5kQxWm6XOvsovmcouMNiL", + "X1faf4+63767O3wuLEsyFLvI0J4AHT5so0M5CkpCPD0fRrtMtsMaNhnXoRwHCzdPn0OlYVDtOnYvCleC", + "Qz3oU/PwmXQ/c/zVBwZ7dL4VYAfIumXlXBGUhbGJfI5bnTMCK0gZge2huCIQAxmvw9un6sQb/E15Omi1", + "wmJ/w/VJxUFWyDEvClp1sXQ+7lollCeu5VphZlTGYHjf8p+QscvNy8VVeTz5TP5fSv7RpguA+o5mhhQl", + "w/YqQA+70rYvfFjtzzGUXNC7AXnAZFqsXYw8ekpdmCjB5zF1eJWaKvXFw1rfOBxT1W6/c+uXULcUjqF4", + "l87lItBf5nbn7GzOW2os2RQsxkzJkl2qRN0VbMOlfq1Wdzn25WJSo/6zgazvm/fAcBXbwTTh56bW2aA9", + "orscVWfrGXYl+gjD7m8Pbalbj/lhNb+F3LRyLkWvV+9obD5yz/KUhAZDwUyZ7CQGgm79dN+z0M0bI6s3", + "maZCglns88bJxjJ/0vP5h3elA1oZdi/puq9a3NwWt8X/AQAA///aS2837SYAAA==", } // 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..813af49 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 := 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("failed to list repos") + } + + 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("failed to list repos") + } + 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..ec6de8c 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..a333b7c 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 + security: [] responses: "200": description: organizations @@ -85,7 +39,7 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" - /o/{org}: + /{org}: get: description: info about an organizations operationId: get organization @@ -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: list distros 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: get org distro parameters: - name: org in: path @@ -180,28 +128,28 @@ 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 @@ -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: list repos 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: find repo by name 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: list arches + parameters: + - name: org in: path - description: version of repo to look for packages + 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: 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: list packages by repo + 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: create package 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