Compare commits
264 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c31b311b4e | ||
|
|
c316532fe9 | ||
|
|
a65d6ba8f1 | ||
|
|
11f5d6aa0d | ||
|
|
9532aa9500 | ||
|
|
ec3deed38e | ||
|
|
38015b4913 | ||
|
|
e5508b5c5d | ||
|
|
9587e4105f | ||
|
|
d2d735c5c0 | ||
|
|
915c10b4b8 | ||
|
|
671530f5b4 | ||
|
|
0c778f57d3 | ||
|
|
43db7729c4 | ||
|
|
48b467a683 | ||
|
|
59b7406dd7 | ||
|
|
9e7a40abc8 | ||
|
|
189331f465 | ||
|
|
e6a2364209 | ||
|
|
2b17aa598f | ||
|
|
f10fdf4610 | ||
|
|
4156fe0666 | ||
|
|
89bef6027c | ||
|
|
333ca0a827 | ||
|
|
de82a056e6 | ||
|
|
a01b1ffe8c | ||
|
|
61718a5915 | ||
|
|
2fed3572b2 | ||
|
|
af9e4fc150 | ||
|
|
f8475af5a6 | ||
|
|
413870e995 | ||
|
|
cdd6f272ed | ||
|
|
5eddd0cd8d | ||
|
|
5cf2b736e1 | ||
|
|
55330960e9 | ||
|
|
a3b88567cc | ||
|
|
73a687376a | ||
|
|
de4c08c2ff | ||
|
|
9396df2e20 | ||
|
|
4143f50004 | ||
|
|
d1511c5eb0 | ||
|
|
c4c6d48abf | ||
|
|
43c5f9094a | ||
|
|
51ab9c59ae | ||
|
|
fc95ab8658 | ||
|
|
bebe860903 | ||
|
|
df4679ea55 | ||
|
|
2263eada70 | ||
|
|
368c9ee3d7 | ||
|
|
3513a01711 | ||
|
|
0af36a5757 | ||
|
|
fdd5a94074 | ||
|
|
17ad2cfd14 | ||
|
|
67f509e2bb | ||
|
|
6102094c9e | ||
|
|
d84062b1b2 | ||
|
|
a878440485 | ||
|
|
cd6e61e93b | ||
|
|
a77b56b522 | ||
|
|
6ed5084691 | ||
|
|
4ac6ecb558 | ||
|
|
41671b4f25 | ||
|
|
024ab1212b | ||
|
|
77f62e11ef | ||
|
|
0960835cd9 | ||
|
|
3746dd47f8 | ||
|
|
ce255c5181 | ||
|
|
7728cc734a | ||
|
|
cc581c6a9e | ||
|
|
f7b142e74a | ||
|
|
1108cee626 | ||
|
|
94fdba5990 | ||
|
|
524258a9ea | ||
|
|
c0cf7a6d6a | ||
|
|
f9916d1cd6 | ||
|
|
52512c0ccc | ||
|
|
989f041658 | ||
|
|
2f81b750a3 | ||
|
|
035a5b88c2 | ||
|
|
7702149962 | ||
|
|
f3e24d62ca | ||
|
|
d663b9f346 | ||
|
|
ae147358b1 | ||
|
|
20bc53119e | ||
|
|
3a3a4b2fea | ||
|
|
497437729b | ||
|
|
1c37fcf398 | ||
|
|
67af66fc55 | ||
|
|
288c843a17 | ||
|
|
9357c2db0e | ||
|
|
139771f4d4 | ||
|
|
b7783aaa1c | ||
|
|
9821beb1de | ||
|
|
d279f722f8 | ||
|
|
9539a8e18a | ||
|
|
f11b9bff17 | ||
|
|
06c282dd9a | ||
|
|
3e9fb853d9 | ||
|
|
cd21ad2085 | ||
|
|
729100ae16 | ||
|
|
bcd29a4232 | ||
|
|
380a9d7faa | ||
|
|
9cd0033504 | ||
|
|
483fe77a35 | ||
|
|
1742303ad7 | ||
|
|
292fb3920f | ||
|
|
9ed8f11b22 | ||
|
|
860d8c6b78 | ||
|
|
99965805a6 | ||
|
|
7036d1328e | ||
|
|
697910c7b2 | ||
|
|
64dc605843 | ||
|
|
75fa88e6e2 | ||
|
|
2857b8c586 | ||
|
|
b1788c29db | ||
|
|
2e1401f013 | ||
|
|
1e1c11b13c | ||
|
|
25c1c854b1 | ||
|
|
5be2cc1965 | ||
|
|
4aa3f40792 | ||
|
|
3f41a82fd3 | ||
|
|
1b641b4222 | ||
|
|
85aabebbb4 | ||
|
|
919232261d | ||
|
|
ddd25a20eb | ||
|
|
84b8f9d6fa | ||
|
|
46af0ff74c | ||
|
|
b3651ed0a3 | ||
|
|
78c4fa393a | ||
|
|
84c4159062 | ||
|
|
ac2888fc4e | ||
|
|
c311847dcf | ||
|
|
cb6cda7265 | ||
|
|
16fd5470db | ||
|
|
ea0cac2a92 | ||
|
|
33b041ef34 | ||
|
|
b692ea693f | ||
|
|
fd39e50c08 | ||
|
|
ad4b9c050a | ||
|
|
1deb6371ed | ||
|
|
3b11556f4b | ||
|
|
25f719b0e2 | ||
|
|
231b63f1b0 | ||
|
|
e73370cc8c | ||
|
|
5d25dd4c06 | ||
|
|
51a8bacc18 | ||
|
|
db07f546a4 | ||
|
|
255cf0bc85 | ||
|
|
733e0b18e2 | ||
|
|
8d90e03992 | ||
|
|
1a1fae9ce3 | ||
|
|
f26786c904 | ||
|
|
e0b6bf5aa6 | ||
|
|
9655fc4490 | ||
|
|
417ea4d481 | ||
|
|
5a59f8e3f4 | ||
|
|
48340d0010 | ||
|
|
251de9fe8a | ||
|
|
c501df927b | ||
|
|
cdb1659506 | ||
|
|
558afe36ad | ||
|
|
712d3870eb | ||
|
|
c71f084531 | ||
|
|
1c58a543b6 | ||
|
|
8e857dc563 | ||
|
|
78d4d4c89e | ||
|
|
aea749d82f | ||
|
|
ce3293b4e2 | ||
|
|
0c12fbdd23 | ||
|
|
118cf97e1d | ||
|
|
abb668633b | ||
|
|
dd2fffd3dc | ||
|
|
64b13e9dc9 | ||
|
|
58d7f1e8ae | ||
|
|
45e4a94416 | ||
|
|
cce054bbe8 | ||
|
|
cf0e326b82 | ||
|
|
e48958f5a0 | ||
|
|
63e2793272 | ||
|
|
532e64b802 | ||
|
|
64b3e965c6 | ||
|
|
9371c027f3 | ||
|
|
a8bc58a420 | ||
|
|
10c56a91da | ||
|
|
403972de39 | ||
|
|
1c0632473a | ||
|
|
ff93109b57 | ||
|
|
b518810106 | ||
|
|
b4d2d65c5c | ||
|
|
beeb188d7e | ||
|
|
2830022ede | ||
|
|
ba4103e03f | ||
|
|
f3d6638384 | ||
|
|
2ad42d660b | ||
|
|
618a00d775 | ||
|
|
d0b65ce297 | ||
|
|
41f640077b | ||
|
|
bfa05616b1 | ||
|
|
f792d7a476 | ||
|
|
9b13cfdbe9 | ||
|
|
02c274e117 | ||
|
|
8993b40730 | ||
|
|
1311b171f9 | ||
|
|
7ecc1022b2 | ||
|
|
a5c14790b3 | ||
|
|
e5f7a03585 | ||
|
|
a024a13f25 | ||
|
|
4d876d0ce8 | ||
|
|
b02c37bf33 | ||
|
|
1d17f11d2f | ||
|
|
1dd9f7f363 | ||
|
|
618d95b76e | ||
|
|
e416abe19b | ||
|
|
296f58f43d | ||
|
|
0b5e3d5a10 | ||
|
|
5d591b18d9 | ||
|
|
e68bc08fed | ||
|
|
df38c84075 | ||
|
|
c509e5db70 | ||
|
|
5a8e029005 | ||
|
|
e3d96b5bb3 | ||
|
|
51afc337ff | ||
|
|
617d41584e | ||
|
|
7a8e2caa50 | ||
|
|
fed58ec29a | ||
|
|
427a7516a3 | ||
|
|
969feb8efa | ||
|
|
d09d6e1e99 | ||
|
|
2d80638090 | ||
|
|
2918d39ab7 | ||
|
|
fb2eb0ebf7 | ||
|
|
e7a36a1ff1 | ||
|
|
41e1b4a5d5 | ||
|
|
6e205fa8ae | ||
|
|
5b3f6ad76e | ||
|
|
8396c3023e | ||
|
|
161d56db36 | ||
|
|
a49a4e5513 | ||
|
|
9741462e7b | ||
|
|
73f09e1af6 | ||
|
|
d41f6e57d2 | ||
|
|
93d041e55b | ||
|
|
94e419e09c | ||
|
|
6c5f6934e7 | ||
|
|
41155b3f97 | ||
|
|
e41c80449d | ||
|
|
6f7a46e528 | ||
|
|
ba48e0c5b8 | ||
|
|
3da636170f | ||
|
|
7687a9e588 | ||
|
|
692dc1a29e | ||
|
|
bb55f9f331 | ||
|
|
dec7b138e9 | ||
|
|
d3b1be80eb | ||
|
|
0339925d15 | ||
|
|
d956ec65a2 | ||
|
|
b02e649405 | ||
|
|
68e98be376 | ||
|
|
c9d174df09 | ||
|
|
80391b867c | ||
|
|
45715293ea | ||
|
|
dd4963e3aa | ||
|
|
c7c7fe194c | ||
|
|
35fdaf1ddd |
1349
.github/workflows/jobs.yaml
vendored
1349
.github/workflows/jobs.yaml
vendored
File diff suppressed because it is too large
Load Diff
@@ -5,50 +5,45 @@ linters-settings:
|
||||
misspell:
|
||||
locale: US
|
||||
|
||||
goheader:
|
||||
values:
|
||||
regexp:
|
||||
copyright-holder: Copyright \(c\) (20\d\d\-20\d\d)|2021|({{year}})
|
||||
template-path: .license.tmpl
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
- typecheck
|
||||
- goimports
|
||||
- misspell
|
||||
- govet
|
||||
- revive
|
||||
- ineffassign
|
||||
- gosimple
|
||||
- deadcode
|
||||
- structcheck
|
||||
- gomodguard
|
||||
- gofmt
|
||||
- unused
|
||||
- structcheck
|
||||
- unconvert
|
||||
- varcheck
|
||||
- gocritic
|
||||
- gofumpt
|
||||
- tenv
|
||||
- durationcheck
|
||||
|
||||
linters-settings:
|
||||
goheader:
|
||||
values:
|
||||
regexp:
|
||||
copyright-holder: Copyright \(c\) (20\d\d\-20\d\d)|2021|({{year}})
|
||||
template-path: .license.tmpl
|
||||
|
||||
service:
|
||||
golangci-lint-version: 1.43.0 # use the fixed version to not introduce new linters unexpectedly
|
||||
|
||||
issues:
|
||||
exclude-use-default: false
|
||||
exclude:
|
||||
- should have a package comment
|
||||
# TODO(y4m4): Remove once all exported ident. have comments!
|
||||
- comment on exported function
|
||||
- comment on exported type
|
||||
- should have comment
|
||||
- use leading k in Go names
|
||||
- comment on exported const
|
||||
- should have a package comment
|
||||
# TODO(y4m4): Remove once all exported ident. have comments!
|
||||
- comment on exported function
|
||||
- comment on exported type
|
||||
- should have comment
|
||||
- use leading k in Go names
|
||||
- comment on exported const
|
||||
run:
|
||||
skip-dirs:
|
||||
- pkg/clientgen
|
||||
- pkg/apis/networking.gke.io
|
||||
- restapi/operations
|
||||
|
||||
@@ -13,7 +13,7 @@ release:
|
||||
before:
|
||||
hooks:
|
||||
# you may remove this if you don't use vgo
|
||||
- go mod tidy -compat=1.17
|
||||
- go mod tidy -compat=1.18
|
||||
|
||||
builds:
|
||||
-
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM node:17 as uilayer
|
||||
ARG NODE_VERSION
|
||||
FROM node:$NODE_VERSION as uilayer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -12,7 +13,7 @@ RUN make build-static
|
||||
|
||||
USER node
|
||||
|
||||
FROM golang:1.17 as golayer
|
||||
FROM golang:1.18 as golayer
|
||||
|
||||
RUN apt-get update -y && apt-get install -y ca-certificates
|
||||
|
||||
@@ -31,7 +32,7 @@ ENV CGO_ENABLED=0
|
||||
COPY --from=uilayer /app/build /go/src/github.com/minio/console/portal-ui/build
|
||||
RUN go build --tags=kqueue,operator -ldflags "-w -s" -a -o console ./cmd/console
|
||||
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.5
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6
|
||||
MAINTAINER MinIO Development "dev@min.io"
|
||||
EXPOSE 9090
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM node:17 as uilayer
|
||||
ARG NODE_VERSION
|
||||
FROM node:$NODE_VERSION as uilayer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.5
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6
|
||||
|
||||
ARG TAG
|
||||
|
||||
|
||||
26
Makefile
26
Makefile
@@ -5,6 +5,8 @@ BUILD_VERSION:=$(shell git describe --exact-match --tags $(git log -n1 --pretty=
|
||||
BUILD_TIME:=$(shell date 2>/dev/null)
|
||||
TAG ?= "minio/console:$(BUILD_VERSION)-dev"
|
||||
MINIO_VERSION ?= "quay.io/minio/minio:latest"
|
||||
TARGET_BUCKET ?= "target"
|
||||
NODE_VERSION := $(shell cat .nvmrc)
|
||||
|
||||
default: console
|
||||
|
||||
@@ -14,22 +16,19 @@ console:
|
||||
@(GO111MODULE=on CGO_ENABLED=0 go build -trimpath --tags=kqueue,operator --ldflags "-s -w" -o console ./cmd/console)
|
||||
|
||||
k8sdev:
|
||||
@docker build -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' .
|
||||
@docker build -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' --build-arg NODE_VERSION='$(NODE_VERSION)' .
|
||||
@kind load docker-image $(TAG)
|
||||
@echo "Done, now restart your console deployment"
|
||||
|
||||
getdeps:
|
||||
@mkdir -p ${GOPATH}/bin
|
||||
@which golangci-lint 1>/dev/null || (echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.43.0)
|
||||
@echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin
|
||||
|
||||
verifiers: getdeps fmt lint
|
||||
|
||||
fmt:
|
||||
@echo "Running $@ check"
|
||||
@GO111MODULE=on gofmt -d restapi/
|
||||
@GO111MODULE=on gofmt -d pkg/
|
||||
@GO111MODULE=on gofmt -d cmd/
|
||||
@GO111MODULE=on gofmt -d cluster/
|
||||
@(env bash $(PWD)/verify-gofmt.sh)
|
||||
|
||||
crosscompile:
|
||||
@(env bash $(PWD)/cross-compile.sh $(arg1))
|
||||
@@ -44,9 +43,13 @@ install: console
|
||||
@mkdir -p $(GOPATH)/bin && cp -f $(PWD)/console $(GOPATH)/bin/console
|
||||
@echo "Installation successful. To learn more, try \"console --help\"."
|
||||
|
||||
swagger-gen: clean-swagger swagger-console swagger-operator
|
||||
swagger-gen: clean-swagger swagger-console swagger-operator apply-gofmt
|
||||
@echo "Done Generating swagger server code from yaml"
|
||||
|
||||
apply-gofmt:
|
||||
@echo "Applying gofmt to all generated an existing files"
|
||||
@GO111MODULE=on gofmt -w .
|
||||
|
||||
clean-swagger:
|
||||
@echo "cleaning"
|
||||
@rm -rf models
|
||||
@@ -62,7 +65,8 @@ swagger-operator:
|
||||
@swagger generate server -A operator --main-package=operator --server-package=operatorapi --exclude-main -P models.Principal -f ./swagger-operator.yml -r NOTICE
|
||||
|
||||
assets:
|
||||
@(cd portal-ui; yarn install --prefer-offline; make build-static; yarn prettier --write . --loglevel warn; cd ..)
|
||||
@(if [ -f "${NVM_DIR}/nvm.sh" ]; then \. "${NVM_DIR}/nvm.sh" && nvm install && nvm use && npm install -g yarn ; fi &&\
|
||||
cd portal-ui; yarn install --prefer-offline; make build-static; yarn prettier --write . --loglevel warn; cd ..)
|
||||
|
||||
test-integration:
|
||||
@(docker stop pgsqlcontainer || true)
|
||||
@@ -74,8 +78,8 @@ test-integration:
|
||||
@echo $(MINIO_VERSION)
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 --net=mynet123 -d --name minio --rm -p 9000:9000 -p 9001:9001 -e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= $(MINIO_VERSION) server /data{1...4} --console-address ':9001' && sleep 5)
|
||||
@(docker run --net=mynet123 --ip=173.18.0.3 --name pgsqlcontainer --rm -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres && sleep 5)
|
||||
@echo "execute test and get coverage"
|
||||
@(cd integration && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && ./integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/system.out)
|
||||
@echo "execute test and get coverage for test-integration:"
|
||||
@(cd integration && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && export THETARGET=$(TARGET_BUCKET) && echo "THETARGET: ${THETARGET}" && ./integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/system.out)
|
||||
@(docker stop pgsqlcontainer)
|
||||
@(docker stop minio)
|
||||
@(docker network rm mynet123)
|
||||
@@ -260,7 +264,7 @@ clean:
|
||||
@rm -vf console
|
||||
|
||||
docker:
|
||||
@docker buildx build --output=type=docker --platform linux/amd64 -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' .
|
||||
@docker buildx build --output=type=docker --platform linux/amd64 -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' --build-arg NODE_VERSION='$(NODE_VERSION)' .
|
||||
|
||||
release: swagger-gen
|
||||
@echo "Generating Release: $(RELEASE)"
|
||||
|
||||
@@ -54,7 +54,7 @@ docker pull minio/console
|
||||
|
||||
### Build from source
|
||||
> You will need a working Go environment. Therefore, please follow [How to install Go](https://golang.org/doc/install).
|
||||
> Minimum version required is go1.17
|
||||
> Minimum version required is go1.18
|
||||
|
||||
```
|
||||
go install github.com/minio/console/cmd/console@latest
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package cluster
|
||||
|
||||
import (
|
||||
directpvclient "github.com/minio/directpv/pkg/client"
|
||||
operator "github.com/minio/operator/pkg/client/clientset/versioned"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
@@ -63,3 +64,13 @@ func OperatorClient(token string) (*operator.Clientset, error) {
|
||||
func K8sClient(token string) (*kubernetes.Clientset, error) {
|
||||
return kubernetes.NewForConfig(GetK8sConfig(token))
|
||||
}
|
||||
|
||||
// DirectPV interfaces required to fetch information
|
||||
|
||||
func DirectPVDriveInterface(token string) (*directpvclient.DirectCSIDriveInterface, error) {
|
||||
return directpvclient.DirectCSIDriveInterfaceForConfig(GetK8sConfig(token))
|
||||
}
|
||||
|
||||
func DirectPVVolumeInterface(token string) (*directpvclient.DirectCSIVolumeInterface, error) {
|
||||
return directpvclient.DirectCSIVolumeInterfaceForConfig(GetK8sConfig(token))
|
||||
}
|
||||
|
||||
127
go.mod
127
go.mod
@@ -1,54 +1,64 @@
|
||||
module github.com/minio/console
|
||||
|
||||
go 1.17
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/blang/semver/v4 v4.0.0
|
||||
github.com/cheggaaa/pb/v3 v3.0.8
|
||||
github.com/cheggaaa/pb/v3 v3.1.0
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/fatih/color v1.13.0
|
||||
github.com/go-openapi/errors v0.20.2
|
||||
github.com/go-openapi/loads v0.21.1
|
||||
github.com/go-openapi/runtime v0.23.3
|
||||
github.com/go-openapi/spec v0.20.5
|
||||
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/golang-jwt/jwt/v4 v4.4.1
|
||||
github.com/go-openapi/errors v0.20.3
|
||||
github.com/go-openapi/loads v0.21.2
|
||||
github.com/go-openapi/runtime v0.24.1
|
||||
github.com/go-openapi/spec v0.20.7
|
||||
github.com/go-openapi/strfmt v0.21.3
|
||||
github.com/go-openapi/swag v0.22.3
|
||||
github.com/go-openapi/validate v0.22.0
|
||||
github.com/golang-jwt/jwt/v4 v4.4.2
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/gorilla/websocket v1.5.0
|
||||
github.com/jessevdk/go-flags v1.5.0
|
||||
github.com/klauspost/compress v1.15.1
|
||||
github.com/minio/cli v1.22.0
|
||||
github.com/klauspost/compress v1.15.11
|
||||
github.com/minio/cli v1.24.0
|
||||
github.com/minio/directpv v1.4.4-0.20220805090942-948ca4731651
|
||||
github.com/minio/highwayhash v1.0.2
|
||||
github.com/minio/kes v0.19.2
|
||||
github.com/minio/madmin-go v1.3.14
|
||||
github.com/minio/mc v0.0.0-20220512134321-aa60a8db1e4d
|
||||
github.com/minio/minio-go/v7 v7.0.26
|
||||
github.com/minio/operator v0.0.0-20220414212219-ba4c097324b2
|
||||
github.com/minio/pkg v1.1.23
|
||||
github.com/minio/selfupdate v0.4.0
|
||||
github.com/minio/kes v0.21.0
|
||||
github.com/minio/madmin-go v1.6.3
|
||||
github.com/minio/mc v0.0.0-20221007160339-ec8687d57e36
|
||||
github.com/minio/minio-go/v7 v7.0.40
|
||||
github.com/minio/operator v0.0.0-20220902184351-21e4073132b0
|
||||
github.com/minio/pkg v1.5.1
|
||||
github.com/minio/selfupdate v0.5.0
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/rs/xid v1.4.0
|
||||
github.com/secure-io/sio-go v0.3.1
|
||||
github.com/stretchr/testify v1.7.1
|
||||
github.com/tidwall/gjson v1.14.0
|
||||
github.com/unrolled/secure v1.10.0
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
|
||||
golang.org/x/net v0.0.0-20220421235706-1d1ef9303861
|
||||
github.com/stretchr/testify v1.8.0
|
||||
github.com/tidwall/gjson v1.14.3
|
||||
github.com/unrolled/secure v1.13.0
|
||||
golang.org/x/crypto v0.0.0-20221005025214-4161e89ecf1b
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b
|
||||
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
|
||||
// Added to include security fix for
|
||||
// https://github.com/golang/go/issues/56152
|
||||
golang.org/x/text v0.3.8 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
k8s.io/api v0.23.5
|
||||
k8s.io/apimachinery v0.23.5
|
||||
k8s.io/client-go v0.23.5
|
||||
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
|
||||
k8s.io/api v0.25.2
|
||||
k8s.io/apimachinery v0.25.2
|
||||
k8s.io/client-go v0.25.2
|
||||
k8s.io/utils v0.0.0-20220922133306-665eaaec4324
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.99.0 // indirect
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
||||
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
|
||||
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
||||
github.com/Azure/go-autorest/logger v0.2.1 // indirect
|
||||
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
||||
github.com/VividCortex/ewma v1.2.0 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/briandowns/spinner v1.18.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/charmbracelet/bubbles v0.10.3 // indirect
|
||||
github.com/charmbracelet/bubbletea v0.20.0 // indirect
|
||||
@@ -60,30 +70,35 @@ require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
||||
github.com/docker/go-units v0.4.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
|
||||
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
|
||||
github.com/fatih/structs v1.1.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
||||
github.com/gdamore/encoding v1.0.0 // indirect
|
||||
github.com/gdamore/tcell/v2 v2.4.1-0.20210905002822-f057f0a857a1 // indirect
|
||||
github.com/go-logr/logr v1.2.2 // indirect
|
||||
github.com/go-logr/logr v1.2.3 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-openapi/analysis v0.21.2 // indirect
|
||||
github.com/go-openapi/analysis v0.21.4 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.0 // indirect
|
||||
github.com/go-stack/stack v1.8.1 // indirect
|
||||
github.com/goccy/go-json v0.9.4 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/google/go-cmp v0.5.7 // indirect
|
||||
github.com/google/gnostic v0.5.7-v3refs // indirect
|
||||
github.com/google/go-cmp v0.5.8 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/googleapis/gnostic v0.5.5 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.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.0.11 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.1.0 // indirect
|
||||
github.com/kr/pretty v0.2.1 // indirect
|
||||
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
|
||||
github.com/lestrrat-go/blackmagic v1.0.0 // indirect
|
||||
github.com/lestrrat-go/httpcc v1.0.0 // indirect
|
||||
@@ -92,12 +107,15 @@ require (
|
||||
github.com/lestrrat-go/option v1.0.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/magiconair/properties v1.8.5 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||
github.com/mattn/go-ieproxy v0.0.1 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.13 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
||||
github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4 // indirect
|
||||
github.com/miekg/dns v1.1.48 // indirect
|
||||
github.com/minio/colorjson v1.0.2 // indirect
|
||||
github.com/minio/filepath v1.0.0 // indirect
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
@@ -109,16 +127,18 @@ require (
|
||||
github.com/muesli/ansi v0.0.0-20211031195517-c9f0611b6c70 // indirect
|
||||
github.com/muesli/reflow v0.3.0 // indirect
|
||||
github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/navidys/tvxwidgets v0.1.0 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/pelletier/go-toml v1.9.4 // indirect
|
||||
github.com/philhofer/fwd v1.1.2-0.20210722190033-5c56ac6d0bb9 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pkg/xattr v0.4.5 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/posener/complete v1.2.3 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
|
||||
github.com/prometheus/client_golang v1.12.1 // indirect
|
||||
github.com/prometheus/client_golang v1.12.2 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.33.0 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
@@ -126,8 +146,14 @@ require (
|
||||
github.com/rivo/tview v0.0.0-20220216162559-96063d6082f3 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/rjeczalik/notify v0.9.2 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.22.2 // indirect
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.22.7 // indirect
|
||||
github.com/sirupsen/logrus v1.9.0 // indirect
|
||||
github.com/spf13/afero v1.6.0 // indirect
|
||||
github.com/spf13/cast v1.4.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.10.0 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tinylib/msgp v1.1.7-0.20211026165309-e818a1881b0e // indirect
|
||||
@@ -137,28 +163,29 @@ require (
|
||||
go.etcd.io/etcd/api/v3 v3.5.2 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.2 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.2 // indirect
|
||||
go.mongodb.org/mongo-driver v1.8.4 // indirect
|
||||
go.mongodb.org/mongo-driver v1.10.0 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
go.uber.org/zap v1.21.0 // indirect
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
|
||||
golang.org/x/tools v0.1.12 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20220302033224-9aa15565e42a // indirect
|
||||
google.golang.org/grpc v1.44.0 // indirect
|
||||
google.golang.org/protobuf v1.27.1 // indirect
|
||||
google.golang.org/protobuf v1.28.0 // indirect
|
||||
gopkg.in/h2non/filetype.v1 v1.0.5 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.66.4 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
k8s.io/klog/v2 v2.40.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf // indirect
|
||||
maze.io/x/duration v0.0.0-20160924141736-faac084b6075 // indirect
|
||||
gopkg.in/ini.v1 v1.66.6 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/apiextensions-apiserver v0.24.3 // indirect
|
||||
k8s.io/klog/v2 v2.80.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
|
||||
sigs.k8s.io/controller-runtime v0.11.1 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
)
|
||||
|
||||
@@ -157,7 +157,7 @@ func TestBadLogin(t *testing.T) {
|
||||
|
||||
response, err := client.Do(request)
|
||||
|
||||
assert.Equal(response.StatusCode, 500, "Login request not rejected")
|
||||
assert.Equal(401, response.StatusCode, "Login request not rejected")
|
||||
assert.NotNil(response, "Login response is nil")
|
||||
assert.Nil(err, "Login errored out")
|
||||
}
|
||||
|
||||
@@ -20,18 +20,16 @@ import (
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestStartProfiling(t *testing.T) {
|
||||
testAsser := assert.New(t)
|
||||
testAssert := assert.New(t)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -58,53 +56,28 @@ func TestStartProfiling(t *testing.T) {
|
||||
"profile-127.0.0.1:9000-mutex-before.pprof": false,
|
||||
}
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
wsDestination := "/ws/profile?types=cpu,mem,block,mutex,trace,threads,goroutines"
|
||||
wsFinalURL := fmt.Sprintf("ws://localhost:9090%s", wsDestination)
|
||||
|
||||
destination := "/api/v1/profiling/start"
|
||||
finalURL := fmt.Sprintf("http://localhost:9090%s", destination)
|
||||
request, err := http.NewRequest("POST", finalURL, strings.NewReader("{\"type\":\"cpu,mem,block,mutex,trace,threads,goroutines\"}"))
|
||||
ws, _, err := websocket.DefaultDialer.Dial(wsFinalURL, nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
defer ws.Close()
|
||||
|
||||
_, zipFileBytes, err := ws.ReadMessage()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
response, err := client.Do(request)
|
||||
|
||||
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
|
||||
testAsser.Equal(201, response.StatusCode)
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
destination = "/api/v1/profiling/stop"
|
||||
finalURL = fmt.Sprintf("http://localhost:9090%s", destination)
|
||||
request, err = http.NewRequest("POST", finalURL, nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
response, err = client.Do(request)
|
||||
|
||||
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
|
||||
testAsser.Equal(200, response.StatusCode)
|
||||
zipFileBytes, err := io.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
|
||||
}
|
||||
filetype := http.DetectContentType(zipFileBytes)
|
||||
testAsser.Equal("application/zip", filetype)
|
||||
testAssert.Equal("application/zip", filetype)
|
||||
|
||||
zipReader, err := zip.NewReader(bytes.NewReader(zipFileBytes), int64(len(zipFileBytes)))
|
||||
if err != nil {
|
||||
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
|
||||
testAssert.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
|
||||
}
|
||||
|
||||
// Read all the files from zip archive
|
||||
@@ -113,7 +86,7 @@ func TestStartProfiling(t *testing.T) {
|
||||
}
|
||||
|
||||
for k, v := range files {
|
||||
testAsser.Equal(true, v, fmt.Sprintf("%s : compressed file expected to have %v file inside", tt.name, k))
|
||||
testAssert.Equal(true, v, fmt.Sprintf("%s : compressed file expected to have %v file inside", tt.name, k))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2787,10 +2787,7 @@ func TestReplication(t *testing.T) {
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(response)
|
||||
if response != nil {
|
||||
// https://github.com/minio/minio/pull/14972
|
||||
// Disallow deletion of arn when active replication config
|
||||
// no longer 204 is expected due to above change
|
||||
assert.Equal(500, response.StatusCode, finalResponse)
|
||||
assert.Equal(204, response.StatusCode, finalResponse)
|
||||
}
|
||||
|
||||
// 6. Delete 2nd rule only with dedicated end point for single rules:
|
||||
@@ -2825,10 +2822,7 @@ func TestReplication(t *testing.T) {
|
||||
}
|
||||
finalResponse = inspectHTTPResponse(response)
|
||||
if response != nil {
|
||||
// https://github.com/minio/minio/pull/14972
|
||||
// Disallow deletion of arn when active replication config
|
||||
// 204 is no longer expected but 500
|
||||
assert.Equal(500, response.StatusCode, finalResponse)
|
||||
assert.Equal(204, response.StatusCode, finalResponse)
|
||||
}
|
||||
|
||||
// 8. Get replication, at this point zero rules are expected
|
||||
@@ -2850,7 +2844,7 @@ func TestReplication(t *testing.T) {
|
||||
log.Println(err)
|
||||
assert.Nil(err)
|
||||
}
|
||||
expected := 3 // none got deleted due to https://github.com/minio/minio/pull/14972
|
||||
expected := 0
|
||||
actual := len(structBucketRepl.Rules)
|
||||
assert.Equal(expected, actual, "Delete failed")
|
||||
}
|
||||
@@ -3638,3 +3632,225 @@ func TestGetBucketRewind(t *testing.T) {
|
||||
200, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
}
|
||||
|
||||
func GetRemoteBucket() (*http.Response, error) {
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/remote-buckets",
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func GetRemoteBucketARN(sourceBucket string) (*http.Response, error) {
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
fmt.Sprintf("http://localhost:9090/api/v1/remote-buckets/%s", sourceBucket),
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func AddRemoteBucket(accessKey, secretKey, targetURL, sourceBucket, targetBucket string) (*http.Response, error) {
|
||||
// Needed Parameters for API Call
|
||||
bucketsRelationArray := make([]map[string]interface{}, 1)
|
||||
bucketsRelationIndex0 := map[string]interface{}{
|
||||
"originBucket": sourceBucket,
|
||||
"destinationBucket": targetBucket,
|
||||
}
|
||||
bucketsRelationArray[0] = bucketsRelationIndex0
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"accessKey": accessKey,
|
||||
"secretKey": secretKey,
|
||||
"targetURL": targetURL,
|
||||
"sourceBucket": sourceBucket,
|
||||
"targetBucket": targetBucket,
|
||||
"region": "",
|
||||
"bucketsRelation": bucketsRelationArray,
|
||||
"syncMode": "async",
|
||||
"bandwidth": 107374182400,
|
||||
"healthCheckPeriod": 60,
|
||||
"prefix": "",
|
||||
"tags": "",
|
||||
"replicateDeleteMarkers": true,
|
||||
"replicateDeletes": true,
|
||||
"priority": 1,
|
||||
"storageClass": "",
|
||||
"replicateMetadata": true,
|
||||
}
|
||||
|
||||
// Creating the Call by adding the URL and Headers
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/remote-buckets",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
// Performing the call
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func DeleteRemoteBucket(sourceBucket string, arn string) (*http.Response, error) {
|
||||
// Needed Parameters for API Call
|
||||
request, err := http.NewRequest(
|
||||
"DELETE",
|
||||
fmt.Sprintf("http://localhost:9090/api/v1/remote-buckets/%s/%s", sourceBucket, arn),
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
// Performing the call
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestAddRemoteBucket(t *testing.T) {
|
||||
// Variables
|
||||
assert := assert.New(t)
|
||||
accessKey := "minioadmin"
|
||||
secretKey := "minioadmin"
|
||||
targetURL := "https://play.min.io"
|
||||
sourceBucket := "source"
|
||||
targetBucket := os.Getenv("THETARGET")
|
||||
fmt.Println("targetBucket: ", targetBucket)
|
||||
|
||||
// 1. Create bucket
|
||||
if !BucketGotAdded("source", true, true, nil, nil, assert, 201) {
|
||||
return
|
||||
}
|
||||
|
||||
// 2. Add Remote Bucket
|
||||
resp, err := AddRemoteBucket(
|
||||
accessKey,
|
||||
secretKey,
|
||||
targetURL,
|
||||
sourceBucket,
|
||||
targetBucket,
|
||||
)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
201, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
|
||||
// 3. Verify Remote Bucket was created
|
||||
resp, err = GetRemoteBucket()
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(resp)
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, finalResponse)
|
||||
}
|
||||
fmt.Println("finalResponse: ", finalResponse)
|
||||
assert.Equal(strings.Contains(finalResponse, targetBucket), true)
|
||||
}
|
||||
|
||||
func TestDeleteRemoteBucket(t *testing.T) {
|
||||
// Variables
|
||||
assert := assert.New(t)
|
||||
accessKey := "minioadmin"
|
||||
secretKey := "minioadmin"
|
||||
targetURL := "https://play.min.io"
|
||||
sourceBucket := "deletesource"
|
||||
targetBucket := os.Getenv("THETARGET")
|
||||
fmt.Println("targetBucket: ", targetBucket)
|
||||
|
||||
// 1. Create bucket
|
||||
if !BucketGotAdded("deletesource", true, true, nil, nil, assert, 201) {
|
||||
return
|
||||
}
|
||||
|
||||
// 2. Add Remote Bucket
|
||||
resp, err := AddRemoteBucket(
|
||||
accessKey,
|
||||
secretKey,
|
||||
targetURL,
|
||||
sourceBucket,
|
||||
targetBucket,
|
||||
)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
201, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
|
||||
// 3. Get ARN
|
||||
resp, err = GetRemoteBucketARN(sourceBucket)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
bodyBytes, _ := ioutil.ReadAll(resp.Body)
|
||||
remoteBucket := models.RemoteBucket{}
|
||||
err = json.Unmarshal(bodyBytes, &remoteBucket)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
assert.Nil(err)
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
|
||||
// 4. Delete Remote Bucket
|
||||
resp, err = DeleteRemoteBucket(sourceBucket, *remoteBucket.RemoteARN)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(resp)
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
204, resp.StatusCode, finalResponse)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
serviceAccountName: console-sa
|
||||
containers:
|
||||
- name: console
|
||||
image: 'minio/console:v0.17.3'
|
||||
image: 'minio/console:v0.21.0'
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
env:
|
||||
- name: CONSOLE_OPERATOR_MODE
|
||||
|
||||
@@ -32,7 +32,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: console
|
||||
image: 'minio/console:v0.17.3'
|
||||
image: 'minio/console:v0.21.0'
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
env:
|
||||
- name: CONSOLE_MINIO_SERVER
|
||||
|
||||
@@ -24,11 +24,13 @@ package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AdminInfoResponse admin info response
|
||||
@@ -36,15 +38,16 @@ import (
|
||||
// swagger:model adminInfoResponse
|
||||
type AdminInfoResponse struct {
|
||||
|
||||
// advanced metrics status
|
||||
// Enum: [not configured available unavailable]
|
||||
AdvancedMetricsStatus string `json:"advancedMetricsStatus,omitempty"`
|
||||
|
||||
// buckets
|
||||
Buckets int64 `json:"buckets,omitempty"`
|
||||
|
||||
// objects
|
||||
Objects int64 `json:"objects,omitempty"`
|
||||
|
||||
// prometheus not ready
|
||||
PrometheusNotReady bool `json:"prometheusNotReady,omitempty"`
|
||||
|
||||
// servers
|
||||
Servers []*ServerProperties `json:"servers"`
|
||||
|
||||
@@ -59,6 +62,10 @@ type AdminInfoResponse struct {
|
||||
func (m *AdminInfoResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateAdvancedMetricsStatus(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateServers(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -73,6 +80,51 @@ func (m *AdminInfoResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var adminInfoResponseTypeAdvancedMetricsStatusPropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["not configured","available","unavailable"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
adminInfoResponseTypeAdvancedMetricsStatusPropEnum = append(adminInfoResponseTypeAdvancedMetricsStatusPropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// AdminInfoResponseAdvancedMetricsStatusNotConfigured captures enum value "not configured"
|
||||
AdminInfoResponseAdvancedMetricsStatusNotConfigured string = "not configured"
|
||||
|
||||
// AdminInfoResponseAdvancedMetricsStatusAvailable captures enum value "available"
|
||||
AdminInfoResponseAdvancedMetricsStatusAvailable string = "available"
|
||||
|
||||
// AdminInfoResponseAdvancedMetricsStatusUnavailable captures enum value "unavailable"
|
||||
AdminInfoResponseAdvancedMetricsStatusUnavailable string = "unavailable"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *AdminInfoResponse) validateAdvancedMetricsStatusEnum(path, location string, value string) error {
|
||||
if err := validate.EnumCase(path, location, value, adminInfoResponseTypeAdvancedMetricsStatusPropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AdminInfoResponse) validateAdvancedMetricsStatus(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.AdvancedMetricsStatus) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validateAdvancedMetricsStatusEnum("advancedMetricsStatus", "body", m.AdvancedMetricsStatus); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AdminInfoResponse) validateServers(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Servers) { // not required
|
||||
return nil
|
||||
|
||||
67
models/api_key.go
Normal file
67
models/api_key.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// APIKey api key
|
||||
//
|
||||
// swagger:model apiKey
|
||||
type APIKey struct {
|
||||
|
||||
// api key
|
||||
APIKey string `json:"apiKey,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this api key
|
||||
func (m *APIKey) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this api key based on context it is used
|
||||
func (m *APIKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *APIKey) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *APIKey) UnmarshalBinary(b []byte) error {
|
||||
var res APIKey
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -58,6 +58,9 @@ type CreateTenantRequest struct {
|
||||
// encryption
|
||||
Encryption *EncryptionConfiguration `json:"encryption,omitempty"`
|
||||
|
||||
// environment variables
|
||||
EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables"`
|
||||
|
||||
// erasure coding parity
|
||||
ErasureCodingParity int64 `json:"erasureCodingParity,omitempty"`
|
||||
|
||||
@@ -85,8 +88,8 @@ type CreateTenantRequest struct {
|
||||
// log search configuration
|
||||
LogSearchConfiguration *LogSearchConfiguration `json:"logSearchConfiguration,omitempty"`
|
||||
|
||||
// mounth path
|
||||
MounthPath string `json:"mounth_path,omitempty"`
|
||||
// mount path
|
||||
MountPath string `json:"mount_path,omitempty"`
|
||||
|
||||
// name
|
||||
// Required: true
|
||||
@@ -123,6 +126,10 @@ func (m *CreateTenantRequest) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateEnvironmentVariables(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateIdp(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -199,6 +206,32 @@ func (m *CreateTenantRequest) validateEncryption(formats strfmt.Registry) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateTenantRequest) validateEnvironmentVariables(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.EnvironmentVariables) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.EnvironmentVariables); i++ {
|
||||
if swag.IsZero(m.EnvironmentVariables[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.EnvironmentVariables[i] != nil {
|
||||
if err := m.EnvironmentVariables[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateTenantRequest) validateIdp(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Idp) { // not required
|
||||
return nil
|
||||
@@ -355,6 +388,10 @@ func (m *CreateTenantRequest) ContextValidate(ctx context.Context, formats strfm
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateEnvironmentVariables(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateIdp(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -417,6 +454,26 @@ func (m *CreateTenantRequest) contextValidateEncryption(ctx context.Context, for
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateTenantRequest) contextValidateEnvironmentVariables(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.EnvironmentVariables); i++ {
|
||||
|
||||
if m.EnvironmentVariables[i] != nil {
|
||||
if err := m.EnvironmentVariables[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CreateTenantRequest) contextValidateIdp(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Idp != nil {
|
||||
|
||||
@@ -29,10 +29,10 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// DirectCSIDriveInfo direct c s i drive info
|
||||
// DirectPVDriveInfo direct p v drive info
|
||||
//
|
||||
// swagger:model directCSIDriveInfo
|
||||
type DirectCSIDriveInfo struct {
|
||||
// swagger:model directPVDriveInfo
|
||||
type DirectPVDriveInfo struct {
|
||||
|
||||
// allocated
|
||||
Allocated int64 `json:"allocated,omitempty"`
|
||||
@@ -56,18 +56,18 @@ type DirectCSIDriveInfo struct {
|
||||
Volumes int64 `json:"volumes,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this direct c s i drive info
|
||||
func (m *DirectCSIDriveInfo) Validate(formats strfmt.Registry) error {
|
||||
// Validate validates this direct p v drive info
|
||||
func (m *DirectPVDriveInfo) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this direct c s i drive info based on context it is used
|
||||
func (m *DirectCSIDriveInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
// ContextValidate validates this direct p v drive info based on context it is used
|
||||
func (m *DirectPVDriveInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *DirectCSIDriveInfo) MarshalBinary() ([]byte, error) {
|
||||
func (m *DirectPVDriveInfo) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -75,8 +75,8 @@ func (m *DirectCSIDriveInfo) MarshalBinary() ([]byte, error) {
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *DirectCSIDriveInfo) UnmarshalBinary(b []byte) error {
|
||||
var res DirectCSIDriveInfo
|
||||
func (m *DirectPVDriveInfo) UnmarshalBinary(b []byte) error {
|
||||
var res DirectPVDriveInfo
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -29,10 +29,10 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// DirectCSIVolumeInfo direct c s i volume info
|
||||
// DirectPVVolumeInfo direct p v volume info
|
||||
//
|
||||
// swagger:model directCSIVolumeInfo
|
||||
type DirectCSIVolumeInfo struct {
|
||||
// swagger:model directPVVolumeInfo
|
||||
type DirectPVVolumeInfo struct {
|
||||
|
||||
// capacity
|
||||
Capacity int64 `json:"capacity,omitempty"`
|
||||
@@ -47,18 +47,18 @@ type DirectCSIVolumeInfo struct {
|
||||
Volume string `json:"volume,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this direct c s i volume info
|
||||
func (m *DirectCSIVolumeInfo) Validate(formats strfmt.Registry) error {
|
||||
// Validate validates this direct p v volume info
|
||||
func (m *DirectPVVolumeInfo) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this direct c s i volume info based on context it is used
|
||||
func (m *DirectCSIVolumeInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
// ContextValidate validates this direct p v volume info based on context it is used
|
||||
func (m *DirectPVVolumeInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *DirectCSIVolumeInfo) MarshalBinary() ([]byte, error) {
|
||||
func (m *DirectPVVolumeInfo) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -66,8 +66,8 @@ func (m *DirectCSIVolumeInfo) MarshalBinary() ([]byte, error) {
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *DirectCSIVolumeInfo) UnmarshalBinary(b []byte) error {
|
||||
var res DirectCSIVolumeInfo
|
||||
func (m *DirectPVVolumeInfo) UnmarshalBinary(b []byte) error {
|
||||
var res DirectPVVolumeInfo
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -54,6 +54,9 @@ type EncryptionConfiguration struct {
|
||||
// image
|
||||
Image string `json:"image,omitempty"`
|
||||
|
||||
// raw
|
||||
Raw string `json:"raw,omitempty"`
|
||||
|
||||
// replicas
|
||||
Replicas string `json:"replicas,omitempty"`
|
||||
|
||||
@@ -93,6 +96,8 @@ func (m *EncryptionConfiguration) UnmarshalJSON(raw []byte) error {
|
||||
|
||||
Image string `json:"image,omitempty"`
|
||||
|
||||
Raw string `json:"raw,omitempty"`
|
||||
|
||||
Replicas string `json:"replicas,omitempty"`
|
||||
|
||||
SecretsToBeDeleted []string `json:"secretsToBeDeleted"`
|
||||
@@ -119,6 +124,8 @@ func (m *EncryptionConfiguration) UnmarshalJSON(raw []byte) error {
|
||||
|
||||
m.Image = dataAO1.Image
|
||||
|
||||
m.Raw = dataAO1.Raw
|
||||
|
||||
m.Replicas = dataAO1.Replicas
|
||||
|
||||
m.SecretsToBeDeleted = dataAO1.SecretsToBeDeleted
|
||||
@@ -154,6 +161,8 @@ func (m EncryptionConfiguration) MarshalJSON() ([]byte, error) {
|
||||
|
||||
Image string `json:"image,omitempty"`
|
||||
|
||||
Raw string `json:"raw,omitempty"`
|
||||
|
||||
Replicas string `json:"replicas,omitempty"`
|
||||
|
||||
SecretsToBeDeleted []string `json:"secretsToBeDeleted"`
|
||||
@@ -177,6 +186,8 @@ func (m EncryptionConfiguration) MarshalJSON() ([]byte, error) {
|
||||
|
||||
dataAO1.Image = m.Image
|
||||
|
||||
dataAO1.Raw = m.Raw
|
||||
|
||||
dataAO1.Replicas = m.Replicas
|
||||
|
||||
dataAO1.SecretsToBeDeleted = m.SecretsToBeDeleted
|
||||
|
||||
@@ -54,6 +54,9 @@ type EncryptionConfigurationResponse struct {
|
||||
// mtls client
|
||||
MtlsClient *CertificateInfo `json:"mtls_client,omitempty"`
|
||||
|
||||
// raw
|
||||
Raw string `json:"raw,omitempty"`
|
||||
|
||||
// replicas
|
||||
Replicas string `json:"replicas,omitempty"`
|
||||
|
||||
@@ -90,6 +93,8 @@ func (m *EncryptionConfigurationResponse) UnmarshalJSON(raw []byte) error {
|
||||
|
||||
MtlsClient *CertificateInfo `json:"mtls_client,omitempty"`
|
||||
|
||||
Raw string `json:"raw,omitempty"`
|
||||
|
||||
Replicas string `json:"replicas,omitempty"`
|
||||
|
||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||
@@ -114,6 +119,8 @@ func (m *EncryptionConfigurationResponse) UnmarshalJSON(raw []byte) error {
|
||||
|
||||
m.MtlsClient = dataAO1.MtlsClient
|
||||
|
||||
m.Raw = dataAO1.Raw
|
||||
|
||||
m.Replicas = dataAO1.Replicas
|
||||
|
||||
m.SecurityContext = dataAO1.SecurityContext
|
||||
@@ -147,6 +154,8 @@ func (m EncryptionConfigurationResponse) MarshalJSON() ([]byte, error) {
|
||||
|
||||
MtlsClient *CertificateInfo `json:"mtls_client,omitempty"`
|
||||
|
||||
Raw string `json:"raw,omitempty"`
|
||||
|
||||
Replicas string `json:"replicas,omitempty"`
|
||||
|
||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||
@@ -168,6 +177,8 @@ func (m EncryptionConfigurationResponse) MarshalJSON() ([]byte, error) {
|
||||
|
||||
dataAO1.MtlsClient = m.MtlsClient
|
||||
|
||||
dataAO1.Raw = m.Raw
|
||||
|
||||
dataAO1.Replicas = m.Replicas
|
||||
|
||||
dataAO1.SecurityContext = m.SecurityContext
|
||||
|
||||
70
models/environment_constants.go
Normal file
70
models/environment_constants.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// EnvironmentConstants environment constants
|
||||
//
|
||||
// swagger:model environmentConstants
|
||||
type EnvironmentConstants struct {
|
||||
|
||||
// max concurrent downloads
|
||||
MaxConcurrentDownloads int64 `json:"maxConcurrentDownloads,omitempty"`
|
||||
|
||||
// max concurrent uploads
|
||||
MaxConcurrentUploads int64 `json:"maxConcurrentUploads,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this environment constants
|
||||
func (m *EnvironmentConstants) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this environment constants based on context it is used
|
||||
func (m *EnvironmentConstants) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *EnvironmentConstants) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *EnvironmentConstants) UnmarshalBinary(b []byte) error {
|
||||
var res EnvironmentConstants
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -31,17 +31,17 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// FormatDirectCSIDrivesResponse format direct c s i drives response
|
||||
// FormatDirectPVDrivesResponse format direct p v drives response
|
||||
//
|
||||
// swagger:model formatDirectCSIDrivesResponse
|
||||
type FormatDirectCSIDrivesResponse struct {
|
||||
// swagger:model formatDirectPVDrivesResponse
|
||||
type FormatDirectPVDrivesResponse struct {
|
||||
|
||||
// format issues list
|
||||
FormatIssuesList []*CsiFormatErrorResponse `json:"formatIssuesList"`
|
||||
FormatIssuesList []*PvFormatErrorResponse `json:"formatIssuesList"`
|
||||
}
|
||||
|
||||
// Validate validates this format direct c s i drives response
|
||||
func (m *FormatDirectCSIDrivesResponse) Validate(formats strfmt.Registry) error {
|
||||
// Validate validates this format direct p v drives response
|
||||
func (m *FormatDirectPVDrivesResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateFormatIssuesList(formats); err != nil {
|
||||
@@ -54,7 +54,7 @@ func (m *FormatDirectCSIDrivesResponse) Validate(formats strfmt.Registry) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *FormatDirectCSIDrivesResponse) validateFormatIssuesList(formats strfmt.Registry) error {
|
||||
func (m *FormatDirectPVDrivesResponse) validateFormatIssuesList(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.FormatIssuesList) { // not required
|
||||
return nil
|
||||
}
|
||||
@@ -80,8 +80,8 @@ func (m *FormatDirectCSIDrivesResponse) validateFormatIssuesList(formats strfmt.
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this format direct c s i drives response based on the context it is used
|
||||
func (m *FormatDirectCSIDrivesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
// ContextValidate validate this format direct p v drives response based on the context it is used
|
||||
func (m *FormatDirectPVDrivesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateFormatIssuesList(ctx, formats); err != nil {
|
||||
@@ -94,7 +94,7 @@ func (m *FormatDirectCSIDrivesResponse) ContextValidate(ctx context.Context, for
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *FormatDirectCSIDrivesResponse) contextValidateFormatIssuesList(ctx context.Context, formats strfmt.Registry) error {
|
||||
func (m *FormatDirectPVDrivesResponse) contextValidateFormatIssuesList(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.FormatIssuesList); i++ {
|
||||
|
||||
@@ -115,7 +115,7 @@ func (m *FormatDirectCSIDrivesResponse) contextValidateFormatIssuesList(ctx cont
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *FormatDirectCSIDrivesResponse) MarshalBinary() ([]byte, error) {
|
||||
func (m *FormatDirectPVDrivesResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -123,8 +123,8 @@ func (m *FormatDirectCSIDrivesResponse) MarshalBinary() ([]byte, error) {
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *FormatDirectCSIDrivesResponse) UnmarshalBinary(b []byte) error {
|
||||
var res FormatDirectCSIDrivesResponse
|
||||
func (m *FormatDirectPVDrivesResponse) UnmarshalBinary(b []byte) error {
|
||||
var res FormatDirectPVDrivesResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -31,17 +31,17 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// GetDirectCSIDriveListResponse get direct c s i drive list response
|
||||
// GetDirectPVDriveListResponse get direct p v drive list response
|
||||
//
|
||||
// swagger:model getDirectCSIDriveListResponse
|
||||
type GetDirectCSIDriveListResponse struct {
|
||||
// swagger:model getDirectPVDriveListResponse
|
||||
type GetDirectPVDriveListResponse struct {
|
||||
|
||||
// drives
|
||||
Drives []*DirectCSIDriveInfo `json:"drives"`
|
||||
Drives []*DirectPVDriveInfo `json:"drives"`
|
||||
}
|
||||
|
||||
// Validate validates this get direct c s i drive list response
|
||||
func (m *GetDirectCSIDriveListResponse) Validate(formats strfmt.Registry) error {
|
||||
// Validate validates this get direct p v drive list response
|
||||
func (m *GetDirectPVDriveListResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateDrives(formats); err != nil {
|
||||
@@ -54,7 +54,7 @@ func (m *GetDirectCSIDriveListResponse) Validate(formats strfmt.Registry) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetDirectCSIDriveListResponse) validateDrives(formats strfmt.Registry) error {
|
||||
func (m *GetDirectPVDriveListResponse) validateDrives(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Drives) { // not required
|
||||
return nil
|
||||
}
|
||||
@@ -80,8 +80,8 @@ func (m *GetDirectCSIDriveListResponse) validateDrives(formats strfmt.Registry)
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this get direct c s i drive list response based on the context it is used
|
||||
func (m *GetDirectCSIDriveListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
// ContextValidate validate this get direct p v drive list response based on the context it is used
|
||||
func (m *GetDirectPVDriveListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateDrives(ctx, formats); err != nil {
|
||||
@@ -94,7 +94,7 @@ func (m *GetDirectCSIDriveListResponse) ContextValidate(ctx context.Context, for
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetDirectCSIDriveListResponse) contextValidateDrives(ctx context.Context, formats strfmt.Registry) error {
|
||||
func (m *GetDirectPVDriveListResponse) contextValidateDrives(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Drives); i++ {
|
||||
|
||||
@@ -115,7 +115,7 @@ func (m *GetDirectCSIDriveListResponse) contextValidateDrives(ctx context.Contex
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GetDirectCSIDriveListResponse) MarshalBinary() ([]byte, error) {
|
||||
func (m *GetDirectPVDriveListResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -123,8 +123,8 @@ func (m *GetDirectCSIDriveListResponse) MarshalBinary() ([]byte, error) {
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *GetDirectCSIDriveListResponse) UnmarshalBinary(b []byte) error {
|
||||
var res GetDirectCSIDriveListResponse
|
||||
func (m *GetDirectPVDriveListResponse) UnmarshalBinary(b []byte) error {
|
||||
var res GetDirectPVDriveListResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -31,17 +31,17 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// GetDirectCSIVolumeListResponse get direct c s i volume list response
|
||||
// GetDirectPVVolumeListResponse get direct p v volume list response
|
||||
//
|
||||
// swagger:model getDirectCSIVolumeListResponse
|
||||
type GetDirectCSIVolumeListResponse struct {
|
||||
// swagger:model getDirectPVVolumeListResponse
|
||||
type GetDirectPVVolumeListResponse struct {
|
||||
|
||||
// volumes
|
||||
Volumes []*DirectCSIVolumeInfo `json:"volumes"`
|
||||
Volumes []*DirectPVVolumeInfo `json:"volumes"`
|
||||
}
|
||||
|
||||
// Validate validates this get direct c s i volume list response
|
||||
func (m *GetDirectCSIVolumeListResponse) Validate(formats strfmt.Registry) error {
|
||||
// Validate validates this get direct p v volume list response
|
||||
func (m *GetDirectPVVolumeListResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateVolumes(formats); err != nil {
|
||||
@@ -54,7 +54,7 @@ func (m *GetDirectCSIVolumeListResponse) Validate(formats strfmt.Registry) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetDirectCSIVolumeListResponse) validateVolumes(formats strfmt.Registry) error {
|
||||
func (m *GetDirectPVVolumeListResponse) validateVolumes(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Volumes) { // not required
|
||||
return nil
|
||||
}
|
||||
@@ -80,8 +80,8 @@ func (m *GetDirectCSIVolumeListResponse) validateVolumes(formats strfmt.Registry
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this get direct c s i volume list response based on the context it is used
|
||||
func (m *GetDirectCSIVolumeListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
// ContextValidate validate this get direct p v volume list response based on the context it is used
|
||||
func (m *GetDirectPVVolumeListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateVolumes(ctx, formats); err != nil {
|
||||
@@ -94,7 +94,7 @@ func (m *GetDirectCSIVolumeListResponse) ContextValidate(ctx context.Context, fo
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetDirectCSIVolumeListResponse) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error {
|
||||
func (m *GetDirectPVVolumeListResponse) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Volumes); i++ {
|
||||
|
||||
@@ -115,7 +115,7 @@ func (m *GetDirectCSIVolumeListResponse) contextValidateVolumes(ctx context.Cont
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GetDirectCSIVolumeListResponse) MarshalBinary() ([]byte, error) {
|
||||
func (m *GetDirectPVVolumeListResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -123,8 +123,8 @@ func (m *GetDirectCSIVolumeListResponse) MarshalBinary() ([]byte, error) {
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *GetDirectCSIVolumeListResponse) UnmarshalBinary(b []byte) error {
|
||||
var res GetDirectCSIVolumeListResponse
|
||||
func (m *GetDirectPVVolumeListResponse) UnmarshalBinary(b []byte) error {
|
||||
var res GetDirectPVVolumeListResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
28
models/km_delete_key_request.go
Normal file
28
models/km_delete_key_request.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// KmDeleteKeyRequest km delete key request
|
||||
//
|
||||
// swagger:model kmDeleteKeyRequest
|
||||
type KmDeleteKeyRequest interface{}
|
||||
28
models/km_list_keys_request.go
Normal file
28
models/km_list_keys_request.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// KmListKeysRequest km list keys request
|
||||
//
|
||||
// swagger:model kmListKeysRequest
|
||||
type KmListKeysRequest interface{}
|
||||
133
models/kms_a_p_is_response.go
Normal file
133
models/kms_a_p_is_response.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsAPIsResponse kms a p is response
|
||||
//
|
||||
// swagger:model kmsAPIsResponse
|
||||
type KmsAPIsResponse struct {
|
||||
|
||||
// results
|
||||
Results []*KmsAPI `json:"results"`
|
||||
}
|
||||
|
||||
// Validate validates this kms a p is response
|
||||
func (m *KmsAPIsResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateResults(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsAPIsResponse) validateResults(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Results) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Results); i++ {
|
||||
if swag.IsZero(m.Results[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Results[i] != nil {
|
||||
if err := m.Results[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this kms a p is response based on the context it is used
|
||||
func (m *KmsAPIsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateResults(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsAPIsResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Results); i++ {
|
||||
|
||||
if m.Results[i] != nil {
|
||||
if err := m.Results[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsAPIsResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsAPIsResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsAPIsResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
76
models/kms_api.go
Normal file
76
models/kms_api.go
Normal file
@@ -0,0 +1,76 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsAPI kms API
|
||||
//
|
||||
// swagger:model kmsAPI
|
||||
type KmsAPI struct {
|
||||
|
||||
// max body
|
||||
MaxBody int64 `json:"maxBody,omitempty"`
|
||||
|
||||
// method
|
||||
Method string `json:"method,omitempty"`
|
||||
|
||||
// path
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
// timeout
|
||||
Timeout int64 `json:"timeout,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms API
|
||||
func (m *KmsAPI) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms API based on context it is used
|
||||
func (m *KmsAPI) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsAPI) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsAPI) UnmarshalBinary(b []byte) error {
|
||||
var res KmsAPI
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
67
models/kms_assign_policy_request.go
Normal file
67
models/kms_assign_policy_request.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsAssignPolicyRequest kms assign policy request
|
||||
//
|
||||
// swagger:model kmsAssignPolicyRequest
|
||||
type KmsAssignPolicyRequest struct {
|
||||
|
||||
// identity
|
||||
Identity string `json:"identity,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms assign policy request
|
||||
func (m *KmsAssignPolicyRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms assign policy request based on context it is used
|
||||
func (m *KmsAssignPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsAssignPolicyRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsAssignPolicyRequest) UnmarshalBinary(b []byte) error {
|
||||
var res KmsAssignPolicyRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
88
models/kms_create_key_request.go
Normal file
88
models/kms_create_key_request.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// KmsCreateKeyRequest kms create key request
|
||||
//
|
||||
// swagger:model kmsCreateKeyRequest
|
||||
type KmsCreateKeyRequest struct {
|
||||
|
||||
// key
|
||||
// Required: true
|
||||
Key *string `json:"key"`
|
||||
}
|
||||
|
||||
// Validate validates this kms create key request
|
||||
func (m *KmsCreateKeyRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateKey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsCreateKeyRequest) validateKey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("key", "body", m.Key); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms create key request based on context it is used
|
||||
func (m *KmsCreateKeyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsCreateKeyRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsCreateKeyRequest) UnmarshalBinary(b []byte) error {
|
||||
var res KmsCreateKeyRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
28
models/kms_describe_identity_request.go
Normal file
28
models/kms_describe_identity_request.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// KmsDescribeIdentityRequest kms describe identity request
|
||||
//
|
||||
// swagger:model kmsDescribeIdentityRequest
|
||||
type KmsDescribeIdentityRequest interface{}
|
||||
79
models/kms_describe_identity_response.go
Normal file
79
models/kms_describe_identity_response.go
Normal file
@@ -0,0 +1,79 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsDescribeIdentityResponse kms describe identity response
|
||||
//
|
||||
// swagger:model kmsDescribeIdentityResponse
|
||||
type KmsDescribeIdentityResponse struct {
|
||||
|
||||
// admin
|
||||
Admin bool `json:"admin,omitempty"`
|
||||
|
||||
// created at
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
|
||||
// created by
|
||||
CreatedBy string `json:"createdBy,omitempty"`
|
||||
|
||||
// identity
|
||||
Identity string `json:"identity,omitempty"`
|
||||
|
||||
// policy
|
||||
Policy string `json:"policy,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms describe identity response
|
||||
func (m *KmsDescribeIdentityResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms describe identity response based on context it is used
|
||||
func (m *KmsDescribeIdentityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsDescribeIdentityResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsDescribeIdentityResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsDescribeIdentityResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
28
models/kms_describe_policy_request.go
Normal file
28
models/kms_describe_policy_request.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// KmsDescribePolicyRequest kms describe policy request
|
||||
//
|
||||
// swagger:model kmsDescribePolicyRequest
|
||||
type KmsDescribePolicyRequest interface{}
|
||||
73
models/kms_describe_policy_response.go
Normal file
73
models/kms_describe_policy_response.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsDescribePolicyResponse kms describe policy response
|
||||
//
|
||||
// swagger:model kmsDescribePolicyResponse
|
||||
type KmsDescribePolicyResponse struct {
|
||||
|
||||
// created at
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
|
||||
// created by
|
||||
CreatedBy string `json:"createdBy,omitempty"`
|
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms describe policy response
|
||||
func (m *KmsDescribePolicyResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms describe policy response based on context it is used
|
||||
func (m *KmsDescribePolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsDescribePolicyResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsDescribePolicyResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsDescribePolicyResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
28
models/kms_describe_self_identity_request.go
Normal file
28
models/kms_describe_self_identity_request.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// KmsDescribeSelfIdentityRequest kms describe self identity request
|
||||
//
|
||||
// swagger:model kmsDescribeSelfIdentityRequest
|
||||
type KmsDescribeSelfIdentityRequest interface{}
|
||||
136
models/kms_describe_self_identity_response.go
Normal file
136
models/kms_describe_self_identity_response.go
Normal file
@@ -0,0 +1,136 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsDescribeSelfIdentityResponse kms describe self identity response
|
||||
//
|
||||
// swagger:model kmsDescribeSelfIdentityResponse
|
||||
type KmsDescribeSelfIdentityResponse struct {
|
||||
|
||||
// admin
|
||||
Admin bool `json:"admin,omitempty"`
|
||||
|
||||
// created at
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
|
||||
// created by
|
||||
CreatedBy string `json:"createdBy,omitempty"`
|
||||
|
||||
// identity
|
||||
Identity string `json:"identity,omitempty"`
|
||||
|
||||
// policy
|
||||
Policy *KmsGetPolicyResponse `json:"policy,omitempty"`
|
||||
|
||||
// policy name
|
||||
PolicyName string `json:"policyName,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms describe self identity response
|
||||
func (m *KmsDescribeSelfIdentityResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validatePolicy(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsDescribeSelfIdentityResponse) validatePolicy(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Policy) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.Policy != nil {
|
||||
if err := m.Policy.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("policy")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("policy")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this kms describe self identity response based on the context it is used
|
||||
func (m *KmsDescribeSelfIdentityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidatePolicy(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsDescribeSelfIdentityResponse) contextValidatePolicy(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Policy != nil {
|
||||
if err := m.Policy.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("policy")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("policy")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsDescribeSelfIdentityResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsDescribeSelfIdentityResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsDescribeSelfIdentityResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
70
models/kms_endpoint.go
Normal file
70
models/kms_endpoint.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsEndpoint kms endpoint
|
||||
//
|
||||
// swagger:model kmsEndpoint
|
||||
type KmsEndpoint struct {
|
||||
|
||||
// status
|
||||
Status string `json:"status,omitempty"`
|
||||
|
||||
// url
|
||||
URL string `json:"url,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms endpoint
|
||||
func (m *KmsEndpoint) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms endpoint based on context it is used
|
||||
func (m *KmsEndpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsEndpoint) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsEndpoint) UnmarshalBinary(b []byte) error {
|
||||
var res KmsEndpoint
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
28
models/kms_get_policy_request.go
Normal file
28
models/kms_get_policy_request.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// KmsGetPolicyRequest kms get policy request
|
||||
//
|
||||
// swagger:model kmsGetPolicyRequest
|
||||
type KmsGetPolicyRequest interface{}
|
||||
70
models/kms_get_policy_response.go
Normal file
70
models/kms_get_policy_response.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsGetPolicyResponse kms get policy response
|
||||
//
|
||||
// swagger:model kmsGetPolicyResponse
|
||||
type KmsGetPolicyResponse struct {
|
||||
|
||||
// allow
|
||||
Allow []string `json:"allow"`
|
||||
|
||||
// deny
|
||||
Deny []string `json:"deny"`
|
||||
}
|
||||
|
||||
// Validate validates this kms get policy response
|
||||
func (m *KmsGetPolicyResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms get policy response based on context it is used
|
||||
func (m *KmsGetPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsGetPolicyResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsGetPolicyResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsGetPolicyResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
79
models/kms_identity_info.go
Normal file
79
models/kms_identity_info.go
Normal file
@@ -0,0 +1,79 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsIdentityInfo kms identity info
|
||||
//
|
||||
// swagger:model kmsIdentityInfo
|
||||
type KmsIdentityInfo struct {
|
||||
|
||||
// created at
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
|
||||
// created by
|
||||
CreatedBy string `json:"createdBy,omitempty"`
|
||||
|
||||
// error
|
||||
Error string `json:"error,omitempty"`
|
||||
|
||||
// identity
|
||||
Identity string `json:"identity,omitempty"`
|
||||
|
||||
// policy
|
||||
Policy string `json:"policy,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms identity info
|
||||
func (m *KmsIdentityInfo) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms identity info based on context it is used
|
||||
func (m *KmsIdentityInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsIdentityInfo) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsIdentityInfo) UnmarshalBinary(b []byte) error {
|
||||
var res KmsIdentityInfo
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
88
models/kms_import_key_request.go
Normal file
88
models/kms_import_key_request.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// KmsImportKeyRequest kms import key request
|
||||
//
|
||||
// swagger:model kmsImportKeyRequest
|
||||
type KmsImportKeyRequest struct {
|
||||
|
||||
// bytes
|
||||
// Required: true
|
||||
Bytes *string `json:"bytes"`
|
||||
}
|
||||
|
||||
// Validate validates this kms import key request
|
||||
func (m *KmsImportKeyRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateBytes(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsImportKeyRequest) validateBytes(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("bytes", "body", m.Bytes); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms import key request based on context it is used
|
||||
func (m *KmsImportKeyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsImportKeyRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsImportKeyRequest) UnmarshalBinary(b []byte) error {
|
||||
var res KmsImportKeyRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
73
models/kms_key_info.go
Normal file
73
models/kms_key_info.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsKeyInfo kms key info
|
||||
//
|
||||
// swagger:model kmsKeyInfo
|
||||
type KmsKeyInfo struct {
|
||||
|
||||
// created at
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
|
||||
// created by
|
||||
CreatedBy string `json:"createdBy,omitempty"`
|
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms key info
|
||||
func (m *KmsKeyInfo) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms key info based on context it is used
|
||||
func (m *KmsKeyInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsKeyInfo) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsKeyInfo) UnmarshalBinary(b []byte) error {
|
||||
var res KmsKeyInfo
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
28
models/kms_key_status_request.go
Normal file
28
models/kms_key_status_request.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// KmsKeyStatusRequest kms key status request
|
||||
//
|
||||
// swagger:model kmsKeyStatusRequest
|
||||
type KmsKeyStatusRequest interface{}
|
||||
73
models/kms_key_status_response.go
Normal file
73
models/kms_key_status_response.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsKeyStatusResponse kms key status response
|
||||
//
|
||||
// swagger:model kmsKeyStatusResponse
|
||||
type KmsKeyStatusResponse struct {
|
||||
|
||||
// decryption err
|
||||
DecryptionErr string `json:"decryptionErr,omitempty"`
|
||||
|
||||
// encryption err
|
||||
EncryptionErr string `json:"encryptionErr,omitempty"`
|
||||
|
||||
// key ID
|
||||
KeyID string `json:"keyID,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms key status response
|
||||
func (m *KmsKeyStatusResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms key status response based on context it is used
|
||||
func (m *KmsKeyStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsKeyStatusResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsKeyStatusResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsKeyStatusResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
67
models/kms_latency_histogram.go
Normal file
67
models/kms_latency_histogram.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsLatencyHistogram kms latency histogram
|
||||
//
|
||||
// swagger:model kmsLatencyHistogram
|
||||
type KmsLatencyHistogram struct {
|
||||
|
||||
// duration
|
||||
Duration int64 `json:"duration,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms latency histogram
|
||||
func (m *KmsLatencyHistogram) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms latency histogram based on context it is used
|
||||
func (m *KmsLatencyHistogram) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsLatencyHistogram) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsLatencyHistogram) UnmarshalBinary(b []byte) error {
|
||||
var res KmsLatencyHistogram
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
133
models/kms_list_identities_response.go
Normal file
133
models/kms_list_identities_response.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsListIdentitiesResponse kms list identities response
|
||||
//
|
||||
// swagger:model kmsListIdentitiesResponse
|
||||
type KmsListIdentitiesResponse struct {
|
||||
|
||||
// results
|
||||
Results []*KmsIdentityInfo `json:"results"`
|
||||
}
|
||||
|
||||
// Validate validates this kms list identities response
|
||||
func (m *KmsListIdentitiesResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateResults(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsListIdentitiesResponse) validateResults(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Results) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Results); i++ {
|
||||
if swag.IsZero(m.Results[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Results[i] != nil {
|
||||
if err := m.Results[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this kms list identities response based on the context it is used
|
||||
func (m *KmsListIdentitiesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateResults(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsListIdentitiesResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Results); i++ {
|
||||
|
||||
if m.Results[i] != nil {
|
||||
if err := m.Results[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsListIdentitiesResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsListIdentitiesResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsListIdentitiesResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
133
models/kms_list_keys_response.go
Normal file
133
models/kms_list_keys_response.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsListKeysResponse kms list keys response
|
||||
//
|
||||
// swagger:model kmsListKeysResponse
|
||||
type KmsListKeysResponse struct {
|
||||
|
||||
// results
|
||||
Results []*KmsKeyInfo `json:"results"`
|
||||
}
|
||||
|
||||
// Validate validates this kms list keys response
|
||||
func (m *KmsListKeysResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateResults(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsListKeysResponse) validateResults(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Results) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Results); i++ {
|
||||
if swag.IsZero(m.Results[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Results[i] != nil {
|
||||
if err := m.Results[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this kms list keys response based on the context it is used
|
||||
func (m *KmsListKeysResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateResults(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsListKeysResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Results); i++ {
|
||||
|
||||
if m.Results[i] != nil {
|
||||
if err := m.Results[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsListKeysResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsListKeysResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsListKeysResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
28
models/kms_list_policies_request.go
Normal file
28
models/kms_list_policies_request.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// KmsListPoliciesRequest kms list policies request
|
||||
//
|
||||
// swagger:model kmsListPoliciesRequest
|
||||
type KmsListPoliciesRequest interface{}
|
||||
133
models/kms_list_policies_response.go
Normal file
133
models/kms_list_policies_response.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsListPoliciesResponse kms list policies response
|
||||
//
|
||||
// swagger:model kmsListPoliciesResponse
|
||||
type KmsListPoliciesResponse struct {
|
||||
|
||||
// results
|
||||
Results []*KmsPolicyInfo `json:"results"`
|
||||
}
|
||||
|
||||
// Validate validates this kms list policies response
|
||||
func (m *KmsListPoliciesResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateResults(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsListPoliciesResponse) validateResults(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Results) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Results); i++ {
|
||||
if swag.IsZero(m.Results[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Results[i] != nil {
|
||||
if err := m.Results[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this kms list policies response based on the context it is used
|
||||
func (m *KmsListPoliciesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateResults(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsListPoliciesResponse) contextValidateResults(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Results); i++ {
|
||||
|
||||
if m.Results[i] != nil {
|
||||
if err := m.Results[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsListPoliciesResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsListPoliciesResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsListPoliciesResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
331
models/kms_metrics_response.go
Normal file
331
models/kms_metrics_response.go
Normal file
@@ -0,0 +1,331 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// KmsMetricsResponse kms metrics response
|
||||
//
|
||||
// swagger:model kmsMetricsResponse
|
||||
type KmsMetricsResponse struct {
|
||||
|
||||
// audit events
|
||||
// Required: true
|
||||
AuditEvents *int64 `json:"auditEvents"`
|
||||
|
||||
// cpus
|
||||
// Required: true
|
||||
Cpus *int64 `json:"cpus"`
|
||||
|
||||
// error events
|
||||
// Required: true
|
||||
ErrorEvents *int64 `json:"errorEvents"`
|
||||
|
||||
// heap alloc
|
||||
// Required: true
|
||||
HeapAlloc *int64 `json:"heapAlloc"`
|
||||
|
||||
// heap objects
|
||||
HeapObjects int64 `json:"heapObjects,omitempty"`
|
||||
|
||||
// latency histogram
|
||||
// Required: true
|
||||
LatencyHistogram *KmsLatencyHistogram `json:"latencyHistogram"`
|
||||
|
||||
// request active
|
||||
// Required: true
|
||||
RequestActive *int64 `json:"requestActive"`
|
||||
|
||||
// request err
|
||||
// Required: true
|
||||
RequestErr *int64 `json:"requestErr"`
|
||||
|
||||
// request fail
|
||||
// Required: true
|
||||
RequestFail *int64 `json:"requestFail"`
|
||||
|
||||
// request o k
|
||||
// Required: true
|
||||
RequestOK *int64 `json:"requestOK"`
|
||||
|
||||
// stack alloc
|
||||
// Required: true
|
||||
StackAlloc *int64 `json:"stackAlloc"`
|
||||
|
||||
// threads
|
||||
// Required: true
|
||||
Threads *int64 `json:"threads"`
|
||||
|
||||
// uptime
|
||||
// Required: true
|
||||
Uptime *int64 `json:"uptime"`
|
||||
|
||||
// usable c p us
|
||||
// Required: true
|
||||
UsableCPUs *int64 `json:"usableCPUs"`
|
||||
}
|
||||
|
||||
// Validate validates this kms metrics response
|
||||
func (m *KmsMetricsResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateAuditEvents(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateCpus(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateErrorEvents(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateHeapAlloc(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateLatencyHistogram(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateRequestActive(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateRequestErr(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateRequestFail(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateRequestOK(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateStackAlloc(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateThreads(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateUptime(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateUsableCPUs(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateAuditEvents(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("auditEvents", "body", m.AuditEvents); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateCpus(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("cpus", "body", m.Cpus); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateErrorEvents(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("errorEvents", "body", m.ErrorEvents); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateHeapAlloc(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("heapAlloc", "body", m.HeapAlloc); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateLatencyHistogram(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("latencyHistogram", "body", m.LatencyHistogram); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.LatencyHistogram != nil {
|
||||
if err := m.LatencyHistogram.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("latencyHistogram")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("latencyHistogram")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateRequestActive(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("requestActive", "body", m.RequestActive); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateRequestErr(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("requestErr", "body", m.RequestErr); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateRequestFail(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("requestFail", "body", m.RequestFail); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateRequestOK(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("requestOK", "body", m.RequestOK); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateStackAlloc(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("stackAlloc", "body", m.StackAlloc); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateThreads(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("threads", "body", m.Threads); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateUptime(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("uptime", "body", m.Uptime); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) validateUsableCPUs(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("usableCPUs", "body", m.UsableCPUs); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this kms metrics response based on the context it is used
|
||||
func (m *KmsMetricsResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateLatencyHistogram(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsMetricsResponse) contextValidateLatencyHistogram(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.LatencyHistogram != nil {
|
||||
if err := m.LatencyHistogram.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("latencyHistogram")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("latencyHistogram")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsMetricsResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsMetricsResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsMetricsResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
73
models/kms_policy_info.go
Normal file
73
models/kms_policy_info.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsPolicyInfo kms policy info
|
||||
//
|
||||
// swagger:model kmsPolicyInfo
|
||||
type KmsPolicyInfo struct {
|
||||
|
||||
// created at
|
||||
CreatedAt string `json:"createdAt,omitempty"`
|
||||
|
||||
// created by
|
||||
CreatedBy string `json:"createdBy,omitempty"`
|
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms policy info
|
||||
func (m *KmsPolicyInfo) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms policy info based on context it is used
|
||||
func (m *KmsPolicyInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsPolicyInfo) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsPolicyInfo) UnmarshalBinary(b []byte) error {
|
||||
var res KmsPolicyInfo
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
94
models/kms_set_policy_request.go
Normal file
94
models/kms_set_policy_request.go
Normal file
@@ -0,0 +1,94 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// KmsSetPolicyRequest kms set policy request
|
||||
//
|
||||
// swagger:model kmsSetPolicyRequest
|
||||
type KmsSetPolicyRequest struct {
|
||||
|
||||
// allow
|
||||
Allow []string `json:"allow"`
|
||||
|
||||
// deny
|
||||
Deny []string `json:"deny"`
|
||||
|
||||
// policy
|
||||
// Required: true
|
||||
Policy *string `json:"policy"`
|
||||
}
|
||||
|
||||
// Validate validates this kms set policy request
|
||||
func (m *KmsSetPolicyRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validatePolicy(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsSetPolicyRequest) validatePolicy(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("policy", "body", m.Policy); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms set policy request based on context it is used
|
||||
func (m *KmsSetPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsSetPolicyRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsSetPolicyRequest) UnmarshalBinary(b []byte) error {
|
||||
var res KmsSetPolicyRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
28
models/kms_status_request.go
Normal file
28
models/kms_status_request.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// KmsStatusRequest kms status request
|
||||
//
|
||||
// swagger:model kmsStatusRequest
|
||||
type KmsStatusRequest interface{}
|
||||
139
models/kms_status_response.go
Normal file
139
models/kms_status_response.go
Normal file
@@ -0,0 +1,139 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsStatusResponse kms status response
|
||||
//
|
||||
// swagger:model kmsStatusResponse
|
||||
type KmsStatusResponse struct {
|
||||
|
||||
// default key ID
|
||||
DefaultKeyID string `json:"defaultKeyID,omitempty"`
|
||||
|
||||
// endpoints
|
||||
Endpoints []*KmsEndpoint `json:"endpoints"`
|
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms status response
|
||||
func (m *KmsStatusResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateEndpoints(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsStatusResponse) validateEndpoints(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Endpoints) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Endpoints); i++ {
|
||||
if swag.IsZero(m.Endpoints[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Endpoints[i] != nil {
|
||||
if err := m.Endpoints[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("endpoints" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("endpoints" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this kms status response based on the context it is used
|
||||
func (m *KmsStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateEndpoints(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *KmsStatusResponse) contextValidateEndpoints(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Endpoints); i++ {
|
||||
|
||||
if m.Endpoints[i] != nil {
|
||||
if err := m.Endpoints[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("endpoints" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("endpoints" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsStatusResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsStatusResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsStatusResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
67
models/kms_version_response.go
Normal file
67
models/kms_version_response.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// KmsVersionResponse kms version response
|
||||
//
|
||||
// swagger:model kmsVersionResponse
|
||||
type KmsVersionResponse struct {
|
||||
|
||||
// version
|
||||
Version string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this kms version response
|
||||
func (m *KmsVersionResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this kms version response based on context it is used
|
||||
func (m *KmsVersionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *KmsVersionResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *KmsVersionResponse) UnmarshalBinary(b []byte) error {
|
||||
var res KmsVersionResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -37,12 +37,18 @@ import (
|
||||
// swagger:model loginDetails
|
||||
type LoginDetails struct {
|
||||
|
||||
// display names
|
||||
DisplayNames []string `json:"displayNames"`
|
||||
|
||||
// is direct p v
|
||||
IsDirectPV bool `json:"isDirectPV,omitempty"`
|
||||
|
||||
// login strategy
|
||||
// Enum: [form redirect service-account redirect-service-account]
|
||||
LoginStrategy string `json:"loginStrategy,omitempty"`
|
||||
|
||||
// redirect
|
||||
Redirect string `json:"redirect,omitempty"`
|
||||
Redirect []string `json:"redirect"`
|
||||
}
|
||||
|
||||
// Validate validates this login details
|
||||
|
||||
@@ -28,7 +28,6 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// LoginRequest login request
|
||||
@@ -37,48 +36,32 @@ import (
|
||||
type LoginRequest struct {
|
||||
|
||||
// access key
|
||||
// Required: true
|
||||
AccessKey *string `json:"accessKey"`
|
||||
AccessKey string `json:"accessKey,omitempty"`
|
||||
|
||||
// features
|
||||
Features *LoginRequestFeatures `json:"features,omitempty"`
|
||||
|
||||
// secret key
|
||||
// Required: true
|
||||
SecretKey *string `json:"secretKey"`
|
||||
SecretKey string `json:"secretKey,omitempty"`
|
||||
|
||||
// sts
|
||||
Sts string `json:"sts,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this login request
|
||||
func (m *LoginRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateAccessKey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateFeatures(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecretKey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoginRequest) validateAccessKey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("accessKey", "body", m.AccessKey); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoginRequest) validateFeatures(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Features) { // not required
|
||||
return nil
|
||||
@@ -98,15 +81,6 @@ func (m *LoginRequest) validateFeatures(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoginRequest) validateSecretKey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("secretKey", "body", m.SecretKey); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this login request based on the context it is used
|
||||
func (m *LoginRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
70
models/mp_integration.go
Normal file
70
models/mp_integration.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// MpIntegration mp integration
|
||||
//
|
||||
// swagger:model mpIntegration
|
||||
type MpIntegration struct {
|
||||
|
||||
// email
|
||||
Email string `json:"email,omitempty"`
|
||||
|
||||
// is in e u
|
||||
IsInEU bool `json:"isInEU,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this mp integration
|
||||
func (m *MpIntegration) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this mp integration based on context it is used
|
||||
func (m *MpIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *MpIntegration) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *MpIntegration) UnmarshalBinary(b []byte) error {
|
||||
var res MpIntegration
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -37,6 +37,9 @@ import (
|
||||
// swagger:model operatorSessionResponse
|
||||
type OperatorSessionResponse struct {
|
||||
|
||||
// direct p v
|
||||
DirectPV bool `json:"directPV,omitempty"`
|
||||
|
||||
// features
|
||||
Features []string `json:"features"`
|
||||
|
||||
|
||||
67
models/operator_subnet_api_key.go
Normal file
67
models/operator_subnet_api_key.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// OperatorSubnetAPIKey operator subnet API key
|
||||
//
|
||||
// swagger:model operatorSubnetAPIKey
|
||||
type OperatorSubnetAPIKey struct {
|
||||
|
||||
// api key
|
||||
APIKey string `json:"apiKey,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet API key
|
||||
func (m *OperatorSubnetAPIKey) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet API key based on context it is used
|
||||
func (m *OperatorSubnetAPIKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetAPIKey) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetAPIKey) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetAPIKey
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
122
models/operator_subnet_login_m_f_a_request.go
Normal file
122
models/operator_subnet_login_m_f_a_request.go
Normal file
@@ -0,0 +1,122 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginMFARequest operator subnet login m f a request
|
||||
//
|
||||
// swagger:model operatorSubnetLoginMFARequest
|
||||
type OperatorSubnetLoginMFARequest struct {
|
||||
|
||||
// mfa token
|
||||
// Required: true
|
||||
MfaToken *string `json:"mfa_token"`
|
||||
|
||||
// otp
|
||||
// Required: true
|
||||
Otp *string `json:"otp"`
|
||||
|
||||
// username
|
||||
// Required: true
|
||||
Username *string `json:"username"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet login m f a request
|
||||
func (m *OperatorSubnetLoginMFARequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateMfaToken(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateOtp(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateUsername(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *OperatorSubnetLoginMFARequest) validateMfaToken(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("mfa_token", "body", m.MfaToken); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *OperatorSubnetLoginMFARequest) validateOtp(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("otp", "body", m.Otp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *OperatorSubnetLoginMFARequest) validateUsername(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("username", "body", m.Username); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet login m f a request based on context it is used
|
||||
func (m *OperatorSubnetLoginMFARequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginMFARequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginMFARequest) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetLoginMFARequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
70
models/operator_subnet_login_request.go
Normal file
70
models/operator_subnet_login_request.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginRequest operator subnet login request
|
||||
//
|
||||
// swagger:model operatorSubnetLoginRequest
|
||||
type OperatorSubnetLoginRequest struct {
|
||||
|
||||
// password
|
||||
Password string `json:"password,omitempty"`
|
||||
|
||||
// username
|
||||
Username string `json:"username,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet login request
|
||||
func (m *OperatorSubnetLoginRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet login request based on context it is used
|
||||
func (m *OperatorSubnetLoginRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginRequest) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetLoginRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
70
models/operator_subnet_login_response.go
Normal file
70
models/operator_subnet_login_response.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginResponse operator subnet login response
|
||||
//
|
||||
// swagger:model operatorSubnetLoginResponse
|
||||
type OperatorSubnetLoginResponse struct {
|
||||
|
||||
// access token
|
||||
AccessToken string `json:"access_token,omitempty"`
|
||||
|
||||
// mfa token
|
||||
MfaToken string `json:"mfa_token,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet login response
|
||||
func (m *OperatorSubnetLoginResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet login response based on context it is used
|
||||
func (m *OperatorSubnetLoginResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginResponse) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetLoginResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
67
models/operator_subnet_register_api_key_response.go
Normal file
67
models/operator_subnet_register_api_key_response.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// OperatorSubnetRegisterAPIKeyResponse operator subnet register API key response
|
||||
//
|
||||
// swagger:model operatorSubnetRegisterAPIKeyResponse
|
||||
type OperatorSubnetRegisterAPIKeyResponse struct {
|
||||
|
||||
// registered
|
||||
Registered bool `json:"registered,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet register API key response
|
||||
func (m *OperatorSubnetRegisterAPIKeyResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet register API key response based on context it is used
|
||||
func (m *OperatorSubnetRegisterAPIKeyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetRegisterAPIKeyResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetRegisterAPIKeyResponse) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetRegisterAPIKeyResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -46,8 +46,14 @@ type Principal struct {
|
||||
// account access key
|
||||
AccountAccessKey string `json:"accountAccessKey,omitempty"`
|
||||
|
||||
// custom style ob
|
||||
CustomStyleOb string `json:"customStyleOb,omitempty"`
|
||||
|
||||
// hm
|
||||
Hm bool `json:"hm,omitempty"`
|
||||
|
||||
// ob
|
||||
Ob bool `json:"ob,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this principal
|
||||
|
||||
@@ -29,10 +29,10 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// CsiFormatErrorResponse csi format error response
|
||||
// PvFormatErrorResponse pv format error response
|
||||
//
|
||||
// swagger:model csiFormatErrorResponse
|
||||
type CsiFormatErrorResponse struct {
|
||||
// swagger:model pvFormatErrorResponse
|
||||
type PvFormatErrorResponse struct {
|
||||
|
||||
// drive
|
||||
Drive string `json:"drive,omitempty"`
|
||||
@@ -44,18 +44,18 @@ type CsiFormatErrorResponse struct {
|
||||
Node string `json:"node,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this csi format error response
|
||||
func (m *CsiFormatErrorResponse) Validate(formats strfmt.Registry) error {
|
||||
// Validate validates this pv format error response
|
||||
func (m *PvFormatErrorResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this csi format error response based on context it is used
|
||||
func (m *CsiFormatErrorResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
// ContextValidate validates this pv format error response based on context it is used
|
||||
func (m *PvFormatErrorResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *CsiFormatErrorResponse) MarshalBinary() ([]byte, error) {
|
||||
func (m *PvFormatErrorResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -63,8 +63,8 @@ func (m *CsiFormatErrorResponse) MarshalBinary() ([]byte, error) {
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *CsiFormatErrorResponse) UnmarshalBinary(b []byte) error {
|
||||
var res CsiFormatErrorResponse
|
||||
func (m *PvFormatErrorResponse) UnmarshalBinary(b []byte) error {
|
||||
var res PvFormatErrorResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -37,8 +37,10 @@ import (
|
||||
type SecurityContext struct {
|
||||
|
||||
// fs group
|
||||
// Required: true
|
||||
FsGroup *string `json:"fsGroup"`
|
||||
FsGroup string `json:"fsGroup,omitempty"`
|
||||
|
||||
// fs group change policy
|
||||
FsGroupChangePolicy string `json:"fsGroupChangePolicy,omitempty"`
|
||||
|
||||
// run as group
|
||||
// Required: true
|
||||
@@ -57,10 +59,6 @@ type SecurityContext struct {
|
||||
func (m *SecurityContext) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateFsGroup(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateRunAsGroup(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -79,15 +77,6 @@ func (m *SecurityContext) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SecurityContext) validateFsGroup(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("fsGroup", "body", m.FsGroup); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SecurityContext) validateRunAsGroup(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("runAsGroup", "body", m.RunAsGroup); err != nil {
|
||||
|
||||
@@ -41,9 +41,15 @@ type SessionResponse struct {
|
||||
// allow resources
|
||||
AllowResources []*PermissionResource `json:"allowResources"`
|
||||
|
||||
// custom styles
|
||||
CustomStyles string `json:"customStyles,omitempty"`
|
||||
|
||||
// distributed mode
|
||||
DistributedMode bool `json:"distributedMode,omitempty"`
|
||||
|
||||
// env constants
|
||||
EnvConstants *EnvironmentConstants `json:"envConstants,omitempty"`
|
||||
|
||||
// features
|
||||
Features []string `json:"features"`
|
||||
|
||||
@@ -53,6 +59,9 @@ type SessionResponse struct {
|
||||
// permissions
|
||||
Permissions map[string][]string `json:"permissions,omitempty"`
|
||||
|
||||
// server end point
|
||||
ServerEndPoint string `json:"serverEndPoint,omitempty"`
|
||||
|
||||
// status
|
||||
// Enum: [ok]
|
||||
Status string `json:"status,omitempty"`
|
||||
@@ -66,6 +75,10 @@ func (m *SessionResponse) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateEnvConstants(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateStatus(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -102,6 +115,25 @@ func (m *SessionResponse) validateAllowResources(formats strfmt.Registry) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SessionResponse) validateEnvConstants(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.EnvConstants) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.EnvConstants != nil {
|
||||
if err := m.EnvConstants.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("envConstants")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("envConstants")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var sessionResponseTypeStatusPropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
@@ -149,6 +181,10 @@ func (m *SessionResponse) ContextValidate(ctx context.Context, formats strfmt.Re
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateEnvConstants(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -175,6 +211,22 @@ func (m *SessionResponse) contextValidateAllowResources(ctx context.Context, for
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SessionResponse) contextValidateEnvConstants(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.EnvConstants != nil {
|
||||
if err := m.EnvConstants.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("envConstants")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("envConstants")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SessionResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
70
models/set_administrators_request.go
Normal file
70
models/set_administrators_request.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// SetAdministratorsRequest set administrators request
|
||||
//
|
||||
// swagger:model setAdministratorsRequest
|
||||
type SetAdministratorsRequest struct {
|
||||
|
||||
// group dns
|
||||
GroupDNS []string `json:"group_dns"`
|
||||
|
||||
// user dns
|
||||
UserDNS []string `json:"user_dns"`
|
||||
}
|
||||
|
||||
// Validate validates this set administrators request
|
||||
func (m *SetAdministratorsRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this set administrators request based on context it is used
|
||||
func (m *SetAdministratorsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SetAdministratorsRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *SetAdministratorsRequest) UnmarshalBinary(b []byte) error {
|
||||
var res SetAdministratorsRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
133
models/tenant_configuration_response.go
Normal file
133
models/tenant_configuration_response.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// TenantConfigurationResponse tenant configuration response
|
||||
//
|
||||
// swagger:model tenantConfigurationResponse
|
||||
type TenantConfigurationResponse struct {
|
||||
|
||||
// environment variables
|
||||
EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables"`
|
||||
}
|
||||
|
||||
// Validate validates this tenant configuration response
|
||||
func (m *TenantConfigurationResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateEnvironmentVariables(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantConfigurationResponse) validateEnvironmentVariables(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.EnvironmentVariables) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.EnvironmentVariables); i++ {
|
||||
if swag.IsZero(m.EnvironmentVariables[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.EnvironmentVariables[i] != nil {
|
||||
if err := m.EnvironmentVariables[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this tenant configuration response based on the context it is used
|
||||
func (m *TenantConfigurationResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateEnvironmentVariables(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantConfigurationResponse) contextValidateEnvironmentVariables(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.EnvironmentVariables); i++ {
|
||||
|
||||
if m.EnvironmentVariables[i] != nil {
|
||||
if err := m.EnvironmentVariables[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TenantConfigurationResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *TenantConfigurationResponse) UnmarshalBinary(b []byte) error {
|
||||
var res TenantConfigurationResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -45,12 +45,18 @@ type TenantLogs struct {
|
||||
// db image
|
||||
DbImage string `json:"dbImage,omitempty"`
|
||||
|
||||
// db init image
|
||||
DbInitImage string `json:"dbInitImage,omitempty"`
|
||||
|
||||
// db labels
|
||||
DbLabels []*Label `json:"dbLabels"`
|
||||
|
||||
// db node selector
|
||||
DbNodeSelector []*NodeSelector `json:"dbNodeSelector"`
|
||||
|
||||
// db security context
|
||||
DbSecurityContext *SecurityContext `json:"dbSecurityContext,omitempty"`
|
||||
|
||||
// db service account name
|
||||
DbServiceAccountName string `json:"dbServiceAccountName,omitempty"`
|
||||
|
||||
@@ -81,6 +87,9 @@ type TenantLogs struct {
|
||||
// node selector
|
||||
NodeSelector []*NodeSelector `json:"nodeSelector"`
|
||||
|
||||
// security context
|
||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||
|
||||
// service account name
|
||||
ServiceAccountName string `json:"serviceAccountName,omitempty"`
|
||||
}
|
||||
@@ -105,6 +114,10 @@ func (m *TenantLogs) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateDbSecurityContext(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateLabels(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -113,6 +126,10 @@ func (m *TenantLogs) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecurityContext(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -223,6 +240,25 @@ func (m *TenantLogs) validateDbNodeSelector(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) validateDbSecurityContext(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.DbSecurityContext) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.DbSecurityContext != nil {
|
||||
if err := m.DbSecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("dbSecurityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("dbSecurityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) validateLabels(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Labels) { // not required
|
||||
return nil
|
||||
@@ -275,6 +311,25 @@ func (m *TenantLogs) validateNodeSelector(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) validateSecurityContext(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.SecurityContext) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this tenant logs based on the context it is used
|
||||
func (m *TenantLogs) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
@@ -295,6 +350,10 @@ func (m *TenantLogs) ContextValidate(ctx context.Context, formats strfmt.Registr
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateDbSecurityContext(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateLabels(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -303,6 +362,10 @@ func (m *TenantLogs) ContextValidate(ctx context.Context, formats strfmt.Registr
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateSecurityContext(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -389,6 +452,22 @@ func (m *TenantLogs) contextValidateDbNodeSelector(ctx context.Context, formats
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) contextValidateDbSecurityContext(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.DbSecurityContext != nil {
|
||||
if err := m.DbSecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("dbSecurityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("dbSecurityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Labels); i++ {
|
||||
@@ -429,6 +508,22 @@ func (m *TenantLogs) contextValidateNodeSelector(ctx context.Context, formats st
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TenantLogs) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -63,6 +63,9 @@ type TenantMonitoringInfo struct {
|
||||
// prometheus enabled
|
||||
PrometheusEnabled bool `json:"prometheusEnabled,omitempty"`
|
||||
|
||||
// security context
|
||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||
|
||||
// service account name
|
||||
ServiceAccountName string `json:"serviceAccountName,omitempty"`
|
||||
|
||||
@@ -92,6 +95,10 @@ func (m *TenantMonitoringInfo) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecurityContext(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -176,6 +183,25 @@ func (m *TenantMonitoringInfo) validateNodeSelector(formats strfmt.Registry) err
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantMonitoringInfo) validateSecurityContext(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.SecurityContext) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this tenant monitoring info based on the context it is used
|
||||
func (m *TenantMonitoringInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
@@ -192,6 +218,10 @@ func (m *TenantMonitoringInfo) ContextValidate(ctx context.Context, formats strf
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateSecurityContext(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -258,6 +288,22 @@ func (m *TenantMonitoringInfo) contextValidateNodeSelector(ctx context.Context,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantMonitoringInfo) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TenantMonitoringInfo) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -41,6 +41,9 @@ type TenantSecurityResponse struct {
|
||||
|
||||
// custom certificates
|
||||
CustomCertificates *TenantSecurityResponseCustomCertificates `json:"customCertificates,omitempty"`
|
||||
|
||||
// security context
|
||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this tenant security response
|
||||
@@ -51,6 +54,10 @@ func (m *TenantSecurityResponse) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecurityContext(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -76,6 +83,25 @@ func (m *TenantSecurityResponse) validateCustomCertificates(formats strfmt.Regis
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantSecurityResponse) validateSecurityContext(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.SecurityContext) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this tenant security response based on the context it is used
|
||||
func (m *TenantSecurityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
@@ -84,6 +110,10 @@ func (m *TenantSecurityResponse) ContextValidate(ctx context.Context, formats st
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateSecurityContext(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -106,6 +136,22 @@ func (m *TenantSecurityResponse) contextValidateCustomCertificates(ctx context.C
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantSecurityResponse) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TenantSecurityResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
@@ -129,6 +175,9 @@ func (m *TenantSecurityResponse) UnmarshalBinary(b []byte) error {
|
||||
// swagger:model TenantSecurityResponseCustomCertificates
|
||||
type TenantSecurityResponseCustomCertificates struct {
|
||||
|
||||
// client
|
||||
Client []*CertificateInfo `json:"client"`
|
||||
|
||||
// minio
|
||||
Minio []*CertificateInfo `json:"minio"`
|
||||
|
||||
@@ -140,6 +189,10 @@ type TenantSecurityResponseCustomCertificates struct {
|
||||
func (m *TenantSecurityResponseCustomCertificates) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateClient(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateMinio(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -154,6 +207,32 @@ func (m *TenantSecurityResponseCustomCertificates) Validate(formats strfmt.Regis
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantSecurityResponseCustomCertificates) validateClient(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Client) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Client); i++ {
|
||||
if swag.IsZero(m.Client[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Client[i] != nil {
|
||||
if err := m.Client[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("customCertificates" + "." + "client" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("customCertificates" + "." + "client" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantSecurityResponseCustomCertificates) validateMinio(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Minio) { // not required
|
||||
return nil
|
||||
@@ -210,6 +289,10 @@ func (m *TenantSecurityResponseCustomCertificates) validateMinioCAs(formats strf
|
||||
func (m *TenantSecurityResponseCustomCertificates) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateClient(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateMinio(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -224,6 +307,26 @@ func (m *TenantSecurityResponseCustomCertificates) ContextValidate(ctx context.C
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantSecurityResponseCustomCertificates) contextValidateClient(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Client); i++ {
|
||||
|
||||
if m.Client[i] != nil {
|
||||
if err := m.Client[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("customCertificates" + "." + "client" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("customCertificates" + "." + "client" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantSecurityResponseCustomCertificates) contextValidateMinio(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Minio); i++ {
|
||||
|
||||
@@ -43,11 +43,14 @@ type Tier struct {
|
||||
// gcs
|
||||
Gcs *TierGcs `json:"gcs,omitempty"`
|
||||
|
||||
// minio
|
||||
Minio *TierMinio `json:"minio,omitempty"`
|
||||
|
||||
// s3
|
||||
S3 *TierS3 `json:"s3,omitempty"`
|
||||
|
||||
// type
|
||||
// Enum: [s3 gcs azure unsupported]
|
||||
// Enum: [s3 gcs azure minio unsupported]
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
@@ -63,6 +66,10 @@ func (m *Tier) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateMinio(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateS3(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -115,6 +122,25 @@ func (m *Tier) validateGcs(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Tier) validateMinio(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Minio) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.Minio != nil {
|
||||
if err := m.Minio.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("minio")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("minio")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Tier) validateS3(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.S3) { // not required
|
||||
return nil
|
||||
@@ -138,7 +164,7 @@ var tierTypeTypePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["s3","gcs","azure","unsupported"]`), &res); err != nil {
|
||||
if err := json.Unmarshal([]byte(`["s3","gcs","azure","minio","unsupported"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
@@ -157,6 +183,9 @@ const (
|
||||
// TierTypeAzure captures enum value "azure"
|
||||
TierTypeAzure string = "azure"
|
||||
|
||||
// TierTypeMinio captures enum value "minio"
|
||||
TierTypeMinio string = "minio"
|
||||
|
||||
// TierTypeUnsupported captures enum value "unsupported"
|
||||
TierTypeUnsupported string = "unsupported"
|
||||
)
|
||||
@@ -194,6 +223,10 @@ func (m *Tier) ContextValidate(ctx context.Context, formats strfmt.Registry) err
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateMinio(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateS3(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -236,6 +269,22 @@ func (m *Tier) contextValidateGcs(ctx context.Context, formats strfmt.Registry)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Tier) contextValidateMinio(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Minio != nil {
|
||||
if err := m.Minio.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("minio")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("minio")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Tier) contextValidateS3(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.S3 != nil {
|
||||
|
||||
97
models/tier_minio.go
Normal file
97
models/tier_minio.go
Normal file
@@ -0,0 +1,97 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// TierMinio tier minio
|
||||
//
|
||||
// swagger:model tier_minio
|
||||
type TierMinio struct {
|
||||
|
||||
// accesskey
|
||||
Accesskey string `json:"accesskey,omitempty"`
|
||||
|
||||
// bucket
|
||||
Bucket string `json:"bucket,omitempty"`
|
||||
|
||||
// endpoint
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
|
||||
// name
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// objects
|
||||
Objects string `json:"objects,omitempty"`
|
||||
|
||||
// prefix
|
||||
Prefix string `json:"prefix,omitempty"`
|
||||
|
||||
// region
|
||||
Region string `json:"region,omitempty"`
|
||||
|
||||
// secretkey
|
||||
Secretkey string `json:"secretkey,omitempty"`
|
||||
|
||||
// storageclass
|
||||
Storageclass string `json:"storageclass,omitempty"`
|
||||
|
||||
// usage
|
||||
Usage string `json:"usage,omitempty"`
|
||||
|
||||
// versions
|
||||
Versions string `json:"versions,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this tier minio
|
||||
func (m *TierMinio) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this tier minio based on context it is used
|
||||
func (m *TierMinio) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TierMinio) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *TierMinio) UnmarshalBinary(b []byte) error {
|
||||
var res TierMinio
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -36,18 +36,25 @@ import (
|
||||
// swagger:model tlsConfiguration
|
||||
type TLSConfiguration struct {
|
||||
|
||||
// ca certificates
|
||||
CaCertificates []string `json:"ca_certificates"`
|
||||
// minio c as certificates
|
||||
MinioCAsCertificates []string `json:"minioCAsCertificates"`
|
||||
|
||||
// minio
|
||||
Minio []*KeyPairConfiguration `json:"minio"`
|
||||
// minio client certificates
|
||||
MinioClientCertificates []*KeyPairConfiguration `json:"minioClientCertificates"`
|
||||
|
||||
// minio server certificates
|
||||
MinioServerCertificates []*KeyPairConfiguration `json:"minioServerCertificates"`
|
||||
}
|
||||
|
||||
// Validate validates this tls configuration
|
||||
func (m *TLSConfiguration) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateMinio(formats); err != nil {
|
||||
if err := m.validateMinioClientCertificates(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateMinioServerCertificates(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
@@ -57,22 +64,48 @@ func (m *TLSConfiguration) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TLSConfiguration) validateMinio(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Minio) { // not required
|
||||
func (m *TLSConfiguration) validateMinioClientCertificates(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.MinioClientCertificates) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Minio); i++ {
|
||||
if swag.IsZero(m.Minio[i]) { // not required
|
||||
for i := 0; i < len(m.MinioClientCertificates); i++ {
|
||||
if swag.IsZero(m.MinioClientCertificates[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Minio[i] != nil {
|
||||
if err := m.Minio[i].Validate(formats); err != nil {
|
||||
if m.MinioClientCertificates[i] != nil {
|
||||
if err := m.MinioClientCertificates[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("minio" + "." + strconv.Itoa(i))
|
||||
return ve.ValidateName("minioClientCertificates" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("minio" + "." + strconv.Itoa(i))
|
||||
return ce.ValidateName("minioClientCertificates" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TLSConfiguration) validateMinioServerCertificates(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.MinioServerCertificates) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.MinioServerCertificates); i++ {
|
||||
if swag.IsZero(m.MinioServerCertificates[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.MinioServerCertificates[i] != nil {
|
||||
if err := m.MinioServerCertificates[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("minioServerCertificates" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("minioServerCertificates" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -87,7 +120,11 @@ func (m *TLSConfiguration) validateMinio(formats strfmt.Registry) error {
|
||||
func (m *TLSConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateMinio(ctx, formats); err != nil {
|
||||
if err := m.contextValidateMinioClientCertificates(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateMinioServerCertificates(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
@@ -97,16 +134,36 @@ func (m *TLSConfiguration) ContextValidate(ctx context.Context, formats strfmt.R
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TLSConfiguration) contextValidateMinio(ctx context.Context, formats strfmt.Registry) error {
|
||||
func (m *TLSConfiguration) contextValidateMinioClientCertificates(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Minio); i++ {
|
||||
for i := 0; i < len(m.MinioClientCertificates); i++ {
|
||||
|
||||
if m.Minio[i] != nil {
|
||||
if err := m.Minio[i].ContextValidate(ctx, formats); err != nil {
|
||||
if m.MinioClientCertificates[i] != nil {
|
||||
if err := m.MinioClientCertificates[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("minio" + "." + strconv.Itoa(i))
|
||||
return ve.ValidateName("minioClientCertificates" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("minio" + "." + strconv.Itoa(i))
|
||||
return ce.ValidateName("minioClientCertificates" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TLSConfiguration) contextValidateMinioServerCertificates(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.MinioServerCertificates); i++ {
|
||||
|
||||
if m.MinioServerCertificates[i] != nil {
|
||||
if err := m.MinioServerCertificates[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("minioServerCertificates" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("minioServerCertificates" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
136
models/update_tenant_configuration_request.go
Normal file
136
models/update_tenant_configuration_request.go
Normal file
@@ -0,0 +1,136 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// UpdateTenantConfigurationRequest update tenant configuration request
|
||||
//
|
||||
// swagger:model updateTenantConfigurationRequest
|
||||
type UpdateTenantConfigurationRequest struct {
|
||||
|
||||
// environment variables
|
||||
EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables"`
|
||||
|
||||
// keys to be deleted
|
||||
KeysToBeDeleted []string `json:"keysToBeDeleted"`
|
||||
}
|
||||
|
||||
// Validate validates this update tenant configuration request
|
||||
func (m *UpdateTenantConfigurationRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateEnvironmentVariables(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateTenantConfigurationRequest) validateEnvironmentVariables(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.EnvironmentVariables) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.EnvironmentVariables); i++ {
|
||||
if swag.IsZero(m.EnvironmentVariables[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.EnvironmentVariables[i] != nil {
|
||||
if err := m.EnvironmentVariables[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this update tenant configuration request based on the context it is used
|
||||
func (m *UpdateTenantConfigurationRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateEnvironmentVariables(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateTenantConfigurationRequest) contextValidateEnvironmentVariables(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.EnvironmentVariables); i++ {
|
||||
|
||||
if m.EnvironmentVariables[i] != nil {
|
||||
if err := m.EnvironmentVariables[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *UpdateTenantConfigurationRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *UpdateTenantConfigurationRequest) UnmarshalBinary(b []byte) error {
|
||||
var res UpdateTenantConfigurationRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -41,6 +41,9 @@ type UpdateTenantSecurityRequest struct {
|
||||
|
||||
// custom certificates
|
||||
CustomCertificates *UpdateTenantSecurityRequestCustomCertificates `json:"customCertificates,omitempty"`
|
||||
|
||||
// security context
|
||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this update tenant security request
|
||||
@@ -51,6 +54,10 @@ func (m *UpdateTenantSecurityRequest) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecurityContext(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -76,6 +83,25 @@ func (m *UpdateTenantSecurityRequest) validateCustomCertificates(formats strfmt.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateTenantSecurityRequest) validateSecurityContext(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.SecurityContext) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this update tenant security request based on the context it is used
|
||||
func (m *UpdateTenantSecurityRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
@@ -84,6 +110,10 @@ func (m *UpdateTenantSecurityRequest) ContextValidate(ctx context.Context, forma
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateSecurityContext(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -106,6 +136,22 @@ func (m *UpdateTenantSecurityRequest) contextValidateCustomCertificates(ctx cont
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateTenantSecurityRequest) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *UpdateTenantSecurityRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
@@ -129,11 +175,14 @@ func (m *UpdateTenantSecurityRequest) UnmarshalBinary(b []byte) error {
|
||||
// swagger:model UpdateTenantSecurityRequestCustomCertificates
|
||||
type UpdateTenantSecurityRequestCustomCertificates struct {
|
||||
|
||||
// minio
|
||||
Minio []*KeyPairConfiguration `json:"minio"`
|
||||
// minio c as certificates
|
||||
MinioCAsCertificates []string `json:"minioCAsCertificates"`
|
||||
|
||||
// minio c as
|
||||
MinioCAs []string `json:"minioCAs"`
|
||||
// minio client certificates
|
||||
MinioClientCertificates []*KeyPairConfiguration `json:"minioClientCertificates"`
|
||||
|
||||
// minio server certificates
|
||||
MinioServerCertificates []*KeyPairConfiguration `json:"minioServerCertificates"`
|
||||
|
||||
// secrets to be deleted
|
||||
SecretsToBeDeleted []string `json:"secretsToBeDeleted"`
|
||||
@@ -143,7 +192,11 @@ type UpdateTenantSecurityRequestCustomCertificates struct {
|
||||
func (m *UpdateTenantSecurityRequestCustomCertificates) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateMinio(formats); err != nil {
|
||||
if err := m.validateMinioClientCertificates(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateMinioServerCertificates(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
@@ -153,22 +206,48 @@ func (m *UpdateTenantSecurityRequestCustomCertificates) Validate(formats strfmt.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateTenantSecurityRequestCustomCertificates) validateMinio(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Minio) { // not required
|
||||
func (m *UpdateTenantSecurityRequestCustomCertificates) validateMinioClientCertificates(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.MinioClientCertificates) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Minio); i++ {
|
||||
if swag.IsZero(m.Minio[i]) { // not required
|
||||
for i := 0; i < len(m.MinioClientCertificates); i++ {
|
||||
if swag.IsZero(m.MinioClientCertificates[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Minio[i] != nil {
|
||||
if err := m.Minio[i].Validate(formats); err != nil {
|
||||
if m.MinioClientCertificates[i] != nil {
|
||||
if err := m.MinioClientCertificates[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("customCertificates" + "." + "minio" + "." + strconv.Itoa(i))
|
||||
return ve.ValidateName("customCertificates" + "." + "minioClientCertificates" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("customCertificates" + "." + "minio" + "." + strconv.Itoa(i))
|
||||
return ce.ValidateName("customCertificates" + "." + "minioClientCertificates" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateTenantSecurityRequestCustomCertificates) validateMinioServerCertificates(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.MinioServerCertificates) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.MinioServerCertificates); i++ {
|
||||
if swag.IsZero(m.MinioServerCertificates[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.MinioServerCertificates[i] != nil {
|
||||
if err := m.MinioServerCertificates[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("customCertificates" + "." + "minioServerCertificates" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("customCertificates" + "." + "minioServerCertificates" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -183,7 +262,11 @@ func (m *UpdateTenantSecurityRequestCustomCertificates) validateMinio(formats st
|
||||
func (m *UpdateTenantSecurityRequestCustomCertificates) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateMinio(ctx, formats); err != nil {
|
||||
if err := m.contextValidateMinioClientCertificates(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateMinioServerCertificates(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
@@ -193,16 +276,36 @@ func (m *UpdateTenantSecurityRequestCustomCertificates) ContextValidate(ctx cont
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateTenantSecurityRequestCustomCertificates) contextValidateMinio(ctx context.Context, formats strfmt.Registry) error {
|
||||
func (m *UpdateTenantSecurityRequestCustomCertificates) contextValidateMinioClientCertificates(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Minio); i++ {
|
||||
for i := 0; i < len(m.MinioClientCertificates); i++ {
|
||||
|
||||
if m.Minio[i] != nil {
|
||||
if err := m.Minio[i].ContextValidate(ctx, formats); err != nil {
|
||||
if m.MinioClientCertificates[i] != nil {
|
||||
if err := m.MinioClientCertificates[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("customCertificates" + "." + "minio" + "." + strconv.Itoa(i))
|
||||
return ve.ValidateName("customCertificates" + "." + "minioClientCertificates" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("customCertificates" + "." + "minio" + "." + strconv.Itoa(i))
|
||||
return ce.ValidateName("customCertificates" + "." + "minioClientCertificates" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateTenantSecurityRequestCustomCertificates) contextValidateMinioServerCertificates(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.MinioServerCertificates); i++ {
|
||||
|
||||
if m.MinioServerCertificates[i] != nil {
|
||||
if err := m.MinioServerCertificates[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("customCertificates" + "." + "minioServerCertificates" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("customCertificates" + "." + "minioServerCertificates" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
73
models/user_s_as.go
Normal file
73
models/user_s_as.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// UserSAs user s as
|
||||
//
|
||||
// swagger:model userSAs
|
||||
type UserSAs struct {
|
||||
|
||||
// path
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
// recursive
|
||||
Recursive bool `json:"recursive,omitempty"`
|
||||
|
||||
// version ID
|
||||
VersionID string `json:"versionID,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this user s as
|
||||
func (m *UserSAs) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this user s as based on context it is used
|
||||
func (m *UserSAs) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *UserSAs) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *UserSAs) UnmarshalBinary(b []byte) error {
|
||||
var res UserSAs
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -39,7 +39,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var token string
|
||||
var (
|
||||
token string
|
||||
jwt string
|
||||
)
|
||||
|
||||
func inspectHTTPResponse(httpResponse *http.Response) string {
|
||||
/*
|
||||
@@ -143,9 +146,6 @@ func TestMain(m *testing.M) {
|
||||
fmt.Println("after 2 seconds sleep")
|
||||
|
||||
fmt.Println("creating the client")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
|
||||
// SA_TOKEN=$(kubectl -n minio-operator get secret console-sa-secret -o jsonpath="{.data.token}" | base64 --decode)
|
||||
fmt.Println("Where we have the secret already: ")
|
||||
@@ -170,29 +170,12 @@ func TestMain(m *testing.M) {
|
||||
return
|
||||
}
|
||||
secret2 := out2.String()
|
||||
secret3 := decodeBase64(secret2[1 : len(secret2)-1])
|
||||
if secret3 == "" {
|
||||
jwt := decodeBase64(secret2[1 : len(secret2)-1])
|
||||
if jwt == "" {
|
||||
fmt.Println("jwt cannot be empty string")
|
||||
os.Exit(-1)
|
||||
}
|
||||
requestData := map[string]string{
|
||||
"jwt": secret3,
|
||||
}
|
||||
fmt.Println("requestData: ", requestData)
|
||||
|
||||
requestDataJSON, _ := json.Marshal(requestData)
|
||||
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
|
||||
request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login/operator", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
response, err := client.Do(request)
|
||||
response, err := LoginOperator()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
@@ -310,6 +293,29 @@ func CreateTenant(tenantName string, namespace string, accessKey string, secretK
|
||||
return response, err
|
||||
}
|
||||
|
||||
func DeleteTenant(nameSpace, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
URL: /namespaces/{namespace}/tenants/{tenant}:
|
||||
HTTP Verb: DELETE
|
||||
Summary: Delete tenant and underlying pvcs
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"DELETE",
|
||||
"http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestCreateTenant(t *testing.T) {
|
||||
printStartFunc("TestCreateTenant")
|
||||
|
||||
@@ -436,6 +442,159 @@ func TestCreateTenant(t *testing.T) {
|
||||
printEndFunc("TestCreateTenant")
|
||||
}
|
||||
|
||||
func TestDeleteTenant(t *testing.T) {
|
||||
printStartFunc("TestCreateTenant")
|
||||
|
||||
// Variables
|
||||
assert := assert.New(t)
|
||||
erasureCodingParity := 2
|
||||
tenantName := "new-tenant-3"
|
||||
namespace := "new-namespace-3"
|
||||
|
||||
// 0. Create the namespace
|
||||
resp, err := CreateNamespace(namespace)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
201, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
|
||||
accessKey := ""
|
||||
secretKey := ""
|
||||
var accessKeys []string
|
||||
var secretKeys []string
|
||||
var minio []string
|
||||
var caCertificates []string
|
||||
var consoleCAcertificates []string
|
||||
enableTLS := true
|
||||
enableConsole := true
|
||||
enablePrometheus := true
|
||||
serviceName := ""
|
||||
image := ""
|
||||
exposeMinIO := true
|
||||
exposeConsole := true
|
||||
values := make([]string, 1)
|
||||
values[0] = "new-tenant"
|
||||
values2 := make([]string, 1)
|
||||
values2[0] = "pool-0"
|
||||
keys := make([]map[string]interface{}, 1)
|
||||
keys[0] = map[string]interface{}{
|
||||
"access_key": "IGLksSXdiU3fjcRI",
|
||||
"secret_key": "EqeCPZ1xBYdnygizxxRWnkH09N2350nO",
|
||||
}
|
||||
pools := make([]map[string]interface{}, 1)
|
||||
matchExpressions := make([]map[string]interface{}, 2)
|
||||
matchExpressions[0] = map[string]interface{}{
|
||||
"key": "v1.min.io/tenant",
|
||||
"operator": "In",
|
||||
"values": values,
|
||||
}
|
||||
matchExpressions[1] = map[string]interface{}{
|
||||
"key": "v1.min.io/pool",
|
||||
"operator": "In",
|
||||
"values": values2,
|
||||
}
|
||||
requiredDuringSchedulingIgnoredDuringExecution := make([]map[string]interface{}, 1)
|
||||
requiredDuringSchedulingIgnoredDuringExecution[0] = map[string]interface{}{
|
||||
"labelSelector": map[string]interface{}{
|
||||
"matchExpressions": matchExpressions,
|
||||
},
|
||||
"topologyKey": "kubernetes.io/hostname",
|
||||
}
|
||||
pools0 := map[string]interface{}{
|
||||
"name": "pool-0",
|
||||
"servers": 4,
|
||||
"volumes_per_server": 1,
|
||||
"volume_configuration": map[string]interface{}{
|
||||
"size": 26843545600,
|
||||
"storage_class_name": "standard",
|
||||
},
|
||||
"securityContext": nil,
|
||||
"affinity": map[string]interface{}{
|
||||
"podAntiAffinity": map[string]interface{}{
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": requiredDuringSchedulingIgnoredDuringExecution,
|
||||
},
|
||||
},
|
||||
"resources": map[string]interface{}{
|
||||
"requests": map[string]interface{}{
|
||||
"cpu": 2,
|
||||
"memory": 2,
|
||||
},
|
||||
},
|
||||
}
|
||||
logSearchConfiguration := map[string]interface{}{
|
||||
"image": "",
|
||||
"postgres_image": "",
|
||||
"postgres_init_image": "",
|
||||
}
|
||||
prometheusConfiguration := map[string]interface{}{
|
||||
"image": "",
|
||||
"sidecar_image": "",
|
||||
"init_image": "",
|
||||
}
|
||||
tls := map[string]interface{}{
|
||||
"minio": minio,
|
||||
"ca_certificates": caCertificates,
|
||||
"console_ca_certificates": consoleCAcertificates,
|
||||
}
|
||||
idp := map[string]interface{}{
|
||||
"keys": keys,
|
||||
}
|
||||
pools[0] = pools0
|
||||
|
||||
// 1. Create Tenant
|
||||
resp, err = CreateTenant(
|
||||
tenantName,
|
||||
namespace,
|
||||
accessKey,
|
||||
secretKey,
|
||||
accessKeys,
|
||||
idp,
|
||||
tls,
|
||||
prometheusConfiguration,
|
||||
logSearchConfiguration,
|
||||
erasureCodingParity,
|
||||
pools,
|
||||
exposeConsole,
|
||||
exposeMinIO,
|
||||
image,
|
||||
serviceName,
|
||||
enablePrometheus,
|
||||
enableConsole,
|
||||
enableTLS,
|
||||
secretKeys,
|
||||
)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 2. Delete tenant
|
||||
resp, err = DeleteTenant(namespace, tenantName)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
204,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
|
||||
printEndFunc("TestCreateTenant")
|
||||
}
|
||||
|
||||
func ListTenantsByNameSpace(namespace string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to list buckets
|
||||
@@ -476,7 +635,10 @@ func TestListTenantsByNameSpace(t *testing.T) {
|
||||
log.Println(err)
|
||||
assert.Nil(err)
|
||||
}
|
||||
TenantName := &result.Tenants[0].Name // The array has to be empty, no index accessible
|
||||
if len(result.Tenants) == 0 {
|
||||
assert.Fail("FAIL: There are no tenants in the array")
|
||||
}
|
||||
TenantName := &result.Tenants[0].Name
|
||||
fmt.Println(*TenantName)
|
||||
assert.Equal("new-tenant", *TenantName, *TenantName)
|
||||
}
|
||||
@@ -673,3 +835,473 @@ func TestGetMultipleCSRs(t *testing.T) {
|
||||
assert.Equal(strings.Contains(finalResponse, element), true)
|
||||
}
|
||||
}
|
||||
|
||||
func ListPVCsForTenant(nameSpace string, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
URL: /namespaces/{namespace}/tenants/{tenant}/pvcs
|
||||
HTTP Verb: GET
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"GET", "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/pvcs/", nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestListPVCsForTenant(t *testing.T) {
|
||||
/*
|
||||
Function to list and verify the Tenant's Persistent Volume Claims
|
||||
*/
|
||||
assert := assert.New(t)
|
||||
namespace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
resp, err := ListPVCsForTenant(namespace, tenant)
|
||||
bodyResponse := resp.Body
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, "failed")
|
||||
}
|
||||
bodyBytes, _ := ioutil.ReadAll(bodyResponse)
|
||||
listObjs := models.ListPVCsResponse{}
|
||||
err = json.Unmarshal(bodyBytes, &listObjs)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
assert.Nil(err)
|
||||
}
|
||||
var pvcArray [4]string
|
||||
pvcArray[0] = "data0-storage-lite-pool-0-0"
|
||||
pvcArray[1] = "data0-storage-lite-pool-0-1"
|
||||
pvcArray[2] = "data0-storage-lite-pool-0-2"
|
||||
pvcArray[3] = "data0-storage-lite-pool-0-3"
|
||||
for i := 0; i < len(pvcArray); i++ {
|
||||
assert.Equal(strings.Contains(listObjs.Pvcs[i].Name, pvcArray[i]), true)
|
||||
}
|
||||
}
|
||||
|
||||
func CreateNamespace(nameSpace string) (*http.Response, error) {
|
||||
/*
|
||||
Description: Creates a new Namespace with given information
|
||||
URL: /namespace
|
||||
HTTP Verb: POST
|
||||
*/
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"name": nameSpace,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/namespace/",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestCreateNamespace(t *testing.T) {
|
||||
/*
|
||||
Function to Create a Namespace only once.
|
||||
*/
|
||||
assert := assert.New(t)
|
||||
namespace := "new-namespace-thujun2208pm"
|
||||
tests := []struct {
|
||||
name string
|
||||
nameSpace string
|
||||
expectedStatus int
|
||||
}{
|
||||
{
|
||||
name: "Create Namespace for the first time",
|
||||
expectedStatus: 201,
|
||||
nameSpace: namespace,
|
||||
},
|
||||
{
|
||||
name: "Create repeated namespace for second time",
|
||||
expectedStatus: 500,
|
||||
nameSpace: namespace,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
resp, err := CreateNamespace(tt.nameSpace)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
tt.expectedStatus, resp.StatusCode, "failed")
|
||||
} else {
|
||||
assert.Fail("resp cannot be nil")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func LoginOperator() (*http.Response, error) {
|
||||
/*
|
||||
Description: Login to Operator Console.
|
||||
URL: /login/operator
|
||||
Params in the Body: jwt
|
||||
*/
|
||||
requestData := map[string]string{
|
||||
"jwt": jwt,
|
||||
}
|
||||
fmt.Println("requestData: ", requestData)
|
||||
|
||||
requestDataJSON, _ := json.Marshal(requestData)
|
||||
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
|
||||
request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login/operator", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func LogoutOperator() (*http.Response, error) {
|
||||
/*
|
||||
Description: Logout from Operator.
|
||||
URL: /logout
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/logout",
|
||||
nil,
|
||||
)
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestLogout(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
|
||||
// 1. Logout
|
||||
response, err := LogoutOperator()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
response.StatusCode,
|
||||
inspectHTTPResponse(response),
|
||||
)
|
||||
}
|
||||
|
||||
// 2. Login to recover token
|
||||
response, err = LoginOperator()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
for _, cookie := range response.Cookies() {
|
||||
if cookie.Name == "token" {
|
||||
token = cookie.Value
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Verify token
|
||||
if token == "" {
|
||||
assert.Fail("authentication token not found in cookies response")
|
||||
}
|
||||
}
|
||||
|
||||
func EnableTenantLogging(namespace, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
Description: Enable Tenant Logging
|
||||
HTTP Verb: POST
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/namespaces/"+namespace+"/tenants/"+tenant+"/enable-logging",
|
||||
nil,
|
||||
)
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func DisableTenantLogging(namespace, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
Description: Disable Tenant Logging
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/namespaces/"+namespace+"/tenants/"+tenant+"/disable-logging",
|
||||
nil,
|
||||
)
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestEnableTenantLogging(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
namespace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
|
||||
// Enable tenant logging
|
||||
resp, err := EnableTenantLogging(namespace, tenant)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisableTenantLogging(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
namespace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
|
||||
// Disable tenant logging
|
||||
resp, err := DisableTenantLogging(namespace, tenant)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func GetTenantLogs(nameSpace, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
URL: /namespaces/{namespace}/tenants/{tenant}/log
|
||||
summary: Get Tenant Logs
|
||||
HTTP Verb:GET
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/log",
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func SetTenantLogs(labels, annotations, nodeSelector, dbLabels, dbAnnotations, dbNodeSelector []string, nameSpace, tenant, dbServiceAccountName, logMemRequest, logDBMemRequest, diskCapacityGB, serviceAccountName string) (*http.Response, error) {
|
||||
/*
|
||||
URL: /namespaces/{namespace}/tenants/{tenant}/log
|
||||
summary: Set Tenant Logs
|
||||
HTTP Verb: PUT
|
||||
*/
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"labels": labels,
|
||||
"annotations": annotations,
|
||||
"dbAnnotations": dbAnnotations,
|
||||
"dbLabels": dbLabels,
|
||||
"dbNodeSelector": dbNodeSelector,
|
||||
"diskCapacityGB": diskCapacityGB,
|
||||
"nodeSelector": nodeSelector,
|
||||
"serviceAccountName": serviceAccountName,
|
||||
"dbServiceAccountName": dbServiceAccountName,
|
||||
"logMemRequest": logMemRequest,
|
||||
"logDBMemRequest": logDBMemRequest,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT",
|
||||
"http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/log",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestGetTenantLogs(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
namespace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
|
||||
// Get Log Settings
|
||||
resp, err := GetTenantLogs(namespace, tenant)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetTenantLogs(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
nameSpace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
var nodeSelector []string
|
||||
var labels []string
|
||||
var annotations []string
|
||||
var dbAnnotations []string
|
||||
var dbNodeSelector []string
|
||||
var dbLabels []string
|
||||
diskCapacityGB := "2"
|
||||
dbServiceAccountName := ""
|
||||
logMemRequest := "0Gi"
|
||||
logDBMemRequest := "0Gi"
|
||||
serviceAccountName := ""
|
||||
|
||||
// Set Tenant Logs
|
||||
resp, err := SetTenantLogs(
|
||||
labels,
|
||||
annotations,
|
||||
nodeSelector,
|
||||
dbLabels,
|
||||
dbAnnotations,
|
||||
dbNodeSelector,
|
||||
nameSpace,
|
||||
tenant,
|
||||
dbServiceAccountName,
|
||||
logMemRequest,
|
||||
logDBMemRequest,
|
||||
diskCapacityGB,
|
||||
serviceAccountName,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TenantDetails(nameSpace, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
url: /namespaces/{namespace}/tenants/{tenant}
|
||||
summary: Tenant Details
|
||||
operationId: TenantDetails
|
||||
HTTP Verb: GET
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestTenantDetails(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
nameSpace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
resp, err := TenantDetails(nameSpace, tenant)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,3 +69,10 @@ func getK8sSAToken() string {
|
||||
func getMarketplace() string {
|
||||
return env.Get(ConsoleMarketplace, "")
|
||||
}
|
||||
|
||||
// Get DirectPVMode
|
||||
func getDirectPVEnabled() bool {
|
||||
currentMode := env.Get(DirectPVMode, "off")
|
||||
|
||||
return currentMode == "on"
|
||||
}
|
||||
|
||||
@@ -89,6 +89,12 @@ func configureAPI(api *operations.OperatorAPI) http.Handler {
|
||||
registerVolumesHandlers(api)
|
||||
// Namespaces handlers
|
||||
registerNamespaceHandlers(api)
|
||||
// Marketplace handlers
|
||||
registerMarketplaceHandlers(api)
|
||||
// Subnet handlers
|
||||
registerOperatorSubnetHandlers(api)
|
||||
// Direct PV handlers
|
||||
registerDirectPVHandlers(api)
|
||||
|
||||
api.PreServerShutdown = func() {}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ const (
|
||||
prometheusPath = "prometheus.io/path"
|
||||
prometheusPort = "prometheus.io/port"
|
||||
prometheusScrape = "prometheus.io/scrape"
|
||||
|
||||
// Constants for DirectPV
|
||||
DirectPVMode = "DIRECTPV_MODE"
|
||||
)
|
||||
|
||||
// Image versions
|
||||
|
||||
328
operatorapi/directpv.go
Normal file
328
operatorapi/directpv.go
Normal file
@@ -0,0 +1,328 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/minio/directpv/pkg/utils"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/minio/console/cluster"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/operatorapi/operations"
|
||||
"github.com/minio/console/operatorapi/operations/operator_api"
|
||||
xerrors "github.com/minio/console/restapi"
|
||||
directcsi "github.com/minio/directpv/pkg/apis/direct.csi.min.io/v1beta4"
|
||||
"github.com/minio/directpv/pkg/sys"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const XFS = "xfs"
|
||||
|
||||
func registerDirectPVHandlers(api *operations.OperatorAPI) {
|
||||
api.OperatorAPIGetDirectPVDriveListHandler = operator_api.GetDirectPVDriveListHandlerFunc(func(params operator_api.GetDirectPVDriveListParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := getDirectPVDrivesListResponse(session)
|
||||
if err != nil {
|
||||
return operator_api.NewGetDirectPVDriveListDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewGetDirectPVDriveListOK().WithPayload(resp)
|
||||
})
|
||||
api.OperatorAPIGetDirectPVVolumeListHandler = operator_api.GetDirectPVVolumeListHandlerFunc(func(params operator_api.GetDirectPVVolumeListParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := getDirectPVVolumesListResponse(session)
|
||||
if err != nil {
|
||||
return operator_api.NewGetDirectPVVolumeListDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewGetDirectPVVolumeListOK().WithPayload(resp)
|
||||
})
|
||||
api.OperatorAPIDirectPVFormatDriveHandler = operator_api.DirectPVFormatDriveHandlerFunc(func(params operator_api.DirectPVFormatDriveParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := formatVolumesResponse(session, params)
|
||||
if err != nil {
|
||||
return operator_api.NewDirectPVFormatDriveDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewDirectPVFormatDriveOK().WithPayload(resp)
|
||||
})
|
||||
}
|
||||
|
||||
// getDirectPVVolumesList returns directPV drives
|
||||
func getDirectPVDriveList(ctx context.Context, driveInterface DirectPVDrivesClientI) (*models.GetDirectPVDriveListResponse, error) {
|
||||
drivesList, err := driveInterface.List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res := &models.GetDirectPVDriveListResponse{}
|
||||
|
||||
// implementation same as directPV `drives ls` command
|
||||
driveName := func(val string) string {
|
||||
dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "")
|
||||
dr = strings.ReplaceAll(dr, sys.HostDevRoot+"/", "")
|
||||
return strings.ReplaceAll(dr, sys.DirectCSIPartitionInfix, "")
|
||||
}
|
||||
drivesSorted := drivesList.Items
|
||||
// sort by nodename, path and status
|
||||
sort.Slice(drivesSorted, func(i, j int) bool {
|
||||
d1 := drivesSorted[i]
|
||||
d2 := drivesSorted[j]
|
||||
|
||||
if v := strings.Compare(d1.Status.NodeName, d2.Status.NodeName); v != 0 {
|
||||
return v < 0
|
||||
}
|
||||
|
||||
if v := strings.Compare(d1.Status.Path, d2.Status.Path); v != 0 {
|
||||
return v < 0
|
||||
}
|
||||
|
||||
return strings.Compare(string(d1.Status.DriveStatus), string(d2.Status.DriveStatus)) < 0
|
||||
})
|
||||
|
||||
for _, d := range drivesSorted {
|
||||
volumes := 0
|
||||
|
||||
if len(d.Finalizers) > 1 {
|
||||
volumes = len(d.Finalizers) - 1
|
||||
}
|
||||
|
||||
dr := driveName(d.Status.Path)
|
||||
dr = strings.ReplaceAll("/dev/"+dr, sys.DirectCSIPartitionInfix, "")
|
||||
|
||||
status := d.Status.DriveStatus
|
||||
msg := ""
|
||||
for _, c := range d.Status.Conditions {
|
||||
switch c.Type {
|
||||
case string(directcsi.DirectCSIDriveConditionInitialized), string(directcsi.DirectCSIDriveConditionOwned), string(directcsi.DirectCSIDriveConditionReady):
|
||||
if c.Status != metav1.ConditionTrue {
|
||||
msg = c.Message
|
||||
if msg != "" {
|
||||
status = d.Status.DriveStatus + "*"
|
||||
msg = strings.ReplaceAll(msg, d.Name, "")
|
||||
msg = strings.ReplaceAll(msg, sys.DirectCSIDevRoot, "/dev")
|
||||
msg = strings.ReplaceAll(msg, sys.DirectCSIPartitionInfix, "")
|
||||
msg = strings.Split(msg, "\n")[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var allocatedCapacity int64
|
||||
if status == directcsi.DriveStatusInUse {
|
||||
allocatedCapacity = d.Status.AllocatedCapacity
|
||||
}
|
||||
|
||||
drStatus := d.Status.DriveStatus
|
||||
|
||||
driveInfo := &models.DirectPVDriveInfo{
|
||||
Drive: dr,
|
||||
Capacity: d.Status.TotalCapacity,
|
||||
Allocated: allocatedCapacity,
|
||||
Node: d.Status.NodeName,
|
||||
Status: string(drStatus),
|
||||
Message: msg,
|
||||
Volumes: int64(volumes),
|
||||
}
|
||||
res.Drives = append(res.Drives, driveInfo)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func getDirectPVDrivesListResponse(session *models.Principal) (*models.GetDirectPVDriveListResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
|
||||
driveInterface, err := cluster.DirectPVDriveInterface(session.STSSessionToken)
|
||||
if err != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
|
||||
directPVDrvClient := &directPVDrivesClient{
|
||||
client: driveInterface,
|
||||
}
|
||||
|
||||
drives, err := getDirectPVDriveList(ctx, directPVDrvClient)
|
||||
if err != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
return drives, nil
|
||||
}
|
||||
|
||||
// getDirectPVVolumesList returns directPV volumes
|
||||
func getDirectPVVolumesList(ctx context.Context, volumeInterface DirectPVVolumesClientI) (*models.GetDirectPVVolumeListResponse, error) {
|
||||
volList, err := volumeInterface.List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
driveName := func(val string) string {
|
||||
dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "")
|
||||
return strings.ReplaceAll(dr, sys.HostDevRoot+"/", "")
|
||||
}
|
||||
|
||||
getLabelValue := func(obj metav1.Object, key string) string {
|
||||
if labels := obj.GetLabels(); labels != nil {
|
||||
return labels[key]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var volumes []*models.DirectPVVolumeInfo
|
||||
for _, v := range volList.Items {
|
||||
vol := &models.DirectPVVolumeInfo{
|
||||
Volume: v.Name,
|
||||
Capacity: v.Status.TotalCapacity,
|
||||
Drive: driveName(getLabelValue(&v, string(utils.DrivePathLabelKey))),
|
||||
Node: v.Status.NodeName,
|
||||
}
|
||||
|
||||
volumes = append(volumes, vol)
|
||||
}
|
||||
|
||||
res := &models.GetDirectPVVolumeListResponse{
|
||||
Volumes: volumes,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func getDirectPVVolumesListResponse(session *models.Principal) (*models.GetDirectPVVolumeListResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
|
||||
volumeInterface, err := cluster.DirectPVVolumeInterface(session.STSSessionToken)
|
||||
if err != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
|
||||
directPVVolClient := &directPVVolumesClient{
|
||||
client: volumeInterface,
|
||||
}
|
||||
|
||||
volumes, err := getDirectPVVolumesList(ctx, directPVVolClient)
|
||||
if err != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
return volumes, nil
|
||||
}
|
||||
|
||||
func formatDrives(ctx context.Context, driveInterface DirectPVDrivesClientI, drives []string, force bool) (*models.FormatDirectPVDrivesResponse, error) {
|
||||
if len(drives) == 0 {
|
||||
return nil, errors.New("at least one drive needs to be set")
|
||||
}
|
||||
|
||||
driveList, err := driveInterface.List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
driveName := func(val string) string {
|
||||
dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "")
|
||||
dr = strings.ReplaceAll(dr, sys.HostDevRoot+"/", "")
|
||||
return strings.ReplaceAll(dr, sys.DirectCSIPartitionInfix, "")
|
||||
}
|
||||
|
||||
drivesArray := map[string]string{}
|
||||
|
||||
for _, driveFromAPI := range drives {
|
||||
drivesArray[driveFromAPI] = driveFromAPI
|
||||
}
|
||||
|
||||
if len(driveList.Items) == 0 {
|
||||
return nil, errors.New("no resources found globally")
|
||||
}
|
||||
|
||||
var errorResponses []*models.PvFormatErrorResponse
|
||||
|
||||
for _, driveItem := range driveList.Items {
|
||||
drName := "/dev/" + driveName(driveItem.Status.Path)
|
||||
driveName := driveItem.Status.NodeName + ":" + drName
|
||||
|
||||
base := &models.PvFormatErrorResponse{
|
||||
Node: driveItem.Status.NodeName,
|
||||
Drive: drName,
|
||||
Error: "",
|
||||
}
|
||||
|
||||
// Element is requested to be formatted
|
||||
if _, ok := drivesArray[driveName]; ok {
|
||||
if driveItem.Status.DriveStatus == directcsi.DriveStatusUnavailable {
|
||||
base.Error = "Status is unavailable"
|
||||
errorResponses = append(errorResponses, base)
|
||||
continue
|
||||
}
|
||||
|
||||
if driveItem.Status.DriveStatus == directcsi.DriveStatusInUse {
|
||||
base.Error = "Drive in use. Cannot be formatted"
|
||||
errorResponses = append(errorResponses, base)
|
||||
continue
|
||||
}
|
||||
|
||||
if driveItem.Status.DriveStatus == directcsi.DriveStatusReady {
|
||||
base.Error = "Drive already owned and managed."
|
||||
errorResponses = append(errorResponses, base)
|
||||
continue
|
||||
}
|
||||
if driveItem.Status.Filesystem != "" && !force {
|
||||
base.Error = "Drive already has a fs. Use force to overwrite"
|
||||
errorResponses = append(errorResponses, base)
|
||||
continue
|
||||
}
|
||||
|
||||
if driveItem.Status.DriveStatus == directcsi.DriveStatusReleased {
|
||||
base.Error = "Drive is in 'released state'. Please wait until it becomes available"
|
||||
errorResponses = append(errorResponses, base)
|
||||
continue
|
||||
}
|
||||
|
||||
// Validation passes, we request format
|
||||
driveItem.Spec.DirectCSIOwned = true
|
||||
driveItem.Spec.RequestedFormat = &directcsi.RequestedFormat{
|
||||
Filesystem: XFS,
|
||||
Force: force,
|
||||
}
|
||||
|
||||
_, err := driveInterface.Update(ctx, &driveItem, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
base.Error = err.Error()
|
||||
errorResponses = append(errorResponses, base)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
returnErrors := &models.FormatDirectPVDrivesResponse{
|
||||
FormatIssuesList: errorResponses,
|
||||
}
|
||||
|
||||
return returnErrors, nil
|
||||
}
|
||||
|
||||
func formatVolumesResponse(session *models.Principal, params operator_api.DirectPVFormatDriveParams) (*models.FormatDirectPVDrivesResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
|
||||
driveInterface, err := cluster.DirectPVDriveInterface(session.STSSessionToken)
|
||||
if err != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
|
||||
directPVDrvClient := &directPVDrivesClient{
|
||||
client: driveInterface,
|
||||
}
|
||||
|
||||
formatResult, errFormat := formatDrives(ctx, directPVDrvClient, params.Body.Drives, *params.Body.Force)
|
||||
if errFormat != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, errFormat)
|
||||
}
|
||||
return formatResult, nil
|
||||
}
|
||||
73
operatorapi/directpv_client.go
Normal file
73
operatorapi/directpv_client.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/minio/directpv/pkg/apis/direct.csi.min.io/v1beta4"
|
||||
directPVClient "github.com/minio/directpv/pkg/client"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// DirectPVDrivesClientI interface with all functions to be implemented
|
||||
// by mock when testing, it should include all DirectPVDrivesClientI respective api calls
|
||||
// that are used within this project.
|
||||
type DirectPVDrivesClientI interface {
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
Update(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts metav1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
}
|
||||
|
||||
// Interface implementation
|
||||
//
|
||||
// Define the structure of directpv drive client and define the functions that are actually used
|
||||
// from the minio operator / directpv interface.
|
||||
|
||||
type directPVDrivesClient struct {
|
||||
client *directPVClient.DirectCSIDriveInterface
|
||||
}
|
||||
|
||||
// List implements the listing for DirectPV Drives List functionality
|
||||
func (dpd *directPVDrivesClient) List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
return dpd.List(ctx, opts)
|
||||
}
|
||||
|
||||
// Update implements the listing for DirectPV Drives Update functionality
|
||||
func (dpd *directPVDrivesClient) Update(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts metav1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
return dpd.Update(ctx, driveItem, opts)
|
||||
}
|
||||
|
||||
// DirectPVVolumesClientI interface with all functions to be implemented
|
||||
// by mock when testing, it should include all DirectPVVolumesClientI respective api calls
|
||||
// that are used within this project.
|
||||
type DirectPVVolumesClientI interface {
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIVolumeList, error)
|
||||
}
|
||||
|
||||
// Interface implementation
|
||||
//
|
||||
// Define the structure of directpv volumes client and define the functions that are actually used
|
||||
// from the minio operator / directpv interface.
|
||||
|
||||
type directPVVolumesClient struct {
|
||||
client *directPVClient.DirectCSIVolumeInterface
|
||||
}
|
||||
|
||||
// List implements the listing for DirectPV Volumes List functionality
|
||||
func (dpv *directPVVolumesClient) List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) {
|
||||
return dpv.List(ctx, opts)
|
||||
}
|
||||
410
operatorapi/directpv_test.go
Normal file
410
operatorapi/directpv_test.go
Normal file
@@ -0,0 +1,410 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/minio/directpv/pkg/apis/direct.csi.min.io/v1beta4"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
dpdClientListMock func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
dpdClientUpdateMock func(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts v1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
)
|
||||
|
||||
// mock function for drives List()
|
||||
func (dpdm directPVDriveMock) List(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
return dpdClientListMock(ctx, opts)
|
||||
}
|
||||
|
||||
func (dpdm directPVDriveMock) Update(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts v1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
return dpdClientUpdateMock(ctx, driveItem, opts)
|
||||
}
|
||||
|
||||
var dpvClientListMock func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error)
|
||||
|
||||
// mock function for volumes List()
|
||||
func (dpvm directPVVolumeMock) List(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) {
|
||||
return dpvClientListMock(ctx, opts)
|
||||
}
|
||||
|
||||
// DirectPVDrivesList
|
||||
func Test_GetDirectPVDrives(t *testing.T) {
|
||||
directPVDrvMock := directPVDriveMock{}
|
||||
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
opts v1.ListOptions
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
client DirectPVDrivesClientI
|
||||
mockListDrives func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "Can List Drives correctly",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
opts: v1.ListOptions{},
|
||||
},
|
||||
client: directPVDrvMock,
|
||||
mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
items := []v1beta4.DirectCSIDrive{}
|
||||
|
||||
returnList := v1beta4.DirectCSIDriveList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "Drives request from DirectPV failed",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
},
|
||||
client: directPVDrvMock,
|
||||
mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
return nil, errors.New("some error occurred")
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "Drives request from DirectPV has information and doesn't return errors",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
},
|
||||
client: directPVDrvMock,
|
||||
mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
items := []v1beta4.DirectCSIDrive{
|
||||
{
|
||||
Status: v1beta4.DirectCSIDriveStatus{
|
||||
Path: "/var/lib/direct-csi/devices/test-part-dev0-directcsi",
|
||||
AllocatedCapacity: 0,
|
||||
FreeCapacity: 4772382377372,
|
||||
RootPartition: "/",
|
||||
PartitionNum: 0,
|
||||
Filesystem: "nfs",
|
||||
Mountpoint: "",
|
||||
NodeName: "test-dev0-directcsi",
|
||||
DriveStatus: v1beta4.DriveStatusReady,
|
||||
ModelNumber: "testModel",
|
||||
SerialNumber: "testSN",
|
||||
TotalCapacity: 4772382377372,
|
||||
PhysicalBlockSize: 1024,
|
||||
LogicalBlockSize: 1024,
|
||||
AccessTier: "",
|
||||
FilesystemUUID: "",
|
||||
PartitionUUID: "",
|
||||
MajorNumber: 0,
|
||||
MinorNumber: 0,
|
||||
UeventSerial: "",
|
||||
UeventFSUUID: "",
|
||||
WWID: "",
|
||||
Vendor: "",
|
||||
DMName: "",
|
||||
DMUUID: "",
|
||||
MDUUID: "",
|
||||
PartTableUUID: "",
|
||||
PartTableType: "",
|
||||
Virtual: false,
|
||||
ReadOnly: false,
|
||||
Partitioned: false,
|
||||
SwapOn: false,
|
||||
Master: "",
|
||||
OtherMountsInfo: nil,
|
||||
PCIPath: "",
|
||||
SerialNumberLong: "",
|
||||
Conditions: []v1.Condition{{
|
||||
Type: "",
|
||||
Status: "",
|
||||
ObservedGeneration: 0,
|
||||
LastTransitionTime: v1.Time{},
|
||||
Reason: "",
|
||||
Message: "",
|
||||
}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Status: v1beta4.DirectCSIDriveStatus{
|
||||
Path: "/var/lib/direct-csi/devices/test-part-dev1-directcsi",
|
||||
AllocatedCapacity: 0,
|
||||
FreeCapacity: 4772382377372,
|
||||
RootPartition: "/",
|
||||
PartitionNum: 0,
|
||||
Filesystem: "nfs",
|
||||
Mountpoint: "",
|
||||
NodeName: "test-dev1-directcsi",
|
||||
DriveStatus: v1beta4.DriveStatus(v1beta4.DirectCSIDriveConditionOwned),
|
||||
ModelNumber: "testModel",
|
||||
SerialNumber: "testSN2",
|
||||
TotalCapacity: 4772382377372,
|
||||
PhysicalBlockSize: 1024,
|
||||
LogicalBlockSize: 1024,
|
||||
AccessTier: "",
|
||||
FilesystemUUID: "",
|
||||
PartitionUUID: "",
|
||||
MajorNumber: 0,
|
||||
MinorNumber: 0,
|
||||
UeventSerial: "",
|
||||
UeventFSUUID: "",
|
||||
WWID: "",
|
||||
Vendor: "",
|
||||
DMName: "",
|
||||
DMUUID: "",
|
||||
MDUUID: "",
|
||||
PartTableUUID: "",
|
||||
PartTableType: "",
|
||||
Virtual: false,
|
||||
ReadOnly: false,
|
||||
Partitioned: false,
|
||||
SwapOn: false,
|
||||
Master: "",
|
||||
OtherMountsInfo: nil,
|
||||
PCIPath: "",
|
||||
SerialNumberLong: "",
|
||||
Conditions: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
returnList := v1beta4.DirectCSIDriveList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
dpdClientListMock = tt.mockListDrives
|
||||
|
||||
_, err := getDirectPVDriveList(tt.args.ctx, tt.client)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("getNamespaceCreated() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// DirectPVVolumesList
|
||||
func Test_GetDirectPVVolumes(t *testing.T) {
|
||||
directPVVolMock := directPVVolumeMock{}
|
||||
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
opts v1.ListOptions
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
volumesClient DirectPVVolumesClientI
|
||||
mockListVolumes func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error)
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "Can List Volumes correctly",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
opts: v1.ListOptions{},
|
||||
},
|
||||
volumesClient: directPVVolMock,
|
||||
mockListVolumes: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) {
|
||||
items := []v1beta4.DirectCSIVolume{}
|
||||
|
||||
returnList := v1beta4.DirectCSIVolumeList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "Drives request from DirectPV is ok but volumes request failed",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
},
|
||||
volumesClient: directPVVolMock,
|
||||
mockListVolumes: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) {
|
||||
return nil, errors.New("some error occurred")
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "Can List Volumes & Drives correctly without any issue",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
opts: v1.ListOptions{},
|
||||
},
|
||||
volumesClient: directPVVolMock,
|
||||
mockListVolumes: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) {
|
||||
items := []v1beta4.DirectCSIVolume{{
|
||||
Status: v1beta4.DirectCSIVolumeStatus{
|
||||
Drive: "/var/lib/direct-csi/devices/test-part-dev1-directcsi",
|
||||
NodeName: "testNodeName",
|
||||
HostPath: "",
|
||||
StagingPath: "",
|
||||
ContainerPath: "",
|
||||
TotalCapacity: 4772382377372,
|
||||
AvailableCapacity: 4772382377372,
|
||||
UsedCapacity: 0,
|
||||
Conditions: nil,
|
||||
},
|
||||
}}
|
||||
|
||||
returnList := v1beta4.DirectCSIVolumeList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
dpvClientListMock = tt.mockListVolumes
|
||||
|
||||
_, err := getDirectPVVolumesList(tt.args.ctx, tt.volumesClient)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("getNamespaceCreated() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// FormatDrives
|
||||
func Test_GetDirectPVFormatDrives(t *testing.T) {
|
||||
directPVDrvMock := directPVDriveMock{}
|
||||
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
opts v1.ListOptions
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
drivesClient DirectPVDrivesClientI
|
||||
mockListDrives func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
drives []string
|
||||
force bool
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "Format doesn't crash on empty list & returns error",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
opts: v1.ListOptions{},
|
||||
},
|
||||
drivesClient: directPVDrvMock,
|
||||
mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
items := []v1beta4.DirectCSIDrive{}
|
||||
|
||||
returnList := v1beta4.DirectCSIDriveList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
drives: []string{},
|
||||
force: false,
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "Can Format Selected drives",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
opts: v1.ListOptions{},
|
||||
},
|
||||
drivesClient: directPVDrvMock,
|
||||
mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
items := []v1beta4.DirectCSIDrive{
|
||||
{
|
||||
Status: v1beta4.DirectCSIDriveStatus{
|
||||
Path: "/var/lib/direct-csi/devices/test-part-dev1-directcsi",
|
||||
AllocatedCapacity: 0,
|
||||
FreeCapacity: 4772382377372,
|
||||
RootPartition: "/",
|
||||
PartitionNum: 0,
|
||||
Filesystem: "nfs",
|
||||
Mountpoint: "",
|
||||
NodeName: "test-dev1-directcsi",
|
||||
DriveStatus: v1beta4.DriveStatusAvailable,
|
||||
ModelNumber: "testModel",
|
||||
SerialNumber: "testSN2",
|
||||
TotalCapacity: 4772382377372,
|
||||
PhysicalBlockSize: 1024,
|
||||
LogicalBlockSize: 1024,
|
||||
AccessTier: "",
|
||||
FilesystemUUID: "",
|
||||
PartitionUUID: "",
|
||||
MajorNumber: 0,
|
||||
MinorNumber: 0,
|
||||
UeventSerial: "",
|
||||
UeventFSUUID: "",
|
||||
WWID: "",
|
||||
Vendor: "",
|
||||
DMName: "",
|
||||
DMUUID: "",
|
||||
MDUUID: "",
|
||||
PartTableUUID: "",
|
||||
PartTableType: "",
|
||||
Virtual: false,
|
||||
ReadOnly: false,
|
||||
Partitioned: false,
|
||||
SwapOn: false,
|
||||
Master: "",
|
||||
OtherMountsInfo: nil,
|
||||
PCIPath: "",
|
||||
SerialNumberLong: "",
|
||||
Conditions: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
returnList := v1beta4.DirectCSIDriveList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
drives: []string{"test-dev1-directcsi:/dev/testdev1-directcsi"},
|
||||
force: false,
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
dpdClientListMock = tt.mockListDrives
|
||||
|
||||
_, err := formatDrives(tt.args.ctx, tt.drivesClient, tt.drives, tt.force)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("getNamespaceCreated() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -18,18 +18,18 @@
|
||||
|
||||
// Package operatorapi MinIO Console Server
|
||||
//
|
||||
// Schemes:
|
||||
// http
|
||||
// ws
|
||||
// Host: localhost
|
||||
// BasePath: /api/v1
|
||||
// Version: 0.1.0
|
||||
// Schemes:
|
||||
// http
|
||||
// ws
|
||||
// Host: localhost
|
||||
// BasePath: /api/v1
|
||||
// Version: 0.1.0
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// swagger:meta
|
||||
package operatorapi
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,6 +39,10 @@ type K8sClientI interface {
|
||||
createSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error)
|
||||
updateSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error)
|
||||
getPVC(ctx context.Context, namespace string, pvcName string, opts metav1.GetOptions) (*v1.PersistentVolumeClaim, error)
|
||||
getConfigMap(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*v1.ConfigMap, error)
|
||||
createConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.CreateOptions) (*v1.ConfigMap, error)
|
||||
updateConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.UpdateOptions) (*v1.ConfigMap, error)
|
||||
deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error
|
||||
}
|
||||
|
||||
// Interface implementation
|
||||
@@ -87,3 +91,19 @@ func (c *k8sClient) getStorageClasses(ctx context.Context, opts metav1.ListOptio
|
||||
func (c *k8sClient) getPVC(ctx context.Context, namespace string, pvcName string, opts metav1.GetOptions) (*v1.PersistentVolumeClaim, error) {
|
||||
return c.client.CoreV1().PersistentVolumeClaims(namespace).Get(ctx, pvcName, opts)
|
||||
}
|
||||
|
||||
func (c *k8sClient) getConfigMap(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*v1.ConfigMap, error) {
|
||||
return c.client.CoreV1().ConfigMaps(namespace).Get(ctx, name, opts)
|
||||
}
|
||||
|
||||
func (c *k8sClient) createConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.CreateOptions) (*v1.ConfigMap, error) {
|
||||
return c.client.CoreV1().ConfigMaps(namespace).Create(ctx, cm, opts)
|
||||
}
|
||||
|
||||
func (c *k8sClient) updateConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.UpdateOptions) (*v1.ConfigMap, error) {
|
||||
return c.client.CoreV1().ConfigMaps(namespace).Update(ctx, cm, opts)
|
||||
}
|
||||
|
||||
func (c *k8sClient) deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.CoreV1().ConfigMaps(namespace).Delete(ctx, name, opts)
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ func getLoginDetailsResponse(params authApi.LoginDetailParams) (*models.LoginDet
|
||||
r := params.HTTPRequest
|
||||
|
||||
loginStrategy := models.LoginDetailsLoginStrategyServiceDashAccount
|
||||
redirectURL := ""
|
||||
redirectURL := []string{}
|
||||
|
||||
if oauth2.IsIDPEnabled() {
|
||||
loginStrategy = models.LoginDetailsLoginStrategyRedirectDashServiceDashAccount
|
||||
@@ -111,13 +111,17 @@ func getLoginDetailsResponse(params authApi.LoginDetailParams) (*models.LoginDet
|
||||
return nil, restapi.ErrorWithContext(ctx, err)
|
||||
}
|
||||
// Validate user against IDP
|
||||
identityProvider := &auth.IdentityProvider{Client: oauth2Client}
|
||||
redirectURL = identityProvider.GenerateLoginURL()
|
||||
identityProvider := &auth.IdentityProvider{
|
||||
KeyFunc: oauth2.DefaultDerivedKey,
|
||||
Client: oauth2Client,
|
||||
}
|
||||
redirectURL = append(redirectURL, identityProvider.GenerateLoginURL())
|
||||
}
|
||||
|
||||
loginDetails := &models.LoginDetails{
|
||||
LoginStrategy: loginStrategy,
|
||||
Redirect: redirectURL,
|
||||
IsDirectPV: getDirectPVEnabled(),
|
||||
}
|
||||
return loginDetails, nil
|
||||
}
|
||||
@@ -145,7 +149,10 @@ func getLoginOauth2AuthResponse(params authApi.LoginOauth2AuthParams) (*models.L
|
||||
return nil, restapi.ErrorWithContext(ctx, err)
|
||||
}
|
||||
// initialize new identity provider
|
||||
identityProvider := auth.IdentityProvider{Client: oauth2Client}
|
||||
identityProvider := auth.IdentityProvider{
|
||||
KeyFunc: oauth2.DefaultDerivedKey,
|
||||
Client: oauth2Client,
|
||||
}
|
||||
// Validate user against IDP
|
||||
_, err = verifyUserAgainstIDP(ctx, identityProvider, *lr.Code, *lr.State)
|
||||
if err != nil {
|
||||
|
||||
194
operatorapi/marketplace.go
Normal file
194
operatorapi/marketplace.go
Normal file
@@ -0,0 +1,194 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
"github.com/minio/console/cluster"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/operatorapi/operations"
|
||||
"github.com/minio/console/operatorapi/operations/operator_api"
|
||||
"github.com/minio/console/pkg"
|
||||
errors "github.com/minio/console/restapi"
|
||||
"github.com/minio/pkg/env"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
mpConfigMapDefault = "mp-config"
|
||||
mpConfigMapKey = "MP_CONFIG_KEY"
|
||||
mpHostEnvVar = "MP_HOST"
|
||||
defaultMPHost = "https://marketplace.apps.min.dev"
|
||||
mpEUHostEnvVar = "MP_EU_HOST"
|
||||
defaultEUMPHost = "https://marketplace-eu.apps.min.dev"
|
||||
isMPEmailSet = "isEmailSet"
|
||||
emailNotSetMsg = "Email was not sent in request"
|
||||
)
|
||||
|
||||
func registerMarketplaceHandlers(api *operations.OperatorAPI) {
|
||||
api.OperatorAPIGetMPIntegrationHandler = operator_api.GetMPIntegrationHandlerFunc(func(params operator_api.GetMPIntegrationParams, session *models.Principal) middleware.Responder {
|
||||
payload, err := getMPIntegrationResponse(session, params)
|
||||
if err != nil {
|
||||
return operator_api.NewGetMPIntegrationDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewGetMPIntegrationOK().WithPayload(payload)
|
||||
})
|
||||
|
||||
api.OperatorAPIPostMPIntegrationHandler = operator_api.PostMPIntegrationHandlerFunc(func(params operator_api.PostMPIntegrationParams, session *models.Principal) middleware.Responder {
|
||||
err := postMPIntegrationResponse(session, params)
|
||||
if err != nil {
|
||||
return operator_api.NewPostMPIntegrationDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewPostMPIntegrationCreated()
|
||||
})
|
||||
}
|
||||
|
||||
func getMPIntegrationResponse(session *models.Principal, params operator_api.GetMPIntegrationParams) (*operator_api.GetMPIntegrationOKBody, *models.Error) {
|
||||
clientSet, err := cluster.K8sClient(session.STSSessionToken)
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
if err != nil {
|
||||
return nil, errors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
isMPEmailSet, err := getMPEmail(ctx, &k8sClient{client: clientSet})
|
||||
if err != nil {
|
||||
return nil, errors.ErrorWithContext(ctx, errors.ErrNotFound)
|
||||
}
|
||||
return &operator_api.GetMPIntegrationOKBody{
|
||||
IsEmailSet: isMPEmailSet,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func getMPEmail(ctx context.Context, clientSet K8sClientI) (bool, error) {
|
||||
cm, err := clientSet.getConfigMap(ctx, "default", getMPConfigMapKey(mpConfigMapKey), metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return cm.Data[isMPEmailSet] == "true", nil
|
||||
}
|
||||
|
||||
func postMPIntegrationResponse(session *models.Principal, params operator_api.PostMPIntegrationParams) *models.Error {
|
||||
clientSet, err := cluster.K8sClient(session.STSSessionToken)
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
if err != nil {
|
||||
return errors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
return setMPIntegration(ctx, params.Body.Email, params.Body.IsInEU, &k8sClient{client: clientSet})
|
||||
}
|
||||
|
||||
func setMPIntegration(ctx context.Context, email string, isInEU bool, clientSet K8sClientI) *models.Error {
|
||||
if email == "" {
|
||||
return errors.ErrorWithContext(ctx, errors.ErrBadRequest, fmt.Errorf(emailNotSetMsg))
|
||||
}
|
||||
if _, err := setMPEmail(ctx, email, isInEU, clientSet); err != nil {
|
||||
return errors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func setMPEmail(ctx context.Context, email string, isInEU bool, clientSet K8sClientI) (*corev1.ConfigMap, error) {
|
||||
if err := postEmailToMP(email, isInEU); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cm := createCM()
|
||||
return clientSet.createConfigMap(ctx, "default", cm, metav1.CreateOptions{})
|
||||
}
|
||||
|
||||
func postEmailToMP(email string, isInEU bool) error {
|
||||
mpURL, err := getMPURL(isInEU)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return makePostRequestToMP(mpURL, email)
|
||||
}
|
||||
|
||||
func getMPURL(isInEU bool) (string, error) {
|
||||
mpHost := getMPHost(isInEU)
|
||||
if mpHost == "" {
|
||||
return "", fmt.Errorf("mp host not set")
|
||||
}
|
||||
return fmt.Sprintf("%s/mp-email", mpHost), nil
|
||||
}
|
||||
|
||||
func getMPHost(isInEU bool) string {
|
||||
if isInEU {
|
||||
return env.Get(mpEUHostEnvVar, defaultEUMPHost)
|
||||
}
|
||||
return env.Get(mpHostEnvVar, defaultMPHost)
|
||||
}
|
||||
|
||||
func makePostRequestToMP(url, email string) error {
|
||||
request, err := createMPRequest(url, email)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
client := &http.Client{Timeout: 3 * time.Second}
|
||||
if res, err := client.Do(request); err != nil {
|
||||
return err
|
||||
} else if res.StatusCode >= http.StatusBadRequest {
|
||||
b, _ := io.ReadAll(res.Body)
|
||||
return fmt.Errorf("request to %s failed with status code %d and error %s", url, res.StatusCode, string(b))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func createMPRequest(url, email string) (*http.Request, error) {
|
||||
request, err := http.NewRequest("POST", url, strings.NewReader(fmt.Sprintf("{\"email\":\"%s\"}", email)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
jwtToken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{})
|
||||
jwtTokenString, err := jwtToken.SignedString([]byte(pkg.MPSecret))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("jwtToken=%s", jwtTokenString))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
return request, nil
|
||||
}
|
||||
|
||||
func createCM() *corev1.ConfigMap {
|
||||
return &corev1.ConfigMap{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "ConfigMap",
|
||||
APIVersion: "v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: getMPConfigMapKey(mpConfigMapKey),
|
||||
Namespace: "default",
|
||||
},
|
||||
Data: map[string]string{isMPEmailSet: "true"},
|
||||
}
|
||||
}
|
||||
|
||||
func getMPConfigMapKey(envVar string) string {
|
||||
if mp := os.Getenv(envVar); mp != "" {
|
||||
return mp
|
||||
}
|
||||
return mpConfigMapDefault
|
||||
}
|
||||
214
operatorapi/marketplace_test.go
Normal file
214
operatorapi/marketplace_test.go
Normal file
@@ -0,0 +1,214 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/operatorapi/operations"
|
||||
"github.com/minio/console/operatorapi/operations/operator_api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
testWithError = false
|
||||
testServerWithError = false
|
||||
errMock = errors.New("mock error")
|
||||
k8sClientGetConfigMapMock func(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*corev1.ConfigMap, error)
|
||||
k8sClientCreateConfigMapMock func(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error)
|
||||
k8sClientUpdateConfigMapMock func(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error)
|
||||
k8sClientDeleteConfigMapMock func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error
|
||||
)
|
||||
|
||||
type MarketplaceTestSuite struct {
|
||||
suite.Suite
|
||||
assert *assert.Assertions
|
||||
kClient k8sClientMock
|
||||
namespace string
|
||||
postServer *httptest.Server
|
||||
}
|
||||
|
||||
func (c k8sClientMock) getConfigMap(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*corev1.ConfigMap, error) {
|
||||
return k8sClientGetConfigMapMock(ctx, namespace, configMap, opts)
|
||||
}
|
||||
|
||||
func (c k8sClientMock) createConfigMap(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error) {
|
||||
return k8sClientCreateConfigMapMock(ctx, namespace, cm, opts)
|
||||
}
|
||||
|
||||
func (c k8sClientMock) updateConfigMap(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error) {
|
||||
return k8sClientUpdateConfigMapMock(ctx, namespace, cm, opts)
|
||||
}
|
||||
|
||||
func (c k8sClientMock) deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error {
|
||||
return k8sClientDeleteConfigMapMock(ctx, namespace, name, opts)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) SetupSuite() {
|
||||
suite.assert = assert.New(suite.T())
|
||||
suite.namespace = "default"
|
||||
k8sClientGetConfigMapMock = suite.getConfigMapMock
|
||||
k8sClientCreateConfigMapMock = suite.createConfigMapMock
|
||||
k8sClientUpdateConfigMapMock = suite.updateConfigMapMock
|
||||
k8sClientDeleteConfigMapMock = suite.deleteConfigMapMock
|
||||
os.Setenv(mpConfigMapKey, "mp-mock-config")
|
||||
suite.postServer = httptest.NewServer(http.HandlerFunc(suite.postHandler))
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) postHandler(
|
||||
w http.ResponseWriter, r *http.Request,
|
||||
) {
|
||||
if testServerWithError {
|
||||
w.WriteHeader(400)
|
||||
} else {
|
||||
fmt.Fprintf(w, `{"post": "Post response"}`)
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TearDownSuite() {
|
||||
os.Unsetenv(mpConfigMapKey)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) getConfigMapMock(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*corev1.ConfigMap, error) {
|
||||
if testWithError {
|
||||
return nil, errMock
|
||||
}
|
||||
return &corev1.ConfigMap{Data: map[string]string{isMPEmailSet: "true"}}, nil
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) createConfigMapMock(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error) {
|
||||
if testWithError {
|
||||
return nil, errMock
|
||||
}
|
||||
return &corev1.ConfigMap{}, nil
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) updateConfigMapMock(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error) {
|
||||
if testWithError {
|
||||
return nil, errMock
|
||||
}
|
||||
return &corev1.ConfigMap{}, nil
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) deleteConfigMapMock(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error {
|
||||
if testWithError {
|
||||
return errMock
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestRegisterMarketplaceHandlers() {
|
||||
api := &operations.OperatorAPI{}
|
||||
suite.assert.Nil(api.OperatorAPIGetMPIntegrationHandler)
|
||||
suite.assert.Nil(api.OperatorAPIPostMPIntegrationHandler)
|
||||
registerMarketplaceHandlers(api)
|
||||
suite.assert.NotNil(api.OperatorAPIGetMPIntegrationHandler)
|
||||
suite.assert.NotNil(api.OperatorAPIPostMPIntegrationHandler)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestGetMPIntegrationHandlerWithError() {
|
||||
api := &operations.OperatorAPI{}
|
||||
registerMarketplaceHandlers(api)
|
||||
params := operator_api.NewGetMPIntegrationParams()
|
||||
params.HTTPRequest = &http.Request{}
|
||||
response := api.OperatorAPIGetMPIntegrationHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*operator_api.GetMPIntegrationDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestPostMPIntegrationHandlerWithError() {
|
||||
api := &operations.OperatorAPI{}
|
||||
registerMarketplaceHandlers(api)
|
||||
params := operator_api.NewPostMPIntegrationParams()
|
||||
params.Body = &models.MpIntegration{Email: ""}
|
||||
params.HTTPRequest = &http.Request{}
|
||||
params.HTTPRequest.Header = map[string][]string{}
|
||||
params.HTTPRequest.AddCookie(&http.Cookie{Value: "token", Name: "token"})
|
||||
response := api.OperatorAPIPostMPIntegrationHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*operator_api.PostMPIntegrationDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestGetMPEmailWithError() {
|
||||
testWithError = true
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
email, err := getMPEmail(ctx, &suite.kClient)
|
||||
suite.assert.NotNil(err)
|
||||
suite.assert.Empty(email)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestGetMPEmailNoError() {
|
||||
testWithError = false
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
isSet, err := getMPEmail(ctx, &suite.kClient)
|
||||
suite.assert.Nil(err)
|
||||
suite.assert.True(isSet)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestSetMPIntegrationNoEmail() {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
err := setMPIntegration(ctx, "", false, &suite.kClient)
|
||||
suite.assert.NotNil(err)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestSetMPIntegrationWithError() {
|
||||
testWithError = true
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
os.Setenv(mpHostEnvVar, " ")
|
||||
err := setMPIntegration(ctx, "mock@mock.com", false, &suite.kClient)
|
||||
suite.assert.NotNil(err)
|
||||
os.Unsetenv(mpHostEnvVar)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestSetMPIntegrationNoError() {
|
||||
testWithError = false
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
os.Setenv(mpHostEnvVar, suite.postServer.URL)
|
||||
err := setMPIntegration(ctx, "mock@mock.com", false, &suite.kClient)
|
||||
suite.assert.Nil(err)
|
||||
os.Unsetenv(mpHostEnvVar)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestSetMPIntegrationWithRequestError() {
|
||||
testWithError = false
|
||||
testServerWithError = true
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
os.Setenv(mpHostEnvVar, suite.postServer.URL)
|
||||
err := setMPIntegration(ctx, "mock@mock.com", false, &suite.kClient)
|
||||
suite.assert.NotNil(err)
|
||||
os.Unsetenv(mpHostEnvVar)
|
||||
}
|
||||
|
||||
func TestMarketplace(t *testing.T) {
|
||||
suite.Run(t, new(MarketplaceTestSuite))
|
||||
}
|
||||
@@ -22,8 +22,10 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
opClientMock struct{}
|
||||
httpClientMock struct{}
|
||||
opClientMock struct{}
|
||||
httpClientMock struct{}
|
||||
directPVDriveMock struct{}
|
||||
directPVVolumeMock struct{}
|
||||
)
|
||||
|
||||
func createMockPVC(pvcMockName, pvcMockNamespace string) *v1.PersistentVolumeClaim {
|
||||
|
||||
@@ -46,10 +46,10 @@ func NewLoginDetail(ctx *middleware.Context, handler LoginDetailHandler) *LoginD
|
||||
return &LoginDetail{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* LoginDetail swagger:route GET /login Auth loginDetail
|
||||
/*
|
||||
LoginDetail swagger:route GET /login Auth loginDetail
|
||||
|
||||
Returns login strategy, form or sso.
|
||||
|
||||
*/
|
||||
type LoginDetail struct {
|
||||
Context *middleware.Context
|
||||
|
||||
@@ -33,7 +33,8 @@ import (
|
||||
// LoginDetailOKCode is the HTTP code returned for type LoginDetailOK
|
||||
const LoginDetailOKCode int = 200
|
||||
|
||||
/*LoginDetailOK A successful response.
|
||||
/*
|
||||
LoginDetailOK A successful response.
|
||||
|
||||
swagger:response loginDetailOK
|
||||
*/
|
||||
@@ -74,7 +75,8 @@ func (o *LoginDetailOK) WriteResponse(rw http.ResponseWriter, producer runtime.P
|
||||
}
|
||||
}
|
||||
|
||||
/*LoginDetailDefault Generic error response.
|
||||
/*
|
||||
LoginDetailDefault Generic error response.
|
||||
|
||||
swagger:response loginDetailDefault
|
||||
*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user