From 07ca61924fcc815194eda489fe655e2f8f1b7042 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 27 May 2022 15:18:30 +0200 Subject: [PATCH] [#172] Upload backup archive to AWS S3. --- .github/workflows/dip.yml | 2 + .github/workflows/go.yml | 4 +- .github/workflows/integration.yml | 2 +- .github/workflows/release.yml | 6 +- Dockerfile | 12 +- README.md | 6 +- build/package/snap/snapcraft.yaml | 2 +- cmd/n3dr/repositoriesV2.go | 2 +- cmd/n3dr/root.go | 33 ++++- docs/CHANGELOG.md | 18 ++- examples/awsS3Upload/README.md | 12 ++ examples/showLogo/README.md | 15 +++ go.mod | 33 ++--- go.sum | 74 +++++----- internal/artifactsv2/download.go | 15 +++ .../reset_secret_parameters.go | 126 ++++++++++++++++++ .../reset_secret_responses.go | 80 +++++++++++ .../security_managementjwt_client.go | 47 +------ .../create_privilege3_parameters.go | 6 +- .../create_privilege3_responses.go | 4 +- .../create_privilege4_parameters.go | 6 +- .../create_privilege4_responses.go | 4 +- .../security_management_privileges_client.go | 16 +-- .../update_privilege3_parameters.go | 6 +- .../update_privilege3_responses.go | 6 +- .../update_privilege4_parameters.go | 6 +- .../update_privilege4_responses.go | 6 +- internal/goswagger/models/asset_x_o.go | 20 +++ .../goswagger/models/docker_attributes.go | 4 + .../goswagger/models/role_x_o_response.go | 3 + internal/pkg/connection/connection.go | 6 +- internal/pkg/s3/aws.go | 43 ++++++ scripts/build.sh | 4 +- test/integration-tests.sh | 2 +- vagrant/scripts/n3dr.ps1 | 8 +- 35 files changed, 485 insertions(+), 154 deletions(-) create mode 100644 examples/awsS3Upload/README.md create mode 100644 examples/showLogo/README.md create mode 100644 internal/goswagger/client/security_management_j_w_t/reset_secret_parameters.go create mode 100644 internal/goswagger/client/security_management_j_w_t/reset_secret_responses.go create mode 100644 internal/pkg/s3/aws.go diff --git a/.github/workflows/dip.yml b/.github/workflows/dip.yml index 27f14fbd..7e70941e 100644 --- a/.github/workflows/dip.yml +++ b/.github/workflows/dip.yml @@ -18,9 +18,11 @@ jobs: - name: Check Nexus3 run: | NEXUS_VERSION=$(./dip image --name=sonatype/nexus3 --regex=^3\.[0-9]+\.[0-9]+$) + echo "Check whether the latest Nexus3 version: '${NEXUS_VERSION}' is used..." grep "${NEXUS_VERSION}" ./test/integration-tests.sh grep "${NEXUS_VERSION}" ./.github/workflows/integration.yml - name: Check golangci-lint run: | GOLANGCI_LINT_VERSION=$(./dip image --name=golangci/golangci-lint --regex=^v1\.[0-9]+\.[0-9]+-alpine$) + echo "Check whether the latest GolangCI version: '${GOLANGCI_LINT_VERSION}' is used..." grep "golangci-lint:${GOLANGCI_LINT_VERSION}" ./.github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6c2935d0..f5d02bae 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -40,6 +40,6 @@ jobs: docker run --rm -v ${PWD}:/data markdownlint/markdownlint:0.11.0 \ README.md -s /data/.markdownlint.rb docker run --rm -v $(pwd):/data cytopia/yamllint:1.26-0.8 . - docker run --rm -v $(pwd):/app -w /app \ - golangci/golangci-lint:v1.45.2-alpine golangci-lint run -v + docker run --rm -v $(pwd):/app -w /app -e GOFLAGS=-buildvcs=false \ + golangci/golangci-lint:v1.46.2-alpine golangci-lint run -v if: ${{ startsWith(matrix.os, 'ubuntu') }} diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index c6733425..6eb7ae5f 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -8,7 +8,7 @@ jobs: matrix: include: - os: ubuntu-20.04 - nexus-version: 3.38.1 + nexus-version: 3.39.0 nexus-api-version: v1 shasum: sha512sum - os: ubuntu-20.04 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dbb7ff27..75fade4a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - "*" + - '*' jobs: release: name: Create Release @@ -29,7 +29,7 @@ jobs: ${{ startsWith(matrix.os, 'mac') || startsWith(matrix.os, 'ubuntu') }} - name: Set N3DR deliverable environment variable on Windows run: echo "n3dr-deliverable=n3dr-${{ matrix.os }}" >> $env:GITHUB_ENV - if: ${{ startsWith(matrix.os, 'windows') }} + if: ${{ startsWith(matrix.os, 'windows') }}go - name: Use the value run: | echo "${{ env.n3dr-deliverable }}" @@ -56,7 +56,7 @@ jobs: echo "GITHUB_TAG: '${{ github.ref }}'" echo "N3DR_DELIVERABLE: '${{ env.n3dr-deliverable }}'" cd cmd/n3dr - go build -ldflags "-X main.Version=${{ github.ref }}" -o "${{ env.n3dr-deliverable }}" + go build -buildvcs=false -ldflags "-X main.Version=${{ github.ref }}" -o "${{ env.n3dr-deliverable }}" sha512sum "${{ env.n3dr-deliverable }}" > "${{ env.n3dr-deliverable }}.sha512.txt" chmod +x "${{ env.n3dr-deliverable }}" ls n3dr-windows-2019 diff --git a/Dockerfile b/Dockerfile index 4e557c50..affac5fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,17 @@ -FROM golang:1.18.1-alpine3.15 as builder +FROM golang:1.18.2-alpine3.16 as builder ARG VERSION ENV USERNAME n3dr RUN adduser -D -g '' $USERNAME COPY . /go/${USERNAME}/ WORKDIR /go/${USERNAME}/cmd/${USERNAME} RUN apk add --no-cache git=~2 && \ - CGO_ENABLED=0 go build -ldflags "-X main.Version=${VERSION}" && \ - cp n3dr /n3dr + CGO_ENABLED=0 go build -ldflags "-X main.Version=${VERSION}" -buildvcs=false && \ + cp n3dr /n3dr -FROM alpine:3.15.4 +FROM alpine:3.16.0 RUN apk update && \ - apk upgrade && \ - rm -rf /var/cache/apk/* + apk upgrade && \ + rm -rf /var/cache/apk/* COPY --from=builder /etc/passwd /etc/passwd COPY --from=builder /n3dr /usr/local/bin/n3dr COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ diff --git a/README.md b/README.md index 26366e86..35db95db 100644 --- a/README.md +++ b/README.md @@ -315,7 +315,7 @@ n3dr config \ ### Build ```bash -docker build -t utrecht/n3dr:6.6.2 . +docker build -t utrecht/n3dr:6.7.0 . ``` [![dockeri.co](https://dockeri.co/image/utrecht/n3dr)](https://hub.docker.com/r/utrecht/n3dr) @@ -325,7 +325,7 @@ docker build -t utrecht/n3dr:6.6.2 . ```bash docker run -it \ -v /home/${USER}/.n3dr:/root/.n3dr \ - -v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:6.6.2 + -v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:6.7.0 ``` ### Upload @@ -334,7 +334,7 @@ docker run -it \ docker run -it \ --entrypoint=/bin/ash \ -v /home/${USER}/.n3dr:/root/.n3dr \ - -v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:6.6.2 + -v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:6.7.0 ``` navigate to the repository folder, e.g. `/tmp/n3dr/download*/` and upload: diff --git a/build/package/snap/snapcraft.yaml b/build/package/snap/snapcraft.yaml index 540ba22d..596f65ab 100644 --- a/build/package/snap/snapcraft.yaml +++ b/build/package/snap/snapcraft.yaml @@ -1,7 +1,7 @@ --- name: n3dr base: core20 -version: 6.6.2 +version: 6.7.0 summary: Nexus3 Disaster Recovery description: | Download all artifacts at once or migrate automatically from Nexus to Nexus. diff --git a/cmd/n3dr/repositoriesV2.go b/cmd/n3dr/repositoriesV2.go index 9734729d..8118b233 100644 --- a/cmd/n3dr/repositoriesV2.go +++ b/cmd/n3dr/repositoriesV2.go @@ -25,7 +25,7 @@ download artifacts from all repositories`, } log.Fatal("One of the required flags \"names\", \"count\" or \"backup\" not set") } - n := connection.Nexus3{BasePathPrefix: basePathPrefix, FQDN: n3drURL, Pass: n3drPass, User: n3drUser, DownloadDirName: downloadDirName, HTTPS: https, DockerHost: dockerHost, DockerPort: dockerPort, DockerPortSecure: dockerPortSecure} + n := connection.Nexus3{AwsBucket: awsBucket, AwsId: awsId, AwsRegion: awsRegion, AwsSecret: awsSecret, BasePathPrefix: basePathPrefix, FQDN: n3drURL, Pass: n3drPass, User: n3drUser, DownloadDirName: downloadDirName, HTTPS: https, DockerHost: dockerHost, DockerPort: dockerPort, DockerPortSecure: dockerPortSecure} a := artifactsv2.Nexus3{Nexus3: &n} if namesV2 { if err := a.RepositoryNamesV2(); err != nil { diff --git a/cmd/n3dr/root.go b/cmd/n3dr/root.go index 876dea7d..e0747972 100644 --- a/cmd/n3dr/root.go +++ b/cmd/n3dr/root.go @@ -23,9 +23,9 @@ import ( var logo string var ( - apiVersion, basePathPrefix, cfgFile, n3drRepo, n3drURL, n3drPass, n3drUser, Version, zipName, downloadDirName, downloadDirNameZip, dockerHost string - anonymous, debug, dockerPortSecure, https, insecureSkipVerify, showLogo, skipErrors, zip bool - dockerPort int32 + apiVersion, awsBucket, awsId, awsRegion, awsSecret, basePathPrefix, cfgFile, n3drRepo, n3drURL, n3drPass, n3drUser, Version, zipName, downloadDirName, downloadDirNameZip, dockerHost string + anonymous, awsS3, debug, dockerPortSecure, https, insecureSkipVerify, showLogo, skipErrors, zip bool + dockerPort int32 ) var rootCmd = &cobra.Command{ @@ -46,6 +46,7 @@ func execute() { func init() { cobra.OnInitialize(initConfig) + rootCmd.PersistentFlags().BoolVarP(&awsS3, "awsS3", "", false, "whether the backup zip should be uploaded to AWS S3") rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/"+cli.DefaultCfgFileWithExt+")") rootCmd.PersistentFlags().BoolVarP(&debug, "debug", "d", false, "enable debug logging") rootCmd.PersistentFlags().BoolVarP(&zip, "zip", "z", false, "add downloaded artifacts to a ZIP archive") @@ -114,6 +115,8 @@ func ascii() error { } func initConfig() { + parseConfig(configFilePath()) + viper.AutomaticEnv() if err := ascii(); err != nil { log.Fatal(err) } @@ -121,8 +124,6 @@ func initConfig() { if err := insecureCerts(); err != nil { log.Fatal(err) } - parseConfig(configFilePath()) - viper.AutomaticEnv() } func valueInConfigFile(key string) (string, error) { @@ -159,6 +160,28 @@ func parseVarsFromConfig() { log.Fatal(err) } } + + showLogo = viper.GetBool("showLogo") + log.Info(showLogo) + + if awsS3 { + awsBucket, err = valueInConfigFile("awsBucket") + if err != nil { + log.Fatal(err) + } + awsId, err = valueInConfigFile("awsId") + if err != nil { + log.Fatal(err) + } + awsRegion, err = valueInConfigFile("awsRegion") + if err != nil { + log.Fatal(err) + } + awsSecret, err = valueInConfigFile("awsSecret") + if err != nil { + log.Fatal(err) + } + } } func parseConfig(cfgFile string) { diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 33994eab..cd9df497 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [6.7.0] - 2022-05-27 + +### Added + +- support for uploading backup archives to AWS S3. +- example how to upload a backup archive to AWS S3. +- option to disable logo using the config file. + +### Changed + +- Alpine version to 3.16.2. +- Golang version to 1.18.2-alpine3.16. +- GolangCI version to v1.46.2-alpine. +- Nexus3 and API version to 3.39.0. + ## [6.6.2] - 2022-05-07 ### Changed @@ -697,7 +712,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Download all artifacts from a certain Nexus3 repository. -[Unreleased]: https://github.com/030/n3dr/compare/6.6.2...HEAD +[Unreleased]: https://github.com/030/n3dr/compare/6.7.0...HEAD +[6.7.0]: https://github.com/030/n3dr/compare/6.6.2...6.7.0 [6.6.2]: https://github.com/030/n3dr/compare/6.6.1...6.6.2 [6.6.1]: https://github.com/030/n3dr/compare/6.6.0...6.6.1 [6.6.0]: https://github.com/030/n3dr/compare/6.5.1...6.6.0 diff --git a/examples/awsS3Upload/README.md b/examples/awsS3Upload/README.md new file mode 100644 index 00000000..b4f1e7a5 --- /dev/null +++ b/examples/awsS3Upload/README.md @@ -0,0 +1,12 @@ +# awsS3Upload + +Add the following parameters to `~/.n3dr/config.yml`: + +```bash +awsBucket: someAwsBucket +awsId: someAwsId +awsRegion: someAwsRegion +awsSecret: someAwsSecret +``` + +and use the `--awsS3` subcommand. diff --git a/examples/showLogo/README.md b/examples/showLogo/README.md new file mode 100644 index 00000000..2526282e --- /dev/null +++ b/examples/showLogo/README.md @@ -0,0 +1,15 @@ +# showLogo + +Add the following parameter to the config file: + +```bash +showLogo: true +``` + +or + +```bash +showLogo: false +``` + +to disable it. diff --git a/go.mod b/go.mod index 85f349c1..588bce8f 100644 --- a/go.mod +++ b/go.mod @@ -8,12 +8,13 @@ require ( github.com/PuerkitoBio/goquery v1.8.0 github.com/andybalholm/cascadia v1.3.1 github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d + github.com/aws/aws-sdk-go v1.44.23 github.com/go-openapi/errors v0.20.2 - github.com/go-openapi/runtime v0.23.3 + github.com/go-openapi/runtime v0.24.1 github.com/go-openapi/strfmt v0.21.2 github.com/go-openapi/swag v0.21.1 github.com/go-openapi/validate v0.21.0 - github.com/go-playground/validator/v10 v10.10.1 + github.com/go-playground/validator/v10 v10.11.0 github.com/hashicorp/go-retryablehttp v0.7.1 github.com/levigross/grequests v0.0.0-20190908174114-253788527a1a github.com/mholt/archiver v3.1.1+incompatible @@ -22,11 +23,11 @@ require ( github.com/sirupsen/logrus v1.8.1 github.com/spf13/cobra v1.4.0 github.com/spf13/jwalterweatherman v1.1.0 - github.com/spf13/viper v1.11.0 + github.com/spf13/viper v1.12.0 github.com/stretchr/testify v1.7.1 github.com/svenfuchs/jq v0.0.0-20180603193138-b038733a5990 github.com/thedevsaddam/gojsonq v2.3.0+incompatible - golang.org/x/net v0.0.0-20220421235706-1d1ef9303861 + golang.org/x/net v0.0.0-20220526153639-5463443f8c37 gopkg.in/validator.v2 v2.0.1 ) @@ -34,13 +35,12 @@ require ( github.com/andybalholm/brotli v1.0.4 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect - github.com/frankban/quicktest v1.14.2 // indirect - github.com/fsnotify/fsnotify v1.5.3 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/go-openapi/analysis v0.21.3 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.20.0 // indirect github.com/go-openapi/loads v0.21.1 // indirect - github.com/go-openapi/spec v0.20.5 // indirect + github.com/go-openapi/spec v0.20.6 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-stack/stack v1.8.1 // indirect @@ -49,38 +49,39 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect - github.com/klauspost/compress v1.15.1 // indirect + github.com/klauspost/compress v1.15.5 // indirect github.com/klauspost/pgzip v1.2.5 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mailru/easyjson v0.7.7 // indirect - github.com/mholt/archiver/v4 v4.0.0-alpha.6 // indirect + github.com/mholt/archiver/v4 v4.0.0-alpha.7 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/nwaples/rardecode v1.1.3 // indirect github.com/nwaples/rardecode/v2 v2.0.0-beta.2 // indirect github.com/oklog/ulid v1.3.1 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect + github.com/pelletier/go-toml/v2 v2.0.1 // indirect github.com/pierrec/lz4 v2.6.1+incompatible // indirect github.com/pierrec/lz4/v4 v4.1.14 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/afero v1.8.2 // indirect - github.com/spf13/cast v1.4.1 // indirect + github.com/spf13/cast v1.5.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.2.0 // indirect + github.com/subosito/gotenv v1.3.0 // indirect github.com/therootcompany/xz v1.0.1 // indirect github.com/tidwall/gjson v1.14.1 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect github.com/ulikunitz/xz v0.5.10 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect - go.mongodb.org/mongo-driver v1.9.0 // indirect - golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect - golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect + go.mongodb.org/mongo-driver v1.9.1 // indirect + golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect golang.org/x/text v0.3.7 // indirect gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 5ed1aae8..8b2b325b 100644 --- a/go.sum +++ b/go.sum @@ -53,6 +53,8 @@ github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEq github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/aws/aws-sdk-go v1.44.23 h1:oFvpKJk5qdprnCcuCWk2/CADdvfYtyduQ392bMXjlYI= +github.com/aws/aws-sdk-go v1.44.23/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= @@ -77,10 +79,9 @@ github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5y github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= -github.com/frankban/quicktest v1.14.2 h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns= -github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= -github.com/fsnotify/fsnotify v1.5.3 h1:vNFpj2z7YIbwh2bw7x35sqYpp2wfuq+pivKbWG09B8c= -github.com/fsnotify/fsnotify v1.5.3/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -99,11 +100,11 @@ github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZ github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= github.com/go-openapi/loads v0.21.1 h1:Wb3nVZpdEzDTcly8S4HMkey6fjARRzb7iEaySimlDW0= github.com/go-openapi/loads v0.21.1/go.mod h1:/DtAMXXneXFjbQMGEtbamCZb+4x7eGwkvZCvBmwUG+g= -github.com/go-openapi/runtime v0.23.3 h1:/dxjx4KCOQI5ImBMz036F6v/DzZ2NUjSRvbLJs1rgoE= -github.com/go-openapi/runtime v0.23.3/go.mod h1:AKurw9fNre+h3ELZfk6ILsfvPN+bvvlaU/M9q/r9hpk= +github.com/go-openapi/runtime v0.24.1 h1:Sml5cgQKGYQHF+M7yYSHaH1eOjvTykrddTE/KtQVjqo= +github.com/go-openapi/runtime v0.24.1/go.mod h1:AKurw9fNre+h3ELZfk6ILsfvPN+bvvlaU/M9q/r9hpk= github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= -github.com/go-openapi/spec v0.20.5 h1:skHa8av4VnAtJU5zyAUXrrdK/NDiVX8lchbG+BfcdrE= -github.com/go-openapi/spec v0.20.5/go.mod h1:QbfOSIVt3/sac+a1wzmKbbcLXm5NdZnyBZYtCijp43o= +github.com/go-openapi/spec v0.20.6 h1:ich1RQ3WDbfoeTqTAb+5EIxNmpKVJZWBNah9RAT0jIQ= +github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= github.com/go-openapi/strfmt v0.21.2 h1:5NDNgadiX1Vhemth/TH4gCGopWSTdDjxl60H3B7f+os= @@ -120,8 +121,8 @@ github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.10.1 h1:uA0+amWMiglNZKZ9FJRKUAe9U3RX91eVn1JYXMWt7ig= -github.com/go-playground/validator/v10 v10.10.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-playground/validator/v10 v10.11.0 h1:0W+xRM511GY47Yy3bZUbJVitCNg2BOGlCyvTqsp/xIw= +github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= @@ -189,8 +190,7 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= @@ -229,6 +229,10 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= @@ -239,8 +243,8 @@ github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0Lh github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.15.1 h1:y9FcTHGyrebwfP0ZZqFiaxTaiDnUrGkJkI+f583BL1A= -github.com/klauspost/compress v1.15.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.15.5 h1:qyCLMz2JCrKADihKOh9FxnW3houKeNsp2h5OEz0QSEA= +github.com/klauspost/compress v1.15.5/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= @@ -272,8 +276,8 @@ github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZb github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mholt/archiver v3.1.1+incompatible h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU= github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU= -github.com/mholt/archiver/v4 v4.0.0-alpha.6 h1:3wvos9Kn1GpKNBz+MpozinGREPslLo1ds1W16vTkErQ= -github.com/mholt/archiver/v4 v4.0.0-alpha.6/go.mod h1:9PTygYq90FQBWPspdwAng6dNjYiBuTYKqmA6c15KuCo= +github.com/mholt/archiver/v4 v4.0.0-alpha.7 h1:xzByj8G8tj0Oq7ZYYU4+ixL/CVb5ruWCm0EZQ1PjOkE= +github.com/mholt/archiver/v4 v4.0.0-alpha.7/go.mod h1:Fs8qUkO74HHaidabihzYephJH8qmGD/nCP6tE5xC9BM= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -296,8 +300,8 @@ github.com/oracle/oci-go-sdk v24.3.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35uk github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.0-beta.8 h1:dy81yyLYJDwMTifq24Oi/IslOslRrDSb3jwDggjz3Z0= -github.com/pelletier/go-toml/v2 v2.0.0-beta.8/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= +github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU= +github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4/v4 v4.1.14 h1:+fL8AQEZtz/ijeNnpduH0bROTu0O3NZAlPjQxGn8LwE= @@ -324,8 +328,8 @@ github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= -github.com/spf13/cast v1.4.1 h1:s0hze+J0196ZfEMTs80N7UlFt0BDuQ7Q+JDnHiMWKdA= -github.com/spf13/cast v1.4.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= @@ -334,8 +338,8 @@ github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0 github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= -github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= +github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ= +github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= @@ -346,8 +350,8 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= -github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/subosito/gotenv v1.3.0 h1:mjC+YW8QpAdXibNi+vNWgzmgBH4+5l5dCXv8cNysBLI= +github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs= github.com/svenfuchs/jq v0.0.0-20180603193138-b038733a5990 h1:fDhZ9jfxlI6SoOxlU2WTBupPheFf3PcUWXZ29NUaXTM= github.com/svenfuchs/jq v0.0.0-20180603193138-b038733a5990/go.mod h1:ZcH6zivboJo3QRNx2LbOj67I5xl/bjU6TcbuJx631Lw= github.com/thedevsaddam/gojsonq v2.3.0+incompatible h1:i2lFTvGY4LvoZ2VUzedsFlRiyaWcJm3Uh6cQ9+HyQA8= @@ -377,8 +381,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= go.mongodb.org/mongo-driver v1.8.3/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= -go.mongodb.org/mongo-driver v1.9.0 h1:f3aLGJvQmBl8d9S40IL+jEyBC6hfLPbJjv9t5hEM9ck= -go.mongodb.org/mongo-driver v1.9.0/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= +go.mongodb.org/mongo-driver v1.9.1 h1:m078y9v7sBItkt1aaoe2YlvWEXcD263e1a4E1fBrJ1c= +go.mongodb.org/mongo-driver v1.9.1/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -397,8 +401,8 @@ golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -468,8 +472,8 @@ golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1 golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220421235706-1d1ef9303861 h1:yssD99+7tqHWO5Gwh81phT+67hg+KttniBr6UnEXOY8= -golang.org/x/net v0.0.0-20220421235706-1d1ef9303861/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220526153639-5463443f8c37 h1:lUkvobShwKsOesNfWWlCS5q7fnbG1MEliIzwu886fn8= +golang.org/x/net v0.0.0-20220526153639-5463443f8c37/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -532,11 +536,11 @@ golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 h1:xHms4gcpe1YE7A3yIllJXP16CMAGuqwO2lX1mTyyRRc= -golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -608,7 +612,6 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -714,8 +717,9 @@ 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-20200605160147-a5ece683394c/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 h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/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= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/internal/artifactsv2/download.go b/internal/artifactsv2/download.go index b4af595c..70dbbab0 100644 --- a/internal/artifactsv2/download.go +++ b/internal/artifactsv2/download.go @@ -13,8 +13,10 @@ import ( "github.com/030/n3dr/internal/goswagger/models" "github.com/030/n3dr/internal/pkg/artifactsv2/artifacts" "github.com/030/n3dr/internal/pkg/connection" + "github.com/030/n3dr/internal/pkg/s3" "github.com/030/p2iwd/pkg/p2iwd" "github.com/hashicorp/go-retryablehttp" + "github.com/mholt/archiver" log "github.com/sirupsen/logrus" ) @@ -183,5 +185,18 @@ func (n *Nexus3) Backup() error { } wg.Wait() + if n.AwsBucket != "" { + zipFilename := "n3dr-backup-" + time.Now().Format("01-02-2006T15-04-05") + ".zip" + zipFilenamePath := filepath.Join(n.DownloadDirNameZip, zipFilename) + if err := archiver.Archive([]string{n.DownloadDirName}, zipFilenamePath); err != nil { + return err + } + + nS3 := s3.Nexus3{AwsBucket: n.AwsBucket, AwsId: n.AwsId, AwsRegion: n.AwsRegion, AwsSecret: n.AwsSecret, ZipFilename: zipFilenamePath} + if err := nS3.Upload(); err != nil { + return err + } + } + return nil } diff --git a/internal/goswagger/client/security_management_j_w_t/reset_secret_parameters.go b/internal/goswagger/client/security_management_j_w_t/reset_secret_parameters.go new file mode 100644 index 00000000..62dba735 --- /dev/null +++ b/internal/goswagger/client/security_management_j_w_t/reset_secret_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package security_management_j_w_t + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewResetSecretParams creates a new ResetSecretParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewResetSecretParams() *ResetSecretParams { + return &ResetSecretParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewResetSecretParamsWithTimeout creates a new ResetSecretParams object +// with the ability to set a timeout on a request. +func NewResetSecretParamsWithTimeout(timeout time.Duration) *ResetSecretParams { + return &ResetSecretParams{ + timeout: timeout, + } +} + +// NewResetSecretParamsWithContext creates a new ResetSecretParams object +// with the ability to set a context for a request. +func NewResetSecretParamsWithContext(ctx context.Context) *ResetSecretParams { + return &ResetSecretParams{ + Context: ctx, + } +} + +// NewResetSecretParamsWithHTTPClient creates a new ResetSecretParams object +// with the ability to set a custom HTTPClient for a request. +func NewResetSecretParamsWithHTTPClient(client *http.Client) *ResetSecretParams { + return &ResetSecretParams{ + HTTPClient: client, + } +} + +/* ResetSecretParams contains all the parameters to send to the API endpoint + for the reset secret operation. + + Typically these are written to a http.Request. +*/ +type ResetSecretParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the reset secret params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ResetSecretParams) WithDefaults() *ResetSecretParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the reset secret params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ResetSecretParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the reset secret params +func (o *ResetSecretParams) WithTimeout(timeout time.Duration) *ResetSecretParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the reset secret params +func (o *ResetSecretParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the reset secret params +func (o *ResetSecretParams) WithContext(ctx context.Context) *ResetSecretParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the reset secret params +func (o *ResetSecretParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the reset secret params +func (o *ResetSecretParams) WithHTTPClient(client *http.Client) *ResetSecretParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the reset secret params +func (o *ResetSecretParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ResetSecretParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/internal/goswagger/client/security_management_j_w_t/reset_secret_responses.go b/internal/goswagger/client/security_management_j_w_t/reset_secret_responses.go new file mode 100644 index 00000000..5a6a60b0 --- /dev/null +++ b/internal/goswagger/client/security_management_j_w_t/reset_secret_responses.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package security_management_j_w_t + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// ResetSecretReader is a Reader for the ResetSecret structure. +type ResetSecretReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ResetSecretReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 401: + result := NewResetSecretUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewResetSecretForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewResetSecretUnauthorized creates a ResetSecretUnauthorized with default headers values +func NewResetSecretUnauthorized() *ResetSecretUnauthorized { + return &ResetSecretUnauthorized{} +} + +/* ResetSecretUnauthorized describes a response with status code 401, with default header values. + +Authentication required +*/ +type ResetSecretUnauthorized struct { +} + +func (o *ResetSecretUnauthorized) Error() string { + return fmt.Sprintf("[PUT /v1/security/jwt][%d] resetSecretUnauthorized ", 401) +} + +func (o *ResetSecretUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewResetSecretForbidden creates a ResetSecretForbidden with default headers values +func NewResetSecretForbidden() *ResetSecretForbidden { + return &ResetSecretForbidden{} +} + +/* ResetSecretForbidden describes a response with status code 403, with default header values. + +Insufficient permissions +*/ +type ResetSecretForbidden struct { +} + +func (o *ResetSecretForbidden) Error() string { + return fmt.Sprintf("[PUT /v1/security/jwt][%d] resetSecretForbidden ", 403) +} + +func (o *ResetSecretForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/internal/goswagger/client/security_management_j_w_t/security_managementjwt_client.go b/internal/goswagger/client/security_management_j_w_t/security_managementjwt_client.go index 162ca6fa..f92ba790 100644 --- a/internal/goswagger/client/security_management_j_w_t/security_managementjwt_client.go +++ b/internal/goswagger/client/security_management_j_w_t/security_managementjwt_client.go @@ -28,61 +28,28 @@ type ClientOption func(*runtime.ClientOperation) // ClientService is the interface for Client methods type ClientService interface { - GetSecret(params *GetSecretParams, opts ...ClientOption) error - - UpdateSecret(params *UpdateSecretParams, opts ...ClientOption) error + ResetSecret(params *ResetSecretParams, opts ...ClientOption) error SetTransport(transport runtime.ClientTransport) } /* - GetSecret gets j w t secret + ResetSecret resets j w t secret note that session will be expired for the all logged in users */ -func (a *Client) GetSecret(params *GetSecretParams, opts ...ClientOption) error { +func (a *Client) ResetSecret(params *ResetSecretParams, opts ...ClientOption) error { // TODO: Validate the params before sending if params == nil { - params = NewGetSecretParams() + params = NewResetSecretParams() } op := &runtime.ClientOperation{ - ID: "getSecret", - Method: "GET", - PathPattern: "/v1/security/jwt", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetSecretReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - _, err := a.transport.Submit(op) - if err != nil { - return err - } - return nil -} - -/* - UpdateSecret sets j w t secret note that session will be expired for the all logged in users -*/ -func (a *Client) UpdateSecret(params *UpdateSecretParams, opts ...ClientOption) error { - // TODO: Validate the params before sending - if params == nil { - params = NewUpdateSecretParams() - } - op := &runtime.ClientOperation{ - ID: "updateSecret", + ID: "resetSecret", Method: "PUT", PathPattern: "/v1/security/jwt", ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"text/plain"}, + ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &UpdateSecretReader{formats: a.formats}, + Reader: &ResetSecretReader{formats: a.formats}, Context: params.Context, Client: params.HTTPClient, } diff --git a/internal/goswagger/client/security_management_privileges/create_privilege3_parameters.go b/internal/goswagger/client/security_management_privileges/create_privilege3_parameters.go index 397ce127..8e84095b 100644 --- a/internal/goswagger/client/security_management_privileges/create_privilege3_parameters.go +++ b/internal/goswagger/client/security_management_privileges/create_privilege3_parameters.go @@ -65,7 +65,7 @@ type CreatePrivilege3Params struct { The privilege to create. */ - Body *models.APIPrivilegeRepositoryAdminRequest + Body *models.APIPrivilegeRepositoryViewRequest timeout time.Duration Context context.Context @@ -121,13 +121,13 @@ func (o *CreatePrivilege3Params) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the create privilege 3 params -func (o *CreatePrivilege3Params) WithBody(body *models.APIPrivilegeRepositoryAdminRequest) *CreatePrivilege3Params { +func (o *CreatePrivilege3Params) WithBody(body *models.APIPrivilegeRepositoryViewRequest) *CreatePrivilege3Params { o.SetBody(body) return o } // SetBody adds the body to the create privilege 3 params -func (o *CreatePrivilege3Params) SetBody(body *models.APIPrivilegeRepositoryAdminRequest) { +func (o *CreatePrivilege3Params) SetBody(body *models.APIPrivilegeRepositoryViewRequest) { o.Body = body } diff --git a/internal/goswagger/client/security_management_privileges/create_privilege3_responses.go b/internal/goswagger/client/security_management_privileges/create_privilege3_responses.go index c9da4f23..04f04633 100644 --- a/internal/goswagger/client/security_management_privileges/create_privilege3_responses.go +++ b/internal/goswagger/client/security_management_privileges/create_privilege3_responses.go @@ -50,7 +50,7 @@ type CreatePrivilege3BadRequest struct { } func (o *CreatePrivilege3BadRequest) Error() string { - return fmt.Sprintf("[POST /v1/security/privileges/repository-admin][%d] createPrivilege3BadRequest ", 400) + return fmt.Sprintf("[POST /v1/security/privileges/repository-view][%d] createPrivilege3BadRequest ", 400) } func (o *CreatePrivilege3BadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -71,7 +71,7 @@ type CreatePrivilege3Forbidden struct { } func (o *CreatePrivilege3Forbidden) Error() string { - return fmt.Sprintf("[POST /v1/security/privileges/repository-admin][%d] createPrivilege3Forbidden ", 403) + return fmt.Sprintf("[POST /v1/security/privileges/repository-view][%d] createPrivilege3Forbidden ", 403) } func (o *CreatePrivilege3Forbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/internal/goswagger/client/security_management_privileges/create_privilege4_parameters.go b/internal/goswagger/client/security_management_privileges/create_privilege4_parameters.go index 82541e48..04aca05d 100644 --- a/internal/goswagger/client/security_management_privileges/create_privilege4_parameters.go +++ b/internal/goswagger/client/security_management_privileges/create_privilege4_parameters.go @@ -65,7 +65,7 @@ type CreatePrivilege4Params struct { The privilege to create. */ - Body *models.APIPrivilegeRepositoryViewRequest + Body *models.APIPrivilegeRepositoryAdminRequest timeout time.Duration Context context.Context @@ -121,13 +121,13 @@ func (o *CreatePrivilege4Params) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the create privilege 4 params -func (o *CreatePrivilege4Params) WithBody(body *models.APIPrivilegeRepositoryViewRequest) *CreatePrivilege4Params { +func (o *CreatePrivilege4Params) WithBody(body *models.APIPrivilegeRepositoryAdminRequest) *CreatePrivilege4Params { o.SetBody(body) return o } // SetBody adds the body to the create privilege 4 params -func (o *CreatePrivilege4Params) SetBody(body *models.APIPrivilegeRepositoryViewRequest) { +func (o *CreatePrivilege4Params) SetBody(body *models.APIPrivilegeRepositoryAdminRequest) { o.Body = body } diff --git a/internal/goswagger/client/security_management_privileges/create_privilege4_responses.go b/internal/goswagger/client/security_management_privileges/create_privilege4_responses.go index 6e4b0f71..9e14526e 100644 --- a/internal/goswagger/client/security_management_privileges/create_privilege4_responses.go +++ b/internal/goswagger/client/security_management_privileges/create_privilege4_responses.go @@ -50,7 +50,7 @@ type CreatePrivilege4BadRequest struct { } func (o *CreatePrivilege4BadRequest) Error() string { - return fmt.Sprintf("[POST /v1/security/privileges/repository-view][%d] createPrivilege4BadRequest ", 400) + return fmt.Sprintf("[POST /v1/security/privileges/repository-admin][%d] createPrivilege4BadRequest ", 400) } func (o *CreatePrivilege4BadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -71,7 +71,7 @@ type CreatePrivilege4Forbidden struct { } func (o *CreatePrivilege4Forbidden) Error() string { - return fmt.Sprintf("[POST /v1/security/privileges/repository-view][%d] createPrivilege4Forbidden ", 403) + return fmt.Sprintf("[POST /v1/security/privileges/repository-admin][%d] createPrivilege4Forbidden ", 403) } func (o *CreatePrivilege4Forbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/internal/goswagger/client/security_management_privileges/security_management_privileges_client.go b/internal/goswagger/client/security_management_privileges/security_management_privileges_client.go index 542942ae..8dad0689 100644 --- a/internal/goswagger/client/security_management_privileges/security_management_privileges_client.go +++ b/internal/goswagger/client/security_management_privileges/security_management_privileges_client.go @@ -157,7 +157,7 @@ func (a *Client) CreatePrivilege2(params *CreatePrivilege2Params, opts ...Client } /* - CreatePrivilege3 creates a repository admin type privilege + CreatePrivilege3 creates a repository view type privilege */ func (a *Client) CreatePrivilege3(params *CreatePrivilege3Params, opts ...ClientOption) error { // TODO: Validate the params before sending @@ -167,7 +167,7 @@ func (a *Client) CreatePrivilege3(params *CreatePrivilege3Params, opts ...Client op := &runtime.ClientOperation{ ID: "createPrivilege_3", Method: "POST", - PathPattern: "/v1/security/privileges/repository-admin", + PathPattern: "/v1/security/privileges/repository-view", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, @@ -188,7 +188,7 @@ func (a *Client) CreatePrivilege3(params *CreatePrivilege3Params, opts ...Client } /* - CreatePrivilege4 creates a repository view type privilege + CreatePrivilege4 creates a repository admin type privilege */ func (a *Client) CreatePrivilege4(params *CreatePrivilege4Params, opts ...ClientOption) error { // TODO: Validate the params before sending @@ -198,7 +198,7 @@ func (a *Client) CreatePrivilege4(params *CreatePrivilege4Params, opts ...Client op := &runtime.ClientOperation{ ID: "createPrivilege_4", Method: "POST", - PathPattern: "/v1/security/privileges/repository-view", + PathPattern: "/v1/security/privileges/repository-admin", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, @@ -450,7 +450,7 @@ func (a *Client) UpdatePrivilege2(params *UpdatePrivilege2Params, opts ...Client } /* - UpdatePrivilege3 updates a repository content selector type privilege + UpdatePrivilege3 updates a repository admin type privilege */ func (a *Client) UpdatePrivilege3(params *UpdatePrivilege3Params, opts ...ClientOption) error { // TODO: Validate the params before sending @@ -460,7 +460,7 @@ func (a *Client) UpdatePrivilege3(params *UpdatePrivilege3Params, opts ...Client op := &runtime.ClientOperation{ ID: "updatePrivilege_3", Method: "PUT", - PathPattern: "/v1/security/privileges/repository-content-selector/{privilegeId}", + PathPattern: "/v1/security/privileges/repository-admin/{privilegeId}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, @@ -481,7 +481,7 @@ func (a *Client) UpdatePrivilege3(params *UpdatePrivilege3Params, opts ...Client } /* - UpdatePrivilege4 updates a repository admin type privilege + UpdatePrivilege4 updates a repository content selector type privilege */ func (a *Client) UpdatePrivilege4(params *UpdatePrivilege4Params, opts ...ClientOption) error { // TODO: Validate the params before sending @@ -491,7 +491,7 @@ func (a *Client) UpdatePrivilege4(params *UpdatePrivilege4Params, opts ...Client op := &runtime.ClientOperation{ ID: "updatePrivilege_4", Method: "PUT", - PathPattern: "/v1/security/privileges/repository-admin/{privilegeId}", + PathPattern: "/v1/security/privileges/repository-content-selector/{privilegeId}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, diff --git a/internal/goswagger/client/security_management_privileges/update_privilege3_parameters.go b/internal/goswagger/client/security_management_privileges/update_privilege3_parameters.go index ce7d6da1..64d3d637 100644 --- a/internal/goswagger/client/security_management_privileges/update_privilege3_parameters.go +++ b/internal/goswagger/client/security_management_privileges/update_privilege3_parameters.go @@ -65,7 +65,7 @@ type UpdatePrivilege3Params struct { The privilege to update. */ - Body *models.APIPrivilegeRepositoryContentSelectorRequest + Body *models.APIPrivilegeRepositoryAdminRequest /* PrivilegeID. @@ -127,13 +127,13 @@ func (o *UpdatePrivilege3Params) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the update privilege 3 params -func (o *UpdatePrivilege3Params) WithBody(body *models.APIPrivilegeRepositoryContentSelectorRequest) *UpdatePrivilege3Params { +func (o *UpdatePrivilege3Params) WithBody(body *models.APIPrivilegeRepositoryAdminRequest) *UpdatePrivilege3Params { o.SetBody(body) return o } // SetBody adds the body to the update privilege 3 params -func (o *UpdatePrivilege3Params) SetBody(body *models.APIPrivilegeRepositoryContentSelectorRequest) { +func (o *UpdatePrivilege3Params) SetBody(body *models.APIPrivilegeRepositoryAdminRequest) { o.Body = body } diff --git a/internal/goswagger/client/security_management_privileges/update_privilege3_responses.go b/internal/goswagger/client/security_management_privileges/update_privilege3_responses.go index d3708478..6856dddf 100644 --- a/internal/goswagger/client/security_management_privileges/update_privilege3_responses.go +++ b/internal/goswagger/client/security_management_privileges/update_privilege3_responses.go @@ -56,7 +56,7 @@ type UpdatePrivilege3BadRequest struct { } func (o *UpdatePrivilege3BadRequest) Error() string { - return fmt.Sprintf("[PUT /v1/security/privileges/repository-content-selector/{privilegeId}][%d] updatePrivilege3BadRequest ", 400) + return fmt.Sprintf("[PUT /v1/security/privileges/repository-admin/{privilegeId}][%d] updatePrivilege3BadRequest ", 400) } func (o *UpdatePrivilege3BadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -77,7 +77,7 @@ type UpdatePrivilege3Forbidden struct { } func (o *UpdatePrivilege3Forbidden) Error() string { - return fmt.Sprintf("[PUT /v1/security/privileges/repository-content-selector/{privilegeId}][%d] updatePrivilege3Forbidden ", 403) + return fmt.Sprintf("[PUT /v1/security/privileges/repository-admin/{privilegeId}][%d] updatePrivilege3Forbidden ", 403) } func (o *UpdatePrivilege3Forbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -98,7 +98,7 @@ type UpdatePrivilege3NotFound struct { } func (o *UpdatePrivilege3NotFound) Error() string { - return fmt.Sprintf("[PUT /v1/security/privileges/repository-content-selector/{privilegeId}][%d] updatePrivilege3NotFound ", 404) + return fmt.Sprintf("[PUT /v1/security/privileges/repository-admin/{privilegeId}][%d] updatePrivilege3NotFound ", 404) } func (o *UpdatePrivilege3NotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/internal/goswagger/client/security_management_privileges/update_privilege4_parameters.go b/internal/goswagger/client/security_management_privileges/update_privilege4_parameters.go index 78d4b600..34405af3 100644 --- a/internal/goswagger/client/security_management_privileges/update_privilege4_parameters.go +++ b/internal/goswagger/client/security_management_privileges/update_privilege4_parameters.go @@ -65,7 +65,7 @@ type UpdatePrivilege4Params struct { The privilege to update. */ - Body *models.APIPrivilegeRepositoryAdminRequest + Body *models.APIPrivilegeRepositoryContentSelectorRequest /* PrivilegeID. @@ -127,13 +127,13 @@ func (o *UpdatePrivilege4Params) SetHTTPClient(client *http.Client) { } // WithBody adds the body to the update privilege 4 params -func (o *UpdatePrivilege4Params) WithBody(body *models.APIPrivilegeRepositoryAdminRequest) *UpdatePrivilege4Params { +func (o *UpdatePrivilege4Params) WithBody(body *models.APIPrivilegeRepositoryContentSelectorRequest) *UpdatePrivilege4Params { o.SetBody(body) return o } // SetBody adds the body to the update privilege 4 params -func (o *UpdatePrivilege4Params) SetBody(body *models.APIPrivilegeRepositoryAdminRequest) { +func (o *UpdatePrivilege4Params) SetBody(body *models.APIPrivilegeRepositoryContentSelectorRequest) { o.Body = body } diff --git a/internal/goswagger/client/security_management_privileges/update_privilege4_responses.go b/internal/goswagger/client/security_management_privileges/update_privilege4_responses.go index 75b29e3f..92cb8d4f 100644 --- a/internal/goswagger/client/security_management_privileges/update_privilege4_responses.go +++ b/internal/goswagger/client/security_management_privileges/update_privilege4_responses.go @@ -56,7 +56,7 @@ type UpdatePrivilege4BadRequest struct { } func (o *UpdatePrivilege4BadRequest) Error() string { - return fmt.Sprintf("[PUT /v1/security/privileges/repository-admin/{privilegeId}][%d] updatePrivilege4BadRequest ", 400) + return fmt.Sprintf("[PUT /v1/security/privileges/repository-content-selector/{privilegeId}][%d] updatePrivilege4BadRequest ", 400) } func (o *UpdatePrivilege4BadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -77,7 +77,7 @@ type UpdatePrivilege4Forbidden struct { } func (o *UpdatePrivilege4Forbidden) Error() string { - return fmt.Sprintf("[PUT /v1/security/privileges/repository-admin/{privilegeId}][%d] updatePrivilege4Forbidden ", 403) + return fmt.Sprintf("[PUT /v1/security/privileges/repository-content-selector/{privilegeId}][%d] updatePrivilege4Forbidden ", 403) } func (o *UpdatePrivilege4Forbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { @@ -98,7 +98,7 @@ type UpdatePrivilege4NotFound struct { } func (o *UpdatePrivilege4NotFound) Error() string { - return fmt.Sprintf("[PUT /v1/security/privileges/repository-admin/{privilegeId}][%d] updatePrivilege4NotFound ", 404) + return fmt.Sprintf("[PUT /v1/security/privileges/repository-content-selector/{privilegeId}][%d] updatePrivilege4NotFound ", 404) } func (o *UpdatePrivilege4NotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { diff --git a/internal/goswagger/models/asset_x_o.go b/internal/goswagger/models/asset_x_o.go index 3e64afaf..fa9243c1 100644 --- a/internal/goswagger/models/asset_x_o.go +++ b/internal/goswagger/models/asset_x_o.go @@ -37,6 +37,10 @@ type AssetXO struct { // id ID string `json:"id,omitempty"` + // last downloaded + // Format: date-time + LastDownloaded strfmt.DateTime `json:"lastDownloaded,omitempty"` + // last modified // Format: date-time LastModified strfmt.DateTime `json:"lastModified,omitempty"` @@ -58,6 +62,10 @@ type AssetXO struct { func (m *AssetXO) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateLastDownloaded(formats); err != nil { + res = append(res, err) + } + if err := m.validateLastModified(formats); err != nil { res = append(res, err) } @@ -68,6 +76,18 @@ func (m *AssetXO) Validate(formats strfmt.Registry) error { return nil } +func (m *AssetXO) validateLastDownloaded(formats strfmt.Registry) error { + if swag.IsZero(m.LastDownloaded) { // not required + return nil + } + + if err := validate.FormatOf("lastDownloaded", "body", "date-time", m.LastDownloaded.String(), formats); err != nil { + return err + } + + return nil +} + func (m *AssetXO) validateLastModified(formats strfmt.Registry) error { if swag.IsZero(m.LastModified) { // not required return nil diff --git a/internal/goswagger/models/docker_attributes.go b/internal/goswagger/models/docker_attributes.go index ee2fd8e7..7f0860c2 100644 --- a/internal/goswagger/models/docker_attributes.go +++ b/internal/goswagger/models/docker_attributes.go @@ -32,6 +32,10 @@ type DockerAttributes struct { // Example: 8083 HTTPSPort int32 `json:"httpsPort,omitempty"` + // Allows to use subdomain + // Example: docker-a + Subdomain string `json:"subdomain,omitempty"` + // Whether to allow clients to use the V1 API to interact with this repository // Example: false // Required: true diff --git a/internal/goswagger/models/role_x_o_response.go b/internal/goswagger/models/role_x_o_response.go index f241f79d..0931a10a 100644 --- a/internal/goswagger/models/role_x_o_response.go +++ b/internal/goswagger/models/role_x_o_response.go @@ -32,6 +32,9 @@ type RoleXOResponse struct { // Unique: true Privileges []string `json:"privileges"` + // Indicates whether the role can be changed. The system will ignore any supplied external values. + ReadOnly bool `json:"readOnly,omitempty"` + // The list of roles assigned to this role. // Unique: true Roles []string `json:"roles"` diff --git a/internal/pkg/connection/connection.go b/internal/pkg/connection/connection.go index 8f58f54e..33e8518b 100644 --- a/internal/pkg/connection/connection.go +++ b/internal/pkg/connection/connection.go @@ -8,9 +8,9 @@ import ( ) type Nexus3 struct { - BasePathPrefix, DockerHost, DownloadDirName, FQDN, Pass, User string - DockerPort int32 - DockerPortSecure, HTTPS bool + AwsBucket, AwsId, AwsRegion, AwsSecret, BasePathPrefix, DockerHost, DownloadDirName, DownloadDirNameZip, FQDN, Pass, User string + DockerPort int32 + DockerPortSecure, HTTPS bool } func (n *Nexus3) Client() *apiclient.Nexus3 { diff --git a/internal/pkg/s3/aws.go b/internal/pkg/s3/aws.go new file mode 100644 index 00000000..61dd52b2 --- /dev/null +++ b/internal/pkg/s3/aws.go @@ -0,0 +1,43 @@ +package s3 + +import ( + "fmt" + "os" + "path/filepath" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3/s3manager" + + log "github.com/sirupsen/logrus" +) + +type Nexus3 struct { + AwsBucket, AwsId, AwsRegion, AwsSecret, ZipFilename string +} + +func (n *Nexus3) Upload() error { + sess, err := session.NewSession(&aws.Config{Region: aws.String(n.AwsRegion), Credentials: credentials.NewStaticCredentials(n.AwsId, n.AwsSecret, "")}) + if err != nil { + return fmt.Errorf("session.NewSession - filename: %v, err: %v", n.ZipFilename, err) + } + uploader := s3manager.NewUploader(sess) + + f, err := os.Open(n.ZipFilename) + if err != nil { + return fmt.Errorf("failed to open file %q, %v", n.ZipFilename, err) + } + + filename := filepath.Base(n.ZipFilename) + result, err := uploader.Upload(&s3manager.UploadInput{ + Bucket: aws.String(n.AwsBucket), + Key: aws.String(filename), + Body: f, + }) + if err != nil { + return fmt.Errorf("failed to upload file, %v", err) + } + log.Infof("file uploaded to, %s\n", aws.StringValue(&result.Location)) + return nil +} diff --git a/scripts/build.sh b/scripts/build.sh index 786ffe58..d5034135 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,7 +5,7 @@ export N3DR_DELIVERABLE="${N3DR_DELIVERABLE:-n3dr}" echo "GITHUB_TAG: '$GITHUB_TAG' N3DR_DELIVERABLE: '$N3DR_DELIVERABLE'" cd cmd/n3dr -go build -ldflags "-X main.Version=${GITHUB_TAG}" -o "${N3DR_DELIVERABLE}" -$SHA512_CMD "${N3DR_DELIVERABLE}" > "${N3DR_DELIVERABLE}.sha512.txt" +go build -buildvcs=false -ldflags "-X main.Version=${GITHUB_TAG}" -o "${N3DR_DELIVERABLE}" +$SHA512_CMD "${N3DR_DELIVERABLE}" >"${N3DR_DELIVERABLE}.sha512.txt" chmod +x "${N3DR_DELIVERABLE}" cd ../.. diff --git a/test/integration-tests.sh b/test/integration-tests.sh index 86fabbb2..b95204dc 100755 --- a/test/integration-tests.sh +++ b/test/integration-tests.sh @@ -17,7 +17,7 @@ fi if [ -z "${NEXUS_VERSION}" ]; then echo "NEXUS_VERSION empty, setting it to the default value" - NEXUS_VERSION=3.38.1 + NEXUS_VERSION=3.39.0 fi if [ -z "${NEXUS_API_VERSION}" ]; then diff --git a/vagrant/scripts/n3dr.ps1 b/vagrant/scripts/n3dr.ps1 index 68edd3b1..66848de7 100644 --- a/vagrant/scripts/n3dr.ps1 +++ b/vagrant/scripts/n3dr.ps1 @@ -1,11 +1,11 @@ function Build { - Write-Output "Building N3DR..." - Set-Location C:\vagrant\cmd\n3dr - go build + Write-Output "Building N3DR..." + Set-Location C:\vagrant\cmd\n3dr + go build -buildvcs=false } function Main { - Build + Build } Main