Compare commits
180 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c19c639dd | ||
|
|
e3a47d980c | ||
|
|
10539929e1 | ||
|
|
3606870565 | ||
|
|
3307d6f282 | ||
|
|
5dc8d1808c | ||
|
|
8d7cddc20a | ||
|
|
35f9743a10 | ||
|
|
f8c397e231 | ||
|
|
24cf6a3ada | ||
|
|
031ee35a00 | ||
|
|
4507ceb36d | ||
|
|
f6116c1624 | ||
|
|
081df4b535 | ||
|
|
e580af8205 | ||
|
|
226e8eeef2 | ||
|
|
00c4ba430d | ||
|
|
951d3bf6dc | ||
|
|
3ae8e14156 | ||
|
|
f170a6ad36 | ||
|
|
25ff4982a0 | ||
|
|
0ac6ceca3f | ||
|
|
81714bbbed | ||
|
|
5b2715ccc0 | ||
|
|
ab411577a2 | ||
|
|
dce96ecc4b | ||
|
|
a232d73cb1 | ||
|
|
c986baf2ae | ||
|
|
df55d5dcde | ||
|
|
ed5cf89776 | ||
|
|
fa3f2283cf | ||
|
|
2988de4025 | ||
|
|
c6f2ddfd7e | ||
|
|
6a7f042d6c | ||
|
|
5fd82ca6e9 | ||
|
|
829404b33c | ||
|
|
610ec0bed4 | ||
|
|
822f063be3 | ||
|
|
32a3094386 | ||
|
|
07ef32bee3 | ||
|
|
df17d31721 | ||
|
|
302c0dd8f1 | ||
|
|
3d70427e2b | ||
|
|
c29ac61ff4 | ||
|
|
c8fdadde39 | ||
|
|
2ffc28a834 | ||
|
|
75b3082172 | ||
|
|
7e8441264f | ||
|
|
b077f2ec22 | ||
|
|
3262b8fd8f | ||
|
|
090b7e5e26 | ||
|
|
7f05c0bf06 | ||
|
|
fbb6c81986 | ||
|
|
9e843f4ba0 | ||
|
|
4e14ec2742 | ||
|
|
69ccf4872e | ||
|
|
1c31aff147 | ||
|
|
608a5c3787 | ||
|
|
297c980a8d | ||
|
|
4091b11f99 | ||
|
|
4718380bd2 | ||
|
|
52ea19809e | ||
|
|
281bd78104 | ||
|
|
d84e744d05 | ||
|
|
1b5bcad3d8 | ||
|
|
bfc4b138ff | ||
|
|
5a0ec11199 | ||
|
|
c52ba1f859 | ||
|
|
d62235ee58 | ||
|
|
e5d2752436 | ||
|
|
cffaee84bb | ||
|
|
96b1d4fe85 | ||
|
|
02acb76ac9 | ||
|
|
038f542895 | ||
|
|
983e175bc9 | ||
|
|
71ac8d7001 | ||
|
|
5258ac3d1a | ||
|
|
27d1627c8f | ||
|
|
780cf7240b | ||
|
|
ce989e39ab | ||
|
|
63d3c7207d | ||
|
|
eb924ec842 | ||
|
|
f826453284 | ||
|
|
1e00111b00 | ||
|
|
06e1592b54 | ||
|
|
41e0c1e39b | ||
|
|
31f63a387e | ||
|
|
4a1ccf19a0 | ||
|
|
d8b387434b | ||
|
|
2e9a42320c | ||
|
|
1d92f90cbe | ||
|
|
df728fc8e6 | ||
|
|
834e3fb996 | ||
|
|
0b7d4a2c35 | ||
|
|
e13626e92b | ||
|
|
0286010053 | ||
|
|
382e315668 | ||
|
|
5f5c00adb5 | ||
|
|
e093efa931 | ||
|
|
c129eae6a7 | ||
|
|
5b6e5786ea | ||
|
|
8a8471e49a | ||
|
|
719866a574 | ||
|
|
95ebc3bedf | ||
|
|
a8747614bf | ||
|
|
c89f5a7003 | ||
|
|
ebcebfbe5f | ||
|
|
c82782fe9f | ||
|
|
e626f59feb | ||
|
|
cc8d5abcd6 | ||
|
|
83a4c351dd | ||
|
|
4c0c46f5a8 | ||
|
|
1842caff0f | ||
|
|
80d3e8cdb8 | ||
|
|
d936d61b20 | ||
|
|
4a10a81374 | ||
|
|
6404a1b984 | ||
|
|
a3dc145738 | ||
|
|
dbd1b8781a | ||
|
|
9e7874cc04 | ||
|
|
d1d3c96777 | ||
|
|
2d975eb6c9 | ||
|
|
be054fe4ce | ||
|
|
f27902ab92 | ||
|
|
7e43719e20 | ||
|
|
f6016c2769 | ||
|
|
0ba60bd674 | ||
|
|
41b34645f9 | ||
|
|
ceff2840d8 | ||
|
|
6541938f16 | ||
|
|
276eff4f15 | ||
|
|
a3c9d0fe59 | ||
|
|
14f032971b | ||
|
|
9b9c54f775 | ||
|
|
a778a1eaf9 | ||
|
|
5f281518fc | ||
|
|
ca7fa30aa8 | ||
|
|
df4c63e2a3 | ||
|
|
51ce548a00 | ||
|
|
7aa8217ee7 | ||
|
|
a926082e4d | ||
|
|
3ba7b34b25 | ||
|
|
d9531f9617 | ||
|
|
18c14cc452 | ||
|
|
1e7a5647dd | ||
|
|
7edab62651 | ||
|
|
9e9321ab00 | ||
|
|
3caa9a8e38 | ||
|
|
02b6add514 | ||
|
|
67574ff92e | ||
|
|
158c231858 | ||
|
|
479fa34542 | ||
|
|
0ba5db58ec | ||
|
|
a15456896b | ||
|
|
e374772fc6 | ||
|
|
257f02c554 | ||
|
|
826cb41392 | ||
|
|
dcfc74ad0b | ||
|
|
5745137a34 | ||
|
|
3adc4cb0d4 | ||
|
|
fb74ac2601 | ||
|
|
d269cfcd31 | ||
|
|
1871f2bf9e | ||
|
|
c386040f99 | ||
|
|
583111fa9b | ||
|
|
6448a8e821 | ||
|
|
2e7d8d3642 | ||
|
|
6527bd02e8 | ||
|
|
0400e0c6d5 | ||
|
|
3a0a2b14d9 | ||
|
|
9997afeedc | ||
|
|
b026baee34 | ||
|
|
5ee3ef4fe4 | ||
|
|
c90094e328 | ||
|
|
ef1dc172fd | ||
|
|
eadc449bb0 | ||
|
|
8c63d6dd4a | ||
|
|
40c3161416 | ||
|
|
ef2d2875b2 | ||
|
|
2310865425 |
27
.github/workflows/integration.yml
vendored
27
.github/workflows/integration.yml
vendored
@@ -33,6 +33,31 @@ jobs:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# To build minio image, we need to clone the repository first
|
||||
- name: clone https://github.com/minio/minio
|
||||
uses: actions/checkout@master
|
||||
with:
|
||||
|
||||
# Repository name with owner. For example, actions/checkout
|
||||
# Default: ${{ github.repository }}
|
||||
repository: minio/minio
|
||||
|
||||
# Relative path under $GITHUB_WORKSPACE to place the repository
|
||||
# To have two repositories under the same test
|
||||
path: 'minio_repository'
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
run: |
|
||||
make test-integration
|
||||
echo "The idea is to build minio image from downloaded repository";
|
||||
cd $GITHUB_WORKSPACE/minio_repository;
|
||||
echo "Get git version to build MinIO Image";
|
||||
VERSION=`git rev-parse HEAD`;
|
||||
echo $VERSION;
|
||||
echo "Create minio image";
|
||||
make docker VERSION=$VERSION;
|
||||
echo "Jumping back to console repository to run the integration test"
|
||||
cd $GITHUB_WORKSPACE;
|
||||
echo "We are going to use the built image on test-integration";
|
||||
VERSION="minio/minio:$VERSION";
|
||||
echo $VERSION;
|
||||
make test-integration MINIO_VERSION=$VERSION;
|
||||
|
||||
70
.github/workflows/permissions.yml
vendored
Normal file
70
.github/workflows/permissions.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
name: "UI"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
permissions:
|
||||
name: Permissions Tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '17'
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Make assets
|
||||
run: |
|
||||
make assets
|
||||
- name: Build Console on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make console
|
||||
|
||||
- name: Start Console, front-end app and initialize users/policies
|
||||
run: |
|
||||
(./console server) & (make initialize-permissions)
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
uses: DevExpress/testcafe-action@latest
|
||||
with:
|
||||
args: '"chrome:headless" portal-ui/tests/permissions/ --skip-js-errors -c 3'
|
||||
|
||||
- name: Clean up users & policies
|
||||
run: |
|
||||
make cleanup-permissions
|
||||
17
.github/workflows/react-no-warnings.yml
vendored
Normal file
17
.github/workflows/react-no-warnings.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: "React Code Has No Warnings"
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install modules
|
||||
working-directory: ./portal-ui
|
||||
run: yarn
|
||||
- name: Check for Warnings in build output
|
||||
working-directory: ./portal-ui
|
||||
continue-on-error: false
|
||||
run: |
|
||||
chmod +x check-warnings.sh && ./check-warnings.sh
|
||||
@@ -19,9 +19,17 @@ linters:
|
||||
- unparam
|
||||
- unused
|
||||
- structcheck
|
||||
- goheader
|
||||
|
||||
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.27.0 # use the fixed version to not introduce new linters unexpectedly
|
||||
golangci-lint-version: 1.43.0 # use the fixed version to not introduce new linters unexpectedly
|
||||
|
||||
issues:
|
||||
exclude-use-default: false
|
||||
@@ -36,3 +44,4 @@ issues:
|
||||
run:
|
||||
skip-dirs:
|
||||
- pkg/clientgen
|
||||
- pkg/apis/networking.gke.io
|
||||
|
||||
@@ -13,7 +13,7 @@ release:
|
||||
before:
|
||||
hooks:
|
||||
# you may remove this if you don't use vgo
|
||||
- go mod tidy
|
||||
- go mod tidy -compat=1.17
|
||||
|
||||
builds:
|
||||
-
|
||||
@@ -41,7 +41,7 @@ builds:
|
||||
|
||||
flags:
|
||||
- -trimpath
|
||||
- --tags=kqueue
|
||||
- --tags=kqueue,operator
|
||||
|
||||
ldflags:
|
||||
- -s -w -X github.com/minio/console/pkg.ReleaseTag={{.Tag}} -X github.com/minio/console/pkg.CommitID={{.FullCommit}} -X github.com/minio/console/pkg.Version={{.Version}} -X github.com/minio/console/pkg.ShortCommitID={{.ShortCommit}} -X github.com/minio/console/pkg.ReleaseTime={{.Date}}
|
||||
|
||||
15
.license.tmpl
Normal file
15
.license.tmpl
Normal file
@@ -0,0 +1,15 @@
|
||||
This file is part of MinIO Console Server
|
||||
{{copyright-holder}} 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/>.
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM node:14 as uilayer
|
||||
FROM node:17 as uilayer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -12,7 +12,7 @@ RUN make build-static
|
||||
|
||||
USER node
|
||||
|
||||
FROM golang:1.16 as golayer
|
||||
FROM golang:1.17 as golayer
|
||||
|
||||
RUN apt-get update -y && apt-get install -y ca-certificates
|
||||
|
||||
@@ -31,7 +31,7 @@ ENV CGO_ENABLED=0
|
||||
COPY --from=uilayer /app/build /go/src/github.com/minio/console/portal-ui/build
|
||||
RUN go build -ldflags "-w -s" -a -o console ./cmd/console
|
||||
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.5
|
||||
MAINTAINER MinIO Development "dev@min.io"
|
||||
EXPOSE 9090
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM node:14 as uilayer
|
||||
FROM node:17 as uilayer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.5
|
||||
|
||||
ARG TAG
|
||||
|
||||
|
||||
38
Makefile
38
Makefile
@@ -4,13 +4,14 @@ GOPATH := $(shell go env GOPATH)
|
||||
BUILD_VERSION:=$(shell git describe --exact-match --tags $(git log -n1 --pretty='%h') 2>/dev/null || git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
||||
BUILD_TIME:=$(shell date 2>/dev/null)
|
||||
TAG ?= "minio/console:$(BUILD_VERSION)-dev"
|
||||
MINIO_VERSION ?= "quay.io/minio/minio:latest"
|
||||
|
||||
default: console
|
||||
|
||||
.PHONY: console
|
||||
console:
|
||||
@echo "Building Console binary to './console'"
|
||||
@(GO111MODULE=on CGO_ENABLED=0 go build -trimpath --tags=kqueue --ldflags "-s -w" -o console ./cmd/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)' .
|
||||
@@ -19,7 +20,7 @@ k8sdev:
|
||||
|
||||
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.40.1)
|
||||
@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)
|
||||
|
||||
verifiers: getdeps fmt lint
|
||||
|
||||
@@ -64,10 +65,33 @@ assets:
|
||||
@(cd portal-ui; yarn install; make build-static; yarn prettier --write . --loglevel warn; cd ..)
|
||||
|
||||
test-integration:
|
||||
@(docker run -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4} && sleep 5)
|
||||
@echo "create docker network to communicate containers MinIO & PostgreSQL"
|
||||
@(docker network create --subnet=173.18.0.0/29 mynet123)
|
||||
@echo "docker run with MinIO Version below:"
|
||||
@echo $(MINIO_VERSION)
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 --net=mynet123 -d --name minio --rm -p 9000:9000 $(MINIO_VERSION) server /data{1...4} && 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)
|
||||
@(GO111MODULE=on go test -race -v github.com/minio/console/integration/...)
|
||||
@(docker stop minio)
|
||||
|
||||
test-permissions:
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh)
|
||||
@(docker stop minio)
|
||||
|
||||
test-apply-permissions:
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/initialize-env.sh)
|
||||
|
||||
test-start-docker-minio:
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
|
||||
initialize-permissions: test-start-docker-minio test-apply-permissions
|
||||
@echo "Done initializing permissions test"
|
||||
|
||||
cleanup-permissions:
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/cleanup-env.sh)
|
||||
@(docker stop minio)
|
||||
|
||||
test:
|
||||
@(GO111MODULE=on go test -race -v github.com/minio/console/restapi/...)
|
||||
|
||||
@@ -85,3 +109,11 @@ clean:
|
||||
|
||||
docker:
|
||||
@docker buildx build --output=type=docker --platform linux/amd64 -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' .
|
||||
|
||||
release: swagger-gen
|
||||
@echo "Generating Release: $(RELEASE)"
|
||||
@make assets
|
||||
@yq -i e '.spec.template.spec.containers[0].image |= "minio/console:$(RELEASE)"' k8s/operator-console/base/console-deployment.yaml
|
||||
@yq -i e 'select(.kind == "Deployment").spec.template.spec.containers[0].image |= "minio/console:$(RELEASE)"' k8s/operator-console/standalone/console-deployment.yaml
|
||||
@git add -u .
|
||||
@git add portal-ui/build/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file is part of MinIO Kubernetes Cloud
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file is part of MinIO Kubernetes Cloud
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file is part of MinIO Kubernetes Cloud
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file is part of MinIO Kubernetes Cloud
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
@@ -47,7 +47,7 @@ func (c *HTTPClient) Post(url, contentType string, body io.Reader) (resp *http.R
|
||||
return c.Client.Post(url, contentType, body)
|
||||
}
|
||||
|
||||
// Do implements http.Client.Do()
|
||||
// Do implement http.Client.Do()
|
||||
func (c *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
||||
return c.Client.Do(req)
|
||||
}
|
||||
|
||||
83
cmd/console/app_commands.go
Normal file
83
cmd/console/app_commands.go
Normal file
@@ -0,0 +1,83 @@
|
||||
//go:build operator
|
||||
// +build operator
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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 main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/console/restapi"
|
||||
)
|
||||
|
||||
var appCmds = []cli.Command{
|
||||
serverCmd,
|
||||
updateCmd,
|
||||
operatorCmd,
|
||||
}
|
||||
|
||||
// StartServer starts the console service
|
||||
func StartServer(ctx *cli.Context) error {
|
||||
if os.Getenv("CONSOLE_OPERATOR_MODE") != "" && os.Getenv("CONSOLE_OPERATOR_MODE") == "on" {
|
||||
return startOperatorServer(ctx)
|
||||
}
|
||||
|
||||
if err := loadAllCerts(ctx); err != nil {
|
||||
// Log this as a warning and continue running console without TLS certificates
|
||||
restapi.LogError("Unable to load certs: %v", err)
|
||||
}
|
||||
|
||||
var rctx restapi.Context
|
||||
if err := rctx.Load(ctx); err != nil {
|
||||
restapi.LogError("argument validation failed: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server, err := buildServer()
|
||||
if err != nil {
|
||||
restapi.LogError("Unable to initialize console server: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server.Host = rctx.Host
|
||||
server.Port = rctx.HTTPPort
|
||||
// set conservative timesout for uploads
|
||||
server.ReadTimeout = 1 * time.Hour
|
||||
// no timeouts for response for downloads
|
||||
server.WriteTimeout = 0
|
||||
restapi.Port = strconv.Itoa(server.Port)
|
||||
restapi.Hostname = server.Host
|
||||
|
||||
if len(restapi.GlobalPublicCerts) > 0 {
|
||||
// If TLS certificates are provided enforce the HTTPS schema, meaning console will redirect
|
||||
// plain HTTP connections to HTTPS server
|
||||
server.EnabledListeners = []string{"http", "https"}
|
||||
server.TLSPort = rctx.HTTPSPort
|
||||
// Need to store tls-port, tls-host un config variables so secure.middleware can read from there
|
||||
restapi.TLSPort = strconv.Itoa(server.TLSPort)
|
||||
restapi.Hostname = rctx.Host
|
||||
restapi.TLSRedirect = rctx.TLSRedirect
|
||||
}
|
||||
|
||||
defer server.Shutdown()
|
||||
|
||||
return server.Serve()
|
||||
}
|
||||
77
cmd/console/app_commands_noop.go
Normal file
77
cmd/console/app_commands_noop.go
Normal file
@@ -0,0 +1,77 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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/>.
|
||||
|
||||
//go:build !operator
|
||||
// +build !operator
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/console/restapi"
|
||||
)
|
||||
|
||||
var appCmds = []cli.Command{
|
||||
serverCmd,
|
||||
updateCmd,
|
||||
}
|
||||
|
||||
// StartServer starts the console service
|
||||
func StartServer(ctx *cli.Context) error {
|
||||
if err := loadAllCerts(ctx); err != nil {
|
||||
// Log this as a warning and continue running console without TLS certificates
|
||||
restapi.LogError("Unable to load certs: %v", err)
|
||||
}
|
||||
|
||||
var rctx restapi.Context
|
||||
if err := rctx.Load(ctx); err != nil {
|
||||
restapi.LogError("argument validation failed: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server, err := buildServer()
|
||||
if err != nil {
|
||||
restapi.LogError("Unable to initialize console server: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server.Host = rctx.Host
|
||||
server.Port = rctx.HTTPPort
|
||||
// set conservative timesout for uploads
|
||||
server.ReadTimeout = 1 * time.Hour
|
||||
// no timeouts for response for downloads
|
||||
server.WriteTimeout = 0
|
||||
restapi.Port = strconv.Itoa(server.Port)
|
||||
restapi.Hostname = server.Host
|
||||
|
||||
if len(restapi.GlobalPublicCerts) > 0 {
|
||||
// If TLS certificates are provided enforce the HTTPS schema, meaning console will redirect
|
||||
// plain HTTP connections to HTTPS server
|
||||
server.EnabledListeners = []string{"http", "https"}
|
||||
server.TLSPort = rctx.HTTPSPort
|
||||
// Need to store tls-port, tls-host un config variables so secure.middleware can read from there
|
||||
restapi.TLSPort = strconv.Itoa(server.TLSPort)
|
||||
restapi.Hostname = rctx.Host
|
||||
restapi.TLSRedirect = rctx.TLSRedirect
|
||||
}
|
||||
|
||||
defer server.Shutdown()
|
||||
|
||||
return server.Serve()
|
||||
}
|
||||
@@ -32,30 +32,24 @@ import (
|
||||
|
||||
// Help template for Console.
|
||||
var consoleHelpTemplate = `NAME:
|
||||
{{.Name}} - {{.Usage}}
|
||||
{{.Name}} - {{.Usage}}
|
||||
|
||||
DESCRIPTION:
|
||||
{{.Description}}
|
||||
{{.Description}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} {{if .VisibleFlags}}[FLAGS] {{end}}COMMAND{{if .VisibleFlags}}{{end}} [ARGS...]
|
||||
{{.HelpName}} {{if .VisibleFlags}}[FLAGS] {{end}}COMMAND{{if .VisibleFlags}}{{end}} [ARGS...]
|
||||
|
||||
COMMANDS:
|
||||
{{range .VisibleCommands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
|
||||
{{end}}{{if .VisibleFlags}}
|
||||
{{range .VisibleCommands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
|
||||
{{end}}{{if .VisibleFlags}}
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}{{end}}
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}{{end}}
|
||||
VERSION:
|
||||
{{.Version}}
|
||||
{{.Version}}
|
||||
`
|
||||
|
||||
var appCmds = []cli.Command{
|
||||
serverCmd,
|
||||
updateCmd,
|
||||
operatorCmd,
|
||||
}
|
||||
|
||||
func newApp(name string) *cli.App {
|
||||
// Collection of console commands currently supported are.
|
||||
var commands []cli.Command
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//go:build operator
|
||||
// +build operator
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
@@ -222,30 +225,5 @@ func startOperatorServer(ctx *cli.Context) error {
|
||||
|
||||
defer server.Shutdown()
|
||||
|
||||
// subnet license refresh process
|
||||
go func() {
|
||||
// start refreshing subnet license after 5 seconds..
|
||||
time.Sleep(time.Second * 5)
|
||||
|
||||
failedAttempts := 0
|
||||
for {
|
||||
if err := operatorapi.RefreshLicense(); err != nil {
|
||||
operatorapi.LogError("Refreshing subnet license failed: %v", err)
|
||||
failedAttempts++
|
||||
// end license refresh after 3 consecutive failed attempts
|
||||
if failedAttempts >= 3 {
|
||||
return
|
||||
}
|
||||
// wait 5 minutes and retry again
|
||||
time.Sleep(time.Minute * 5)
|
||||
continue
|
||||
}
|
||||
// if license refreshed successfully reset the counter
|
||||
failedAttempts = 0
|
||||
// try to refresh license every 24 hrs
|
||||
time.Sleep(time.Hour * 24)
|
||||
}
|
||||
}()
|
||||
|
||||
return server.Serve()
|
||||
}
|
||||
|
||||
@@ -19,11 +19,8 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/loads"
|
||||
"github.com/jessevdk/go-flags"
|
||||
@@ -179,51 +176,3 @@ func loadAllCerts(ctx *cli.Context) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// StartServer starts the console service
|
||||
func StartServer(ctx *cli.Context) error {
|
||||
if os.Getenv("CONSOLE_OPERATOR_MODE") != "" && os.Getenv("CONSOLE_OPERATOR_MODE") == "on" {
|
||||
return startOperatorServer(ctx)
|
||||
}
|
||||
|
||||
if err := loadAllCerts(ctx); err != nil {
|
||||
// Log this as a warning and continue running console without TLS certificates
|
||||
restapi.LogError("Unable to load certs: %v", err)
|
||||
}
|
||||
|
||||
var rctx restapi.Context
|
||||
if err := rctx.Load(ctx); err != nil {
|
||||
restapi.LogError("argument validation failed: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server, err := buildServer()
|
||||
if err != nil {
|
||||
restapi.LogError("Unable to initialize console server: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server.Host = rctx.Host
|
||||
server.Port = rctx.HTTPPort
|
||||
// set conservative timesout for uploads
|
||||
server.ReadTimeout = 1 * time.Hour
|
||||
// no timeouts for response for downloads
|
||||
server.WriteTimeout = 0
|
||||
restapi.Port = strconv.Itoa(server.Port)
|
||||
restapi.Hostname = server.Host
|
||||
|
||||
if len(restapi.GlobalPublicCerts) > 0 {
|
||||
// If TLS certificates are provided enforce the HTTPS schema, meaning console will redirect
|
||||
// plain HTTP connections to HTTPS server
|
||||
server.EnabledListeners = []string{"http", "https"}
|
||||
server.TLSPort = rctx.HTTPSPort
|
||||
// Need to store tls-port, tls-host un config variables so secure.middleware can read from there
|
||||
restapi.TLSPort = strconv.Itoa(server.TLSPort)
|
||||
restapi.Hostname = rctx.Host
|
||||
restapi.TLSRedirect = rctx.TLSRedirect
|
||||
}
|
||||
|
||||
defer server.Shutdown()
|
||||
|
||||
return server.Serve()
|
||||
}
|
||||
|
||||
88
go.mod
88
go.mod
@@ -6,13 +6,13 @@ require (
|
||||
github.com/blang/semver/v4 v4.0.0
|
||||
github.com/cheggaaa/pb/v3 v3.0.6
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/go-openapi/errors v0.19.9
|
||||
github.com/go-openapi/loads v0.20.2
|
||||
github.com/go-openapi/runtime v0.19.24
|
||||
github.com/go-openapi/spec v0.20.3
|
||||
github.com/go-openapi/strfmt v0.20.0
|
||||
github.com/go-openapi/swag v0.19.14
|
||||
github.com/go-openapi/validate v0.20.2
|
||||
github.com/go-openapi/errors v0.20.2
|
||||
github.com/go-openapi/loads v0.21.0
|
||||
github.com/go-openapi/runtime v0.21.1
|
||||
github.com/go-openapi/spec v0.20.4
|
||||
github.com/go-openapi/strfmt v0.21.1
|
||||
github.com/go-openapi/swag v0.19.15
|
||||
github.com/go-openapi/validate v0.20.3
|
||||
github.com/golang-jwt/jwt/v4 v4.1.0
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/jessevdk/go-flags v1.4.0
|
||||
@@ -20,20 +20,20 @@ require (
|
||||
github.com/minio/cli v1.22.0
|
||||
github.com/minio/direct-csi v1.3.5-0.20210601185811-f7776f7961bf
|
||||
github.com/minio/kes v0.11.0
|
||||
github.com/minio/madmin-go v1.1.23
|
||||
github.com/minio/mc v0.0.0-20211207230606-23a05f5a17f2
|
||||
github.com/minio/minio-go/v7 v7.0.20
|
||||
github.com/minio/operator v0.0.0-20211011212245-31460bbbc4b7
|
||||
github.com/minio/operator/logsearchapi v0.0.0-20211011212245-31460bbbc4b7
|
||||
github.com/minio/pkg v1.1.11
|
||||
github.com/minio/madmin-go v1.3.0
|
||||
github.com/minio/mc v0.0.0-20220204044644-e048c85d71a7
|
||||
github.com/minio/minio-go/v7 v7.0.21
|
||||
github.com/minio/operator v0.0.0-20220110040724-a5d59a342b7f
|
||||
github.com/minio/pkg v1.1.14
|
||||
github.com/minio/selfupdate v0.4.0
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/rs/xid v1.3.0
|
||||
github.com/secure-io/sio-go v0.3.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/tidwall/gjson v1.12.1
|
||||
github.com/unrolled/secure v1.0.9
|
||||
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2
|
||||
golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd
|
||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
k8s.io/api v0.21.1
|
||||
@@ -44,36 +44,38 @@ require (
|
||||
require (
|
||||
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||
github.com/StackExchange/wmi v1.2.1 // indirect
|
||||
github.com/VividCortex/ewma v1.1.1 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/briandowns/spinner v1.16.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/charmbracelet/bubbles v0.10.0 // indirect
|
||||
github.com/charmbracelet/bubbletea v0.19.3 // indirect
|
||||
github.com/charmbracelet/lipgloss v0.4.1-0.20220204041308-bf2912e703f6 // indirect
|
||||
github.com/cheggaaa/pb v1.0.29 // indirect
|
||||
github.com/containerd/console v1.0.2 // indirect
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0 // 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 v2.9.5+incompatible // indirect
|
||||
github.com/evanphx/json-patch v4.9.0+incompatible // indirect
|
||||
github.com/fatih/color v1.13.0 // indirect
|
||||
github.com/fatih/structs v1.1.0 // indirect
|
||||
github.com/georgysavva/scany v0.2.7 // indirect
|
||||
github.com/go-logr/logr v0.4.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-openapi/analysis v0.20.0 // indirect
|
||||
github.com/go-openapi/analysis v0.21.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.19.6 // indirect
|
||||
github.com/go-stack/stack v1.8.0 // indirect
|
||||
github.com/goccy/go-json v0.7.9 // indirect
|
||||
github.com/goccy/go-json v0.8.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/google/go-cmp v0.5.5 // indirect
|
||||
github.com/google/go-cmp v0.5.6 // indirect
|
||||
github.com/google/gofuzz v1.1.0 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/googleapis/gnostic v0.5.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
@@ -87,10 +89,12 @@ require (
|
||||
github.com/lestrrat-go/blackmagic v1.0.0 // indirect
|
||||
github.com/lestrrat-go/httpcc v1.0.0 // indirect
|
||||
github.com/lestrrat-go/iter v1.0.1 // indirect
|
||||
github.com/lestrrat-go/jwx v1.2.7 // indirect
|
||||
github.com/lestrrat-go/jwx v1.2.14 // indirect
|
||||
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/mailru/easyjson v0.7.6 // indirect
|
||||
github.com/mattn/go-colorable v0.1.10 // 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
|
||||
@@ -104,45 +108,51 @@ require (
|
||||
github.com/mitchellh/mapstructure v1.4.1 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect
|
||||
github.com/muesli/reflow v0.3.0 // indirect
|
||||
github.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0 // indirect
|
||||
github.com/nxadm/tail v1.4.8 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/philhofer/fwd v1.1.1 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pkg/profile v1.6.0 // indirect
|
||||
github.com/pkg/xattr v0.4.3 // indirect
|
||||
github.com/pkg/xattr v0.4.4 // 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-20210106213030-5aafc221ea8c // indirect
|
||||
github.com/prometheus/client_golang v1.11.0 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.31.1 // indirect
|
||||
github.com/prometheus/common v0.32.1 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/rjeczalik/notify v0.9.2 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.21.8 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.21.12 // indirect
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/stretchr/objx v0.2.0 // indirect
|
||||
github.com/tidwall/gjson v1.10.2 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tinylib/msgp v1.1.6 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.9 // indirect
|
||||
github.com/tklauser/numcpus v0.3.0 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.0 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.0 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.0 // indirect
|
||||
go.mongodb.org/mongo-driver v1.4.6 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.2 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.1 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.1 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.1 // indirect
|
||||
go.mongodb.org/mongo-driver v1.7.5 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.7.0 // indirect
|
||||
go.uber.org/zap v1.19.1 // indirect
|
||||
golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 // indirect
|
||||
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // 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-20210220033141-f8bda1e9f3ba // indirect
|
||||
google.golang.org/appengine v1.6.6 // indirect
|
||||
google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 // indirect
|
||||
google.golang.org/grpc v1.41.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb // indirect
|
||||
google.golang.org/grpc v1.43.0 // indirect
|
||||
google.golang.org/protobuf v1.27.1 // indirect
|
||||
gopkg.in/h2non/filetype.v1 v1.0.5 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.63.2 // indirect
|
||||
gopkg.in/ini.v1 v1.66.3 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
k8s.io/klog/v2 v2.8.0 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 // indirect
|
||||
|
||||
15
hack/header.go.txt
Normal file
15
hack/header.go.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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/>.
|
||||
@@ -1,18 +1,4 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2020 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
@@ -20,10 +6,7 @@ set -o pipefail
|
||||
|
||||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
|
||||
|
||||
go get -d k8s.io/code-generator/...
|
||||
|
||||
# Checkout code-generator to compatible version
|
||||
#(cd $GOPATH/src/k8s.io/code-generator && git checkout origin/release-1.14 -B release-1.14)
|
||||
GO111MODULE=off go get -d k8s.io/code-generator/...
|
||||
|
||||
REPOSITORY=github.com/minio/console
|
||||
$GOPATH/src/k8s.io/code-generator/generate-groups.sh all \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
198
integration/service_account_test.go
Normal file
198
integration/service_account_test.go
Normal file
@@ -0,0 +1,198 @@
|
||||
// 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 integration
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
iampolicy "github.com/minio/pkg/iam/policy"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAddServiceAccount(t *testing.T) {
|
||||
/*
|
||||
This is an atomic API Test to add a user service account, the intention
|
||||
is simple, add a user and make sure the response is 201 meaning that the
|
||||
user got added successfully.
|
||||
After test completion, it is expected that user is removed, so other
|
||||
tests like users.ts can run over clean data and we don't collide against
|
||||
it.
|
||||
*/
|
||||
|
||||
assert := assert.New(t)
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
// Add service account
|
||||
fmt.Println(".......................TestServiceAccountPolicy(): Create Data to add user")
|
||||
requestDataAddServiceAccount := map[string]interface{}{
|
||||
"accessKey": "testuser1",
|
||||
"secretKey": "password",
|
||||
}
|
||||
|
||||
fmt.Println("..............................TestServiceAccountPolicy(): Prepare the POST")
|
||||
requestDataJSON, _ := json.Marshal(requestDataAddServiceAccount)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST", "http://localhost:9090/api/v1/service-account-credentials", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
fmt.Println(".................................TestServiceAccountPolicy(): Make the POST")
|
||||
response, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("..................................TestServiceAccountPolicy(): Verification")
|
||||
fmt.Println(".................................TestServiceAccountPolicy(): POST response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("....................................TestServiceAccountPolicy(): POST error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
requestDataPolicy := map[string]interface{}{"policy": `
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:GetBucketLocation",
|
||||
"s3:GetObject"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}`,
|
||||
}
|
||||
fmt.Println("..............................TestServiceAccountPolicy(): Prepare the PUT")
|
||||
requestDataJSON, _ = json.Marshal(requestDataPolicy)
|
||||
requestDataBody = bytes.NewReader(requestDataJSON)
|
||||
request, err = http.NewRequest(
|
||||
"PUT", "http://localhost:9090/api/v1/service-accounts/testuser1/policy", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
fmt.Println(".................................TestServiceAccountPolicy(): Make the PUT")
|
||||
response, err = client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("..................................TestServiceAccountPolicy(): Verification")
|
||||
fmt.Println(".................................TestServiceAccountPolicy(): PUT response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("....................................TestServiceAccountPolicy(): PUT error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(200, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
fmt.Println("...................................TestServiceAccountPolicy(): Check policy")
|
||||
|
||||
// Test policy
|
||||
fmt.Println(".......................TestAddUserServiceAccount(): Create Data to add user")
|
||||
request, err = http.NewRequest(
|
||||
"GET", "http://localhost:9090/api/v1/service-accounts/testuser1/policy", nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
fmt.Println(".................................TestAddServiceAccount(): Make the POST")
|
||||
response, err = client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("..................................TestAddServiceAccount(): Verification")
|
||||
fmt.Println(".................................TestAddServiceAccount(): POST response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("....................................TestAddServiceAccount(): POST error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(200, response.StatusCode, "Status Code is incorrect")
|
||||
buf := new(bytes.Buffer)
|
||||
buf.ReadFrom(response.Body)
|
||||
var actual *iampolicy.Policy
|
||||
var expected *iampolicy.Policy
|
||||
json.Unmarshal(buf.Bytes(), actual)
|
||||
policy, err := json.Marshal(requestDataAddServiceAccount["policy"])
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
json.Unmarshal(policy, expected)
|
||||
assert.Equal(expected, actual)
|
||||
}
|
||||
|
||||
fmt.Println("...................................TestServiceAccountPolicy(): Remove service account")
|
||||
|
||||
// {{baseUrl}}/user?name=proident velit
|
||||
// Investiga como se borra en el browser.
|
||||
request, err = http.NewRequest(
|
||||
"DELETE", "http://localhost:9090/api/v1/service-accounts/testuser1", nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
fmt.Println("...............................TestServiceAccountPolicy(): Make the DELETE")
|
||||
response, err = client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("..................................TestServiceAccountPolicy(): Verification")
|
||||
fmt.Println("...............................TestServiceAccountPolicy(): DELETE response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("..................................TestServiceAccountPolicy(): DELETE error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("DELETE StatusCode:", response.StatusCode)
|
||||
assert.Equal(204, response.StatusCode, "has to be 204 when delete user")
|
||||
}
|
||||
|
||||
}
|
||||
974
integration/users_test.go
Normal file
974
integration/users_test.go
Normal file
@@ -0,0 +1,974 @@
|
||||
// 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 integration
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func AddUser(accessKey string, secretKey string, groups []string, policies []string) (*http.Response, error) {
|
||||
/*
|
||||
This is an atomic function to add user and can be reused across
|
||||
different functions.
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
fmt.Println(".......................TestAddUser(): Create Data to add user")
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"accessKey": accessKey,
|
||||
"secretKey": secretKey,
|
||||
"groups": groups,
|
||||
"policies": policies,
|
||||
}
|
||||
|
||||
fmt.Println("..............................TestAddUser(): Prepare the POST")
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST", "http://localhost:9090/api/v1/users", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
fmt.Println(".................................TestAddUser(): Make the POST")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func DeleteUser(userName string) (*http.Response, error) {
|
||||
/*
|
||||
This is an atomic function to delete user and can be reused across
|
||||
different functions.
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
fmt.Println("...................................TestAddUser(): Remove user")
|
||||
request, err := http.NewRequest(
|
||||
"DELETE", "http://localhost:9090/api/v1/user?name="+userName, nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
fmt.Println("...............................TestAddUser(): Make the DELETE")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func ListUsers(offset string, limit string) (*http.Response, error) {
|
||||
/*
|
||||
This is an atomic function to list users.
|
||||
{{baseUrl}}/users?offset=-5480083&limit=-5480083
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
fmt.Println("...................................TestAddUser(): Remove user")
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/users?offset="+offset+"&limit="+limit,
|
||||
nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
fmt.Println("...............................TestAddUser(): Make the DELETE")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func GetUserInformation(userName string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to get user information via API:
|
||||
{{baseUrl}}/user?name=proident velit
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/user?name="+userName,
|
||||
nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func UpdateUserInformation(name string, status string, groups []string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to update user information:
|
||||
PUT: {{baseUrl}}/user?name=proident velit
|
||||
Body:
|
||||
{
|
||||
"status": "nisi voluptate amet ea",
|
||||
"groups": [
|
||||
"ipsum eu cupidatat",
|
||||
"aliquip non nulla"
|
||||
]
|
||||
}
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"status": status,
|
||||
"groups": groups,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT", "http://localhost:9090/api/v1/user?name="+name, requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func RemoveUser(name string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to remove user.
|
||||
DELETE: {{baseUrl}}/user?name=proident velit
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
request, err := http.NewRequest(
|
||||
"DELETE", "http://localhost:9090/api/v1/user?name="+name, nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func UpdateGroupsForAUser(userName string, groups []string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to update groups for a user
|
||||
PUT: {{baseUrl}}/user/groups?name=username
|
||||
{
|
||||
"groups":[
|
||||
"groupone",
|
||||
"grouptwo"
|
||||
]
|
||||
}
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"groups": groups,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT",
|
||||
"http://localhost:9090/api/v1/user/groups?name="+userName,
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func CreateServiceAccountForUser(userName string, policy string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to Create Service Account for user
|
||||
POST: api/v1/user/username/service-accounts
|
||||
{
|
||||
"policy": "ad magna"
|
||||
}
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"policy": policy,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/user/"+userName+"/service-accounts",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func CreateServiceAccountForUserWithCredentials(userName string, policy string, accessKey string, secretKey string) (*http.Response, error) {
|
||||
// Helper function to test "Create Service Account for User With Credentials" end point.
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"policy": policy,
|
||||
"accessKey": accessKey,
|
||||
"secretKey": secretKey,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/user/"+userName+"/service-account-credentials",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func ReturnsAListOfServiceAccountsForAUser(userName string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to return a list of service accounts for a user.
|
||||
GET: {{baseUrl}}/user/:name/service-accounts
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/user/"+userName+"/service-accounts",
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func AddGroup(group string, members []string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to add a group.
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"group": group,
|
||||
"members": members,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/groups",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func UsersGroupsBulk(users []string, groups []string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to test Bulk functionality to Add Users to Groups.
|
||||
PUT: {{baseUrl}}/users-groups-bulk
|
||||
{
|
||||
"users": [
|
||||
"magna id",
|
||||
"enim sit tempor incididunt"
|
||||
],
|
||||
"groups": [
|
||||
"nisi est esse",
|
||||
"fugiat eu"
|
||||
]
|
||||
}
|
||||
*/
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"users": users,
|
||||
"groups": groups,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT",
|
||||
"http://localhost:9090/api/v1/users-groups-bulk",
|
||||
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 TestAddUser(t *testing.T) {
|
||||
/*
|
||||
This is an API Test to add a user via api/v1/users, the intention
|
||||
is simple, add a user and make sure the response is 201 meaning that the
|
||||
user got added successfully.
|
||||
After test completion, it is expected that user is removed, so other
|
||||
tests like users.ts can run over clean data and we don't collide against
|
||||
it.
|
||||
*/
|
||||
|
||||
assert := assert.New(t)
|
||||
|
||||
// With no groups & no policies
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
|
||||
fmt.Println(".................................TestAddUser(): Make the POST")
|
||||
response, err := AddUser("accessKey", "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("..................................TestAddUser(): Verification")
|
||||
fmt.Println(".................................TestAddUser(): POST response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("....................................TestAddUser(): POST error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
response, err = DeleteUser("accessKey")
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("..................................TestAddUser(): Verification")
|
||||
fmt.Println("...............................TestAddUser(): DELETE response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("..................................TestAddUser(): DELETE error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("DELETE StatusCode:", response.StatusCode)
|
||||
assert.Equal(204, response.StatusCode, "has to be 204 when delete user")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestListUsers(t *testing.T) {
|
||||
/*
|
||||
This test is intended to list users via API.
|
||||
1. First, it creates the users
|
||||
2. Then, it lists the users <------ 200 is expected when listing them.
|
||||
3. Finally, it deletes the users
|
||||
*/
|
||||
|
||||
assert := assert.New(t)
|
||||
|
||||
// With no groups & no policies
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
|
||||
// 1. Create the users
|
||||
numberOfUsers := 5
|
||||
for i := 1; i < numberOfUsers; i++ {
|
||||
fmt.Println("............................TestListUsers(): Adding users")
|
||||
fmt.Println(strconv.Itoa(i) + "accessKey" + strconv.Itoa(i))
|
||||
response, err := AddUser(
|
||||
strconv.Itoa(i)+"accessKey"+strconv.Itoa(i),
|
||||
"secretKey"+strconv.Itoa(i), groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("............................TestListUsers(): Verification")
|
||||
fmt.Println("...........................TestListUsers(): POST response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("..............................TestListUsers(): POST error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode,
|
||||
"Status Code is incorrect on index: "+strconv.Itoa(i))
|
||||
}
|
||||
|
||||
b, err := io.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
fmt.Println(string(b))
|
||||
}
|
||||
|
||||
// 2. List the users
|
||||
listResponse, listError := ListUsers("-5480083", "-5480083")
|
||||
if listError != nil {
|
||||
log.Fatalln(listError)
|
||||
}
|
||||
if listResponse != nil {
|
||||
fmt.Println("POST StatusCode:", listResponse.StatusCode)
|
||||
assert.Equal(200, listResponse.StatusCode,
|
||||
"TestListUsers(): Status Code is incorrect when listing users")
|
||||
}
|
||||
b, err := io.ReadAll(listResponse.Body)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
fmt.Println(string(b))
|
||||
|
||||
// 3. Delete the users
|
||||
for i := 1; i < numberOfUsers; i++ {
|
||||
response, err := DeleteUser(
|
||||
strconv.Itoa(i) + "accessKey" + strconv.Itoa(i))
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("............................TestListUsers(): Verification")
|
||||
fmt.Println(".........................TestListUsers(): DELETE response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("............................TestListUsers(): DELETE error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("DELETE StatusCode:", response.StatusCode)
|
||||
assert.Equal(204,
|
||||
response.StatusCode, "has to be 204 when delete user")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetUserInfo(t *testing.T) {
|
||||
/*
|
||||
Test to get the user information via API.
|
||||
*/
|
||||
|
||||
// 1. Create the user
|
||||
fmt.Println("TestGetUserInfo(): 1. Create the user")
|
||||
assert := assert.New(t)
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
response, err := AddUser("accessKey", "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 2. Get user information
|
||||
fmt.Println("TestGetUserInfo(): 2. Get user information")
|
||||
response, err = GetUserInformation("accessKey")
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
assert.Fail("There was an error in the response")
|
||||
return
|
||||
}
|
||||
|
||||
// 3. Verify user information
|
||||
fmt.Println("TestGetUserInfo(): 3. Verify user information")
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(200, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
b, err := io.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
fmt.Println(string(b))
|
||||
expected := "{\"accessKey\":\"accessKey\",\"memberOf\":null,\"policy\":[],\"status\":\"enabled\"}\n"
|
||||
obtained := string(b)
|
||||
assert.Equal(expected, obtained, "User Information is wrong")
|
||||
}
|
||||
|
||||
func TestUpdateUserInfoSuccessfulResponse(t *testing.T) {
|
||||
/*
|
||||
Update User Information Test with Successful Response
|
||||
*/
|
||||
|
||||
assert := assert.New(t)
|
||||
|
||||
// 1. Create an active user
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
addUserResponse, addUserError := AddUser(
|
||||
"updateuser", "secretKey", groups, policies)
|
||||
if addUserError != nil {
|
||||
log.Println(addUserError)
|
||||
return
|
||||
}
|
||||
if addUserResponse != nil {
|
||||
fmt.Println("StatusCode:", addUserResponse.StatusCode)
|
||||
assert.Equal(
|
||||
201, addUserResponse.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 2. Deactivate the user
|
||||
// '{"status":"disabled","groups":[]}'
|
||||
updateUserResponse, UpdateUserError := UpdateUserInformation(
|
||||
"updateuser", "disabled", groups)
|
||||
|
||||
// 3. Verify user got deactivated
|
||||
if UpdateUserError != nil {
|
||||
log.Println(UpdateUserError)
|
||||
return
|
||||
}
|
||||
if updateUserResponse != nil {
|
||||
fmt.Println("StatusCode:", updateUserResponse.StatusCode)
|
||||
assert.Equal(
|
||||
200, updateUserResponse.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
b, err := io.ReadAll(updateUserResponse.Body)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
assert.True(strings.Contains(string(b), "disabled"))
|
||||
|
||||
}
|
||||
|
||||
func TestUpdateUserInfoGenericErrorResponse(t *testing.T) {
|
||||
/*
|
||||
Update User Information Test with Generic Error Response
|
||||
*/
|
||||
|
||||
assert := assert.New(t)
|
||||
|
||||
// 1. Create an active user
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
addUserResponse, addUserError := AddUser(
|
||||
"updateusererror", "secretKey", groups, policies)
|
||||
if addUserError != nil {
|
||||
log.Println(addUserError)
|
||||
return
|
||||
}
|
||||
if addUserResponse != nil {
|
||||
fmt.Println("StatusCode:", addUserResponse.StatusCode)
|
||||
assert.Equal(
|
||||
201, addUserResponse.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 2. Deactivate the user with wrong status
|
||||
updateUserResponse, UpdateUserError := UpdateUserInformation(
|
||||
"updateusererror", "inactive", groups)
|
||||
|
||||
// 3. Verify user got deactivated
|
||||
if UpdateUserError != nil {
|
||||
log.Println(UpdateUserError)
|
||||
assert.Fail("There was an error while updating user info")
|
||||
return
|
||||
}
|
||||
if updateUserResponse != nil {
|
||||
fmt.Println("StatusCode:", updateUserResponse.StatusCode)
|
||||
assert.Equal(
|
||||
500, updateUserResponse.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
b, err := io.ReadAll(updateUserResponse.Body)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
assert.True(strings.Contains(string(b), "status not valid"))
|
||||
|
||||
}
|
||||
|
||||
func TestRemoveUserSuccessfulResponse(t *testing.T) {
|
||||
/*
|
||||
To test removing a user from API
|
||||
*/
|
||||
assert := assert.New(t)
|
||||
|
||||
// 1. Create an active user
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
addUserResponse, addUserError := AddUser(
|
||||
"testremoveuser1", "secretKey", groups, policies)
|
||||
if addUserError != nil {
|
||||
log.Println(addUserError)
|
||||
return
|
||||
}
|
||||
if addUserResponse != nil {
|
||||
fmt.Println("StatusCode:", addUserResponse.StatusCode)
|
||||
assert.Equal(
|
||||
201, addUserResponse.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 2. Remove the user
|
||||
removeUserResponse, removeUserError := RemoveUser("testremoveuser1")
|
||||
if removeUserError != nil {
|
||||
log.Println(removeUserError)
|
||||
return
|
||||
}
|
||||
if removeUserResponse != nil {
|
||||
fmt.Println("StatusCode:", removeUserResponse.StatusCode)
|
||||
assert.Equal(
|
||||
204, removeUserResponse.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 3. Verify the user got removed
|
||||
getUserInfoResponse, getUserInfoError := GetUserInformation(
|
||||
"testremoveuser1")
|
||||
if getUserInfoError != nil {
|
||||
log.Println(getUserInfoError)
|
||||
assert.Fail("There was an error in the response")
|
||||
return
|
||||
}
|
||||
if getUserInfoResponse != nil {
|
||||
fmt.Println("StatusCode:", getUserInfoResponse.StatusCode)
|
||||
assert.Equal(
|
||||
404, getUserInfoResponse.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(getUserInfoResponse)
|
||||
printMessage(finalResponse)
|
||||
assert.True(strings.Contains(
|
||||
finalResponse, "The specified user does not exist"), finalResponse)
|
||||
|
||||
}
|
||||
|
||||
func TestUpdateGroupsForAUser(t *testing.T) {
|
||||
/*
|
||||
To test Update Groups For a User End Point.
|
||||
*/
|
||||
// 1. Create the user
|
||||
numberOfGroups := 3
|
||||
groupName := "updategroupforausergroup"
|
||||
userName := "updategroupsforauser1"
|
||||
assert := assert.New(t)
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
response, err := AddUser(userName, "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 2. Update the groups of the created user with newGroups
|
||||
var newGroups = make([]string, 3)
|
||||
for i := 0; i < numberOfGroups; i++ {
|
||||
newGroups[i] = groupName + strconv.Itoa(i)
|
||||
}
|
||||
response, err = UpdateGroupsForAUser(userName, newGroups)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("StatusCode:", response.StatusCode)
|
||||
assert.Equal(200, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 3. Verify the newGroups were updated accordingly
|
||||
getUserInfoResponse, getUserInfoErr := GetUserInformation(userName)
|
||||
if getUserInfoErr != nil {
|
||||
log.Println(getUserInfoErr)
|
||||
assert.Fail("There was an error in the response")
|
||||
return
|
||||
}
|
||||
if getUserInfoResponse != nil {
|
||||
fmt.Println("StatusCode:", getUserInfoResponse.StatusCode)
|
||||
assert.Equal(
|
||||
200, getUserInfoResponse.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(getUserInfoResponse)
|
||||
for i := 0; i < numberOfGroups; i++ {
|
||||
assert.True(strings.Contains(
|
||||
finalResponse, groupName+strconv.Itoa(i)), finalResponse)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateServiceAccountForUser(t *testing.T) {
|
||||
/*
|
||||
To test creation of service account for a user.
|
||||
*/
|
||||
|
||||
// Test's variables
|
||||
userName := "testcreateserviceaccountforuser1"
|
||||
assert := assert.New(t)
|
||||
policy := ""
|
||||
serviceAccountLengthInBytes := 40 // As observed, update as needed
|
||||
|
||||
// 1. Create the user
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
response, err := AddUser(userName, "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 2. Create the service account for the user
|
||||
createServiceAccountResponse,
|
||||
createServiceAccountError := CreateServiceAccountForUser(
|
||||
userName,
|
||||
policy,
|
||||
)
|
||||
if createServiceAccountError != nil {
|
||||
log.Println(createServiceAccountError)
|
||||
assert.Fail("Error in createServiceAccountError")
|
||||
}
|
||||
if createServiceAccountResponse != nil {
|
||||
fmt.Println("StatusCode:", createServiceAccountResponse.StatusCode)
|
||||
assert.Equal(
|
||||
201, createServiceAccountResponse.StatusCode,
|
||||
inspectHTTPResponse(createServiceAccountResponse),
|
||||
)
|
||||
}
|
||||
|
||||
// 3. Verify the service account for the user
|
||||
listOfAccountsResponse,
|
||||
listOfAccountsError := ReturnsAListOfServiceAccountsForAUser(userName)
|
||||
if listOfAccountsError != nil {
|
||||
log.Println(listOfAccountsError)
|
||||
assert.Fail("Error in listOfAccountsError")
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(listOfAccountsResponse)
|
||||
if listOfAccountsResponse != nil {
|
||||
fmt.Println("StatusCode:", listOfAccountsResponse.StatusCode)
|
||||
assert.Equal(
|
||||
200, listOfAccountsResponse.StatusCode,
|
||||
finalResponse,
|
||||
)
|
||||
}
|
||||
assert.Equal(len(finalResponse), serviceAccountLengthInBytes, finalResponse)
|
||||
}
|
||||
|
||||
func TestCreateServiceAccountForUserWithCredentials(t *testing.T) {
|
||||
/*
|
||||
To test creation of service account for a user.
|
||||
*/
|
||||
|
||||
// Test's variables
|
||||
userName := "testcreateserviceaccountforuserwithcredentials1"
|
||||
assert := assert.New(t)
|
||||
policy := ""
|
||||
serviceAccountLengthInBytes := 40 // As observed, update as needed
|
||||
|
||||
// 1. Create the user
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
var secretKey = "testcreateserviceaccountforuserwithcrede"
|
||||
response, err := AddUser(userName, "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// Table driven testing part
|
||||
type args struct {
|
||||
accessKey string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
}{
|
||||
{
|
||||
name: "Service Account With Valid Credentials",
|
||||
expectedStatus: 201,
|
||||
args: args{
|
||||
accessKey: "testcreateserviceacc",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Service Account With Invalid Credentials",
|
||||
expectedStatus: 500,
|
||||
args: args{
|
||||
accessKey: "tooooooooooooooooooooolongggggggggggggggggg",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// 2. Create the service account for the user
|
||||
createServiceAccountWithCredentialsResponse,
|
||||
createServiceAccountWithCredentialsError := CreateServiceAccountForUserWithCredentials(
|
||||
userName,
|
||||
policy,
|
||||
tt.args.accessKey,
|
||||
secretKey,
|
||||
)
|
||||
if createServiceAccountWithCredentialsError != nil {
|
||||
log.Println(createServiceAccountWithCredentialsError)
|
||||
assert.Fail("Error in createServiceAccountWithCredentialsError")
|
||||
}
|
||||
if createServiceAccountWithCredentialsResponse != nil {
|
||||
fmt.Println("StatusCode:", createServiceAccountWithCredentialsResponse.StatusCode)
|
||||
assert.Equal(
|
||||
tt.expectedStatus, // different status expected per table's row
|
||||
createServiceAccountWithCredentialsResponse.StatusCode,
|
||||
inspectHTTPResponse(createServiceAccountWithCredentialsResponse),
|
||||
)
|
||||
}
|
||||
|
||||
// 3. Verify the service account for the user
|
||||
listOfAccountsResponse,
|
||||
listOfAccountsError := ReturnsAListOfServiceAccountsForAUser(userName)
|
||||
if listOfAccountsError != nil {
|
||||
log.Println(listOfAccountsError)
|
||||
assert.Fail("Error in listOfAccountsError")
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(listOfAccountsResponse)
|
||||
if listOfAccountsResponse != nil {
|
||||
fmt.Println("StatusCode:", listOfAccountsResponse.StatusCode)
|
||||
assert.Equal(
|
||||
200, listOfAccountsResponse.StatusCode,
|
||||
finalResponse,
|
||||
)
|
||||
}
|
||||
assert.Equal(len(finalResponse), serviceAccountLengthInBytes, finalResponse)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestUsersGroupsBulk(t *testing.T) {
|
||||
/*
|
||||
To test UsersGroupsBulk End Point
|
||||
*/
|
||||
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
numberOfUsers := 5
|
||||
numberOfGroups := 1
|
||||
//var groups = []string{}
|
||||
var policies = []string{}
|
||||
username := "testusersgroupbulk"
|
||||
groupName := "testusersgroupsbulkgroupone"
|
||||
var members = []string{}
|
||||
users := make([]string, numberOfUsers)
|
||||
groups := make([]string, numberOfGroups)
|
||||
|
||||
// 1. Create some users
|
||||
for i := 0; i < numberOfUsers; i++ {
|
||||
users[i] = username + strconv.Itoa(i)
|
||||
response, err := AddUser(
|
||||
users[i],
|
||||
"secretKey"+strconv.Itoa(i), []string{}, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode,
|
||||
"Status Code is incorrect on index: "+strconv.Itoa(i))
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Create a group with no members
|
||||
responseAddGroup, errorAddGroup := AddGroup(groupName, members)
|
||||
if errorAddGroup != nil {
|
||||
log.Println(errorAddGroup)
|
||||
return
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(responseAddGroup)
|
||||
if responseAddGroup != nil {
|
||||
fmt.Println("POST StatusCode:", responseAddGroup.StatusCode)
|
||||
assert.Equal(
|
||||
201,
|
||||
responseAddGroup.StatusCode,
|
||||
finalResponse,
|
||||
)
|
||||
}
|
||||
|
||||
// 3. Add users to the group
|
||||
groups[0] = groupName
|
||||
responseUsersGroupsBulk, errorUsersGroupsBulk := UsersGroupsBulk(
|
||||
users,
|
||||
groups,
|
||||
)
|
||||
if errorUsersGroupsBulk != nil {
|
||||
log.Println(errorUsersGroupsBulk)
|
||||
return
|
||||
}
|
||||
finalResponse = inspectHTTPResponse(responseUsersGroupsBulk)
|
||||
if responseUsersGroupsBulk != nil {
|
||||
fmt.Println("POST StatusCode:", responseUsersGroupsBulk.StatusCode)
|
||||
assert.Equal(
|
||||
200,
|
||||
responseUsersGroupsBulk.StatusCode,
|
||||
finalResponse,
|
||||
)
|
||||
}
|
||||
|
||||
// 4. Verify users got added to the group
|
||||
for i := 0; i < numberOfUsers; i++ {
|
||||
responseGetUserInfo, errGetUserInfo := GetUserInformation(
|
||||
username + strconv.Itoa(i),
|
||||
)
|
||||
if errGetUserInfo != nil {
|
||||
log.Println(errGetUserInfo)
|
||||
assert.Fail("There was an error in the response")
|
||||
return
|
||||
}
|
||||
finalResponse = inspectHTTPResponse(responseGetUserInfo)
|
||||
if responseGetUserInfo != nil {
|
||||
assert.Equal(200, responseGetUserInfo.StatusCode, finalResponse)
|
||||
}
|
||||
// Make sure the user belongs to the created group
|
||||
assert.True(strings.Contains(string(finalResponse), groupName))
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
serviceAccountName: console-sa
|
||||
containers:
|
||||
- name: console
|
||||
image: minio/console:v0.13.2
|
||||
image: 'minio/console:v0.14.7'
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
env:
|
||||
- name: CONSOLE_OPERATOR_MODE
|
||||
|
||||
@@ -32,7 +32,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: console
|
||||
image: minio/console:v0.13.2
|
||||
image: 'minio/console:v0.14.7'
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
env:
|
||||
- name: CONSOLE_MINIO_SERVER
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// This file is part of MinIO Kubernetes Cloud
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -24,9 +24,12 @@ package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AddBucketLifecycle add bucket lifecycle
|
||||
@@ -40,9 +43,6 @@ type AddBucketLifecycle struct {
|
||||
// Non required, toggle to disable or enable rule
|
||||
ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"`
|
||||
|
||||
// Required in case of expiry_days or transition fields are not set. it defines an expiry date for ILM
|
||||
ExpiryDate string `json:"expiry_date,omitempty"`
|
||||
|
||||
// Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM
|
||||
ExpiryDays int32 `json:"expiry_days,omitempty"`
|
||||
|
||||
@@ -64,15 +64,67 @@ type AddBucketLifecycle struct {
|
||||
// Non required field, tags to match ILM files
|
||||
Tags string `json:"tags,omitempty"`
|
||||
|
||||
// Required in case of transition_days or expiry fields are not set. it defines a transition date for ILM
|
||||
TransitionDate string `json:"transition_date,omitempty"`
|
||||
|
||||
// Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM
|
||||
TransitionDays int32 `json:"transition_days,omitempty"`
|
||||
|
||||
// ILM Rule type (Expiry or transition)
|
||||
// Enum: [expiry transition]
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this add bucket lifecycle
|
||||
func (m *AddBucketLifecycle) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateType(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var addBucketLifecycleTypeTypePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
addBucketLifecycleTypeTypePropEnum = append(addBucketLifecycleTypeTypePropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// AddBucketLifecycleTypeExpiry captures enum value "expiry"
|
||||
AddBucketLifecycleTypeExpiry string = "expiry"
|
||||
|
||||
// AddBucketLifecycleTypeTransition captures enum value "transition"
|
||||
AddBucketLifecycleTypeTransition string = "transition"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *AddBucketLifecycle) validateTypeEnum(path, location string, value string) error {
|
||||
if err := validate.EnumCase(path, location, value, addBucketLifecycleTypeTypePropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AddBucketLifecycle) validateType(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Type) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validateTypeEnum("type", "body", m.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
168
models/add_multi_bucket_lifecycle.go
Normal file
168
models/add_multi_bucket_lifecycle.go
Normal file
@@ -0,0 +1,168 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AddMultiBucketLifecycle add multi bucket lifecycle
|
||||
//
|
||||
// swagger:model addMultiBucketLifecycle
|
||||
type AddMultiBucketLifecycle struct {
|
||||
|
||||
// buckets
|
||||
// Required: true
|
||||
Buckets []string `json:"buckets"`
|
||||
|
||||
// Non required, toggle to disable or enable rule
|
||||
ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"`
|
||||
|
||||
// Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM
|
||||
ExpiryDays int32 `json:"expiry_days,omitempty"`
|
||||
|
||||
// Non required, can be set in case of expiration is enabled
|
||||
NoncurrentversionExpirationDays int32 `json:"noncurrentversion_expiration_days,omitempty"`
|
||||
|
||||
// Non required, can be set in case of transition is enabled
|
||||
NoncurrentversionTransitionDays int32 `json:"noncurrentversion_transition_days,omitempty"`
|
||||
|
||||
// Non required, can be set in case of transition is enabled
|
||||
NoncurrentversionTransitionStorageClass string `json:"noncurrentversion_transition_storage_class,omitempty"`
|
||||
|
||||
// Non required field, it matches a prefix to perform ILM operations on it
|
||||
Prefix string `json:"prefix,omitempty"`
|
||||
|
||||
// Required only in case of transition is set. it refers to a tier
|
||||
StorageClass string `json:"storage_class,omitempty"`
|
||||
|
||||
// Non required field, tags to match ILM files
|
||||
Tags string `json:"tags,omitempty"`
|
||||
|
||||
// Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM
|
||||
TransitionDays int32 `json:"transition_days,omitempty"`
|
||||
|
||||
// ILM Rule type (Expiry or transition)
|
||||
// Required: true
|
||||
// Enum: [expiry transition]
|
||||
Type *string `json:"type"`
|
||||
}
|
||||
|
||||
// Validate validates this add multi bucket lifecycle
|
||||
func (m *AddMultiBucketLifecycle) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateBuckets(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateType(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AddMultiBucketLifecycle) validateBuckets(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("buckets", "body", m.Buckets); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var addMultiBucketLifecycleTypeTypePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
addMultiBucketLifecycleTypeTypePropEnum = append(addMultiBucketLifecycleTypeTypePropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// AddMultiBucketLifecycleTypeExpiry captures enum value "expiry"
|
||||
AddMultiBucketLifecycleTypeExpiry string = "expiry"
|
||||
|
||||
// AddMultiBucketLifecycleTypeTransition captures enum value "transition"
|
||||
AddMultiBucketLifecycleTypeTransition string = "transition"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *AddMultiBucketLifecycle) validateTypeEnum(path, location string, value string) error {
|
||||
if err := validate.EnumCase(path, location, value, addMultiBucketLifecycleTypeTypePropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AddMultiBucketLifecycle) validateType(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("type", "body", m.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validateTypeEnum("type", "body", *m.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this add multi bucket lifecycle based on context it is used
|
||||
func (m *AddMultiBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AddMultiBucketLifecycle) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AddMultiBucketLifecycle) UnmarshalBinary(b []byte) error {
|
||||
var res AddMultiBucketLifecycle
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
88
models/add_service_account_policy_request.go
Normal file
88
models/add_service_account_policy_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) 2021 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"
|
||||
)
|
||||
|
||||
// AddServiceAccountPolicyRequest add service account policy request
|
||||
//
|
||||
// swagger:model addServiceAccountPolicyRequest
|
||||
type AddServiceAccountPolicyRequest struct {
|
||||
|
||||
// policy
|
||||
// Required: true
|
||||
Policy *string `json:"policy"`
|
||||
}
|
||||
|
||||
// Validate validates this add service account policy request
|
||||
func (m *AddServiceAccountPolicyRequest) 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 *AddServiceAccountPolicyRequest) validatePolicy(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("policy", "body", m.Policy); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this add service account policy request based on context it is used
|
||||
func (m *AddServiceAccountPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AddServiceAccountPolicyRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AddServiceAccountPolicyRequest) UnmarshalBinary(b []byte) error {
|
||||
var res AddServiceAccountPolicyRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -87,6 +87,8 @@ func (m *AdminInfoResponse) validateServers(formats strfmt.Registry) error {
|
||||
if err := m.Servers[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("servers" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("servers" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -111,6 +113,8 @@ func (m *AdminInfoResponse) validateWidgets(formats strfmt.Registry) error {
|
||||
if err := m.Widgets[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("widgets" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("widgets" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -147,6 +151,8 @@ func (m *AdminInfoResponse) contextValidateServers(ctx context.Context, formats
|
||||
if err := m.Servers[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("servers" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("servers" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -165,6 +171,8 @@ func (m *AdminInfoResponse) contextValidateWidgets(ctx context.Context, formats
|
||||
if err := m.Widgets[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("widgets" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("widgets" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -75,6 +75,8 @@ func (m *AllocatableResourcesResponse) validateCPUPriority(formats strfmt.Regist
|
||||
if err := m.CPUPriority.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("cpu_priority")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("cpu_priority")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -92,6 +94,8 @@ func (m *AllocatableResourcesResponse) validateMemPriority(formats strfmt.Regist
|
||||
if err := m.MemPriority.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("mem_priority")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("mem_priority")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -124,6 +128,8 @@ func (m *AllocatableResourcesResponse) contextValidateCPUPriority(ctx context.Co
|
||||
if err := m.CPUPriority.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("cpu_priority")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("cpu_priority")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -138,6 +144,8 @@ func (m *AllocatableResourcesResponse) contextValidateMemPriority(ctx context.Co
|
||||
if err := m.MemPriority.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("mem_priority")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("mem_priority")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ func (m *AwsConfiguration) validateSecretsmanager(formats strfmt.Registry) error
|
||||
if err := m.Secretsmanager.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretsmanager")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretsmanager")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -93,6 +95,8 @@ func (m *AwsConfiguration) contextValidateSecretsmanager(ctx context.Context, fo
|
||||
if err := m.Secretsmanager.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretsmanager")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretsmanager")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -172,6 +176,8 @@ func (m *AwsConfigurationSecretsmanager) validateCredentials(formats strfmt.Regi
|
||||
if err := m.Credentials.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretsmanager" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretsmanager" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -218,6 +224,8 @@ func (m *AwsConfigurationSecretsmanager) contextValidateCredentials(ctx context.
|
||||
if err := m.Credentials.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretsmanager" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretsmanager" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ func (m *AzureConfiguration) validateKeyvault(formats strfmt.Registry) error {
|
||||
if err := m.Keyvault.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keyvault")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keyvault")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -93,6 +95,8 @@ func (m *AzureConfiguration) contextValidateKeyvault(ctx context.Context, format
|
||||
if err := m.Keyvault.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keyvault")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keyvault")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -159,6 +163,8 @@ func (m *AzureConfigurationKeyvault) validateCredentials(formats strfmt.Registry
|
||||
if err := m.Credentials.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keyvault" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keyvault" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -196,6 +202,8 @@ func (m *AzureConfigurationKeyvault) contextValidateCredentials(ctx context.Cont
|
||||
if err := m.Credentials.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keyvault" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keyvault" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -99,6 +99,8 @@ func (m *Bucket) validateAccess(formats strfmt.Registry) error {
|
||||
if err := m.Access.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("access")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("access")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -116,6 +118,8 @@ func (m *Bucket) validateDetails(formats strfmt.Registry) error {
|
||||
if err := m.Details.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("details")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("details")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -146,6 +150,8 @@ func (m *Bucket) validateRwAccess(formats strfmt.Registry) error {
|
||||
if err := m.RwAccess.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("rw_access")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("rw_access")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -182,6 +188,8 @@ func (m *Bucket) contextValidateAccess(ctx context.Context, formats strfmt.Regis
|
||||
if err := m.Access.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("access")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("access")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -196,6 +204,8 @@ func (m *Bucket) contextValidateDetails(ctx context.Context, formats strfmt.Regi
|
||||
if err := m.Details.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("details")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("details")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -210,6 +220,8 @@ func (m *Bucket) contextValidateRwAccess(ctx context.Context, formats strfmt.Reg
|
||||
if err := m.RwAccess.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("rw_access")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("rw_access")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -283,6 +295,8 @@ func (m *BucketDetails) validateQuota(formats strfmt.Registry) error {
|
||||
if err := m.Quota.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("details" + "." + "quota")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("details" + "." + "quota")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -311,6 +325,8 @@ func (m *BucketDetails) contextValidateQuota(ctx context.Context, formats strfmt
|
||||
if err := m.Quota.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("details" + "." + "quota")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("details" + "." + "quota")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -346,7 +362,7 @@ type BucketDetailsQuota struct {
|
||||
Quota int64 `json:"quota,omitempty"`
|
||||
|
||||
// type
|
||||
// Enum: [fifo hard]
|
||||
// Enum: [hard]
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
@@ -368,7 +384,7 @@ var bucketDetailsQuotaTypeTypePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["fifo","hard"]`), &res); err != nil {
|
||||
if err := json.Unmarshal([]byte(`["hard"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
@@ -378,9 +394,6 @@ func init() {
|
||||
|
||||
const (
|
||||
|
||||
// BucketDetailsQuotaTypeFifo captures enum value "fifo"
|
||||
BucketDetailsQuotaTypeFifo string = "fifo"
|
||||
|
||||
// BucketDetailsQuotaTypeHard captures enum value "hard"
|
||||
BucketDetailsQuotaTypeHard string = "hard"
|
||||
)
|
||||
|
||||
@@ -37,8 +37,12 @@ import (
|
||||
type BucketAccess string
|
||||
|
||||
func NewBucketAccess(value BucketAccess) *BucketAccess {
|
||||
v := value
|
||||
return &v
|
||||
return &value
|
||||
}
|
||||
|
||||
// Pointer returns a pointer to a freshly-allocated BucketAccess.
|
||||
func (m BucketAccess) Pointer() *BucketAccess {
|
||||
return &m
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -65,6 +65,8 @@ func (m *BucketEncryptionRequest) validateEncType(formats strfmt.Registry) error
|
||||
if err := m.EncType.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("encType")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("encType")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -93,6 +95,8 @@ func (m *BucketEncryptionRequest) contextValidateEncType(ctx context.Context, fo
|
||||
if err := m.EncType.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("encType")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("encType")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -37,8 +37,12 @@ import (
|
||||
type BucketEncryptionType string
|
||||
|
||||
func NewBucketEncryptionType(value BucketEncryptionType) *BucketEncryptionType {
|
||||
v := value
|
||||
return &v
|
||||
return &value
|
||||
}
|
||||
|
||||
// Pointer returns a pointer to a freshly-allocated BucketEncryptionType.
|
||||
func (m BucketEncryptionType) Pointer() *BucketEncryptionType {
|
||||
return &m
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -68,6 +68,8 @@ func (m *BucketEventRequest) validateConfiguration(formats strfmt.Registry) erro
|
||||
if err := m.Configuration.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("configuration")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("configuration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -96,6 +98,8 @@ func (m *BucketEventRequest) contextValidateConfiguration(ctx context.Context, f
|
||||
if err := m.Configuration.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("configuration")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("configuration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func (m *BucketLifecycleResponse) validateLifecycle(formats strfmt.Registry) err
|
||||
if err := m.Lifecycle[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("lifecycle" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("lifecycle" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *BucketLifecycleResponse) contextValidateLifecycle(ctx context.Context,
|
||||
if err := m.Lifecycle[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("lifecycle" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("lifecycle" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ type BucketQuota struct {
|
||||
Quota int64 `json:"quota,omitempty"`
|
||||
|
||||
// type
|
||||
// Enum: [hard fifo]
|
||||
// Enum: [hard]
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ var bucketQuotaTypeTypePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["hard","fifo"]`), &res); err != nil {
|
||||
if err := json.Unmarshal([]byte(`["hard"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
@@ -75,9 +75,6 @@ const (
|
||||
|
||||
// BucketQuotaTypeHard captures enum value "hard"
|
||||
BucketQuotaTypeHard string = "hard"
|
||||
|
||||
// BucketQuotaTypeFifo captures enum value "fifo"
|
||||
BucketQuotaTypeFifo string = "fifo"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
|
||||
@@ -68,6 +68,8 @@ func (m *BucketReplicationResponse) validateRules(formats strfmt.Registry) error
|
||||
if err := m.Rules[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("rules" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("rules" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *BucketReplicationResponse) contextValidateRules(ctx context.Context, fo
|
||||
if err := m.Rules[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("rules" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("rules" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ type BucketReplicationRule struct {
|
||||
// destination
|
||||
Destination *BucketReplicationDestination `json:"destination,omitempty"`
|
||||
|
||||
// existing objects
|
||||
ExistingObjects bool `json:"existingObjects,omitempty"`
|
||||
|
||||
// health check period
|
||||
HealthCheckPeriod int64 `json:"healthCheckPeriod,omitempty"`
|
||||
|
||||
@@ -68,6 +71,9 @@ type BucketReplicationRule struct {
|
||||
// Enum: [Enabled Disabled]
|
||||
Status string `json:"status,omitempty"`
|
||||
|
||||
// storage class
|
||||
StorageClass string `json:"storageClass,omitempty"`
|
||||
|
||||
// sync mode
|
||||
// Enum: [async sync]
|
||||
SyncMode *string `json:"syncMode,omitempty"`
|
||||
@@ -107,6 +113,8 @@ func (m *BucketReplicationRule) validateDestination(formats strfmt.Registry) err
|
||||
if err := m.Destination.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("destination")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("destination")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -219,6 +227,8 @@ func (m *BucketReplicationRule) contextValidateDestination(ctx context.Context,
|
||||
if err := m.Destination.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("destination")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("destination")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *Configuration) validateKeyValues(formats strfmt.Registry) error {
|
||||
if err := m.KeyValues[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("key_values" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("key_values" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *Configuration) contextValidateKeyValues(ctx context.Context, formats st
|
||||
if err := m.KeyValues[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("key_values" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("key_values" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -163,6 +163,8 @@ func (m *CreateTenantRequest) validateEncryption(formats strfmt.Registry) error
|
||||
if err := m.Encryption.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("encryption")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("encryption")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -180,6 +182,8 @@ func (m *CreateTenantRequest) validateIdp(formats strfmt.Registry) error {
|
||||
if err := m.Idp.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("idp")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("idp")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -197,6 +201,8 @@ func (m *CreateTenantRequest) validateImageRegistry(formats strfmt.Registry) err
|
||||
if err := m.ImageRegistry.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("image_registry")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("image_registry")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -214,6 +220,8 @@ func (m *CreateTenantRequest) validateLogSearchConfiguration(formats strfmt.Regi
|
||||
if err := m.LogSearchConfiguration.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("logSearchConfiguration")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("logSearchConfiguration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -259,6 +267,8 @@ func (m *CreateTenantRequest) validatePools(formats strfmt.Registry) error {
|
||||
if err := m.Pools[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("pools" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("pools" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -278,6 +288,8 @@ func (m *CreateTenantRequest) validatePrometheusConfiguration(formats strfmt.Reg
|
||||
if err := m.PrometheusConfiguration.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("prometheusConfiguration")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("prometheusConfiguration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -295,6 +307,8 @@ func (m *CreateTenantRequest) validateTLS(formats strfmt.Registry) error {
|
||||
if err := m.TLS.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tls")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("tls")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -347,6 +361,8 @@ func (m *CreateTenantRequest) contextValidateEncryption(ctx context.Context, for
|
||||
if err := m.Encryption.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("encryption")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("encryption")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -361,6 +377,8 @@ func (m *CreateTenantRequest) contextValidateIdp(ctx context.Context, formats st
|
||||
if err := m.Idp.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("idp")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("idp")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -375,6 +393,8 @@ func (m *CreateTenantRequest) contextValidateImageRegistry(ctx context.Context,
|
||||
if err := m.ImageRegistry.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("image_registry")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("image_registry")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -389,6 +409,8 @@ func (m *CreateTenantRequest) contextValidateLogSearchConfiguration(ctx context.
|
||||
if err := m.LogSearchConfiguration.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("logSearchConfiguration")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("logSearchConfiguration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -405,6 +427,8 @@ func (m *CreateTenantRequest) contextValidatePools(ctx context.Context, formats
|
||||
if err := m.Pools[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("pools" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("pools" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -421,6 +445,8 @@ func (m *CreateTenantRequest) contextValidatePrometheusConfiguration(ctx context
|
||||
if err := m.PrometheusConfiguration.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("prometheusConfiguration")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("prometheusConfiguration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -435,6 +461,8 @@ func (m *CreateTenantRequest) contextValidateTLS(ctx context.Context, formats st
|
||||
if err := m.TLS.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tls")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("tls")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *CreateTenantResponse) validateConsole(formats strfmt.Registry) error {
|
||||
if err := m.Console[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("console" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("console" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *CreateTenantResponse) contextValidateConsole(ctx context.Context, forma
|
||||
if err := m.Console[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("console" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("console" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -241,6 +241,8 @@ func (m *EncryptionConfiguration) validateAws(formats strfmt.Registry) error {
|
||||
if err := m.Aws.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("aws")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("aws")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -259,6 +261,8 @@ func (m *EncryptionConfiguration) validateAzure(formats strfmt.Registry) error {
|
||||
if err := m.Azure.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("azure")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("azure")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -277,6 +281,8 @@ func (m *EncryptionConfiguration) validateClient(formats strfmt.Registry) error
|
||||
if err := m.Client.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("client")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("client")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -295,6 +301,8 @@ func (m *EncryptionConfiguration) validateGcp(formats strfmt.Registry) error {
|
||||
if err := m.Gcp.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("gcp")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("gcp")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -313,6 +321,8 @@ func (m *EncryptionConfiguration) validateGemalto(formats strfmt.Registry) error
|
||||
if err := m.Gemalto.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("gemalto")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("gemalto")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -331,6 +341,8 @@ func (m *EncryptionConfiguration) validateSecurityContext(formats strfmt.Registr
|
||||
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
|
||||
}
|
||||
@@ -349,6 +361,8 @@ func (m *EncryptionConfiguration) validateServer(formats strfmt.Registry) error
|
||||
if err := m.Server.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("server")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("server")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -367,6 +381,8 @@ func (m *EncryptionConfiguration) validateVault(formats strfmt.Registry) error {
|
||||
if err := m.Vault.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("vault")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("vault")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -428,6 +444,8 @@ func (m *EncryptionConfiguration) contextValidateAws(ctx context.Context, format
|
||||
if err := m.Aws.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("aws")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("aws")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -442,6 +460,8 @@ func (m *EncryptionConfiguration) contextValidateAzure(ctx context.Context, form
|
||||
if err := m.Azure.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("azure")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("azure")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -456,6 +476,8 @@ func (m *EncryptionConfiguration) contextValidateClient(ctx context.Context, for
|
||||
if err := m.Client.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("client")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("client")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -470,6 +492,8 @@ func (m *EncryptionConfiguration) contextValidateGcp(ctx context.Context, format
|
||||
if err := m.Gcp.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("gcp")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("gcp")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -484,6 +508,8 @@ func (m *EncryptionConfiguration) contextValidateGemalto(ctx context.Context, fo
|
||||
if err := m.Gemalto.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("gemalto")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("gemalto")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -498,6 +524,8 @@ func (m *EncryptionConfiguration) contextValidateSecurityContext(ctx context.Con
|
||||
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
|
||||
}
|
||||
@@ -512,6 +540,8 @@ func (m *EncryptionConfiguration) contextValidateServer(ctx context.Context, for
|
||||
if err := m.Server.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("server")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("server")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -526,6 +556,8 @@ func (m *EncryptionConfiguration) contextValidateVault(ctx context.Context, form
|
||||
if err := m.Vault.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("vault")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("vault")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ func (m EventListWrapper) Validate(formats strfmt.Registry) error {
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -72,6 +74,8 @@ func (m EventListWrapper) ContextValidate(ctx context.Context, formats strfmt.Re
|
||||
if err := m[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@ type ExpirationResponse struct {
|
||||
|
||||
// delete marker
|
||||
DeleteMarker bool `json:"delete_marker,omitempty"`
|
||||
|
||||
// noncurrent expiration days
|
||||
NoncurrentExpirationDays int64 `json:"noncurrent_expiration_days,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this expiration response
|
||||
|
||||
@@ -68,6 +68,8 @@ func (m *FormatDirectCSIDrivesResponse) validateFormatIssuesList(formats strfmt.
|
||||
if err := m.FormatIssuesList[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("formatIssuesList" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("formatIssuesList" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *FormatDirectCSIDrivesResponse) contextValidateFormatIssuesList(ctx cont
|
||||
if err := m.FormatIssuesList[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("formatIssuesList" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("formatIssuesList" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ func (m *GcpConfiguration) validateSecretmanager(formats strfmt.Registry) error
|
||||
if err := m.Secretmanager.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretmanager")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretmanager")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -93,6 +95,8 @@ func (m *GcpConfiguration) contextValidateSecretmanager(ctx context.Context, for
|
||||
if err := m.Secretmanager.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretmanager")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretmanager")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -162,6 +166,8 @@ func (m *GcpConfigurationSecretmanager) validateCredentials(formats strfmt.Regis
|
||||
if err := m.Credentials.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretmanager" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretmanager" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -199,6 +205,8 @@ func (m *GcpConfigurationSecretmanager) contextValidateCredentials(ctx context.C
|
||||
if err := m.Credentials.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretmanager" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretmanager" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ func (m *GemaltoConfiguration) validateKeysecure(formats strfmt.Registry) error
|
||||
if err := m.Keysecure.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keysecure")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keysecure")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -93,6 +95,8 @@ func (m *GemaltoConfiguration) contextValidateKeysecure(ctx context.Context, for
|
||||
if err := m.Keysecure.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keysecure")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keysecure")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -168,6 +172,8 @@ func (m *GemaltoConfigurationKeysecure) validateCredentials(formats strfmt.Regis
|
||||
if err := m.Credentials.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keysecure" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keysecure" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -194,6 +200,8 @@ func (m *GemaltoConfigurationKeysecure) validateTLS(formats strfmt.Registry) err
|
||||
if err := m.TLS.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keysecure" + "." + "tls")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keysecure" + "." + "tls")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -226,6 +234,8 @@ func (m *GemaltoConfigurationKeysecure) contextValidateCredentials(ctx context.C
|
||||
if err := m.Credentials.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keysecure" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keysecure" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -240,6 +250,8 @@ func (m *GemaltoConfigurationKeysecure) contextValidateTLS(ctx context.Context,
|
||||
if err := m.TLS.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keysecure" + "." + "tls")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keysecure" + "." + "tls")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *GetBucketRetentionConfig) validateMode(formats strfmt.Registry) error {
|
||||
if err := m.Mode.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("mode")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("mode")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -86,6 +88,8 @@ func (m *GetBucketRetentionConfig) validateUnit(formats strfmt.Registry) error {
|
||||
if err := m.Unit.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("unit")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("unit")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -116,6 +120,8 @@ func (m *GetBucketRetentionConfig) contextValidateMode(ctx context.Context, form
|
||||
if err := m.Mode.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("mode")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("mode")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -128,6 +134,8 @@ func (m *GetBucketRetentionConfig) contextValidateUnit(ctx context.Context, form
|
||||
if err := m.Unit.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("unit")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("unit")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func (m *GetDirectCSIDriveListResponse) validateDrives(formats strfmt.Registry)
|
||||
if err := m.Drives[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("drives" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("drives" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *GetDirectCSIDriveListResponse) contextValidateDrives(ctx context.Contex
|
||||
if err := m.Drives[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("drives" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("drives" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func (m *GetDirectCSIVolumeListResponse) validateVolumes(formats strfmt.Registry
|
||||
if err := m.Volumes[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("volumes" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("volumes" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *GetDirectCSIVolumeListResponse) contextValidateVolumes(ctx context.Cont
|
||||
if err := m.Volumes[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("volumes" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("volumes" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 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"
|
||||
)
|
||||
|
||||
// HasPermissionResponse has permission response
|
||||
//
|
||||
// swagger:model hasPermissionResponse
|
||||
type HasPermissionResponse struct {
|
||||
|
||||
// permissions
|
||||
Permissions []*PermissionAction `json:"permissions"`
|
||||
}
|
||||
|
||||
// Validate validates this has permission response
|
||||
func (m *HasPermissionResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validatePermissions(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HasPermissionResponse) validatePermissions(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Permissions) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Permissions); i++ {
|
||||
if swag.IsZero(m.Permissions[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Permissions[i] != nil {
|
||||
if err := m.Permissions[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("permissions" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this has permission response based on the context it is used
|
||||
func (m *HasPermissionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidatePermissions(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HasPermissionResponse) contextValidatePermissions(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Permissions); i++ {
|
||||
|
||||
if m.Permissions[i] != nil {
|
||||
if err := m.Permissions[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("permissions" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *HasPermissionResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *HasPermissionResponse) UnmarshalBinary(b []byte) error {
|
||||
var res HasPermissionResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -71,6 +71,8 @@ func (m *IamPolicy) validateStatement(formats strfmt.Registry) error {
|
||||
if err := m.Statement[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("statement" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("statement" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *IamPolicy) contextValidateStatement(ctx context.Context, formats strfmt
|
||||
if err := m.Statement[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("statement" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("statement" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -78,6 +78,8 @@ func (m *IdpConfiguration) validateActiveDirectory(formats strfmt.Registry) erro
|
||||
if err := m.ActiveDirectory.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("active_directory")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("active_directory")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *IdpConfiguration) validateKeys(formats strfmt.Registry) error {
|
||||
if err := m.Keys[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keys" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keys" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -119,6 +123,8 @@ func (m *IdpConfiguration) validateOidc(formats strfmt.Registry) error {
|
||||
if err := m.Oidc.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("oidc")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("oidc")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -155,6 +161,8 @@ func (m *IdpConfiguration) contextValidateActiveDirectory(ctx context.Context, f
|
||||
if err := m.ActiveDirectory.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("active_directory")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("active_directory")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -171,6 +179,8 @@ func (m *IdpConfiguration) contextValidateKeys(ctx context.Context, formats strf
|
||||
if err := m.Keys[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keys" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keys" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -187,6 +197,8 @@ func (m *IdpConfiguration) contextValidateOidc(ctx context.Context, formats strf
|
||||
if err := m.Oidc.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("oidc")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("oidc")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *ListAccessRulesResponse) validateAccessRules(formats strfmt.Registry) e
|
||||
if err := m.AccessRules[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("accessRules" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("accessRules" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *ListAccessRulesResponse) contextValidateAccessRules(ctx context.Context
|
||||
if err := m.AccessRules[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("accessRules" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("accessRules" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *ListBucketEventsResponse) validateEvents(formats strfmt.Registry) error
|
||||
if err := m.Events[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *ListBucketEventsResponse) contextValidateEvents(ctx context.Context, fo
|
||||
if err := m.Events[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *ListBucketsResponse) validateBuckets(formats strfmt.Registry) error {
|
||||
if err := m.Buckets[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("buckets" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("buckets" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *ListBucketsResponse) contextValidateBuckets(ctx context.Context, format
|
||||
if err := m.Buckets[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("buckets" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("buckets" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *ListConfigResponse) validateConfigurations(formats strfmt.Registry) err
|
||||
if err := m.Configurations[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("configurations" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("configurations" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *ListConfigResponse) contextValidateConfigurations(ctx context.Context,
|
||||
if err := m.Configurations[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("configurations" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("configurations" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *ListObjectsResponse) validateObjects(formats strfmt.Registry) error {
|
||||
if err := m.Objects[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("objects" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("objects" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *ListObjectsResponse) contextValidateObjects(ctx context.Context, format
|
||||
if err := m.Objects[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("objects" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("objects" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func (m *ListPVCsResponse) validatePvcs(formats strfmt.Registry) error {
|
||||
if err := m.Pvcs[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("pvcs" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("pvcs" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *ListPVCsResponse) contextValidatePvcs(ctx context.Context, formats strf
|
||||
if err := m.Pvcs[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("pvcs" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("pvcs" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *ListPoliciesResponse) validatePolicies(formats strfmt.Registry) error {
|
||||
if err := m.Policies[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("policies" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("policies" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *ListPoliciesResponse) contextValidatePolicies(ctx context.Context, form
|
||||
if err := m.Policies[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("policies" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("policies" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *ListRemoteBucketsResponse) validateBuckets(formats strfmt.Registry) err
|
||||
if err := m.Buckets[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("buckets" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("buckets" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *ListRemoteBucketsResponse) contextValidateBuckets(ctx context.Context,
|
||||
if err := m.Buckets[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("buckets" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("buckets" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *ListTenantsResponse) validateTenants(formats strfmt.Registry) error {
|
||||
if err := m.Tenants[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tenants" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("tenants" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *ListTenantsResponse) contextValidateTenants(ctx context.Context, format
|
||||
if err := m.Tenants[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tenants" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("tenants" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ func (m *ListUsersResponse) validateUsers(formats strfmt.Registry) error {
|
||||
if err := m.Users[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("users" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("users" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *ListUsersResponse) contextValidateUsers(ctx context.Context, formats st
|
||||
if err := m.Users[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("users" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("users" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -84,6 +84,8 @@ func (m *LogSearchConfiguration) validatePostgresSecurityContext(formats strfmt.
|
||||
if err := m.PostgresSecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("postgres_securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("postgres_securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -101,6 +103,8 @@ func (m *LogSearchConfiguration) validateSecurityContext(formats strfmt.Registry
|
||||
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
|
||||
}
|
||||
@@ -133,6 +137,8 @@ func (m *LogSearchConfiguration) contextValidatePostgresSecurityContext(ctx cont
|
||||
if err := m.PostgresSecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("postgres_securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("postgres_securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -147,6 +153,8 @@ func (m *LogSearchConfiguration) contextValidateSecurityContext(ctx context.Cont
|
||||
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
|
||||
}
|
||||
|
||||
@@ -93,6 +93,8 @@ func (m *MakeBucketRequest) validateQuota(formats strfmt.Registry) error {
|
||||
if err := m.Quota.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("quota")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("quota")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -110,6 +112,8 @@ func (m *MakeBucketRequest) validateRetention(formats strfmt.Registry) error {
|
||||
if err := m.Retention.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("retention")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("retention")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -142,6 +146,8 @@ func (m *MakeBucketRequest) contextValidateQuota(ctx context.Context, formats st
|
||||
if err := m.Quota.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("quota")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("quota")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -156,6 +162,8 @@ func (m *MakeBucketRequest) contextValidateRetention(ctx context.Context, format
|
||||
if err := m.Retention.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("retention")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("retention")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -56,6 +56,9 @@ type MultiBucketReplication struct {
|
||||
// prefix
|
||||
Prefix string `json:"prefix,omitempty"`
|
||||
|
||||
// priority
|
||||
Priority int32 `json:"priority,omitempty"`
|
||||
|
||||
// region
|
||||
Region string `json:"region,omitempty"`
|
||||
|
||||
@@ -73,6 +76,9 @@ type MultiBucketReplication struct {
|
||||
// Min Length: 8
|
||||
SecretKey *string `json:"secretKey"`
|
||||
|
||||
// storage class
|
||||
StorageClass string `json:"storageClass,omitempty"`
|
||||
|
||||
// sync mode
|
||||
// Enum: [async sync]
|
||||
SyncMode *string `json:"syncMode,omitempty"`
|
||||
@@ -143,6 +149,8 @@ func (m *MultiBucketReplication) validateBucketsRelation(formats strfmt.Registry
|
||||
if err := m.BucketsRelation[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("bucketsRelation" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("bucketsRelation" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -239,6 +247,8 @@ func (m *MultiBucketReplication) contextValidateBucketsRelation(ctx context.Cont
|
||||
if err := m.BucketsRelation[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("bucketsRelation" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("bucketsRelation" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
94
models/multi_bucket_replication_edit.go
Normal file
94
models/multi_bucket_replication_edit.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) 2021 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"
|
||||
)
|
||||
|
||||
// MultiBucketReplicationEdit multi bucket replication edit
|
||||
//
|
||||
// swagger:model multiBucketReplicationEdit
|
||||
type MultiBucketReplicationEdit struct {
|
||||
|
||||
// arn
|
||||
Arn string `json:"arn,omitempty"`
|
||||
|
||||
// prefix
|
||||
Prefix string `json:"prefix,omitempty"`
|
||||
|
||||
// priority
|
||||
Priority int32 `json:"priority,omitempty"`
|
||||
|
||||
// replicate delete markers
|
||||
ReplicateDeleteMarkers bool `json:"replicateDeleteMarkers,omitempty"`
|
||||
|
||||
// replicate deletes
|
||||
ReplicateDeletes bool `json:"replicateDeletes,omitempty"`
|
||||
|
||||
// replicate existing objects
|
||||
ReplicateExistingObjects bool `json:"replicateExistingObjects,omitempty"`
|
||||
|
||||
// replicate metadata
|
||||
ReplicateMetadata bool `json:"replicateMetadata,omitempty"`
|
||||
|
||||
// rule state
|
||||
RuleState bool `json:"ruleState,omitempty"`
|
||||
|
||||
// storage class
|
||||
StorageClass string `json:"storageClass,omitempty"`
|
||||
|
||||
// tags
|
||||
Tags string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this multi bucket replication edit
|
||||
func (m *MultiBucketReplicationEdit) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this multi bucket replication edit based on context it is used
|
||||
func (m *MultiBucketReplicationEdit) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *MultiBucketReplicationEdit) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *MultiBucketReplicationEdit) UnmarshalBinary(b []byte) error {
|
||||
var res MultiBucketReplicationEdit
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -68,6 +68,8 @@ func (m *MultiBucketResponseState) validateReplicationState(formats strfmt.Regis
|
||||
if err := m.ReplicationState[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("replicationState" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("replicationState" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *MultiBucketResponseState) contextValidateReplicationState(ctx context.C
|
||||
if err := m.ReplicationState[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("replicationState" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("replicationState" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -31,20 +31,20 @@ import (
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// HasPermissionRequest has permission request
|
||||
// MultiLifecycleResult multi lifecycle result
|
||||
//
|
||||
// swagger:model hasPermissionRequest
|
||||
type HasPermissionRequest struct {
|
||||
// swagger:model multiLifecycleResult
|
||||
type MultiLifecycleResult struct {
|
||||
|
||||
// actions
|
||||
Actions []*PolicyArgs `json:"actions"`
|
||||
// results
|
||||
Results []*MulticycleResultItem `json:"results"`
|
||||
}
|
||||
|
||||
// Validate validates this has permission request
|
||||
func (m *HasPermissionRequest) Validate(formats strfmt.Registry) error {
|
||||
// Validate validates this multi lifecycle result
|
||||
func (m *MultiLifecycleResult) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateActions(formats); err != nil {
|
||||
if err := m.validateResults(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
@@ -54,20 +54,22 @@ func (m *HasPermissionRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HasPermissionRequest) validateActions(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Actions) { // not required
|
||||
func (m *MultiLifecycleResult) validateResults(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Results) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Actions); i++ {
|
||||
if swag.IsZero(m.Actions[i]) { // not required
|
||||
for i := 0; i < len(m.Results); i++ {
|
||||
if swag.IsZero(m.Results[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Actions[i] != nil {
|
||||
if err := m.Actions[i].Validate(formats); err != nil {
|
||||
if m.Results[i] != nil {
|
||||
if err := m.Results[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("actions" + "." + strconv.Itoa(i))
|
||||
return ve.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -78,11 +80,11 @@ func (m *HasPermissionRequest) validateActions(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this has permission request based on the context it is used
|
||||
func (m *HasPermissionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
// ContextValidate validate this multi lifecycle result based on the context it is used
|
||||
func (m *MultiLifecycleResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateActions(ctx, formats); err != nil {
|
||||
if err := m.contextValidateResults(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
@@ -92,14 +94,16 @@ func (m *HasPermissionRequest) ContextValidate(ctx context.Context, formats strf
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *HasPermissionRequest) contextValidateActions(ctx context.Context, formats strfmt.Registry) error {
|
||||
func (m *MultiLifecycleResult) contextValidateResults(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Actions); i++ {
|
||||
for i := 0; i < len(m.Results); i++ {
|
||||
|
||||
if m.Actions[i] != nil {
|
||||
if err := m.Actions[i].ContextValidate(ctx, formats); err != nil {
|
||||
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("actions" + "." + strconv.Itoa(i))
|
||||
return ve.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("results" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -111,7 +115,7 @@ func (m *HasPermissionRequest) contextValidateActions(ctx context.Context, forma
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *HasPermissionRequest) MarshalBinary() ([]byte, error) {
|
||||
func (m *MultiLifecycleResult) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -119,8 +123,8 @@ func (m *HasPermissionRequest) MarshalBinary() ([]byte, error) {
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *HasPermissionRequest) UnmarshalBinary(b []byte) error {
|
||||
var res HasPermissionRequest
|
||||
func (m *MultiLifecycleResult) UnmarshalBinary(b []byte) error {
|
||||
var res MultiLifecycleResult
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
70
models/multicycle_result_item.go
Normal file
70
models/multicycle_result_item.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) 2021 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"
|
||||
)
|
||||
|
||||
// MulticycleResultItem multicycle result item
|
||||
//
|
||||
// swagger:model multicycleResultItem
|
||||
type MulticycleResultItem struct {
|
||||
|
||||
// bucket name
|
||||
BucketName string `json:"bucketName,omitempty"`
|
||||
|
||||
// error
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this multicycle result item
|
||||
func (m *MulticycleResultItem) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this multicycle result item based on context it is used
|
||||
func (m *MulticycleResultItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *MulticycleResultItem) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *MulticycleResultItem) UnmarshalBinary(b []byte) error {
|
||||
var res MulticycleResultItem
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -76,6 +76,8 @@ func (m *NodeSelectorTerm) validateMatchExpressions(formats strfmt.Registry) err
|
||||
if err := m.MatchExpressions[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("matchExpressions" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("matchExpressions" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *NodeSelectorTerm) validateMatchFields(formats strfmt.Registry) error {
|
||||
if err := m.MatchFields[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("matchFields" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("matchFields" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -136,6 +140,8 @@ func (m *NodeSelectorTerm) contextValidateMatchExpressions(ctx context.Context,
|
||||
if err := m.MatchExpressions[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("matchExpressions" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("matchExpressions" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -154,6 +160,8 @@ func (m *NodeSelectorTerm) contextValidateMatchFields(ctx context.Context, forma
|
||||
if err := m.MatchFields[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("matchFields" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("matchFields" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -37,8 +37,12 @@ import (
|
||||
type NofiticationService string
|
||||
|
||||
func NewNofiticationService(value NofiticationService) *NofiticationService {
|
||||
v := value
|
||||
return &v
|
||||
return &value
|
||||
}
|
||||
|
||||
// Pointer returns a pointer to a freshly-allocated NofiticationService.
|
||||
func (m NofiticationService) Pointer() *NofiticationService {
|
||||
return &m
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -68,6 +68,8 @@ func (m *NotifEndpointResponse) validateNotificationEndpoints(formats strfmt.Reg
|
||||
if err := m.NotificationEndpoints[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("notification_endpoints" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("notification_endpoints" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -100,6 +102,8 @@ func (m *NotifEndpointResponse) contextValidateNotificationEndpoints(ctx context
|
||||
if err := m.NotificationEndpoints[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("notification_endpoints" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("notification_endpoints" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -91,6 +91,8 @@ func (m *NotificationConfig) validateEvents(formats strfmt.Registry) error {
|
||||
if err := m.Events[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -121,6 +123,8 @@ func (m *NotificationConfig) contextValidateEvents(ctx context.Context, formats
|
||||
if err := m.Events[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -83,6 +83,8 @@ func (m *NotificationDeleteRequest) validateEvents(formats strfmt.Registry) erro
|
||||
if err := m.Events[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -131,6 +133,8 @@ func (m *NotificationDeleteRequest) contextValidateEvents(ctx context.Context, f
|
||||
if err := m.Events[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("events" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -103,6 +103,8 @@ func (m *NotificationEndpoint) validateService(formats strfmt.Registry) error {
|
||||
if err := m.Service.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("service")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("service")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -131,6 +133,8 @@ func (m *NotificationEndpoint) contextValidateService(ctx context.Context, forma
|
||||
if err := m.Service.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("service")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("service")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ func (m *NotificationEndpointItem) validateService(formats strfmt.Registry) erro
|
||||
if err := m.Service.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("service")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("service")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -93,6 +95,8 @@ func (m *NotificationEndpointItem) contextValidateService(ctx context.Context, f
|
||||
if err := m.Service.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("service")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("service")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -37,8 +37,12 @@ import (
|
||||
type NotificationEventType string
|
||||
|
||||
func NewNotificationEventType(value NotificationEventType) *NotificationEventType {
|
||||
v := value
|
||||
return &v
|
||||
return &value
|
||||
}
|
||||
|
||||
// Pointer returns a pointer to a freshly-allocated NotificationEventType.
|
||||
func (m NotificationEventType) Pointer() *NotificationEventType {
|
||||
return &m
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -86,6 +86,8 @@ func (m *ObjectBucketLifecycle) validateExpiration(formats strfmt.Registry) erro
|
||||
if err := m.Expiration.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("expiration")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("expiration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -108,6 +110,8 @@ func (m *ObjectBucketLifecycle) validateTags(formats strfmt.Registry) error {
|
||||
if err := m.Tags[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tags" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("tags" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -127,6 +131,8 @@ func (m *ObjectBucketLifecycle) validateTransition(formats strfmt.Registry) erro
|
||||
if err := m.Transition.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("transition")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("transition")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -163,6 +169,8 @@ func (m *ObjectBucketLifecycle) contextValidateExpiration(ctx context.Context, f
|
||||
if err := m.Expiration.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("expiration")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("expiration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -179,6 +187,8 @@ func (m *ObjectBucketLifecycle) contextValidateTags(ctx context.Context, formats
|
||||
if err := m.Tags[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tags" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("tags" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -195,6 +205,8 @@ func (m *ObjectBucketLifecycle) contextValidateTransition(ctx context.Context, f
|
||||
if err := m.Transition.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("transition")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("transition")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -37,8 +37,12 @@ import (
|
||||
type ObjectLegalHoldStatus string
|
||||
|
||||
func NewObjectLegalHoldStatus(value ObjectLegalHoldStatus) *ObjectLegalHoldStatus {
|
||||
v := value
|
||||
return &v
|
||||
return &value
|
||||
}
|
||||
|
||||
// Pointer returns a pointer to a freshly-allocated ObjectLegalHoldStatus.
|
||||
func (m ObjectLegalHoldStatus) Pointer() *ObjectLegalHoldStatus {
|
||||
return &m
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -37,8 +37,12 @@ import (
|
||||
type ObjectRetentionMode string
|
||||
|
||||
func NewObjectRetentionMode(value ObjectRetentionMode) *ObjectRetentionMode {
|
||||
v := value
|
||||
return &v
|
||||
return &value
|
||||
}
|
||||
|
||||
// Pointer returns a pointer to a freshly-allocated ObjectRetentionMode.
|
||||
func (m ObjectRetentionMode) Pointer() *ObjectRetentionMode {
|
||||
return &m
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -37,8 +37,12 @@ import (
|
||||
type ObjectRetentionUnit string
|
||||
|
||||
func NewObjectRetentionUnit(value ObjectRetentionUnit) *ObjectRetentionUnit {
|
||||
v := value
|
||||
return &v
|
||||
return &value
|
||||
}
|
||||
|
||||
// Pointer returns a pointer to a freshly-allocated ObjectRetentionUnit.
|
||||
func (m ObjectRetentionUnit) Pointer() *ObjectRetentionUnit {
|
||||
return &m
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -75,6 +75,8 @@ func (m *PodAffinityTerm) validateLabelSelector(formats strfmt.Registry) error {
|
||||
if err := m.LabelSelector.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("labelSelector")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("labelSelector")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -112,6 +114,8 @@ func (m *PodAffinityTerm) contextValidateLabelSelector(ctx context.Context, form
|
||||
if err := m.LabelSelector.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("labelSelector")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("labelSelector")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -178,6 +182,8 @@ func (m *PodAffinityTermLabelSelector) validateMatchExpressions(formats strfmt.R
|
||||
if err := m.MatchExpressions[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("labelSelector" + "." + "matchExpressions" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("labelSelector" + "." + "matchExpressions" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -210,6 +216,8 @@ func (m *PodAffinityTermLabelSelector) contextValidateMatchExpressions(ctx conte
|
||||
if err := m.MatchExpressions[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("labelSelector" + "." + "matchExpressions" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("labelSelector" + "." + "matchExpressions" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -37,8 +37,12 @@ import (
|
||||
type PolicyEntity string
|
||||
|
||||
func NewPolicyEntity(value PolicyEntity) *PolicyEntity {
|
||||
v := value
|
||||
return &v
|
||||
return &value
|
||||
}
|
||||
|
||||
// Pointer returns a pointer to a freshly-allocated PolicyEntity.
|
||||
func (m PolicyEntity) Pointer() *PolicyEntity {
|
||||
return &m
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -114,6 +114,8 @@ func (m *Pool) validateAffinity(formats strfmt.Registry) error {
|
||||
if err := m.Affinity.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("affinity")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("affinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -131,6 +133,8 @@ func (m *Pool) validateResources(formats strfmt.Registry) error {
|
||||
if err := m.Resources.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("resources")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("resources")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -148,6 +152,8 @@ func (m *Pool) validateSecurityContext(formats strfmt.Registry) error {
|
||||
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
|
||||
}
|
||||
@@ -173,6 +179,8 @@ func (m *Pool) validateTolerations(formats strfmt.Registry) error {
|
||||
if err := m.Tolerations.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tolerations")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("tolerations")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -190,6 +198,8 @@ func (m *Pool) validateVolumeConfiguration(formats strfmt.Registry) error {
|
||||
if err := m.VolumeConfiguration.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("volume_configuration")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("volume_configuration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -243,6 +253,8 @@ func (m *Pool) contextValidateAffinity(ctx context.Context, formats strfmt.Regis
|
||||
if err := m.Affinity.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("affinity")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("affinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -257,6 +269,8 @@ func (m *Pool) contextValidateResources(ctx context.Context, formats strfmt.Regi
|
||||
if err := m.Resources.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("resources")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("resources")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -271,6 +285,8 @@ func (m *Pool) contextValidateSecurityContext(ctx context.Context, formats strfm
|
||||
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
|
||||
}
|
||||
@@ -284,6 +300,8 @@ func (m *Pool) contextValidateTolerations(ctx context.Context, formats strfmt.Re
|
||||
if err := m.Tolerations.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tolerations")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("tolerations")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -297,6 +315,8 @@ func (m *Pool) contextValidateVolumeConfiguration(ctx context.Context, formats s
|
||||
if err := m.VolumeConfiguration.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("volume_configuration")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("volume_configuration")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -78,6 +78,8 @@ func (m *PoolAffinity) validateNodeAffinity(formats strfmt.Registry) error {
|
||||
if err := m.NodeAffinity.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("nodeAffinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -95,6 +97,8 @@ func (m *PoolAffinity) validatePodAffinity(formats strfmt.Registry) error {
|
||||
if err := m.PodAffinity.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinity")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAffinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -112,6 +116,8 @@ func (m *PoolAffinity) validatePodAntiAffinity(formats strfmt.Registry) error {
|
||||
if err := m.PodAntiAffinity.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAntiAffinity")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAntiAffinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -148,6 +154,8 @@ func (m *PoolAffinity) contextValidateNodeAffinity(ctx context.Context, formats
|
||||
if err := m.NodeAffinity.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("nodeAffinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -162,6 +170,8 @@ func (m *PoolAffinity) contextValidatePodAffinity(ctx context.Context, formats s
|
||||
if err := m.PodAffinity.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinity")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAffinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -176,6 +186,8 @@ func (m *PoolAffinity) contextValidatePodAntiAffinity(ctx context.Context, forma
|
||||
if err := m.PodAntiAffinity.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAntiAffinity")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAntiAffinity")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -246,6 +258,8 @@ func (m *PoolAffinityNodeAffinity) validatePreferredDuringSchedulingIgnoredDurin
|
||||
if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("nodeAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -265,6 +279,8 @@ func (m *PoolAffinityNodeAffinity) validateRequiredDuringSchedulingIgnoredDuring
|
||||
if err := m.RequiredDuringSchedulingIgnoredDuringExecution.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -299,6 +315,8 @@ func (m *PoolAffinityNodeAffinity) contextValidatePreferredDuringSchedulingIgnor
|
||||
if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("nodeAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -315,6 +333,8 @@ func (m *PoolAffinityNodeAffinity) contextValidateRequiredDuringSchedulingIgnore
|
||||
if err := m.RequiredDuringSchedulingIgnoredDuringExecution.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -383,6 +403,8 @@ func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecution
|
||||
if err := m.Preference.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("preference")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("preference")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -420,6 +442,8 @@ func (m *PoolAffinityNodeAffinityPreferredDuringSchedulingIgnoredDuringExecution
|
||||
if err := m.Preference.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("preference")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("preference")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -485,6 +509,8 @@ func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution)
|
||||
if err := m.NodeSelectorTerms[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + "nodeSelectorTerms" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + "nodeSelectorTerms" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -517,6 +543,8 @@ func (m *PoolAffinityNodeAffinityRequiredDuringSchedulingIgnoredDuringExecution)
|
||||
if err := m.NodeSelectorTerms[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + "nodeSelectorTerms" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("nodeAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + "nodeSelectorTerms" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -589,6 +617,8 @@ func (m *PoolAffinityPodAffinity) validatePreferredDuringSchedulingIgnoredDuring
|
||||
if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -613,6 +643,8 @@ func (m *PoolAffinityPodAffinity) validateRequiredDuringSchedulingIgnoredDuringE
|
||||
if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -649,6 +681,8 @@ func (m *PoolAffinityPodAffinity) contextValidatePreferredDuringSchedulingIgnore
|
||||
if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -667,6 +701,8 @@ func (m *PoolAffinityPodAffinity) contextValidateRequiredDuringSchedulingIgnored
|
||||
if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -737,6 +773,8 @@ func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionI
|
||||
if err := m.PodAffinityTerm.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinityTerm")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAffinityTerm")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -774,6 +812,8 @@ func (m *PoolAffinityPodAffinityPreferredDuringSchedulingIgnoredDuringExecutionI
|
||||
if err := m.PodAffinityTerm.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinityTerm")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAffinityTerm")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -844,6 +884,8 @@ func (m *PoolAffinityPodAntiAffinity) validatePreferredDuringSchedulingIgnoredDu
|
||||
if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAntiAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAntiAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -868,6 +910,8 @@ func (m *PoolAffinityPodAntiAffinity) validateRequiredDuringSchedulingIgnoredDur
|
||||
if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAntiAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAntiAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -904,6 +948,8 @@ func (m *PoolAffinityPodAntiAffinity) contextValidatePreferredDuringSchedulingIg
|
||||
if err := m.PreferredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAntiAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAntiAffinity" + "." + "preferredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -922,6 +968,8 @@ func (m *PoolAffinityPodAntiAffinity) contextValidateRequiredDuringSchedulingIgn
|
||||
if err := m.RequiredDuringSchedulingIgnoredDuringExecution[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAntiAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAntiAffinity" + "." + "requiredDuringSchedulingIgnoredDuringExecution" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -992,6 +1040,8 @@ func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecut
|
||||
if err := m.PodAffinityTerm.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinityTerm")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAffinityTerm")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -1029,6 +1079,8 @@ func (m *PoolAffinityPodAntiAffinityPreferredDuringSchedulingIgnoredDuringExecut
|
||||
if err := m.PodAffinityTerm.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("podAffinityTerm")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("podAffinityTerm")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ func (m PoolTolerations) Validate(formats strfmt.Registry) error {
|
||||
if err := m[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -72,6 +74,8 @@ func (m PoolTolerations) ContextValidate(ctx context.Context, formats strfmt.Reg
|
||||
if err := m[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName(strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName(strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -129,6 +133,8 @@ func (m *PoolTolerationsItems0) validateTolerationSeconds(formats strfmt.Registr
|
||||
if err := m.TolerationSeconds.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tolerationSeconds")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("tolerationSeconds")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -157,6 +163,8 @@ func (m *PoolTolerationsItems0) contextValidateTolerationSeconds(ctx context.Con
|
||||
if err := m.TolerationSeconds.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("tolerationSeconds")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("tolerationSeconds")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,6 +71,8 @@ func (m *PoolUpdateRequest) validatePools(formats strfmt.Registry) error {
|
||||
if err := m.Pools[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("pools" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("pools" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -103,6 +105,8 @@ func (m *PoolUpdateRequest) contextValidatePools(ctx context.Context, formats st
|
||||
if err := m.Pools[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("pools" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("pools" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -37,8 +37,12 @@ import (
|
||||
type ProfilerType string
|
||||
|
||||
func NewProfilerType(value ProfilerType) *ProfilerType {
|
||||
v := value
|
||||
return &v
|
||||
return &value
|
||||
}
|
||||
|
||||
// Pointer returns a pointer to a freshly-allocated ProfilerType.
|
||||
func (m ProfilerType) Pointer() *ProfilerType {
|
||||
return &m
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -69,6 +69,8 @@ func (m *ProfilingStartRequest) validateType(formats strfmt.Registry) error {
|
||||
if err := m.Type.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("type")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("type")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -97,6 +99,8 @@ func (m *ProfilingStartRequest) contextValidateType(ctx context.Context, formats
|
||||
if err := m.Type.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("type")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("type")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -77,6 +77,8 @@ func (m *PrometheusConfiguration) validateSecurityContext(formats strfmt.Registr
|
||||
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
|
||||
}
|
||||
@@ -105,6 +107,8 @@ func (m *PrometheusConfiguration) contextValidateSecurityContext(ctx context.Con
|
||||
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
|
||||
}
|
||||
|
||||
@@ -85,6 +85,8 @@ func (m *PutBucketRetentionRequest) validateMode(formats strfmt.Registry) error
|
||||
if err := m.Mode.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("mode")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("mode")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -107,6 +109,8 @@ func (m *PutBucketRetentionRequest) validateUnit(formats strfmt.Registry) error
|
||||
if err := m.Unit.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("unit")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("unit")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -148,6 +152,8 @@ func (m *PutBucketRetentionRequest) contextValidateMode(ctx context.Context, for
|
||||
if err := m.Mode.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("mode")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("mode")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -162,6 +168,8 @@ func (m *PutBucketRetentionRequest) contextValidateUnit(ctx context.Context, for
|
||||
if err := m.Unit.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("unit")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("unit")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ func (m *PutObjectLegalHoldRequest) validateStatus(formats strfmt.Registry) erro
|
||||
if err := m.Status.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("status")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("status")
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -97,6 +99,8 @@ func (m *PutObjectLegalHoldRequest) contextValidateStatus(ctx context.Context, f
|
||||
if err := m.Status.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("status")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("status")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user