Compare commits
174 Commits
v0.17.2
...
bucket_nam
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ed8f11b22 | ||
|
|
860d8c6b78 | ||
|
|
99965805a6 | ||
|
|
7036d1328e | ||
|
|
697910c7b2 | ||
|
|
64dc605843 | ||
|
|
75fa88e6e2 | ||
|
|
2857b8c586 | ||
|
|
b1788c29db | ||
|
|
2e1401f013 | ||
|
|
1e1c11b13c | ||
|
|
25c1c854b1 | ||
|
|
5be2cc1965 | ||
|
|
4aa3f40792 | ||
|
|
3f41a82fd3 | ||
|
|
1b641b4222 | ||
|
|
85aabebbb4 | ||
|
|
919232261d | ||
|
|
ddd25a20eb | ||
|
|
84b8f9d6fa | ||
|
|
46af0ff74c | ||
|
|
b3651ed0a3 | ||
|
|
78c4fa393a | ||
|
|
84c4159062 | ||
|
|
ac2888fc4e | ||
|
|
c311847dcf | ||
|
|
cb6cda7265 | ||
|
|
16fd5470db | ||
|
|
ea0cac2a92 | ||
|
|
33b041ef34 | ||
|
|
b692ea693f | ||
|
|
fd39e50c08 | ||
|
|
ad4b9c050a | ||
|
|
1deb6371ed | ||
|
|
3b11556f4b | ||
|
|
25f719b0e2 | ||
|
|
231b63f1b0 | ||
|
|
e73370cc8c | ||
|
|
5d25dd4c06 | ||
|
|
51a8bacc18 | ||
|
|
db07f546a4 | ||
|
|
255cf0bc85 | ||
|
|
733e0b18e2 | ||
|
|
8d90e03992 | ||
|
|
1a1fae9ce3 | ||
|
|
f26786c904 | ||
|
|
e0b6bf5aa6 | ||
|
|
9655fc4490 | ||
|
|
417ea4d481 | ||
|
|
5a59f8e3f4 | ||
|
|
48340d0010 | ||
|
|
251de9fe8a | ||
|
|
c501df927b | ||
|
|
cdb1659506 | ||
|
|
558afe36ad | ||
|
|
712d3870eb | ||
|
|
c71f084531 | ||
|
|
1c58a543b6 | ||
|
|
8e857dc563 | ||
|
|
78d4d4c89e | ||
|
|
aea749d82f | ||
|
|
ce3293b4e2 | ||
|
|
0c12fbdd23 | ||
|
|
118cf97e1d | ||
|
|
abb668633b | ||
|
|
dd2fffd3dc | ||
|
|
64b13e9dc9 | ||
|
|
58d7f1e8ae | ||
|
|
45e4a94416 | ||
|
|
cce054bbe8 | ||
|
|
cf0e326b82 | ||
|
|
e48958f5a0 | ||
|
|
63e2793272 | ||
|
|
532e64b802 | ||
|
|
64b3e965c6 | ||
|
|
9371c027f3 | ||
|
|
a8bc58a420 | ||
|
|
10c56a91da | ||
|
|
403972de39 | ||
|
|
1c0632473a | ||
|
|
ff93109b57 | ||
|
|
b518810106 | ||
|
|
b4d2d65c5c | ||
|
|
beeb188d7e | ||
|
|
2830022ede | ||
|
|
ba4103e03f | ||
|
|
f3d6638384 | ||
|
|
2ad42d660b | ||
|
|
618a00d775 | ||
|
|
d0b65ce297 | ||
|
|
41f640077b | ||
|
|
bfa05616b1 | ||
|
|
f792d7a476 | ||
|
|
9b13cfdbe9 | ||
|
|
02c274e117 | ||
|
|
8993b40730 | ||
|
|
1311b171f9 | ||
|
|
7ecc1022b2 | ||
|
|
a5c14790b3 | ||
|
|
e5f7a03585 | ||
|
|
a024a13f25 | ||
|
|
4d876d0ce8 | ||
|
|
b02c37bf33 | ||
|
|
1d17f11d2f | ||
|
|
1dd9f7f363 | ||
|
|
618d95b76e | ||
|
|
e416abe19b | ||
|
|
296f58f43d | ||
|
|
0b5e3d5a10 | ||
|
|
5d591b18d9 | ||
|
|
e68bc08fed | ||
|
|
df38c84075 | ||
|
|
c509e5db70 | ||
|
|
5a8e029005 | ||
|
|
e3d96b5bb3 | ||
|
|
51afc337ff | ||
|
|
617d41584e | ||
|
|
7a8e2caa50 | ||
|
|
fed58ec29a | ||
|
|
427a7516a3 | ||
|
|
969feb8efa | ||
|
|
d09d6e1e99 | ||
|
|
2d80638090 | ||
|
|
2918d39ab7 | ||
|
|
fb2eb0ebf7 | ||
|
|
e7a36a1ff1 | ||
|
|
41e1b4a5d5 | ||
|
|
6e205fa8ae | ||
|
|
5b3f6ad76e | ||
|
|
8396c3023e | ||
|
|
161d56db36 | ||
|
|
a49a4e5513 | ||
|
|
9741462e7b | ||
|
|
73f09e1af6 | ||
|
|
d41f6e57d2 | ||
|
|
93d041e55b | ||
|
|
94e419e09c | ||
|
|
6c5f6934e7 | ||
|
|
41155b3f97 | ||
|
|
e41c80449d | ||
|
|
6f7a46e528 | ||
|
|
ba48e0c5b8 | ||
|
|
3da636170f | ||
|
|
7687a9e588 | ||
|
|
692dc1a29e | ||
|
|
bb55f9f331 | ||
|
|
dec7b138e9 | ||
|
|
d3b1be80eb | ||
|
|
0339925d15 | ||
|
|
d956ec65a2 | ||
|
|
b02e649405 | ||
|
|
68e98be376 | ||
|
|
c9d174df09 | ||
|
|
80391b867c | ||
|
|
45715293ea | ||
|
|
dd4963e3aa | ||
|
|
c7c7fe194c | ||
|
|
35fdaf1ddd | ||
|
|
2aa5081889 | ||
|
|
9c5d4aaf11 | ||
|
|
04adf25e65 | ||
|
|
8f77261872 | ||
|
|
8b7505c466 | ||
|
|
b420ef3c1f | ||
|
|
e235863b94 | ||
|
|
6b7948b6cd | ||
|
|
87c373b08c | ||
|
|
9844269c1a | ||
|
|
6866b84da8 | ||
|
|
5b19fb3d96 | ||
|
|
fce2a148b8 | ||
|
|
69e1d653ce | ||
|
|
9b88dd6348 | ||
|
|
85c0e5eca2 |
376
.github/workflows/jobs.yaml
vendored
376
.github/workflows/jobs.yaml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -98,7 +98,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -135,6 +135,7 @@ jobs:
|
||||
run: |
|
||||
echo "The idea is to build minio image from downloaded repository";
|
||||
cd $GITHUB_WORKSPACE/minio_repository;
|
||||
echo "replace github.com/minio/console => ../" >> go.mod
|
||||
echo "Get git version to build MinIO Image";
|
||||
VERSION=`git rev-parse HEAD`;
|
||||
echo $VERSION;
|
||||
@@ -167,7 +168,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
|
||||
steps:
|
||||
|
||||
@@ -192,7 +193,7 @@ jobs:
|
||||
curl -sLO "https://dl.k8s.io/release/v1.23.1/bin/linux/amd64/kubectl" -o kubectl
|
||||
chmod +x kubectl
|
||||
mv kubectl /usr/local/bin
|
||||
"${GITHUB_WORKSPACE}/.github/workflows/deploy-tenant.sh"
|
||||
"${GITHUB_WORKSPACE}/tests/deploy-tenant.sh"
|
||||
echo "start ---> make test-operator-integration";
|
||||
make test-operator-integration;
|
||||
|
||||
@@ -209,7 +210,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -233,7 +234,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -276,11 +277,11 @@ jobs:
|
||||
semgrep --config semgrep.yaml $(pwd)/portal-ui --error
|
||||
|
||||
no-warnings-and-make-assets:
|
||||
name: "React Code Has No Warnings and then Make Assets"
|
||||
name: "React Code Has No Warnings & is Prettified, then Make Assets"
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -288,12 +289,18 @@ jobs:
|
||||
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
|
||||
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
@@ -329,13 +336,18 @@ jobs:
|
||||
continue-on-error: false
|
||||
run: |
|
||||
./check-warnings.sh
|
||||
- name: Check if Files are Prettified
|
||||
working-directory: ./portal-ui
|
||||
continue-on-error: false
|
||||
run: |
|
||||
./check-prettier.sh
|
||||
|
||||
reuse-golang-dependencies:
|
||||
name: reuse golang dependencies
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -373,7 +385,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -381,12 +393,18 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
@@ -452,7 +470,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -460,12 +478,18 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
@@ -531,7 +555,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -539,12 +563,18 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
@@ -612,7 +642,7 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -620,11 +650,14 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
@@ -681,7 +714,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -689,11 +722,14 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
@@ -750,7 +786,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -758,11 +794,14 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
@@ -819,7 +858,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -827,11 +866,14 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
@@ -877,6 +919,163 @@ jobs:
|
||||
with:
|
||||
args: '"chrome:headless" portal-ui/tests/permissions-7/ --skip-js-errors'
|
||||
|
||||
all-permissions-8:
|
||||
name: Permissions Tests Part 8
|
||||
needs:
|
||||
- lint-job
|
||||
- no-warnings-and-make-assets
|
||||
- reuse-golang-dependencies
|
||||
- vulnerable-dependencies-checks
|
||||
- semgrep-static-code-analysis
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.18.x, 1.19.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
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- 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
|
||||
name: Yarn Cache
|
||||
with:
|
||||
path: |
|
||||
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
./portal-ui/node_modules/
|
||||
./portal-ui/build/
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('./portal-ui/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- uses: actions/cache@v2
|
||||
id: assets-cache
|
||||
name: Assets Cache
|
||||
with:
|
||||
path: |
|
||||
./portal-ui/build/
|
||||
key: ${{ runner.os }}-assets-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-assets-
|
||||
- uses: actions/cache@v2
|
||||
name: Go Mod Cache
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ github.run_id }}
|
||||
- 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
|
||||
timeout-minutes: 5
|
||||
uses: DevExpress/testcafe-action@latest
|
||||
with:
|
||||
args: '"chrome:headless" portal-ui/tests/permissions-8/ --skip-js-errors'
|
||||
|
||||
all-permissions-9:
|
||||
name: Permissions Tests Part 9
|
||||
needs:
|
||||
- lint-job
|
||||
- no-warnings-and-make-assets
|
||||
- reuse-golang-dependencies
|
||||
- vulnerable-dependencies-checks
|
||||
- semgrep-static-code-analysis
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.18.x, 1.19.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
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
|
||||
- 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
|
||||
name: Yarn Cache
|
||||
with:
|
||||
path: |
|
||||
${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
./portal-ui/node_modules/
|
||||
./portal-ui/build/
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('./portal-ui/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: assets-cache
|
||||
name: Assets Cache
|
||||
with:
|
||||
path: |
|
||||
./portal-ui/build/
|
||||
key: ${{ runner.os }}-assets-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-assets-
|
||||
|
||||
- uses: actions/cache@v2
|
||||
name: Go Mod Cache
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ github.run_id }}
|
||||
|
||||
- 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-9/ --skip-js-errors -c 3'
|
||||
|
||||
- name: Clean up users & policies
|
||||
run: |
|
||||
make cleanup-permissions
|
||||
|
||||
all-operator-tests:
|
||||
name: Operator UI Tests
|
||||
needs:
|
||||
@@ -888,7 +1087,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -896,11 +1095,18 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '16'
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
name: Go Mod Cache
|
||||
with:
|
||||
@@ -962,7 +1168,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1000,7 +1206,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1038,7 +1244,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1076,7 +1282,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1114,7 +1320,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1152,7 +1358,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1190,7 +1396,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1228,7 +1434,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1274,7 +1480,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1321,7 +1527,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1368,7 +1574,31 @@ jobs:
|
||||
echo "We are going to use the built image on test-integration";
|
||||
VERSION="minio/minio:$VERSION";
|
||||
echo $VERSION;
|
||||
make test-integration MINIO_VERSION=$VERSION;
|
||||
|
||||
echo "Create bucket for replication with versioning"
|
||||
echo "Download mc for Ubuntu"
|
||||
wget -q https://dl.min.io/client/mc/release/linux-amd64/mc
|
||||
echo "Change the permissions to execute mc command"
|
||||
chmod +x mc
|
||||
echo "Create the folder to put the all.out file"
|
||||
TARGET_BUCKET=`echo $RANDOM | md5sum | head -c 20; echo;`
|
||||
echo "TARGET_BUCKET: ${TARGET_BUCKET}"
|
||||
echo "Only run our test if play is up and running..."
|
||||
PLAY_IS_ON=`wget --spider --server-response https://play.min.io:9443/login 2>&1 | grep '200\ OK' | wc -l`
|
||||
if [ $PLAY_IS_ON == 1 ]
|
||||
then
|
||||
echo "Play is up and running, we will proceed with the test"
|
||||
else
|
||||
echo "Play is down, please report it on hack channel"
|
||||
exit
|
||||
fi
|
||||
./mc mb --ignore-existing play/${TARGET_BUCKET}/
|
||||
./mc version enable play/${TARGET_BUCKET}
|
||||
# Via API we are going to test:
|
||||
# mc admin bucket remote add myminio/source https://minioadmin:minioadmin@play.min.io/target --service "replication"
|
||||
# expected output is: Remote ARN = `arn:minio:replication::f5bdb8d7-541d-415e-aaf4-592979484ba9:target`.
|
||||
|
||||
make test-integration MINIO_VERSION=$VERSION TARGET_BUCKET=$TARGET_BUCKET;
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: coverage-cache
|
||||
@@ -1409,7 +1639,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
go-version: [ 1.18.x, 1.19.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
@@ -1504,22 +1734,32 @@ jobs:
|
||||
wget -q https://dl.min.io/client/mc/release/linux-amd64/mc
|
||||
echo "Change the permissions to execute mc command"
|
||||
chmod +x mc
|
||||
echo "Create the folder to put the all.out file"
|
||||
./mc mb --ignore-existing play/builds/
|
||||
echo "Copy the all.out file to play bucket"
|
||||
echo ${{ github.repository }}
|
||||
echo ${{ github.event.number }}
|
||||
echo ${{ github.run_id }}
|
||||
./mc cp all.out play/builds/${{ github.repository }}/${{ github.event.number }}/${{ github.run_id }}/
|
||||
./mc cp all.out play/builds/${{ github.repository }}/${{ github.event.number }}/latest/
|
||||
go tool cover -html=all.out -o coverage.html
|
||||
./mc cp coverage.html play/builds/${{ github.repository }}/${{ github.event.number }}/${{ github.run_id }}/
|
||||
./mc cp coverage.html play/builds/${{ github.repository }}/${{ github.event.number }}/latest/
|
||||
echo "Only run our test if play is up and running since we require it for replication tests here."
|
||||
PLAY_IS_ON=`wget --spider --server-response https://play.min.io:9443/login 2>&1 | grep '200\ OK' | wc -l`
|
||||
if [ $PLAY_IS_ON == 1 ]
|
||||
then
|
||||
echo "Play is up and running, we will proceed with the play part for coverage"
|
||||
echo "Create the folder to put the all.out file"
|
||||
./mc mb --ignore-existing play/builds/
|
||||
echo "Copy the all.out file to play bucket"
|
||||
echo ${{ github.repository }}
|
||||
echo ${{ github.event.number }}
|
||||
echo ${{ github.run_id }}
|
||||
# mc cp can fail due to lack of space: mc: <ERROR> Failed to copy `all.out`.
|
||||
# Storage backend has reached its minimum free disk threshold. Please delete a few objects to proceed.
|
||||
./mc cp all.out play/builds/${{ github.repository }}/${{ github.event.number }}/${{ github.run_id }}/ || true
|
||||
./mc cp all.out play/builds/${{ github.repository }}/${{ github.event.number }}/latest/ || true
|
||||
go tool cover -html=all.out -o coverage.html
|
||||
./mc cp coverage.html play/builds/${{ github.repository }}/${{ github.event.number }}/${{ github.run_id }}/ || true
|
||||
./mc cp coverage.html play/builds/${{ github.repository }}/${{ github.event.number }}/latest/ || true
|
||||
else
|
||||
echo "Play is down, please report it on hack channel, no coverage is going to be uploaded!!!"
|
||||
fi
|
||||
echo "grep to obtain the result"
|
||||
go tool cover -func=all.out | grep total > tmp2
|
||||
result=`cat tmp2 | awk 'END {print $3}'`
|
||||
result=${result%\%}
|
||||
threshold=47.7
|
||||
threshold=53.40
|
||||
echo "Result:"
|
||||
echo "$result%"
|
||||
if (( $(echo "$result >= $threshold" |bc -l) )); then
|
||||
|
||||
@@ -5,6 +5,12 @@ linters-settings:
|
||||
misspell:
|
||||
locale: US
|
||||
|
||||
goheader:
|
||||
values:
|
||||
regexp:
|
||||
copyright-holder: Copyright \(c\) (20\d\d\-20\d\d)|2021|({{year}})
|
||||
template-path: .license.tmpl
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
@@ -28,27 +34,21 @@ linters:
|
||||
- tenv
|
||||
- durationcheck
|
||||
|
||||
linters-settings:
|
||||
goheader:
|
||||
values:
|
||||
regexp:
|
||||
copyright-holder: Copyright \(c\) (20\d\d\-20\d\d)|2021|({{year}})
|
||||
template-path: .license.tmpl
|
||||
|
||||
service:
|
||||
golangci-lint-version: 1.43.0 # use the fixed version to not introduce new linters unexpectedly
|
||||
|
||||
issues:
|
||||
exclude-use-default: false
|
||||
exclude:
|
||||
- should have a package comment
|
||||
# TODO(y4m4): Remove once all exported ident. have comments!
|
||||
- comment on exported function
|
||||
- comment on exported type
|
||||
- should have comment
|
||||
- use leading k in Go names
|
||||
- comment on exported const
|
||||
- should have a package comment
|
||||
# TODO(y4m4): Remove once all exported ident. have comments!
|
||||
- comment on exported function
|
||||
- comment on exported type
|
||||
- should have comment
|
||||
- use leading k in Go names
|
||||
- comment on exported const
|
||||
run:
|
||||
skip-dirs:
|
||||
- pkg/clientgen
|
||||
- pkg/apis/networking.gke.io
|
||||
- restapi/operations
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM node:17 as uilayer
|
||||
ARG NODE_VERSION
|
||||
FROM node:$NODE_VERSION as uilayer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -12,7 +13,7 @@ RUN make build-static
|
||||
|
||||
USER node
|
||||
|
||||
FROM golang:1.17 as golayer
|
||||
FROM golang:1.18 as golayer
|
||||
|
||||
RUN apt-get update -y && apt-get install -y ca-certificates
|
||||
|
||||
@@ -31,7 +32,7 @@ ENV CGO_ENABLED=0
|
||||
COPY --from=uilayer /app/build /go/src/github.com/minio/console/portal-ui/build
|
||||
RUN go build --tags=kqueue,operator -ldflags "-w -s" -a -o console ./cmd/console
|
||||
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.5
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6
|
||||
MAINTAINER MinIO Development "dev@min.io"
|
||||
EXPOSE 9090
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM node:17 as uilayer
|
||||
ARG NODE_VERSION
|
||||
FROM node:$NODE_VERSION as uilayer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
15
Makefile
15
Makefile
@@ -5,6 +5,8 @@ BUILD_VERSION:=$(shell git describe --exact-match --tags $(git log -n1 --pretty=
|
||||
BUILD_TIME:=$(shell date 2>/dev/null)
|
||||
TAG ?= "minio/console:$(BUILD_VERSION)-dev"
|
||||
MINIO_VERSION ?= "quay.io/minio/minio:latest"
|
||||
TARGET_BUCKET ?= "target"
|
||||
NODE_VERSION := $(shell cat .nvmrc)
|
||||
|
||||
default: console
|
||||
|
||||
@@ -14,13 +16,13 @@ console:
|
||||
@(GO111MODULE=on CGO_ENABLED=0 go build -trimpath --tags=kqueue,operator --ldflags "-s -w" -o console ./cmd/console)
|
||||
|
||||
k8sdev:
|
||||
@docker build -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' .
|
||||
@docker build -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' --build-arg NODE_VERSION='$(NODE_VERSION)' .
|
||||
@kind load docker-image $(TAG)
|
||||
@echo "Done, now restart your console deployment"
|
||||
|
||||
getdeps:
|
||||
@mkdir -p ${GOPATH}/bin
|
||||
@which golangci-lint 1>/dev/null || (echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.43.0)
|
||||
@echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin
|
||||
|
||||
verifiers: getdeps fmt lint
|
||||
|
||||
@@ -62,7 +64,8 @@ swagger-operator:
|
||||
@swagger generate server -A operator --main-package=operator --server-package=operatorapi --exclude-main -P models.Principal -f ./swagger-operator.yml -r NOTICE
|
||||
|
||||
assets:
|
||||
@(cd portal-ui; yarn install --prefer-offline; make build-static; yarn prettier --write . --loglevel warn; cd ..)
|
||||
@(if [ -f "${NVM_DIR}/nvm.sh" ]; then \. "${NVM_DIR}/nvm.sh" && nvm install && nvm use && npm install -g yarn ; fi &&\
|
||||
cd portal-ui; yarn install --prefer-offline; make build-static; yarn prettier --write . --loglevel warn; cd ..)
|
||||
|
||||
test-integration:
|
||||
@(docker stop pgsqlcontainer || true)
|
||||
@@ -74,8 +77,8 @@ test-integration:
|
||||
@echo $(MINIO_VERSION)
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 --net=mynet123 -d --name minio --rm -p 9000:9000 -p 9001:9001 -e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= $(MINIO_VERSION) server /data{1...4} --console-address ':9001' && sleep 5)
|
||||
@(docker run --net=mynet123 --ip=173.18.0.3 --name pgsqlcontainer --rm -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres && sleep 5)
|
||||
@echo "execute test and get coverage"
|
||||
@(cd integration && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && ./integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/system.out)
|
||||
@echo "execute test and get coverage for test-integration:"
|
||||
@(cd integration && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && export THETARGET=$(TARGET_BUCKET) && echo "THETARGET: ${THETARGET}" && ./integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/system.out)
|
||||
@(docker stop pgsqlcontainer)
|
||||
@(docker stop minio)
|
||||
@(docker network rm mynet123)
|
||||
@@ -260,7 +263,7 @@ clean:
|
||||
@rm -vf console
|
||||
|
||||
docker:
|
||||
@docker buildx build --output=type=docker --platform linux/amd64 -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' .
|
||||
@docker buildx build --output=type=docker --platform linux/amd64 -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' --build-arg NODE_VERSION='$(NODE_VERSION)' .
|
||||
|
||||
release: swagger-gen
|
||||
@echo "Generating Release: $(RELEASE)"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package cluster
|
||||
|
||||
import (
|
||||
directpvclient "github.com/minio/directpv/pkg/client"
|
||||
operator "github.com/minio/operator/pkg/client/clientset/versioned"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
@@ -63,3 +64,13 @@ func OperatorClient(token string) (*operator.Clientset, error) {
|
||||
func K8sClient(token string) (*kubernetes.Clientset, error) {
|
||||
return kubernetes.NewForConfig(GetK8sConfig(token))
|
||||
}
|
||||
|
||||
// DirectPV interfaces required to fetch information
|
||||
|
||||
func DirectPVDriveInterface(token string) (*directpvclient.DirectCSIDriveInterface, error) {
|
||||
return directpvclient.DirectCSIDriveInterfaceForConfig(GetK8sConfig(token))
|
||||
}
|
||||
|
||||
func DirectPVVolumeInterface(token string) (*directpvclient.DirectCSIVolumeInterface, error) {
|
||||
return directpvclient.DirectCSIVolumeInterfaceForConfig(GetK8sConfig(token))
|
||||
}
|
||||
|
||||
53
go.mod
53
go.mod
@@ -20,11 +20,12 @@ require (
|
||||
github.com/jessevdk/go-flags v1.5.0
|
||||
github.com/klauspost/compress v1.15.1
|
||||
github.com/minio/cli v1.22.0
|
||||
github.com/minio/directpv v1.4.4-0.20220805090942-948ca4731651
|
||||
github.com/minio/highwayhash v1.0.2
|
||||
github.com/minio/kes v0.19.2
|
||||
github.com/minio/madmin-go v1.3.14
|
||||
github.com/minio/mc v0.0.0-20220512134321-aa60a8db1e4d
|
||||
github.com/minio/minio-go/v7 v7.0.26
|
||||
github.com/minio/madmin-go v1.4.3
|
||||
github.com/minio/mc v0.0.0-20220705180830-01b87ecc02ff
|
||||
github.com/minio/minio-go/v7 v7.0.30
|
||||
github.com/minio/operator v0.0.0-20220414212219-ba4c097324b2
|
||||
github.com/minio/pkg v1.1.23
|
||||
github.com/minio/selfupdate v0.4.0
|
||||
@@ -34,21 +35,27 @@ require (
|
||||
github.com/stretchr/testify v1.7.1
|
||||
github.com/tidwall/gjson v1.14.0
|
||||
github.com/unrolled/secure v1.10.0
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
|
||||
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e
|
||||
golang.org/x/net v0.0.0-20220421235706-1d1ef9303861
|
||||
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
k8s.io/api v0.23.5
|
||||
k8s.io/apimachinery v0.23.5
|
||||
k8s.io/client-go v0.23.5
|
||||
k8s.io/api v0.24.3
|
||||
k8s.io/apimachinery v0.24.3
|
||||
k8s.io/client-go v0.24.3
|
||||
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.81.0 // indirect
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
||||
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
|
||||
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
||||
github.com/Azure/go-autorest/logger v0.2.1 // indirect
|
||||
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
||||
github.com/VividCortex/ewma v1.2.0 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/briandowns/spinner v1.18.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/charmbracelet/bubbles v0.10.3 // indirect
|
||||
github.com/charmbracelet/bubbletea v0.20.0 // indirect
|
||||
@@ -60,8 +67,11 @@ require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
|
||||
github.com/docker/go-units v0.4.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.8.0 // indirect
|
||||
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
|
||||
github.com/fatih/structs v1.1.0 // indirect
|
||||
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
|
||||
github.com/fsnotify/fsnotify v1.5.1 // indirect
|
||||
github.com/gdamore/encoding v1.0.0 // indirect
|
||||
github.com/gdamore/tcell/v2 v2.4.1-0.20210905002822-f057f0a857a1 // indirect
|
||||
github.com/go-logr/logr v1.2.2 // indirect
|
||||
@@ -73,13 +83,16 @@ require (
|
||||
github.com/goccy/go-json v0.9.4 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/google/gnostic v0.5.7-v3refs // indirect
|
||||
github.com/google/go-cmp v0.5.7 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/googleapis/gnostic v0.5.5 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
@@ -92,12 +105,14 @@ require (
|
||||
github.com/lestrrat-go/option v1.0.0 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
|
||||
github.com/magiconair/properties v1.8.5 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.12 // indirect
|
||||
github.com/mattn/go-ieproxy v0.0.1 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.13 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
||||
github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4 // indirect
|
||||
github.com/minio/colorjson v1.0.2 // indirect
|
||||
github.com/minio/filepath v1.0.0 // indirect
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
@@ -109,16 +124,18 @@ require (
|
||||
github.com/muesli/ansi v0.0.0-20211031195517-c9f0611b6c70 // indirect
|
||||
github.com/muesli/reflow v0.3.0 // indirect
|
||||
github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/navidys/tvxwidgets v0.1.0 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/pelletier/go-toml v1.9.3 // indirect
|
||||
github.com/philhofer/fwd v1.1.2-0.20210722190033-5c56ac6d0bb9 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pkg/xattr v0.4.5 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/posener/complete v1.2.3 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
|
||||
github.com/prometheus/client_golang v1.12.1 // indirect
|
||||
github.com/prometheus/client_golang v1.12.2 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.33.0 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
@@ -128,6 +145,12 @@ require (
|
||||
github.com/rjeczalik/notify v0.9.2 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.22.2 // indirect
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/spf13/afero v1.6.0 // indirect
|
||||
github.com/spf13/cast v1.3.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.8.1 // indirect
|
||||
github.com/subosito/gotenv v1.2.0 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/tinylib/msgp v1.1.7-0.20211026165309-e818a1881b0e // indirect
|
||||
@@ -137,7 +160,7 @@ require (
|
||||
go.etcd.io/etcd/api/v3 v3.5.2 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.2 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.2 // indirect
|
||||
go.mongodb.org/mongo-driver v1.8.4 // indirect
|
||||
go.mongodb.org/mongo-driver v1.9.1 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.8.0 // indirect
|
||||
go.uber.org/zap v1.21.0 // indirect
|
||||
@@ -153,10 +176,10 @@ require (
|
||||
gopkg.in/h2non/filetype.v1 v1.0.5 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.66.4 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
k8s.io/klog/v2 v2.40.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20220124234850-424119656bbf // indirect
|
||||
maze.io/x/duration v0.0.0-20160924141736-faac084b6075 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/apiextensions-apiserver v0.24.3 // indirect
|
||||
k8s.io/klog/v2 v2.60.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20220627174259-011e075b9cb8 // indirect
|
||||
sigs.k8s.io/controller-runtime v0.11.1 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
|
||||
|
||||
@@ -34,6 +34,7 @@ func Test_AddAccessRuleAPI(t *testing.T) {
|
||||
AddBucket("testaccessruleadd", false, false, nil, nil)
|
||||
|
||||
type args struct {
|
||||
bucket string
|
||||
prefix string
|
||||
access string
|
||||
}
|
||||
@@ -46,6 +47,7 @@ func Test_AddAccessRuleAPI(t *testing.T) {
|
||||
{
|
||||
name: "Create Access Rule - Valid",
|
||||
args: args{
|
||||
bucket: "testaccessruleadd",
|
||||
prefix: "/test/",
|
||||
access: "readonly",
|
||||
},
|
||||
@@ -53,14 +55,25 @@ func Test_AddAccessRuleAPI(t *testing.T) {
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Create Group - Invalid",
|
||||
name: "Add Access Rule - Invalid",
|
||||
args: args{
|
||||
bucket: "testaccessruleadd",
|
||||
prefix: "/test/",
|
||||
access: "readonl",
|
||||
},
|
||||
expectedStatus: 500,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Add Access Rule - Invalid Bucket",
|
||||
args: args{
|
||||
bucket: "fakebucket",
|
||||
prefix: "/test/",
|
||||
access: "readonl",
|
||||
},
|
||||
expectedStatus: 404,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
@@ -76,7 +89,114 @@ func Test_AddAccessRuleAPI(t *testing.T) {
|
||||
requestDataJSON, _ := json.Marshal(requestDataPolicy)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT", "http://localhost:9090/api/v1/bucket/testaccessruleadd/access-rules", requestDataBody)
|
||||
"PUT", fmt.Sprintf("http://localhost:9090/api/v1/bucket/%s/access-rules", tt.args.bucket), requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetAccessRulesAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
AddBucket("testaccessruleget", false, false, nil, nil)
|
||||
|
||||
type args struct {
|
||||
bucket string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Get Access Rule - Valid",
|
||||
args: args{
|
||||
bucket: "testaccessruleget",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
request, err := http.NewRequest(
|
||||
"GET", fmt.Sprintf("http://localhost:9090/api/v1/bucket/%s/access-rules", tt.args.bucket), nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_DeleteAccessRuleAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
AddBucket("testaccessruledelete", false, false, nil, nil)
|
||||
|
||||
type args struct {
|
||||
prefix string
|
||||
access string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Delete Access Rule - Valid",
|
||||
args: args{
|
||||
prefix: "/test/",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
requestDataPolicy := map[string]interface{}{}
|
||||
requestDataPolicy["prefix"] = tt.args.prefix
|
||||
requestDataPolicy["access"] = tt.args.access
|
||||
|
||||
requestDataJSON, _ := json.Marshal(requestDataPolicy)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"DELETE", "http://localhost:9090/api/v1/bucket/testaccessruledelete/access-rules", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
|
||||
@@ -157,7 +157,7 @@ func TestBadLogin(t *testing.T) {
|
||||
|
||||
response, err := client.Do(request)
|
||||
|
||||
assert.Equal(response.StatusCode, 500, "Login request not rejected")
|
||||
assert.Equal(401, response.StatusCode, "Login request not rejected")
|
||||
assert.NotNil(response, "Login response is nil")
|
||||
assert.Nil(err, "Login errored out")
|
||||
}
|
||||
|
||||
@@ -674,7 +674,6 @@ func Test_PolicyListGroupsAPI(t *testing.T) {
|
||||
{
|
||||
name: "List Users for Policy - Valid",
|
||||
args: args{
|
||||
|
||||
api: "/policies/" + base64.StdEncoding.EncodeToString([]byte("policylistgroups")) + "/groups",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
@@ -794,3 +793,70 @@ func Test_DeletePolicyAPI(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetAUserPolicyAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// Create a User with a Policy to use for testing
|
||||
groups := []string{}
|
||||
policies := []string{"readwrite"}
|
||||
_, err := AddUser("getuserpolicyuser", "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
// encode usernames to pass to api
|
||||
bName := []byte("getuserpolicyuser")
|
||||
fName := []byte("failname")
|
||||
encodedName := base64.URLEncoding.EncodeToString(bName)
|
||||
encodedFailName := base64.URLEncoding.EncodeToString(fName)
|
||||
|
||||
type args struct {
|
||||
api string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Get User Policy - Invalid",
|
||||
args: args{
|
||||
api: "/user/" + encodedFailName + "/policies",
|
||||
},
|
||||
expectedStatus: 401,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Get User Policy - Valid",
|
||||
args: args{
|
||||
api: "/user/" + encodedName + "/policies",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
request, err := http.NewRequest(
|
||||
"GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,18 +20,16 @@ import (
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestStartProfiling(t *testing.T) {
|
||||
testAsser := assert.New(t)
|
||||
testAssert := assert.New(t)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@@ -58,53 +56,28 @@ func TestStartProfiling(t *testing.T) {
|
||||
"profile-127.0.0.1:9000-mutex-before.pprof": false,
|
||||
}
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
wsDestination := "/ws/profile?types=cpu,mem,block,mutex,trace,threads,goroutines"
|
||||
wsFinalURL := fmt.Sprintf("ws://localhost:9090%s", wsDestination)
|
||||
|
||||
destination := "/api/v1/profiling/start"
|
||||
finalURL := fmt.Sprintf("http://localhost:9090%s", destination)
|
||||
request, err := http.NewRequest("POST", finalURL, strings.NewReader("{\"type\":\"cpu,mem,block,mutex,trace,threads,goroutines\"}"))
|
||||
ws, _, err := websocket.DefaultDialer.Dial(wsFinalURL, nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
defer ws.Close()
|
||||
|
||||
_, zipFileBytes, err := ws.ReadMessage()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
response, err := client.Do(request)
|
||||
|
||||
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
|
||||
testAsser.Equal(201, response.StatusCode)
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
|
||||
destination = "/api/v1/profiling/stop"
|
||||
finalURL = fmt.Sprintf("http://localhost:9090%s", destination)
|
||||
request, err = http.NewRequest("POST", finalURL, nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
response, err = client.Do(request)
|
||||
|
||||
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
|
||||
testAsser.Equal(200, response.StatusCode)
|
||||
zipFileBytes, err := io.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
|
||||
}
|
||||
filetype := http.DetectContentType(zipFileBytes)
|
||||
testAsser.Equal("application/zip", filetype)
|
||||
testAssert.Equal("application/zip", filetype)
|
||||
|
||||
zipReader, err := zip.NewReader(bytes.NewReader(zipFileBytes), int64(len(zipFileBytes)))
|
||||
if err != nil {
|
||||
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
|
||||
testAssert.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
|
||||
}
|
||||
|
||||
// Read all the files from zip archive
|
||||
@@ -113,7 +86,7 @@ func TestStartProfiling(t *testing.T) {
|
||||
}
|
||||
|
||||
for k, v := range files {
|
||||
testAsser.Equal(true, v, fmt.Sprintf("%s : compressed file expected to have %v file inside", tt.name, k))
|
||||
testAssert.Equal(true, v, fmt.Sprintf("%s : compressed file expected to have %v file inside", tt.name, k))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2804,7 +2804,10 @@ func TestReplication(t *testing.T) {
|
||||
}
|
||||
finalResponse = inspectHTTPResponse(response)
|
||||
if response != nil {
|
||||
assert.Equal(204, response.StatusCode, finalResponse)
|
||||
// https://github.com/minio/minio/pull/14972
|
||||
// Disallow deletion of arn when active replication config
|
||||
// 204 is no longer expected but 500
|
||||
assert.Equal(500, response.StatusCode, finalResponse)
|
||||
}
|
||||
|
||||
// 7. Delete remaining Bucket Replication Rule with generic end point:
|
||||
@@ -2841,8 +2844,9 @@ func TestReplication(t *testing.T) {
|
||||
log.Println(err)
|
||||
assert.Nil(err)
|
||||
}
|
||||
|
||||
assert.Equal(len(structBucketRepl.Rules), 0, "Delete failed")
|
||||
expected := 0
|
||||
actual := len(structBucketRepl.Rules)
|
||||
assert.Equal(expected, actual, "Delete failed")
|
||||
}
|
||||
|
||||
func GetBucketVersioning(bucketName string) (*http.Response, error) {
|
||||
@@ -3628,3 +3632,225 @@ func TestGetBucketRewind(t *testing.T) {
|
||||
200, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
}
|
||||
|
||||
func GetRemoteBucket() (*http.Response, error) {
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/remote-buckets",
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func GetRemoteBucketARN(sourceBucket string) (*http.Response, error) {
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
fmt.Sprintf("http://localhost:9090/api/v1/remote-buckets/%s", sourceBucket),
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func AddRemoteBucket(accessKey, secretKey, targetURL, sourceBucket, targetBucket string) (*http.Response, error) {
|
||||
// Needed Parameters for API Call
|
||||
bucketsRelationArray := make([]map[string]interface{}, 1)
|
||||
bucketsRelationIndex0 := map[string]interface{}{
|
||||
"originBucket": sourceBucket,
|
||||
"destinationBucket": targetBucket,
|
||||
}
|
||||
bucketsRelationArray[0] = bucketsRelationIndex0
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"accessKey": accessKey,
|
||||
"secretKey": secretKey,
|
||||
"targetURL": targetURL,
|
||||
"sourceBucket": sourceBucket,
|
||||
"targetBucket": targetBucket,
|
||||
"region": "",
|
||||
"bucketsRelation": bucketsRelationArray,
|
||||
"syncMode": "async",
|
||||
"bandwidth": 107374182400,
|
||||
"healthCheckPeriod": 60,
|
||||
"prefix": "",
|
||||
"tags": "",
|
||||
"replicateDeleteMarkers": true,
|
||||
"replicateDeletes": true,
|
||||
"priority": 1,
|
||||
"storageClass": "",
|
||||
"replicateMetadata": true,
|
||||
}
|
||||
|
||||
// Creating the Call by adding the URL and Headers
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/remote-buckets",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
// Performing the call
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func DeleteRemoteBucket(sourceBucket string, arn string) (*http.Response, error) {
|
||||
// Needed Parameters for API Call
|
||||
request, err := http.NewRequest(
|
||||
"DELETE",
|
||||
fmt.Sprintf("http://localhost:9090/api/v1/remote-buckets/%s/%s", sourceBucket, arn),
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
// Performing the call
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestAddRemoteBucket(t *testing.T) {
|
||||
// Variables
|
||||
assert := assert.New(t)
|
||||
accessKey := "minioadmin"
|
||||
secretKey := "minioadmin"
|
||||
targetURL := "https://play.min.io"
|
||||
sourceBucket := "source"
|
||||
targetBucket := os.Getenv("THETARGET")
|
||||
fmt.Println("targetBucket: ", targetBucket)
|
||||
|
||||
// 1. Create bucket
|
||||
if !BucketGotAdded("source", true, true, nil, nil, assert, 201) {
|
||||
return
|
||||
}
|
||||
|
||||
// 2. Add Remote Bucket
|
||||
resp, err := AddRemoteBucket(
|
||||
accessKey,
|
||||
secretKey,
|
||||
targetURL,
|
||||
sourceBucket,
|
||||
targetBucket,
|
||||
)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
201, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
|
||||
// 3. Verify Remote Bucket was created
|
||||
resp, err = GetRemoteBucket()
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(resp)
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, finalResponse)
|
||||
}
|
||||
fmt.Println("finalResponse: ", finalResponse)
|
||||
assert.Equal(strings.Contains(finalResponse, targetBucket), true)
|
||||
}
|
||||
|
||||
func TestDeleteRemoteBucket(t *testing.T) {
|
||||
// Variables
|
||||
assert := assert.New(t)
|
||||
accessKey := "minioadmin"
|
||||
secretKey := "minioadmin"
|
||||
targetURL := "https://play.min.io"
|
||||
sourceBucket := "deletesource"
|
||||
targetBucket := os.Getenv("THETARGET")
|
||||
fmt.Println("targetBucket: ", targetBucket)
|
||||
|
||||
// 1. Create bucket
|
||||
if !BucketGotAdded("deletesource", true, true, nil, nil, assert, 201) {
|
||||
return
|
||||
}
|
||||
|
||||
// 2. Add Remote Bucket
|
||||
resp, err := AddRemoteBucket(
|
||||
accessKey,
|
||||
secretKey,
|
||||
targetURL,
|
||||
sourceBucket,
|
||||
targetBucket,
|
||||
)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
201, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
|
||||
// 3. Get ARN
|
||||
resp, err = GetRemoteBucketARN(sourceBucket)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
bodyBytes, _ := ioutil.ReadAll(resp.Body)
|
||||
remoteBucket := models.RemoteBucket{}
|
||||
err = json.Unmarshal(bodyBytes, &remoteBucket)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
assert.Nil(err)
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
|
||||
// 4. Delete Remote Bucket
|
||||
resp, err = DeleteRemoteBucket(sourceBucket, *remoteBucket.RemoteARN)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(resp)
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
204, resp.StatusCode, finalResponse)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
serviceAccountName: console-sa
|
||||
containers:
|
||||
- name: console
|
||||
image: 'minio/console:v0.17.2'
|
||||
image: 'minio/console:v0.19.5'
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
env:
|
||||
- name: CONSOLE_OPERATOR_MODE
|
||||
|
||||
@@ -32,7 +32,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: console
|
||||
image: 'minio/console:v0.17.2'
|
||||
image: 'minio/console:v0.19.5'
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
env:
|
||||
- name: CONSOLE_MINIO_SERVER
|
||||
|
||||
67
models/a_user_policy_response.go
Normal file
67
models/a_user_policy_response.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// AUserPolicyResponse a user policy response
|
||||
//
|
||||
// swagger:model aUserPolicyResponse
|
||||
type AUserPolicyResponse struct {
|
||||
|
||||
// policy
|
||||
Policy string `json:"policy,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this a user policy response
|
||||
func (m *AUserPolicyResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this a user policy response based on context it is used
|
||||
func (m *AUserPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AUserPolicyResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AUserPolicyResponse) UnmarshalBinary(b []byte) error {
|
||||
var res AUserPolicyResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
67
models/api_key.go
Normal file
67
models/api_key.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// APIKey api key
|
||||
//
|
||||
// swagger:model apiKey
|
||||
type APIKey struct {
|
||||
|
||||
// api key
|
||||
APIKey string `json:"apiKey,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this api key
|
||||
func (m *APIKey) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this api key based on context it is used
|
||||
func (m *APIKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *APIKey) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *APIKey) UnmarshalBinary(b []byte) error {
|
||||
var res APIKey
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
133
models/csr_elements.go
Normal file
133
models/csr_elements.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// CsrElements csr elements
|
||||
//
|
||||
// swagger:model csrElements
|
||||
type CsrElements struct {
|
||||
|
||||
// csr element
|
||||
CsrElement []*CsrElement `json:"csrElement"`
|
||||
}
|
||||
|
||||
// Validate validates this csr elements
|
||||
func (m *CsrElements) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateCsrElement(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CsrElements) validateCsrElement(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.CsrElement) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.CsrElement); i++ {
|
||||
if swag.IsZero(m.CsrElement[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.CsrElement[i] != nil {
|
||||
if err := m.CsrElement[i].Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("csrElement" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("csrElement" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this csr elements based on the context it is used
|
||||
func (m *CsrElements) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateCsrElement(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *CsrElements) contextValidateCsrElement(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.CsrElement); i++ {
|
||||
|
||||
if m.CsrElement[i] != nil {
|
||||
if err := m.CsrElement[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("csrElement" + "." + strconv.Itoa(i))
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("csrElement" + "." + strconv.Itoa(i))
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *CsrElements) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *CsrElements) UnmarshalBinary(b []byte) error {
|
||||
var res CsrElements
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
85
models/direct_p_v_drive_info.go
Normal file
85
models/direct_p_v_drive_info.go
Normal file
@@ -0,0 +1,85 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// DirectPVDriveInfo direct p v drive info
|
||||
//
|
||||
// swagger:model directPVDriveInfo
|
||||
type DirectPVDriveInfo struct {
|
||||
|
||||
// allocated
|
||||
Allocated int64 `json:"allocated,omitempty"`
|
||||
|
||||
// capacity
|
||||
Capacity int64 `json:"capacity,omitempty"`
|
||||
|
||||
// drive
|
||||
Drive string `json:"drive,omitempty"`
|
||||
|
||||
// message
|
||||
Message string `json:"message,omitempty"`
|
||||
|
||||
// node
|
||||
Node string `json:"node,omitempty"`
|
||||
|
||||
// status
|
||||
Status string `json:"status,omitempty"`
|
||||
|
||||
// volumes
|
||||
Volumes int64 `json:"volumes,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this direct p v drive info
|
||||
func (m *DirectPVDriveInfo) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this direct p v drive info based on context it is used
|
||||
func (m *DirectPVDriveInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *DirectPVDriveInfo) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *DirectPVDriveInfo) UnmarshalBinary(b []byte) error {
|
||||
var res DirectPVDriveInfo
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
76
models/direct_p_v_volume_info.go
Normal file
76
models/direct_p_v_volume_info.go
Normal file
@@ -0,0 +1,76 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// DirectPVVolumeInfo direct p v volume info
|
||||
//
|
||||
// swagger:model directPVVolumeInfo
|
||||
type DirectPVVolumeInfo struct {
|
||||
|
||||
// capacity
|
||||
Capacity int64 `json:"capacity,omitempty"`
|
||||
|
||||
// drive
|
||||
Drive string `json:"drive,omitempty"`
|
||||
|
||||
// node
|
||||
Node string `json:"node,omitempty"`
|
||||
|
||||
// volume
|
||||
Volume string `json:"volume,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this direct p v volume info
|
||||
func (m *DirectPVVolumeInfo) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this direct p v volume info based on context it is used
|
||||
func (m *DirectPVVolumeInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *DirectPVVolumeInfo) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *DirectPVVolumeInfo) UnmarshalBinary(b []byte) error {
|
||||
var res DirectPVVolumeInfo
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
133
models/format_direct_p_v_drives_response.go
Normal file
133
models/format_direct_p_v_drives_response.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// FormatDirectPVDrivesResponse format direct p v drives response
|
||||
//
|
||||
// swagger:model formatDirectPVDrivesResponse
|
||||
type FormatDirectPVDrivesResponse struct {
|
||||
|
||||
// format issues list
|
||||
FormatIssuesList []*PvFormatErrorResponse `json:"formatIssuesList"`
|
||||
}
|
||||
|
||||
// Validate validates this format direct p v drives response
|
||||
func (m *FormatDirectPVDrivesResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateFormatIssuesList(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *FormatDirectPVDrivesResponse) validateFormatIssuesList(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.FormatIssuesList) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.FormatIssuesList); i++ {
|
||||
if swag.IsZero(m.FormatIssuesList[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.FormatIssuesList[i] != nil {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this format direct p v drives response based on the context it is used
|
||||
func (m *FormatDirectPVDrivesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateFormatIssuesList(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *FormatDirectPVDrivesResponse) contextValidateFormatIssuesList(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.FormatIssuesList); i++ {
|
||||
|
||||
if m.FormatIssuesList[i] != nil {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *FormatDirectPVDrivesResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *FormatDirectPVDrivesResponse) UnmarshalBinary(b []byte) error {
|
||||
var res FormatDirectPVDrivesResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
133
models/get_direct_p_v_drive_list_response.go
Normal file
133
models/get_direct_p_v_drive_list_response.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// GetDirectPVDriveListResponse get direct p v drive list response
|
||||
//
|
||||
// swagger:model getDirectPVDriveListResponse
|
||||
type GetDirectPVDriveListResponse struct {
|
||||
|
||||
// drives
|
||||
Drives []*DirectPVDriveInfo `json:"drives"`
|
||||
}
|
||||
|
||||
// Validate validates this get direct p v drive list response
|
||||
func (m *GetDirectPVDriveListResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateDrives(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetDirectPVDriveListResponse) validateDrives(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Drives) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Drives); i++ {
|
||||
if swag.IsZero(m.Drives[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Drives[i] != nil {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this get direct p v drive list response based on the context it is used
|
||||
func (m *GetDirectPVDriveListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateDrives(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetDirectPVDriveListResponse) contextValidateDrives(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Drives); i++ {
|
||||
|
||||
if m.Drives[i] != nil {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GetDirectPVDriveListResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *GetDirectPVDriveListResponse) UnmarshalBinary(b []byte) error {
|
||||
var res GetDirectPVDriveListResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
133
models/get_direct_p_v_volume_list_response.go
Normal file
133
models/get_direct_p_v_volume_list_response.go
Normal file
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// GetDirectPVVolumeListResponse get direct p v volume list response
|
||||
//
|
||||
// swagger:model getDirectPVVolumeListResponse
|
||||
type GetDirectPVVolumeListResponse struct {
|
||||
|
||||
// volumes
|
||||
Volumes []*DirectPVVolumeInfo `json:"volumes"`
|
||||
}
|
||||
|
||||
// Validate validates this get direct p v volume list response
|
||||
func (m *GetDirectPVVolumeListResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateVolumes(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetDirectPVVolumeListResponse) validateVolumes(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Volumes) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Volumes); i++ {
|
||||
if swag.IsZero(m.Volumes[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Volumes[i] != nil {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this get direct p v volume list response based on the context it is used
|
||||
func (m *GetDirectPVVolumeListResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateVolumes(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *GetDirectPVVolumeListResponse) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Volumes); i++ {
|
||||
|
||||
if m.Volumes[i] != nil {
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *GetDirectPVVolumeListResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *GetDirectPVVolumeListResponse) UnmarshalBinary(b []byte) error {
|
||||
var res GetDirectPVVolumeListResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -37,6 +37,9 @@ import (
|
||||
// swagger:model loginDetails
|
||||
type LoginDetails struct {
|
||||
|
||||
// is direct p v
|
||||
IsDirectPV bool `json:"isDirectPV,omitempty"`
|
||||
|
||||
// login strategy
|
||||
// Enum: [form redirect service-account redirect-service-account]
|
||||
LoginStrategy string `json:"loginStrategy,omitempty"`
|
||||
|
||||
@@ -28,7 +28,6 @@ import (
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// LoginRequest login request
|
||||
@@ -37,48 +36,32 @@ import (
|
||||
type LoginRequest struct {
|
||||
|
||||
// access key
|
||||
// Required: true
|
||||
AccessKey *string `json:"accessKey"`
|
||||
AccessKey string `json:"accessKey,omitempty"`
|
||||
|
||||
// features
|
||||
Features *LoginRequestFeatures `json:"features,omitempty"`
|
||||
|
||||
// secret key
|
||||
// Required: true
|
||||
SecretKey *string `json:"secretKey"`
|
||||
SecretKey string `json:"secretKey,omitempty"`
|
||||
|
||||
// sts
|
||||
Sts string `json:"sts,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this login request
|
||||
func (m *LoginRequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateAccessKey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateFeatures(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecretKey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoginRequest) validateAccessKey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("accessKey", "body", m.AccessKey); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoginRequest) validateFeatures(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Features) { // not required
|
||||
return nil
|
||||
@@ -98,15 +81,6 @@ func (m *LoginRequest) validateFeatures(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoginRequest) validateSecretKey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("secretKey", "body", m.SecretKey); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this login request based on the context it is used
|
||||
func (m *LoginRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
70
models/mp_integration.go
Normal file
70
models/mp_integration.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// MpIntegration mp integration
|
||||
//
|
||||
// swagger:model mpIntegration
|
||||
type MpIntegration struct {
|
||||
|
||||
// email
|
||||
Email string `json:"email,omitempty"`
|
||||
|
||||
// is in e u
|
||||
IsInEU bool `json:"isInEU,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this mp integration
|
||||
func (m *MpIntegration) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this mp integration based on context it is used
|
||||
func (m *MpIntegration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *MpIntegration) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *MpIntegration) UnmarshalBinary(b []byte) error {
|
||||
var res MpIntegration
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -37,6 +37,9 @@ import (
|
||||
// swagger:model operatorSessionResponse
|
||||
type OperatorSessionResponse struct {
|
||||
|
||||
// direct p v
|
||||
DirectPV bool `json:"directPV,omitempty"`
|
||||
|
||||
// features
|
||||
Features []string `json:"features"`
|
||||
|
||||
|
||||
67
models/operator_subnet_api_key.go
Normal file
67
models/operator_subnet_api_key.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// OperatorSubnetAPIKey operator subnet API key
|
||||
//
|
||||
// swagger:model operatorSubnetAPIKey
|
||||
type OperatorSubnetAPIKey struct {
|
||||
|
||||
// api key
|
||||
APIKey string `json:"apiKey,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet API key
|
||||
func (m *OperatorSubnetAPIKey) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet API key based on context it is used
|
||||
func (m *OperatorSubnetAPIKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetAPIKey) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetAPIKey) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetAPIKey
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
122
models/operator_subnet_login_m_f_a_request.go
Normal file
122
models/operator_subnet_login_m_f_a_request.go
Normal file
@@ -0,0 +1,122 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginMFARequest operator subnet login m f a request
|
||||
//
|
||||
// swagger:model operatorSubnetLoginMFARequest
|
||||
type OperatorSubnetLoginMFARequest struct {
|
||||
|
||||
// mfa token
|
||||
// Required: true
|
||||
MfaToken *string `json:"mfa_token"`
|
||||
|
||||
// otp
|
||||
// Required: true
|
||||
Otp *string `json:"otp"`
|
||||
|
||||
// username
|
||||
// Required: true
|
||||
Username *string `json:"username"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet login m f a request
|
||||
func (m *OperatorSubnetLoginMFARequest) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateMfaToken(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateOtp(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateUsername(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *OperatorSubnetLoginMFARequest) validateMfaToken(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("mfa_token", "body", m.MfaToken); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *OperatorSubnetLoginMFARequest) validateOtp(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("otp", "body", m.Otp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *OperatorSubnetLoginMFARequest) validateUsername(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("username", "body", m.Username); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet login m f a request based on context it is used
|
||||
func (m *OperatorSubnetLoginMFARequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginMFARequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginMFARequest) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetLoginMFARequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
70
models/operator_subnet_login_request.go
Normal file
70
models/operator_subnet_login_request.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginRequest operator subnet login request
|
||||
//
|
||||
// swagger:model operatorSubnetLoginRequest
|
||||
type OperatorSubnetLoginRequest struct {
|
||||
|
||||
// password
|
||||
Password string `json:"password,omitempty"`
|
||||
|
||||
// username
|
||||
Username string `json:"username,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet login request
|
||||
func (m *OperatorSubnetLoginRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet login request based on context it is used
|
||||
func (m *OperatorSubnetLoginRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginRequest) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetLoginRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
70
models/operator_subnet_login_response.go
Normal file
70
models/operator_subnet_login_response.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginResponse operator subnet login response
|
||||
//
|
||||
// swagger:model operatorSubnetLoginResponse
|
||||
type OperatorSubnetLoginResponse struct {
|
||||
|
||||
// access token
|
||||
AccessToken string `json:"access_token,omitempty"`
|
||||
|
||||
// mfa token
|
||||
MfaToken string `json:"mfa_token,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet login response
|
||||
func (m *OperatorSubnetLoginResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet login response based on context it is used
|
||||
func (m *OperatorSubnetLoginResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetLoginResponse) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetLoginResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
67
models/operator_subnet_register_api_key.go
Normal file
67
models/operator_subnet_register_api_key.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// OperatorSubnetRegisterAPIKey operator subnet register API key
|
||||
//
|
||||
// swagger:model operatorSubnetRegisterAPIKey
|
||||
type OperatorSubnetRegisterAPIKey struct {
|
||||
|
||||
// registered
|
||||
Registered bool `json:"registered,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet register API key
|
||||
func (m *OperatorSubnetRegisterAPIKey) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet register API key based on context it is used
|
||||
func (m *OperatorSubnetRegisterAPIKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetRegisterAPIKey) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetRegisterAPIKey) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetRegisterAPIKey
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
67
models/operator_subnet_register_api_key_response.go
Normal file
67
models/operator_subnet_register_api_key_response.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// OperatorSubnetRegisterAPIKeyResponse operator subnet register API key response
|
||||
//
|
||||
// swagger:model operatorSubnetRegisterAPIKeyResponse
|
||||
type OperatorSubnetRegisterAPIKeyResponse struct {
|
||||
|
||||
// registered
|
||||
Registered bool `json:"registered,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this operator subnet register API key response
|
||||
func (m *OperatorSubnetRegisterAPIKeyResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this operator subnet register API key response based on context it is used
|
||||
func (m *OperatorSubnetRegisterAPIKeyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *OperatorSubnetRegisterAPIKeyResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *OperatorSubnetRegisterAPIKeyResponse) UnmarshalBinary(b []byte) error {
|
||||
var res OperatorSubnetRegisterAPIKeyResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -46,8 +46,14 @@ type Principal struct {
|
||||
// account access key
|
||||
AccountAccessKey string `json:"accountAccessKey,omitempty"`
|
||||
|
||||
// custom style ob
|
||||
CustomStyleOb string `json:"customStyleOb,omitempty"`
|
||||
|
||||
// hm
|
||||
Hm bool `json:"hm,omitempty"`
|
||||
|
||||
// ob
|
||||
Ob bool `json:"ob,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this principal
|
||||
|
||||
73
models/pv_format_error_response.go
Normal file
73
models/pv_format_error_response.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// PvFormatErrorResponse pv format error response
|
||||
//
|
||||
// swagger:model pvFormatErrorResponse
|
||||
type PvFormatErrorResponse struct {
|
||||
|
||||
// drive
|
||||
Drive string `json:"drive,omitempty"`
|
||||
|
||||
// error
|
||||
Error string `json:"error,omitempty"`
|
||||
|
||||
// node
|
||||
Node string `json:"node,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this pv format error response
|
||||
func (m *PvFormatErrorResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this pv format error response based on context it is used
|
||||
func (m *PvFormatErrorResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *PvFormatErrorResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *PvFormatErrorResponse) UnmarshalBinary(b []byte) error {
|
||||
var res PvFormatErrorResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -37,8 +37,10 @@ import (
|
||||
type SecurityContext struct {
|
||||
|
||||
// fs group
|
||||
// Required: true
|
||||
FsGroup *string `json:"fsGroup"`
|
||||
FsGroup string `json:"fsGroup,omitempty"`
|
||||
|
||||
// fs group change policy
|
||||
FsGroupChangePolicy string `json:"fsGroupChangePolicy,omitempty"`
|
||||
|
||||
// run as group
|
||||
// Required: true
|
||||
@@ -57,10 +59,6 @@ type SecurityContext struct {
|
||||
func (m *SecurityContext) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateFsGroup(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateRunAsGroup(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -79,15 +77,6 @@ func (m *SecurityContext) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SecurityContext) validateFsGroup(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("fsGroup", "body", m.FsGroup); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SecurityContext) validateRunAsGroup(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("runAsGroup", "body", m.RunAsGroup); err != nil {
|
||||
|
||||
@@ -41,6 +41,9 @@ type SessionResponse struct {
|
||||
// allow resources
|
||||
AllowResources []*PermissionResource `json:"allowResources"`
|
||||
|
||||
// custom styles
|
||||
CustomStyles string `json:"customStyles,omitempty"`
|
||||
|
||||
// distributed mode
|
||||
DistributedMode bool `json:"distributedMode,omitempty"`
|
||||
|
||||
|
||||
70
models/set_administrators_request.go
Normal file
70
models/set_administrators_request.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// SetAdministratorsRequest set administrators request
|
||||
//
|
||||
// swagger:model setAdministratorsRequest
|
||||
type SetAdministratorsRequest struct {
|
||||
|
||||
// group dns
|
||||
GroupDNS []string `json:"group_dns"`
|
||||
|
||||
// user dns
|
||||
UserDNS []string `json:"user_dns"`
|
||||
}
|
||||
|
||||
// Validate validates this set administrators request
|
||||
func (m *SetAdministratorsRequest) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this set administrators request based on context it is used
|
||||
func (m *SetAdministratorsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *SetAdministratorsRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *SetAdministratorsRequest) UnmarshalBinary(b []byte) error {
|
||||
var res SetAdministratorsRequest
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -45,12 +45,18 @@ type TenantLogs struct {
|
||||
// db image
|
||||
DbImage string `json:"dbImage,omitempty"`
|
||||
|
||||
// db init image
|
||||
DbInitImage string `json:"dbInitImage,omitempty"`
|
||||
|
||||
// db labels
|
||||
DbLabels []*Label `json:"dbLabels"`
|
||||
|
||||
// db node selector
|
||||
DbNodeSelector []*NodeSelector `json:"dbNodeSelector"`
|
||||
|
||||
// db security context
|
||||
DbSecurityContext *SecurityContext `json:"dbSecurityContext,omitempty"`
|
||||
|
||||
// db service account name
|
||||
DbServiceAccountName string `json:"dbServiceAccountName,omitempty"`
|
||||
|
||||
@@ -81,6 +87,9 @@ type TenantLogs struct {
|
||||
// node selector
|
||||
NodeSelector []*NodeSelector `json:"nodeSelector"`
|
||||
|
||||
// security context
|
||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||
|
||||
// service account name
|
||||
ServiceAccountName string `json:"serviceAccountName,omitempty"`
|
||||
}
|
||||
@@ -105,6 +114,10 @@ func (m *TenantLogs) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateDbSecurityContext(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateLabels(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -113,6 +126,10 @@ func (m *TenantLogs) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecurityContext(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -223,6 +240,25 @@ func (m *TenantLogs) validateDbNodeSelector(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) validateDbSecurityContext(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.DbSecurityContext) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.DbSecurityContext != nil {
|
||||
if err := m.DbSecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("dbSecurityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("dbSecurityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) validateLabels(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Labels) { // not required
|
||||
return nil
|
||||
@@ -275,6 +311,25 @@ func (m *TenantLogs) validateNodeSelector(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) validateSecurityContext(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.SecurityContext) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this tenant logs based on the context it is used
|
||||
func (m *TenantLogs) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
@@ -295,6 +350,10 @@ func (m *TenantLogs) ContextValidate(ctx context.Context, formats strfmt.Registr
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateDbSecurityContext(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateLabels(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -303,6 +362,10 @@ func (m *TenantLogs) ContextValidate(ctx context.Context, formats strfmt.Registr
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateSecurityContext(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -389,6 +452,22 @@ func (m *TenantLogs) contextValidateDbNodeSelector(ctx context.Context, formats
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) contextValidateDbSecurityContext(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.DbSecurityContext != nil {
|
||||
if err := m.DbSecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("dbSecurityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("dbSecurityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Labels); i++ {
|
||||
@@ -429,6 +508,22 @@ func (m *TenantLogs) contextValidateNodeSelector(ctx context.Context, formats st
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantLogs) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TenantLogs) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -63,6 +63,9 @@ type TenantMonitoringInfo struct {
|
||||
// prometheus enabled
|
||||
PrometheusEnabled bool `json:"prometheusEnabled,omitempty"`
|
||||
|
||||
// security context
|
||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||
|
||||
// service account name
|
||||
ServiceAccountName string `json:"serviceAccountName,omitempty"`
|
||||
|
||||
@@ -92,6 +95,10 @@ func (m *TenantMonitoringInfo) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecurityContext(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -176,6 +183,25 @@ func (m *TenantMonitoringInfo) validateNodeSelector(formats strfmt.Registry) err
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantMonitoringInfo) validateSecurityContext(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.SecurityContext) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this tenant monitoring info based on the context it is used
|
||||
func (m *TenantMonitoringInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
@@ -192,6 +218,10 @@ func (m *TenantMonitoringInfo) ContextValidate(ctx context.Context, formats strf
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateSecurityContext(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -258,6 +288,22 @@ func (m *TenantMonitoringInfo) contextValidateNodeSelector(ctx context.Context,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantMonitoringInfo) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TenantMonitoringInfo) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -41,6 +41,9 @@ type TenantSecurityResponse struct {
|
||||
|
||||
// custom certificates
|
||||
CustomCertificates *TenantSecurityResponseCustomCertificates `json:"customCertificates,omitempty"`
|
||||
|
||||
// security context
|
||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this tenant security response
|
||||
@@ -51,6 +54,10 @@ func (m *TenantSecurityResponse) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecurityContext(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -76,6 +83,25 @@ func (m *TenantSecurityResponse) validateCustomCertificates(formats strfmt.Regis
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantSecurityResponse) validateSecurityContext(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.SecurityContext) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this tenant security response based on the context it is used
|
||||
func (m *TenantSecurityResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
@@ -84,6 +110,10 @@ func (m *TenantSecurityResponse) ContextValidate(ctx context.Context, formats st
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateSecurityContext(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -106,6 +136,22 @@ func (m *TenantSecurityResponse) contextValidateCustomCertificates(ctx context.C
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TenantSecurityResponse) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *TenantSecurityResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
@@ -41,6 +41,9 @@ type UpdateTenantSecurityRequest struct {
|
||||
|
||||
// custom certificates
|
||||
CustomCertificates *UpdateTenantSecurityRequestCustomCertificates `json:"customCertificates,omitempty"`
|
||||
|
||||
// security context
|
||||
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this update tenant security request
|
||||
@@ -51,6 +54,10 @@ func (m *UpdateTenantSecurityRequest) Validate(formats strfmt.Registry) error {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecurityContext(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -76,6 +83,25 @@ func (m *UpdateTenantSecurityRequest) validateCustomCertificates(formats strfmt.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateTenantSecurityRequest) validateSecurityContext(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.SecurityContext) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this update tenant security request based on the context it is used
|
||||
func (m *UpdateTenantSecurityRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
@@ -84,6 +110,10 @@ func (m *UpdateTenantSecurityRequest) ContextValidate(ctx context.Context, forma
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateSecurityContext(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -106,6 +136,22 @@ func (m *UpdateTenantSecurityRequest) contextValidateCustomCertificates(ctx cont
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *UpdateTenantSecurityRequest) contextValidateSecurityContext(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.SecurityContext != nil {
|
||||
if err := m.SecurityContext.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("securityContext")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("securityContext")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *UpdateTenantSecurityRequest) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
|
||||
73
models/user_s_as.go
Normal file
73
models/user_s_as.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// UserSAs user s as
|
||||
//
|
||||
// swagger:model userSAs
|
||||
type UserSAs struct {
|
||||
|
||||
// path
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
// recursive
|
||||
Recursive bool `json:"recursive,omitempty"`
|
||||
|
||||
// version ID
|
||||
VersionID string `json:"versionID,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this user s as
|
||||
func (m *UserSAs) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this user s as based on context it is used
|
||||
func (m *UserSAs) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *UserSAs) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *UserSAs) UnmarshalBinary(b []byte) error {
|
||||
var res UserSAs
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -39,7 +39,10 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var token string
|
||||
var (
|
||||
token string
|
||||
jwt string
|
||||
)
|
||||
|
||||
func inspectHTTPResponse(httpResponse *http.Response) string {
|
||||
/*
|
||||
@@ -143,9 +146,6 @@ func TestMain(m *testing.M) {
|
||||
fmt.Println("after 2 seconds sleep")
|
||||
|
||||
fmt.Println("creating the client")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
|
||||
// SA_TOKEN=$(kubectl -n minio-operator get secret console-sa-secret -o jsonpath="{.data.token}" | base64 --decode)
|
||||
fmt.Println("Where we have the secret already: ")
|
||||
@@ -170,29 +170,12 @@ func TestMain(m *testing.M) {
|
||||
return
|
||||
}
|
||||
secret2 := out2.String()
|
||||
secret3 := decodeBase64(secret2[1 : len(secret2)-1])
|
||||
if secret3 == "" {
|
||||
jwt := decodeBase64(secret2[1 : len(secret2)-1])
|
||||
if jwt == "" {
|
||||
fmt.Println("jwt cannot be empty string")
|
||||
os.Exit(-1)
|
||||
}
|
||||
requestData := map[string]string{
|
||||
"jwt": secret3,
|
||||
}
|
||||
fmt.Println("requestData: ", requestData)
|
||||
|
||||
requestDataJSON, _ := json.Marshal(requestData)
|
||||
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
|
||||
request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login/operator", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
response, err := client.Do(request)
|
||||
response, err := LoginOperator()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
@@ -260,7 +243,7 @@ func TestListTenants(t *testing.T) {
|
||||
}
|
||||
TenantName := &result.Tenants[0].Name // The array has to be empty, no index accessible
|
||||
fmt.Println(*TenantName)
|
||||
assert.Equal("storage-lite", *TenantName, *TenantName)
|
||||
assert.Equal("storage-kms-encrypted", *TenantName, *TenantName)
|
||||
printEndFunc("TestListTenants")
|
||||
}
|
||||
|
||||
@@ -310,6 +293,29 @@ func CreateTenant(tenantName string, namespace string, accessKey string, secretK
|
||||
return response, err
|
||||
}
|
||||
|
||||
func DeleteTenant(nameSpace, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
URL: /namespaces/{namespace}/tenants/{tenant}:
|
||||
HTTP Verb: DELETE
|
||||
Summary: Delete tenant and underlying pvcs
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"DELETE",
|
||||
"http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestCreateTenant(t *testing.T) {
|
||||
printStartFunc("TestCreateTenant")
|
||||
|
||||
@@ -436,6 +442,159 @@ func TestCreateTenant(t *testing.T) {
|
||||
printEndFunc("TestCreateTenant")
|
||||
}
|
||||
|
||||
func TestDeleteTenant(t *testing.T) {
|
||||
printStartFunc("TestCreateTenant")
|
||||
|
||||
// Variables
|
||||
assert := assert.New(t)
|
||||
erasureCodingParity := 2
|
||||
tenantName := "new-tenant-3"
|
||||
namespace := "new-namespace-3"
|
||||
|
||||
// 0. Create the namespace
|
||||
resp, err := CreateNamespace(namespace)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
201, resp.StatusCode, inspectHTTPResponse(resp))
|
||||
}
|
||||
|
||||
accessKey := ""
|
||||
secretKey := ""
|
||||
var accessKeys []string
|
||||
var secretKeys []string
|
||||
var minio []string
|
||||
var caCertificates []string
|
||||
var consoleCAcertificates []string
|
||||
enableTLS := true
|
||||
enableConsole := true
|
||||
enablePrometheus := true
|
||||
serviceName := ""
|
||||
image := ""
|
||||
exposeMinIO := true
|
||||
exposeConsole := true
|
||||
values := make([]string, 1)
|
||||
values[0] = "new-tenant"
|
||||
values2 := make([]string, 1)
|
||||
values2[0] = "pool-0"
|
||||
keys := make([]map[string]interface{}, 1)
|
||||
keys[0] = map[string]interface{}{
|
||||
"access_key": "IGLksSXdiU3fjcRI",
|
||||
"secret_key": "EqeCPZ1xBYdnygizxxRWnkH09N2350nO",
|
||||
}
|
||||
pools := make([]map[string]interface{}, 1)
|
||||
matchExpressions := make([]map[string]interface{}, 2)
|
||||
matchExpressions[0] = map[string]interface{}{
|
||||
"key": "v1.min.io/tenant",
|
||||
"operator": "In",
|
||||
"values": values,
|
||||
}
|
||||
matchExpressions[1] = map[string]interface{}{
|
||||
"key": "v1.min.io/pool",
|
||||
"operator": "In",
|
||||
"values": values2,
|
||||
}
|
||||
requiredDuringSchedulingIgnoredDuringExecution := make([]map[string]interface{}, 1)
|
||||
requiredDuringSchedulingIgnoredDuringExecution[0] = map[string]interface{}{
|
||||
"labelSelector": map[string]interface{}{
|
||||
"matchExpressions": matchExpressions,
|
||||
},
|
||||
"topologyKey": "kubernetes.io/hostname",
|
||||
}
|
||||
pools0 := map[string]interface{}{
|
||||
"name": "pool-0",
|
||||
"servers": 4,
|
||||
"volumes_per_server": 1,
|
||||
"volume_configuration": map[string]interface{}{
|
||||
"size": 26843545600,
|
||||
"storage_class_name": "standard",
|
||||
},
|
||||
"securityContext": nil,
|
||||
"affinity": map[string]interface{}{
|
||||
"podAntiAffinity": map[string]interface{}{
|
||||
"requiredDuringSchedulingIgnoredDuringExecution": requiredDuringSchedulingIgnoredDuringExecution,
|
||||
},
|
||||
},
|
||||
"resources": map[string]interface{}{
|
||||
"requests": map[string]interface{}{
|
||||
"cpu": 2,
|
||||
"memory": 2,
|
||||
},
|
||||
},
|
||||
}
|
||||
logSearchConfiguration := map[string]interface{}{
|
||||
"image": "",
|
||||
"postgres_image": "",
|
||||
"postgres_init_image": "",
|
||||
}
|
||||
prometheusConfiguration := map[string]interface{}{
|
||||
"image": "",
|
||||
"sidecar_image": "",
|
||||
"init_image": "",
|
||||
}
|
||||
tls := map[string]interface{}{
|
||||
"minio": minio,
|
||||
"ca_certificates": caCertificates,
|
||||
"console_ca_certificates": consoleCAcertificates,
|
||||
}
|
||||
idp := map[string]interface{}{
|
||||
"keys": keys,
|
||||
}
|
||||
pools[0] = pools0
|
||||
|
||||
// 1. Create Tenant
|
||||
resp, err = CreateTenant(
|
||||
tenantName,
|
||||
namespace,
|
||||
accessKey,
|
||||
secretKey,
|
||||
accessKeys,
|
||||
idp,
|
||||
tls,
|
||||
prometheusConfiguration,
|
||||
logSearchConfiguration,
|
||||
erasureCodingParity,
|
||||
pools,
|
||||
exposeConsole,
|
||||
exposeMinIO,
|
||||
image,
|
||||
serviceName,
|
||||
enablePrometheus,
|
||||
enableConsole,
|
||||
enableTLS,
|
||||
secretKeys,
|
||||
)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 2. Delete tenant
|
||||
resp, err = DeleteTenant(namespace, tenantName)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
204,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
|
||||
printEndFunc("TestCreateTenant")
|
||||
}
|
||||
|
||||
func ListTenantsByNameSpace(namespace string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to list buckets
|
||||
@@ -476,7 +635,10 @@ func TestListTenantsByNameSpace(t *testing.T) {
|
||||
log.Println(err)
|
||||
assert.Nil(err)
|
||||
}
|
||||
TenantName := &result.Tenants[0].Name // The array has to be empty, no index accessible
|
||||
if len(result.Tenants) == 0 {
|
||||
assert.Fail("FAIL: There are no tenants in the array")
|
||||
}
|
||||
TenantName := &result.Tenants[0].Name
|
||||
fmt.Println(*TenantName)
|
||||
assert.Equal("new-tenant", *TenantName, *TenantName)
|
||||
}
|
||||
@@ -637,5 +799,509 @@ func TestGetCSR(t *testing.T) {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, finalResponse)
|
||||
}
|
||||
assert.Equal(strings.Contains(finalResponse, "Automatically approved by MinIO Operator"), true)
|
||||
assert.Equal(strings.Contains(finalResponse, "Automatically approved by MinIO Operator"), true, finalResponse)
|
||||
}
|
||||
|
||||
func TestGetMultipleCSRs(t *testing.T) {
|
||||
/*
|
||||
We can have multiple CSRs per tenant, the idea is to support them in our API and test them here, making sure we
|
||||
can retrieve them all, as an example I found this tenant:
|
||||
storage-kms-encrypted -client -tenant-kms-encrypted-csr
|
||||
storage-kms-encrypted -kes -tenant-kms-encrypted-csr
|
||||
storage-kms-encrypted -tenant-kms-encrypted-csr
|
||||
Notice the nomenclature of it:
|
||||
<tenant-name>-<*>-<namespace>-csr
|
||||
where * is anything either nothing or something, anything.
|
||||
*/
|
||||
assert := assert.New(t)
|
||||
namespace := "tenant-kms-encrypted"
|
||||
tenant := "storage-kms-encrypted"
|
||||
resp, err := GetCSR(namespace, tenant)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(resp)
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, finalResponse)
|
||||
}
|
||||
var expectedMessages [3]string
|
||||
expectedMessages[0] = "storage-kms-encrypted-tenant-kms-encrypted-csr"
|
||||
expectedMessages[1] = "storage-kms-encrypted-kes-tenant-kms-encrypted-csr"
|
||||
expectedMessages[2] = "Automatically approved by MinIO Operator"
|
||||
for _, element := range expectedMessages {
|
||||
assert.Equal(strings.Contains(finalResponse, element), true)
|
||||
}
|
||||
}
|
||||
|
||||
func ListPVCsForTenant(nameSpace string, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
URL: /namespaces/{namespace}/tenants/{tenant}/pvcs
|
||||
HTTP Verb: GET
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"GET", "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/pvcs/", nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestListPVCsForTenant(t *testing.T) {
|
||||
/*
|
||||
Function to list and verify the Tenant's Persistent Volume Claims
|
||||
*/
|
||||
assert := assert.New(t)
|
||||
namespace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
resp, err := ListPVCsForTenant(namespace, tenant)
|
||||
bodyResponse := resp.Body
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200, resp.StatusCode, "failed")
|
||||
}
|
||||
bodyBytes, _ := ioutil.ReadAll(bodyResponse)
|
||||
listObjs := models.ListPVCsResponse{}
|
||||
err = json.Unmarshal(bodyBytes, &listObjs)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
assert.Nil(err)
|
||||
}
|
||||
var pvcArray [4]string
|
||||
pvcArray[0] = "data0-storage-lite-pool-0-0"
|
||||
pvcArray[1] = "data0-storage-lite-pool-0-1"
|
||||
pvcArray[2] = "data0-storage-lite-pool-0-2"
|
||||
pvcArray[3] = "data0-storage-lite-pool-0-3"
|
||||
for i := 0; i < len(pvcArray); i++ {
|
||||
assert.Equal(strings.Contains(listObjs.Pvcs[i].Name, pvcArray[i]), true)
|
||||
}
|
||||
}
|
||||
|
||||
func CreateNamespace(nameSpace string) (*http.Response, error) {
|
||||
/*
|
||||
Description: Creates a new Namespace with given information
|
||||
URL: /namespace
|
||||
HTTP Verb: POST
|
||||
*/
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"name": nameSpace,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/namespace/",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestCreateNamespace(t *testing.T) {
|
||||
/*
|
||||
Function to Create a Namespace only once.
|
||||
*/
|
||||
assert := assert.New(t)
|
||||
namespace := "new-namespace-thujun2208pm"
|
||||
tests := []struct {
|
||||
name string
|
||||
nameSpace string
|
||||
expectedStatus int
|
||||
}{
|
||||
{
|
||||
name: "Create Namespace for the first time",
|
||||
expectedStatus: 201,
|
||||
nameSpace: namespace,
|
||||
},
|
||||
{
|
||||
name: "Create repeated namespace for second time",
|
||||
expectedStatus: 500,
|
||||
nameSpace: namespace,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
resp, err := CreateNamespace(tt.nameSpace)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
tt.expectedStatus, resp.StatusCode, "failed")
|
||||
} else {
|
||||
assert.Fail("resp cannot be nil")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func LoginOperator() (*http.Response, error) {
|
||||
/*
|
||||
Description: Login to Operator Console.
|
||||
URL: /login/operator
|
||||
Params in the Body: jwt
|
||||
*/
|
||||
requestData := map[string]string{
|
||||
"jwt": jwt,
|
||||
}
|
||||
fmt.Println("requestData: ", requestData)
|
||||
|
||||
requestDataJSON, _ := json.Marshal(requestData)
|
||||
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
|
||||
request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login/operator", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func LogoutOperator() (*http.Response, error) {
|
||||
/*
|
||||
Description: Logout from Operator.
|
||||
URL: /logout
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/logout",
|
||||
nil,
|
||||
)
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestLogout(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
|
||||
// 1. Logout
|
||||
response, err := LogoutOperator()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
response.StatusCode,
|
||||
inspectHTTPResponse(response),
|
||||
)
|
||||
}
|
||||
|
||||
// 2. Login to recover token
|
||||
response, err = LoginOperator()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
for _, cookie := range response.Cookies() {
|
||||
if cookie.Name == "token" {
|
||||
token = cookie.Value
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Verify token
|
||||
if token == "" {
|
||||
assert.Fail("authentication token not found in cookies response")
|
||||
}
|
||||
}
|
||||
|
||||
func EnableTenantLogging(namespace, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
Description: Enable Tenant Logging
|
||||
HTTP Verb: POST
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/namespaces/"+namespace+"/tenants/"+tenant+"/enable-logging",
|
||||
nil,
|
||||
)
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func DisableTenantLogging(namespace, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
Description: Disable Tenant Logging
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/namespaces/"+namespace+"/tenants/"+tenant+"/disable-logging",
|
||||
nil,
|
||||
)
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestEnableTenantLogging(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
namespace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
|
||||
// Enable tenant logging
|
||||
resp, err := EnableTenantLogging(namespace, tenant)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDisableTenantLogging(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
namespace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
|
||||
// Disable tenant logging
|
||||
resp, err := DisableTenantLogging(namespace, tenant)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func GetTenantLogs(nameSpace, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
URL: /namespaces/{namespace}/tenants/{tenant}/log
|
||||
summary: Get Tenant Logs
|
||||
HTTP Verb:GET
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/log",
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func SetTenantLogs(labels, annotations, nodeSelector, dbLabels, dbAnnotations, dbNodeSelector []string, nameSpace, tenant, dbServiceAccountName, logMemRequest, logDBMemRequest, diskCapacityGB, serviceAccountName string) (*http.Response, error) {
|
||||
/*
|
||||
URL: /namespaces/{namespace}/tenants/{tenant}/log
|
||||
summary: Set Tenant Logs
|
||||
HTTP Verb: PUT
|
||||
*/
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"labels": labels,
|
||||
"annotations": annotations,
|
||||
"dbAnnotations": dbAnnotations,
|
||||
"dbLabels": dbLabels,
|
||||
"dbNodeSelector": dbNodeSelector,
|
||||
"diskCapacityGB": diskCapacityGB,
|
||||
"nodeSelector": nodeSelector,
|
||||
"serviceAccountName": serviceAccountName,
|
||||
"dbServiceAccountName": dbServiceAccountName,
|
||||
"logMemRequest": logMemRequest,
|
||||
"logDBMemRequest": logDBMemRequest,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT",
|
||||
"http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/log",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestGetTenantLogs(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
namespace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
|
||||
// Get Log Settings
|
||||
resp, err := GetTenantLogs(namespace, tenant)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetTenantLogs(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
nameSpace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
var nodeSelector []string
|
||||
var labels []string
|
||||
var annotations []string
|
||||
var dbAnnotations []string
|
||||
var dbNodeSelector []string
|
||||
var dbLabels []string
|
||||
diskCapacityGB := "2"
|
||||
dbServiceAccountName := ""
|
||||
logMemRequest := "0Gi"
|
||||
logDBMemRequest := "0Gi"
|
||||
serviceAccountName := ""
|
||||
|
||||
// Set Tenant Logs
|
||||
resp, err := SetTenantLogs(
|
||||
labels,
|
||||
annotations,
|
||||
nodeSelector,
|
||||
dbLabels,
|
||||
dbAnnotations,
|
||||
dbNodeSelector,
|
||||
nameSpace,
|
||||
tenant,
|
||||
dbServiceAccountName,
|
||||
logMemRequest,
|
||||
logDBMemRequest,
|
||||
diskCapacityGB,
|
||||
serviceAccountName,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TenantDetails(nameSpace, tenant string) (*http.Response, error) {
|
||||
/*
|
||||
url: /namespaces/{namespace}/tenants/{tenant}
|
||||
summary: Tenant Details
|
||||
operationId: TenantDetails
|
||||
HTTP Verb: GET
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant,
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestTenantDetails(t *testing.T) {
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
nameSpace := "tenant-lite"
|
||||
tenant := "storage-lite"
|
||||
resp, err := TenantDetails(nameSpace, tenant)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
inspectHTTPResponse(resp),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,3 +69,10 @@ func getK8sSAToken() string {
|
||||
func getMarketplace() string {
|
||||
return env.Get(ConsoleMarketplace, "")
|
||||
}
|
||||
|
||||
// Get DirectPVMode
|
||||
func getDirectPVEnabled() bool {
|
||||
currentMode := env.Get(DirectPVMode, "off")
|
||||
|
||||
return currentMode == "on"
|
||||
}
|
||||
|
||||
@@ -89,6 +89,12 @@ func configureAPI(api *operations.OperatorAPI) http.Handler {
|
||||
registerVolumesHandlers(api)
|
||||
// Namespaces handlers
|
||||
registerNamespaceHandlers(api)
|
||||
// Marketplace handlers
|
||||
registerMarketplaceHandlers(api)
|
||||
// Subnet handlers
|
||||
registerOperatorSubnetHandlers(api)
|
||||
// Direct PV handlers
|
||||
registerDirectPVHandlers(api)
|
||||
|
||||
api.PreServerShutdown = func() {}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ const (
|
||||
prometheusPath = "prometheus.io/path"
|
||||
prometheusPort = "prometheus.io/port"
|
||||
prometheusScrape = "prometheus.io/scrape"
|
||||
|
||||
// Constants for DirectPV
|
||||
DirectPVMode = "DIRECTPV_MODE"
|
||||
)
|
||||
|
||||
// Image versions
|
||||
|
||||
328
operatorapi/directpv.go
Normal file
328
operatorapi/directpv.go
Normal file
@@ -0,0 +1,328 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/minio/directpv/pkg/utils"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/minio/console/cluster"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/operatorapi/operations"
|
||||
"github.com/minio/console/operatorapi/operations/operator_api"
|
||||
xerrors "github.com/minio/console/restapi"
|
||||
directcsi "github.com/minio/directpv/pkg/apis/direct.csi.min.io/v1beta4"
|
||||
"github.com/minio/directpv/pkg/sys"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
const XFS = "xfs"
|
||||
|
||||
func registerDirectPVHandlers(api *operations.OperatorAPI) {
|
||||
api.OperatorAPIGetDirectPVDriveListHandler = operator_api.GetDirectPVDriveListHandlerFunc(func(params operator_api.GetDirectPVDriveListParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := getDirectPVDrivesListResponse(session)
|
||||
if err != nil {
|
||||
return operator_api.NewGetDirectPVDriveListDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewGetDirectPVDriveListOK().WithPayload(resp)
|
||||
})
|
||||
api.OperatorAPIGetDirectPVVolumeListHandler = operator_api.GetDirectPVVolumeListHandlerFunc(func(params operator_api.GetDirectPVVolumeListParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := getDirectPVVolumesListResponse(session)
|
||||
if err != nil {
|
||||
return operator_api.NewGetDirectPVVolumeListDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewGetDirectPVVolumeListOK().WithPayload(resp)
|
||||
})
|
||||
api.OperatorAPIDirectPVFormatDriveHandler = operator_api.DirectPVFormatDriveHandlerFunc(func(params operator_api.DirectPVFormatDriveParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := formatVolumesResponse(session, params)
|
||||
if err != nil {
|
||||
return operator_api.NewDirectPVFormatDriveDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewDirectPVFormatDriveOK().WithPayload(resp)
|
||||
})
|
||||
}
|
||||
|
||||
// getDirectPVVolumesList returns directPV drives
|
||||
func getDirectPVDriveList(ctx context.Context, driveInterface DirectPVDrivesClientI) (*models.GetDirectPVDriveListResponse, error) {
|
||||
drivesList, err := driveInterface.List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res := &models.GetDirectPVDriveListResponse{}
|
||||
|
||||
// implementation same as directPV `drives ls` command
|
||||
driveName := func(val string) string {
|
||||
dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "")
|
||||
dr = strings.ReplaceAll(dr, sys.HostDevRoot+"/", "")
|
||||
return strings.ReplaceAll(dr, sys.DirectCSIPartitionInfix, "")
|
||||
}
|
||||
drivesSorted := drivesList.Items
|
||||
// sort by nodename, path and status
|
||||
sort.Slice(drivesSorted, func(i, j int) bool {
|
||||
d1 := drivesSorted[i]
|
||||
d2 := drivesSorted[j]
|
||||
|
||||
if v := strings.Compare(d1.Status.NodeName, d2.Status.NodeName); v != 0 {
|
||||
return v < 0
|
||||
}
|
||||
|
||||
if v := strings.Compare(d1.Status.Path, d2.Status.Path); v != 0 {
|
||||
return v < 0
|
||||
}
|
||||
|
||||
return strings.Compare(string(d1.Status.DriveStatus), string(d2.Status.DriveStatus)) < 0
|
||||
})
|
||||
|
||||
for _, d := range drivesSorted {
|
||||
volumes := 0
|
||||
|
||||
if len(d.Finalizers) > 1 {
|
||||
volumes = len(d.Finalizers) - 1
|
||||
}
|
||||
|
||||
dr := driveName(d.Status.Path)
|
||||
dr = strings.ReplaceAll("/dev/"+dr, sys.DirectCSIPartitionInfix, "")
|
||||
|
||||
status := d.Status.DriveStatus
|
||||
msg := ""
|
||||
for _, c := range d.Status.Conditions {
|
||||
switch c.Type {
|
||||
case string(directcsi.DirectCSIDriveConditionInitialized), string(directcsi.DirectCSIDriveConditionOwned), string(directcsi.DirectCSIDriveConditionReady):
|
||||
if c.Status != metav1.ConditionTrue {
|
||||
msg = c.Message
|
||||
if msg != "" {
|
||||
status = d.Status.DriveStatus + "*"
|
||||
msg = strings.ReplaceAll(msg, d.Name, "")
|
||||
msg = strings.ReplaceAll(msg, sys.DirectCSIDevRoot, "/dev")
|
||||
msg = strings.ReplaceAll(msg, sys.DirectCSIPartitionInfix, "")
|
||||
msg = strings.Split(msg, "\n")[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var allocatedCapacity int64
|
||||
if status == directcsi.DriveStatusInUse {
|
||||
allocatedCapacity = d.Status.AllocatedCapacity
|
||||
}
|
||||
|
||||
drStatus := d.Status.DriveStatus
|
||||
|
||||
driveInfo := &models.DirectPVDriveInfo{
|
||||
Drive: dr,
|
||||
Capacity: d.Status.TotalCapacity,
|
||||
Allocated: allocatedCapacity,
|
||||
Node: d.Status.NodeName,
|
||||
Status: string(drStatus),
|
||||
Message: msg,
|
||||
Volumes: int64(volumes),
|
||||
}
|
||||
res.Drives = append(res.Drives, driveInfo)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func getDirectPVDrivesListResponse(session *models.Principal) (*models.GetDirectPVDriveListResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
|
||||
driveInterface, err := cluster.DirectPVDriveInterface(session.STSSessionToken)
|
||||
if err != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
|
||||
directPVDrvClient := &directPVDrivesClient{
|
||||
client: driveInterface,
|
||||
}
|
||||
|
||||
drives, err := getDirectPVDriveList(ctx, directPVDrvClient)
|
||||
if err != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
return drives, nil
|
||||
}
|
||||
|
||||
// getDirectPVVolumesList returns directPV volumes
|
||||
func getDirectPVVolumesList(ctx context.Context, volumeInterface DirectPVVolumesClientI) (*models.GetDirectPVVolumeListResponse, error) {
|
||||
volList, err := volumeInterface.List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
driveName := func(val string) string {
|
||||
dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "")
|
||||
return strings.ReplaceAll(dr, sys.HostDevRoot+"/", "")
|
||||
}
|
||||
|
||||
getLabelValue := func(obj metav1.Object, key string) string {
|
||||
if labels := obj.GetLabels(); labels != nil {
|
||||
return labels[key]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var volumes []*models.DirectPVVolumeInfo
|
||||
for _, v := range volList.Items {
|
||||
vol := &models.DirectPVVolumeInfo{
|
||||
Volume: v.Name,
|
||||
Capacity: v.Status.TotalCapacity,
|
||||
Drive: driveName(getLabelValue(&v, string(utils.DrivePathLabelKey))),
|
||||
Node: v.Status.NodeName,
|
||||
}
|
||||
|
||||
volumes = append(volumes, vol)
|
||||
}
|
||||
|
||||
res := &models.GetDirectPVVolumeListResponse{
|
||||
Volumes: volumes,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func getDirectPVVolumesListResponse(session *models.Principal) (*models.GetDirectPVVolumeListResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
|
||||
volumeInterface, err := cluster.DirectPVVolumeInterface(session.STSSessionToken)
|
||||
if err != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
|
||||
directPVVolClient := &directPVVolumesClient{
|
||||
client: volumeInterface,
|
||||
}
|
||||
|
||||
volumes, err := getDirectPVVolumesList(ctx, directPVVolClient)
|
||||
if err != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
return volumes, nil
|
||||
}
|
||||
|
||||
func formatDrives(ctx context.Context, driveInterface DirectPVDrivesClientI, drives []string, force bool) (*models.FormatDirectPVDrivesResponse, error) {
|
||||
if len(drives) == 0 {
|
||||
return nil, errors.New("at least one drive needs to be set")
|
||||
}
|
||||
|
||||
driveList, err := driveInterface.List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
driveName := func(val string) string {
|
||||
dr := strings.ReplaceAll(val, sys.DirectCSIDevRoot+"/", "")
|
||||
dr = strings.ReplaceAll(dr, sys.HostDevRoot+"/", "")
|
||||
return strings.ReplaceAll(dr, sys.DirectCSIPartitionInfix, "")
|
||||
}
|
||||
|
||||
drivesArray := map[string]string{}
|
||||
|
||||
for _, driveFromAPI := range drives {
|
||||
drivesArray[driveFromAPI] = driveFromAPI
|
||||
}
|
||||
|
||||
if len(driveList.Items) == 0 {
|
||||
return nil, errors.New("no resources found globally")
|
||||
}
|
||||
|
||||
var errorResponses []*models.PvFormatErrorResponse
|
||||
|
||||
for _, driveItem := range driveList.Items {
|
||||
drName := "/dev/" + driveName(driveItem.Status.Path)
|
||||
driveName := driveItem.Status.NodeName + ":" + drName
|
||||
|
||||
base := &models.PvFormatErrorResponse{
|
||||
Node: driveItem.Status.NodeName,
|
||||
Drive: drName,
|
||||
Error: "",
|
||||
}
|
||||
|
||||
// Element is requested to be formatted
|
||||
if _, ok := drivesArray[driveName]; ok {
|
||||
if driveItem.Status.DriveStatus == directcsi.DriveStatusUnavailable {
|
||||
base.Error = "Status is unavailable"
|
||||
errorResponses = append(errorResponses, base)
|
||||
continue
|
||||
}
|
||||
|
||||
if driveItem.Status.DriveStatus == directcsi.DriveStatusInUse {
|
||||
base.Error = "Drive in use. Cannot be formatted"
|
||||
errorResponses = append(errorResponses, base)
|
||||
continue
|
||||
}
|
||||
|
||||
if driveItem.Status.DriveStatus == directcsi.DriveStatusReady {
|
||||
base.Error = "Drive already owned and managed."
|
||||
errorResponses = append(errorResponses, base)
|
||||
continue
|
||||
}
|
||||
if driveItem.Status.Filesystem != "" && !force {
|
||||
base.Error = "Drive already has a fs. Use force to overwrite"
|
||||
errorResponses = append(errorResponses, base)
|
||||
continue
|
||||
}
|
||||
|
||||
if driveItem.Status.DriveStatus == directcsi.DriveStatusReleased {
|
||||
base.Error = "Drive is in 'released state'. Please wait until it becomes available"
|
||||
errorResponses = append(errorResponses, base)
|
||||
continue
|
||||
}
|
||||
|
||||
// Validation passes, we request format
|
||||
driveItem.Spec.DirectCSIOwned = true
|
||||
driveItem.Spec.RequestedFormat = &directcsi.RequestedFormat{
|
||||
Filesystem: XFS,
|
||||
Force: force,
|
||||
}
|
||||
|
||||
_, err := driveInterface.Update(ctx, &driveItem, metav1.UpdateOptions{})
|
||||
if err != nil {
|
||||
base.Error = err.Error()
|
||||
errorResponses = append(errorResponses, base)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
returnErrors := &models.FormatDirectPVDrivesResponse{
|
||||
FormatIssuesList: errorResponses,
|
||||
}
|
||||
|
||||
return returnErrors, nil
|
||||
}
|
||||
|
||||
func formatVolumesResponse(session *models.Principal, params operator_api.DirectPVFormatDriveParams) (*models.FormatDirectPVDrivesResponse, *models.Error) {
|
||||
ctx := context.Background()
|
||||
|
||||
driveInterface, err := cluster.DirectPVDriveInterface(session.STSSessionToken)
|
||||
if err != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
|
||||
directPVDrvClient := &directPVDrivesClient{
|
||||
client: driveInterface,
|
||||
}
|
||||
|
||||
formatResult, errFormat := formatDrives(ctx, directPVDrvClient, params.Body.Drives, *params.Body.Force)
|
||||
if errFormat != nil {
|
||||
return nil, xerrors.ErrorWithContext(ctx, errFormat)
|
||||
}
|
||||
return formatResult, nil
|
||||
}
|
||||
73
operatorapi/directpv_client.go
Normal file
73
operatorapi/directpv_client.go
Normal file
@@ -0,0 +1,73 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/minio/directpv/pkg/apis/direct.csi.min.io/v1beta4"
|
||||
directPVClient "github.com/minio/directpv/pkg/client"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// DirectPVDrivesClientI interface with all functions to be implemented
|
||||
// by mock when testing, it should include all DirectPVDrivesClientI respective api calls
|
||||
// that are used within this project.
|
||||
type DirectPVDrivesClientI interface {
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
Update(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts metav1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
}
|
||||
|
||||
// Interface implementation
|
||||
//
|
||||
// Define the structure of directpv drive client and define the functions that are actually used
|
||||
// from the minio operator / directpv interface.
|
||||
|
||||
type directPVDrivesClient struct {
|
||||
client *directPVClient.DirectCSIDriveInterface
|
||||
}
|
||||
|
||||
// List implements the listing for DirectPV Drives List functionality
|
||||
func (dpd *directPVDrivesClient) List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
return dpd.List(ctx, opts)
|
||||
}
|
||||
|
||||
// Update implements the listing for DirectPV Drives Update functionality
|
||||
func (dpd *directPVDrivesClient) Update(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts metav1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
return dpd.Update(ctx, driveItem, opts)
|
||||
}
|
||||
|
||||
// DirectPVVolumesClientI interface with all functions to be implemented
|
||||
// by mock when testing, it should include all DirectPVVolumesClientI respective api calls
|
||||
// that are used within this project.
|
||||
type DirectPVVolumesClientI interface {
|
||||
List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIVolumeList, error)
|
||||
}
|
||||
|
||||
// Interface implementation
|
||||
//
|
||||
// Define the structure of directpv volumes client and define the functions that are actually used
|
||||
// from the minio operator / directpv interface.
|
||||
|
||||
type directPVVolumesClient struct {
|
||||
client *directPVClient.DirectCSIVolumeInterface
|
||||
}
|
||||
|
||||
// List implements the listing for DirectPV Volumes List functionality
|
||||
func (dpv *directPVVolumesClient) List(ctx context.Context, opts metav1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) {
|
||||
return dpv.List(ctx, opts)
|
||||
}
|
||||
410
operatorapi/directpv_test.go
Normal file
410
operatorapi/directpv_test.go
Normal file
@@ -0,0 +1,410 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/minio/directpv/pkg/apis/direct.csi.min.io/v1beta4"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
dpdClientListMock func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
dpdClientUpdateMock func(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts v1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
)
|
||||
|
||||
// mock function for drives List()
|
||||
func (dpdm directPVDriveMock) List(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
return dpdClientListMock(ctx, opts)
|
||||
}
|
||||
|
||||
func (dpdm directPVDriveMock) Update(ctx context.Context, driveItem *v1beta4.DirectCSIDrive, opts v1.UpdateOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
return dpdClientUpdateMock(ctx, driveItem, opts)
|
||||
}
|
||||
|
||||
var dpvClientListMock func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error)
|
||||
|
||||
// mock function for volumes List()
|
||||
func (dpvm directPVVolumeMock) List(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) {
|
||||
return dpvClientListMock(ctx, opts)
|
||||
}
|
||||
|
||||
// DirectPVDrivesList
|
||||
func Test_GetDirectPVDrives(t *testing.T) {
|
||||
directPVDrvMock := directPVDriveMock{}
|
||||
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
opts v1.ListOptions
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
client DirectPVDrivesClientI
|
||||
mockListDrives func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "Can List Drives correctly",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
opts: v1.ListOptions{},
|
||||
},
|
||||
client: directPVDrvMock,
|
||||
mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
items := []v1beta4.DirectCSIDrive{}
|
||||
|
||||
returnList := v1beta4.DirectCSIDriveList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "Drives request from DirectPV failed",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
},
|
||||
client: directPVDrvMock,
|
||||
mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
return nil, errors.New("some error occurred")
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "Drives request from DirectPV has information and doesn't return errors",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
},
|
||||
client: directPVDrvMock,
|
||||
mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
items := []v1beta4.DirectCSIDrive{
|
||||
{
|
||||
Status: v1beta4.DirectCSIDriveStatus{
|
||||
Path: "/var/lib/direct-csi/devices/test-part-dev0-directcsi",
|
||||
AllocatedCapacity: 0,
|
||||
FreeCapacity: 4772382377372,
|
||||
RootPartition: "/",
|
||||
PartitionNum: 0,
|
||||
Filesystem: "nfs",
|
||||
Mountpoint: "",
|
||||
NodeName: "test-dev0-directcsi",
|
||||
DriveStatus: v1beta4.DriveStatusReady,
|
||||
ModelNumber: "testModel",
|
||||
SerialNumber: "testSN",
|
||||
TotalCapacity: 4772382377372,
|
||||
PhysicalBlockSize: 1024,
|
||||
LogicalBlockSize: 1024,
|
||||
AccessTier: "",
|
||||
FilesystemUUID: "",
|
||||
PartitionUUID: "",
|
||||
MajorNumber: 0,
|
||||
MinorNumber: 0,
|
||||
UeventSerial: "",
|
||||
UeventFSUUID: "",
|
||||
WWID: "",
|
||||
Vendor: "",
|
||||
DMName: "",
|
||||
DMUUID: "",
|
||||
MDUUID: "",
|
||||
PartTableUUID: "",
|
||||
PartTableType: "",
|
||||
Virtual: false,
|
||||
ReadOnly: false,
|
||||
Partitioned: false,
|
||||
SwapOn: false,
|
||||
Master: "",
|
||||
OtherMountsInfo: nil,
|
||||
PCIPath: "",
|
||||
SerialNumberLong: "",
|
||||
Conditions: []v1.Condition{{
|
||||
Type: "",
|
||||
Status: "",
|
||||
ObservedGeneration: 0,
|
||||
LastTransitionTime: v1.Time{},
|
||||
Reason: "",
|
||||
Message: "",
|
||||
}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Status: v1beta4.DirectCSIDriveStatus{
|
||||
Path: "/var/lib/direct-csi/devices/test-part-dev1-directcsi",
|
||||
AllocatedCapacity: 0,
|
||||
FreeCapacity: 4772382377372,
|
||||
RootPartition: "/",
|
||||
PartitionNum: 0,
|
||||
Filesystem: "nfs",
|
||||
Mountpoint: "",
|
||||
NodeName: "test-dev1-directcsi",
|
||||
DriveStatus: v1beta4.DriveStatus(v1beta4.DirectCSIDriveConditionOwned),
|
||||
ModelNumber: "testModel",
|
||||
SerialNumber: "testSN2",
|
||||
TotalCapacity: 4772382377372,
|
||||
PhysicalBlockSize: 1024,
|
||||
LogicalBlockSize: 1024,
|
||||
AccessTier: "",
|
||||
FilesystemUUID: "",
|
||||
PartitionUUID: "",
|
||||
MajorNumber: 0,
|
||||
MinorNumber: 0,
|
||||
UeventSerial: "",
|
||||
UeventFSUUID: "",
|
||||
WWID: "",
|
||||
Vendor: "",
|
||||
DMName: "",
|
||||
DMUUID: "",
|
||||
MDUUID: "",
|
||||
PartTableUUID: "",
|
||||
PartTableType: "",
|
||||
Virtual: false,
|
||||
ReadOnly: false,
|
||||
Partitioned: false,
|
||||
SwapOn: false,
|
||||
Master: "",
|
||||
OtherMountsInfo: nil,
|
||||
PCIPath: "",
|
||||
SerialNumberLong: "",
|
||||
Conditions: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
returnList := v1beta4.DirectCSIDriveList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
dpdClientListMock = tt.mockListDrives
|
||||
|
||||
_, err := getDirectPVDriveList(tt.args.ctx, tt.client)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("getNamespaceCreated() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// DirectPVVolumesList
|
||||
func Test_GetDirectPVVolumes(t *testing.T) {
|
||||
directPVVolMock := directPVVolumeMock{}
|
||||
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
opts v1.ListOptions
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
volumesClient DirectPVVolumesClientI
|
||||
mockListVolumes func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error)
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "Can List Volumes correctly",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
opts: v1.ListOptions{},
|
||||
},
|
||||
volumesClient: directPVVolMock,
|
||||
mockListVolumes: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) {
|
||||
items := []v1beta4.DirectCSIVolume{}
|
||||
|
||||
returnList := v1beta4.DirectCSIVolumeList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "Drives request from DirectPV is ok but volumes request failed",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
},
|
||||
volumesClient: directPVVolMock,
|
||||
mockListVolumes: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) {
|
||||
return nil, errors.New("some error occurred")
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "Can List Volumes & Drives correctly without any issue",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
opts: v1.ListOptions{},
|
||||
},
|
||||
volumesClient: directPVVolMock,
|
||||
mockListVolumes: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIVolumeList, error) {
|
||||
items := []v1beta4.DirectCSIVolume{{
|
||||
Status: v1beta4.DirectCSIVolumeStatus{
|
||||
Drive: "/var/lib/direct-csi/devices/test-part-dev1-directcsi",
|
||||
NodeName: "testNodeName",
|
||||
HostPath: "",
|
||||
StagingPath: "",
|
||||
ContainerPath: "",
|
||||
TotalCapacity: 4772382377372,
|
||||
AvailableCapacity: 4772382377372,
|
||||
UsedCapacity: 0,
|
||||
Conditions: nil,
|
||||
},
|
||||
}}
|
||||
|
||||
returnList := v1beta4.DirectCSIVolumeList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
dpvClientListMock = tt.mockListVolumes
|
||||
|
||||
_, err := getDirectPVVolumesList(tt.args.ctx, tt.volumesClient)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("getNamespaceCreated() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// FormatDrives
|
||||
func Test_GetDirectPVFormatDrives(t *testing.T) {
|
||||
directPVDrvMock := directPVDriveMock{}
|
||||
|
||||
type args struct {
|
||||
ctx context.Context
|
||||
opts v1.ListOptions
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
drivesClient DirectPVDrivesClientI
|
||||
mockListDrives func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error)
|
||||
drives []string
|
||||
force bool
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "Format doesn't crash on empty list & returns error",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
opts: v1.ListOptions{},
|
||||
},
|
||||
drivesClient: directPVDrvMock,
|
||||
mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
items := []v1beta4.DirectCSIDrive{}
|
||||
|
||||
returnList := v1beta4.DirectCSIDriveList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
drives: []string{},
|
||||
force: false,
|
||||
wantErr: true,
|
||||
},
|
||||
{
|
||||
name: "Can Format Selected drives",
|
||||
args: args{
|
||||
ctx: context.Background(),
|
||||
opts: v1.ListOptions{},
|
||||
},
|
||||
drivesClient: directPVDrvMock,
|
||||
mockListDrives: func(ctx context.Context, opts v1.ListOptions) (*v1beta4.DirectCSIDriveList, error) {
|
||||
items := []v1beta4.DirectCSIDrive{
|
||||
{
|
||||
Status: v1beta4.DirectCSIDriveStatus{
|
||||
Path: "/var/lib/direct-csi/devices/test-part-dev1-directcsi",
|
||||
AllocatedCapacity: 0,
|
||||
FreeCapacity: 4772382377372,
|
||||
RootPartition: "/",
|
||||
PartitionNum: 0,
|
||||
Filesystem: "nfs",
|
||||
Mountpoint: "",
|
||||
NodeName: "test-dev1-directcsi",
|
||||
DriveStatus: v1beta4.DriveStatusAvailable,
|
||||
ModelNumber: "testModel",
|
||||
SerialNumber: "testSN2",
|
||||
TotalCapacity: 4772382377372,
|
||||
PhysicalBlockSize: 1024,
|
||||
LogicalBlockSize: 1024,
|
||||
AccessTier: "",
|
||||
FilesystemUUID: "",
|
||||
PartitionUUID: "",
|
||||
MajorNumber: 0,
|
||||
MinorNumber: 0,
|
||||
UeventSerial: "",
|
||||
UeventFSUUID: "",
|
||||
WWID: "",
|
||||
Vendor: "",
|
||||
DMName: "",
|
||||
DMUUID: "",
|
||||
MDUUID: "",
|
||||
PartTableUUID: "",
|
||||
PartTableType: "",
|
||||
Virtual: false,
|
||||
ReadOnly: false,
|
||||
Partitioned: false,
|
||||
SwapOn: false,
|
||||
Master: "",
|
||||
OtherMountsInfo: nil,
|
||||
PCIPath: "",
|
||||
SerialNumberLong: "",
|
||||
Conditions: nil,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
returnList := v1beta4.DirectCSIDriveList{
|
||||
Items: items,
|
||||
}
|
||||
|
||||
return &returnList, nil
|
||||
},
|
||||
drives: []string{"test-dev1-directcsi:/dev/testdev1-directcsi"},
|
||||
force: false,
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
dpdClientListMock = tt.mockListDrives
|
||||
|
||||
_, err := formatDrives(tt.args.ctx, tt.drivesClient, tt.drives, tt.force)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("getNamespaceCreated() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,6 +39,10 @@ type K8sClientI interface {
|
||||
createSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error)
|
||||
updateSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error)
|
||||
getPVC(ctx context.Context, namespace string, pvcName string, opts metav1.GetOptions) (*v1.PersistentVolumeClaim, error)
|
||||
getConfigMap(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*v1.ConfigMap, error)
|
||||
createConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.CreateOptions) (*v1.ConfigMap, error)
|
||||
updateConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.UpdateOptions) (*v1.ConfigMap, error)
|
||||
deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error
|
||||
}
|
||||
|
||||
// Interface implementation
|
||||
@@ -87,3 +91,19 @@ func (c *k8sClient) getStorageClasses(ctx context.Context, opts metav1.ListOptio
|
||||
func (c *k8sClient) getPVC(ctx context.Context, namespace string, pvcName string, opts metav1.GetOptions) (*v1.PersistentVolumeClaim, error) {
|
||||
return c.client.CoreV1().PersistentVolumeClaims(namespace).Get(ctx, pvcName, opts)
|
||||
}
|
||||
|
||||
func (c *k8sClient) getConfigMap(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*v1.ConfigMap, error) {
|
||||
return c.client.CoreV1().ConfigMaps(namespace).Get(ctx, name, opts)
|
||||
}
|
||||
|
||||
func (c *k8sClient) createConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.CreateOptions) (*v1.ConfigMap, error) {
|
||||
return c.client.CoreV1().ConfigMaps(namespace).Create(ctx, cm, opts)
|
||||
}
|
||||
|
||||
func (c *k8sClient) updateConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.UpdateOptions) (*v1.ConfigMap, error) {
|
||||
return c.client.CoreV1().ConfigMaps(namespace).Update(ctx, cm, opts)
|
||||
}
|
||||
|
||||
func (c *k8sClient) deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error {
|
||||
return c.client.CoreV1().ConfigMaps(namespace).Delete(ctx, name, opts)
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ func getLoginDetailsResponse(params authApi.LoginDetailParams) (*models.LoginDet
|
||||
loginDetails := &models.LoginDetails{
|
||||
LoginStrategy: loginStrategy,
|
||||
Redirect: redirectURL,
|
||||
IsDirectPV: getDirectPVEnabled(),
|
||||
}
|
||||
return loginDetails, nil
|
||||
}
|
||||
|
||||
194
operatorapi/marketplace.go
Normal file
194
operatorapi/marketplace.go
Normal file
@@ -0,0 +1,194 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/golang-jwt/jwt/v4"
|
||||
"github.com/minio/console/cluster"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/operatorapi/operations"
|
||||
"github.com/minio/console/operatorapi/operations/operator_api"
|
||||
"github.com/minio/console/pkg"
|
||||
errors "github.com/minio/console/restapi"
|
||||
"github.com/minio/pkg/env"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
mpConfigMapDefault = "mp-config"
|
||||
mpConfigMapKey = "MP_CONFIG_KEY"
|
||||
mpHostEnvVar = "MP_HOST"
|
||||
defaultMPHost = "https://marketplace.apps.min.dev"
|
||||
mpEUHostEnvVar = "MP_EU_HOST"
|
||||
defaultEUMPHost = "https://marketplace-eu.apps.min.dev"
|
||||
isMPEmailSet = "isEmailSet"
|
||||
emailNotSetMsg = "Email was not sent in request"
|
||||
)
|
||||
|
||||
func registerMarketplaceHandlers(api *operations.OperatorAPI) {
|
||||
api.OperatorAPIGetMPIntegrationHandler = operator_api.GetMPIntegrationHandlerFunc(func(params operator_api.GetMPIntegrationParams, session *models.Principal) middleware.Responder {
|
||||
payload, err := getMPIntegrationResponse(session, params)
|
||||
if err != nil {
|
||||
return operator_api.NewGetMPIntegrationDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewGetMPIntegrationOK().WithPayload(payload)
|
||||
})
|
||||
|
||||
api.OperatorAPIPostMPIntegrationHandler = operator_api.PostMPIntegrationHandlerFunc(func(params operator_api.PostMPIntegrationParams, session *models.Principal) middleware.Responder {
|
||||
err := postMPIntegrationResponse(session, params)
|
||||
if err != nil {
|
||||
return operator_api.NewPostMPIntegrationDefault(int(err.Code)).WithPayload(err)
|
||||
}
|
||||
return operator_api.NewPostMPIntegrationCreated()
|
||||
})
|
||||
}
|
||||
|
||||
func getMPIntegrationResponse(session *models.Principal, params operator_api.GetMPIntegrationParams) (*operator_api.GetMPIntegrationOKBody, *models.Error) {
|
||||
clientSet, err := cluster.K8sClient(session.STSSessionToken)
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
if err != nil {
|
||||
return nil, errors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
isMPEmailSet, err := getMPEmail(ctx, &k8sClient{client: clientSet})
|
||||
if err != nil {
|
||||
return nil, errors.ErrorWithContext(ctx, errors.ErrNotFound)
|
||||
}
|
||||
return &operator_api.GetMPIntegrationOKBody{
|
||||
IsEmailSet: isMPEmailSet,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func getMPEmail(ctx context.Context, clientSet K8sClientI) (bool, error) {
|
||||
cm, err := clientSet.getConfigMap(ctx, "default", getMPConfigMapKey(mpConfigMapKey), metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return cm.Data[isMPEmailSet] == "true", nil
|
||||
}
|
||||
|
||||
func postMPIntegrationResponse(session *models.Principal, params operator_api.PostMPIntegrationParams) *models.Error {
|
||||
clientSet, err := cluster.K8sClient(session.STSSessionToken)
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
if err != nil {
|
||||
return errors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
return setMPIntegration(ctx, params.Body.Email, params.Body.IsInEU, &k8sClient{client: clientSet})
|
||||
}
|
||||
|
||||
func setMPIntegration(ctx context.Context, email string, isInEU bool, clientSet K8sClientI) *models.Error {
|
||||
if email == "" {
|
||||
return errors.ErrorWithContext(ctx, errors.ErrBadRequest, fmt.Errorf(emailNotSetMsg))
|
||||
}
|
||||
if _, err := setMPEmail(ctx, email, isInEU, clientSet); err != nil {
|
||||
return errors.ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func setMPEmail(ctx context.Context, email string, isInEU bool, clientSet K8sClientI) (*corev1.ConfigMap, error) {
|
||||
if err := postEmailToMP(email, isInEU); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cm := createCM()
|
||||
return clientSet.createConfigMap(ctx, "default", cm, metav1.CreateOptions{})
|
||||
}
|
||||
|
||||
func postEmailToMP(email string, isInEU bool) error {
|
||||
mpURL, err := getMPURL(isInEU)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return makePostRequestToMP(mpURL, email)
|
||||
}
|
||||
|
||||
func getMPURL(isInEU bool) (string, error) {
|
||||
mpHost := getMPHost(isInEU)
|
||||
if mpHost == "" {
|
||||
return "", fmt.Errorf("mp host not set")
|
||||
}
|
||||
return fmt.Sprintf("%s/mp-email", mpHost), nil
|
||||
}
|
||||
|
||||
func getMPHost(isInEU bool) string {
|
||||
if isInEU {
|
||||
return env.Get(mpEUHostEnvVar, defaultEUMPHost)
|
||||
}
|
||||
return env.Get(mpHostEnvVar, defaultMPHost)
|
||||
}
|
||||
|
||||
func makePostRequestToMP(url, email string) error {
|
||||
request, err := createMPRequest(url, email)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
client := &http.Client{Timeout: 3 * time.Second}
|
||||
if res, err := client.Do(request); err != nil {
|
||||
return err
|
||||
} else if res.StatusCode >= http.StatusBadRequest {
|
||||
b, _ := io.ReadAll(res.Body)
|
||||
return fmt.Errorf("request to %s failed with status code %d and error %s", url, res.StatusCode, string(b))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func createMPRequest(url, email string) (*http.Request, error) {
|
||||
request, err := http.NewRequest("POST", url, strings.NewReader(fmt.Sprintf("{\"email\":\"%s\"}", email)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
jwtToken := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{})
|
||||
jwtTokenString, err := jwtToken.SignedString([]byte(pkg.MPSecret))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("jwtToken=%s", jwtTokenString))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
return request, nil
|
||||
}
|
||||
|
||||
func createCM() *corev1.ConfigMap {
|
||||
return &corev1.ConfigMap{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "ConfigMap",
|
||||
APIVersion: "v1",
|
||||
},
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: getMPConfigMapKey(mpConfigMapKey),
|
||||
Namespace: "default",
|
||||
},
|
||||
Data: map[string]string{isMPEmailSet: "true"},
|
||||
}
|
||||
}
|
||||
|
||||
func getMPConfigMapKey(envVar string) string {
|
||||
if mp := os.Getenv(envVar); mp != "" {
|
||||
return mp
|
||||
}
|
||||
return mpConfigMapDefault
|
||||
}
|
||||
214
operatorapi/marketplace_test.go
Normal file
214
operatorapi/marketplace_test.go
Normal file
@@ -0,0 +1,214 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package operatorapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/operatorapi/operations"
|
||||
"github.com/minio/console/operatorapi/operations/operator_api"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
testWithError = false
|
||||
testServerWithError = false
|
||||
errMock = errors.New("mock error")
|
||||
k8sClientGetConfigMapMock func(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*corev1.ConfigMap, error)
|
||||
k8sClientCreateConfigMapMock func(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error)
|
||||
k8sClientUpdateConfigMapMock func(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error)
|
||||
k8sClientDeleteConfigMapMock func(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error
|
||||
)
|
||||
|
||||
type MarketplaceTestSuite struct {
|
||||
suite.Suite
|
||||
assert *assert.Assertions
|
||||
kClient k8sClientMock
|
||||
namespace string
|
||||
postServer *httptest.Server
|
||||
}
|
||||
|
||||
func (c k8sClientMock) getConfigMap(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*corev1.ConfigMap, error) {
|
||||
return k8sClientGetConfigMapMock(ctx, namespace, configMap, opts)
|
||||
}
|
||||
|
||||
func (c k8sClientMock) createConfigMap(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error) {
|
||||
return k8sClientCreateConfigMapMock(ctx, namespace, cm, opts)
|
||||
}
|
||||
|
||||
func (c k8sClientMock) updateConfigMap(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error) {
|
||||
return k8sClientUpdateConfigMapMock(ctx, namespace, cm, opts)
|
||||
}
|
||||
|
||||
func (c k8sClientMock) deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error {
|
||||
return k8sClientDeleteConfigMapMock(ctx, namespace, name, opts)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) SetupSuite() {
|
||||
suite.assert = assert.New(suite.T())
|
||||
suite.namespace = "default"
|
||||
k8sClientGetConfigMapMock = suite.getConfigMapMock
|
||||
k8sClientCreateConfigMapMock = suite.createConfigMapMock
|
||||
k8sClientUpdateConfigMapMock = suite.updateConfigMapMock
|
||||
k8sClientDeleteConfigMapMock = suite.deleteConfigMapMock
|
||||
os.Setenv(mpConfigMapKey, "mp-mock-config")
|
||||
suite.postServer = httptest.NewServer(http.HandlerFunc(suite.postHandler))
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) postHandler(
|
||||
w http.ResponseWriter, r *http.Request,
|
||||
) {
|
||||
if testServerWithError {
|
||||
w.WriteHeader(400)
|
||||
} else {
|
||||
fmt.Fprintf(w, `{"post": "Post response"}`)
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TearDownSuite() {
|
||||
os.Unsetenv(mpConfigMapKey)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) getConfigMapMock(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*corev1.ConfigMap, error) {
|
||||
if testWithError {
|
||||
return nil, errMock
|
||||
}
|
||||
return &corev1.ConfigMap{Data: map[string]string{isMPEmailSet: "true"}}, nil
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) createConfigMapMock(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.CreateOptions) (*corev1.ConfigMap, error) {
|
||||
if testWithError {
|
||||
return nil, errMock
|
||||
}
|
||||
return &corev1.ConfigMap{}, nil
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) updateConfigMapMock(ctx context.Context, namespace string, cm *corev1.ConfigMap, opts metav1.UpdateOptions) (*corev1.ConfigMap, error) {
|
||||
if testWithError {
|
||||
return nil, errMock
|
||||
}
|
||||
return &corev1.ConfigMap{}, nil
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) deleteConfigMapMock(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error {
|
||||
if testWithError {
|
||||
return errMock
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestRegisterMarketplaceHandlers() {
|
||||
api := &operations.OperatorAPI{}
|
||||
suite.assert.Nil(api.OperatorAPIGetMPIntegrationHandler)
|
||||
suite.assert.Nil(api.OperatorAPIPostMPIntegrationHandler)
|
||||
registerMarketplaceHandlers(api)
|
||||
suite.assert.NotNil(api.OperatorAPIGetMPIntegrationHandler)
|
||||
suite.assert.NotNil(api.OperatorAPIPostMPIntegrationHandler)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestGetMPIntegrationHandlerWithError() {
|
||||
api := &operations.OperatorAPI{}
|
||||
registerMarketplaceHandlers(api)
|
||||
params := operator_api.NewGetMPIntegrationParams()
|
||||
params.HTTPRequest = &http.Request{}
|
||||
response := api.OperatorAPIGetMPIntegrationHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*operator_api.GetMPIntegrationDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestPostMPIntegrationHandlerWithError() {
|
||||
api := &operations.OperatorAPI{}
|
||||
registerMarketplaceHandlers(api)
|
||||
params := operator_api.NewPostMPIntegrationParams()
|
||||
params.Body = &models.MpIntegration{Email: ""}
|
||||
params.HTTPRequest = &http.Request{}
|
||||
params.HTTPRequest.Header = map[string][]string{}
|
||||
params.HTTPRequest.AddCookie(&http.Cookie{Value: "token", Name: "token"})
|
||||
response := api.OperatorAPIPostMPIntegrationHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*operator_api.PostMPIntegrationDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestGetMPEmailWithError() {
|
||||
testWithError = true
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
email, err := getMPEmail(ctx, &suite.kClient)
|
||||
suite.assert.NotNil(err)
|
||||
suite.assert.Empty(email)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestGetMPEmailNoError() {
|
||||
testWithError = false
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
isSet, err := getMPEmail(ctx, &suite.kClient)
|
||||
suite.assert.Nil(err)
|
||||
suite.assert.True(isSet)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestSetMPIntegrationNoEmail() {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
err := setMPIntegration(ctx, "", false, &suite.kClient)
|
||||
suite.assert.NotNil(err)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestSetMPIntegrationWithError() {
|
||||
testWithError = true
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
os.Setenv(mpHostEnvVar, " ")
|
||||
err := setMPIntegration(ctx, "mock@mock.com", false, &suite.kClient)
|
||||
suite.assert.NotNil(err)
|
||||
os.Unsetenv(mpHostEnvVar)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestSetMPIntegrationNoError() {
|
||||
testWithError = false
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
os.Setenv(mpHostEnvVar, suite.postServer.URL)
|
||||
err := setMPIntegration(ctx, "mock@mock.com", false, &suite.kClient)
|
||||
suite.assert.Nil(err)
|
||||
os.Unsetenv(mpHostEnvVar)
|
||||
}
|
||||
|
||||
func (suite *MarketplaceTestSuite) TestSetMPIntegrationWithRequestError() {
|
||||
testWithError = false
|
||||
testServerWithError = true
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
os.Setenv(mpHostEnvVar, suite.postServer.URL)
|
||||
err := setMPIntegration(ctx, "mock@mock.com", false, &suite.kClient)
|
||||
suite.assert.NotNil(err)
|
||||
os.Unsetenv(mpHostEnvVar)
|
||||
}
|
||||
|
||||
func TestMarketplace(t *testing.T) {
|
||||
suite.Run(t, new(MarketplaceTestSuite))
|
||||
}
|
||||
@@ -22,8 +22,10 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
opClientMock struct{}
|
||||
httpClientMock struct{}
|
||||
opClientMock struct{}
|
||||
httpClientMock struct{}
|
||||
directPVDriveMock struct{}
|
||||
directPVVolumeMock struct{}
|
||||
)
|
||||
|
||||
func createMockPVC(pvcMockName, pvcMockNamespace string) *v1.PersistentVolumeClaim {
|
||||
|
||||
@@ -85,6 +85,9 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
|
||||
OperatorAPIDescribePodHandler: operator_api.DescribePodHandlerFunc(func(params operator_api.DescribePodParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.DescribePod has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIDirectPVFormatDriveHandler: operator_api.DirectPVFormatDriveHandlerFunc(func(params operator_api.DirectPVFormatDriveParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.DirectPVFormatDrive has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIDisableTenantLoggingHandler: operator_api.DisableTenantLoggingHandlerFunc(func(params operator_api.DisableTenantLoggingParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.DisableTenantLogging has not yet been implemented")
|
||||
}),
|
||||
@@ -94,6 +97,15 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
|
||||
OperatorAPIGetAllocatableResourcesHandler: operator_api.GetAllocatableResourcesHandlerFunc(func(params operator_api.GetAllocatableResourcesParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetAllocatableResources has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetDirectPVDriveListHandler: operator_api.GetDirectPVDriveListHandlerFunc(func(params operator_api.GetDirectPVDriveListParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetDirectPVDriveList has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetDirectPVVolumeListHandler: operator_api.GetDirectPVVolumeListHandlerFunc(func(params operator_api.GetDirectPVVolumeListParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetDirectPVVolumeList has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetMPIntegrationHandler: operator_api.GetMPIntegrationHandlerFunc(func(params operator_api.GetMPIntegrationParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetMPIntegration has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIGetMaxAllocatableMemHandler: operator_api.GetMaxAllocatableMemHandlerFunc(func(params operator_api.GetMaxAllocatableMemParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.GetMaxAllocatableMem has not yet been implemented")
|
||||
}),
|
||||
@@ -163,12 +175,33 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
|
||||
AuthLogoutHandler: auth.LogoutHandlerFunc(func(params auth.LogoutParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation auth.Logout has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIOperatorSubnetAPIKeyInfoHandler: operator_api.OperatorSubnetAPIKeyInfoHandlerFunc(func(params operator_api.OperatorSubnetAPIKeyInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.OperatorSubnetAPIKeyInfo has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIOperatorSubnetAPIKeyHandler: operator_api.OperatorSubnetAPIKeyHandlerFunc(func(params operator_api.OperatorSubnetAPIKeyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.OperatorSubnetAPIKey has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIOperatorSubnetLoginHandler: operator_api.OperatorSubnetLoginHandlerFunc(func(params operator_api.OperatorSubnetLoginParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.OperatorSubnetLogin has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIOperatorSubnetLoginMFAHandler: operator_api.OperatorSubnetLoginMFAHandlerFunc(func(params operator_api.OperatorSubnetLoginMFAParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.OperatorSubnetLoginMFA has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIOperatorSubnetRegisterAPIKeyHandler: operator_api.OperatorSubnetRegisterAPIKeyHandlerFunc(func(params operator_api.OperatorSubnetRegisterAPIKeyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.OperatorSubnetRegisterAPIKey has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIPostMPIntegrationHandler: operator_api.PostMPIntegrationHandlerFunc(func(params operator_api.PostMPIntegrationParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.PostMPIntegration has not yet been implemented")
|
||||
}),
|
||||
OperatorAPIPutTenantYAMLHandler: operator_api.PutTenantYAMLHandlerFunc(func(params operator_api.PutTenantYAMLParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.PutTenantYAML has not yet been implemented")
|
||||
}),
|
||||
AuthSessionCheckHandler: auth.SessionCheckHandlerFunc(func(params auth.SessionCheckParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation auth.SessionCheck has not yet been implemented")
|
||||
}),
|
||||
OperatorAPISetTenantAdministratorsHandler: operator_api.SetTenantAdministratorsHandlerFunc(func(params operator_api.SetTenantAdministratorsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.SetTenantAdministrators has not yet been implemented")
|
||||
}),
|
||||
OperatorAPISetTenantLogsHandler: operator_api.SetTenantLogsHandlerFunc(func(params operator_api.SetTenantLogsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation operator_api.SetTenantLogs has not yet been implemented")
|
||||
}),
|
||||
@@ -289,12 +322,20 @@ type OperatorAPI struct {
|
||||
OperatorAPIDeleteTenantHandler operator_api.DeleteTenantHandler
|
||||
// OperatorAPIDescribePodHandler sets the operation handler for the describe pod operation
|
||||
OperatorAPIDescribePodHandler operator_api.DescribePodHandler
|
||||
// OperatorAPIDirectPVFormatDriveHandler sets the operation handler for the direct p v format drive operation
|
||||
OperatorAPIDirectPVFormatDriveHandler operator_api.DirectPVFormatDriveHandler
|
||||
// OperatorAPIDisableTenantLoggingHandler sets the operation handler for the disable tenant logging operation
|
||||
OperatorAPIDisableTenantLoggingHandler operator_api.DisableTenantLoggingHandler
|
||||
// OperatorAPIEnableTenantLoggingHandler sets the operation handler for the enable tenant logging operation
|
||||
OperatorAPIEnableTenantLoggingHandler operator_api.EnableTenantLoggingHandler
|
||||
// OperatorAPIGetAllocatableResourcesHandler sets the operation handler for the get allocatable resources operation
|
||||
OperatorAPIGetAllocatableResourcesHandler operator_api.GetAllocatableResourcesHandler
|
||||
// OperatorAPIGetDirectPVDriveListHandler sets the operation handler for the get direct p v drive list operation
|
||||
OperatorAPIGetDirectPVDriveListHandler operator_api.GetDirectPVDriveListHandler
|
||||
// OperatorAPIGetDirectPVVolumeListHandler sets the operation handler for the get direct p v volume list operation
|
||||
OperatorAPIGetDirectPVVolumeListHandler operator_api.GetDirectPVVolumeListHandler
|
||||
// OperatorAPIGetMPIntegrationHandler sets the operation handler for the get m p integration operation
|
||||
OperatorAPIGetMPIntegrationHandler operator_api.GetMPIntegrationHandler
|
||||
// OperatorAPIGetMaxAllocatableMemHandler sets the operation handler for the get max allocatable mem operation
|
||||
OperatorAPIGetMaxAllocatableMemHandler operator_api.GetMaxAllocatableMemHandler
|
||||
// OperatorAPIGetPVCDescribeHandler sets the operation handler for the get p v c describe operation
|
||||
@@ -341,10 +382,24 @@ type OperatorAPI struct {
|
||||
AuthLoginOperatorHandler auth.LoginOperatorHandler
|
||||
// AuthLogoutHandler sets the operation handler for the logout operation
|
||||
AuthLogoutHandler auth.LogoutHandler
|
||||
// OperatorAPIOperatorSubnetAPIKeyInfoHandler sets the operation handler for the operator subnet API key info operation
|
||||
OperatorAPIOperatorSubnetAPIKeyInfoHandler operator_api.OperatorSubnetAPIKeyInfoHandler
|
||||
// OperatorAPIOperatorSubnetAPIKeyHandler sets the operation handler for the operator subnet Api key operation
|
||||
OperatorAPIOperatorSubnetAPIKeyHandler operator_api.OperatorSubnetAPIKeyHandler
|
||||
// OperatorAPIOperatorSubnetLoginHandler sets the operation handler for the operator subnet login operation
|
||||
OperatorAPIOperatorSubnetLoginHandler operator_api.OperatorSubnetLoginHandler
|
||||
// OperatorAPIOperatorSubnetLoginMFAHandler sets the operation handler for the operator subnet login m f a operation
|
||||
OperatorAPIOperatorSubnetLoginMFAHandler operator_api.OperatorSubnetLoginMFAHandler
|
||||
// OperatorAPIOperatorSubnetRegisterAPIKeyHandler sets the operation handler for the operator subnet register API key operation
|
||||
OperatorAPIOperatorSubnetRegisterAPIKeyHandler operator_api.OperatorSubnetRegisterAPIKeyHandler
|
||||
// OperatorAPIPostMPIntegrationHandler sets the operation handler for the post m p integration operation
|
||||
OperatorAPIPostMPIntegrationHandler operator_api.PostMPIntegrationHandler
|
||||
// OperatorAPIPutTenantYAMLHandler sets the operation handler for the put tenant y a m l operation
|
||||
OperatorAPIPutTenantYAMLHandler operator_api.PutTenantYAMLHandler
|
||||
// AuthSessionCheckHandler sets the operation handler for the session check operation
|
||||
AuthSessionCheckHandler auth.SessionCheckHandler
|
||||
// OperatorAPISetTenantAdministratorsHandler sets the operation handler for the set tenant administrators operation
|
||||
OperatorAPISetTenantAdministratorsHandler operator_api.SetTenantAdministratorsHandler
|
||||
// OperatorAPISetTenantLogsHandler sets the operation handler for the set tenant logs operation
|
||||
OperatorAPISetTenantLogsHandler operator_api.SetTenantLogsHandler
|
||||
// OperatorAPISetTenantMonitoringHandler sets the operation handler for the set tenant monitoring operation
|
||||
@@ -485,6 +540,9 @@ func (o *OperatorAPI) Validate() error {
|
||||
if o.OperatorAPIDescribePodHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.DescribePodHandler")
|
||||
}
|
||||
if o.OperatorAPIDirectPVFormatDriveHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.DirectPVFormatDriveHandler")
|
||||
}
|
||||
if o.OperatorAPIDisableTenantLoggingHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.DisableTenantLoggingHandler")
|
||||
}
|
||||
@@ -494,6 +552,15 @@ func (o *OperatorAPI) Validate() error {
|
||||
if o.OperatorAPIGetAllocatableResourcesHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetAllocatableResourcesHandler")
|
||||
}
|
||||
if o.OperatorAPIGetDirectPVDriveListHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetDirectPVDriveListHandler")
|
||||
}
|
||||
if o.OperatorAPIGetDirectPVVolumeListHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetDirectPVVolumeListHandler")
|
||||
}
|
||||
if o.OperatorAPIGetMPIntegrationHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetMPIntegrationHandler")
|
||||
}
|
||||
if o.OperatorAPIGetMaxAllocatableMemHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.GetMaxAllocatableMemHandler")
|
||||
}
|
||||
@@ -563,12 +630,33 @@ func (o *OperatorAPI) Validate() error {
|
||||
if o.AuthLogoutHandler == nil {
|
||||
unregistered = append(unregistered, "auth.LogoutHandler")
|
||||
}
|
||||
if o.OperatorAPIOperatorSubnetAPIKeyInfoHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.OperatorSubnetAPIKeyInfoHandler")
|
||||
}
|
||||
if o.OperatorAPIOperatorSubnetAPIKeyHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.OperatorSubnetAPIKeyHandler")
|
||||
}
|
||||
if o.OperatorAPIOperatorSubnetLoginHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.OperatorSubnetLoginHandler")
|
||||
}
|
||||
if o.OperatorAPIOperatorSubnetLoginMFAHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.OperatorSubnetLoginMFAHandler")
|
||||
}
|
||||
if o.OperatorAPIOperatorSubnetRegisterAPIKeyHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.OperatorSubnetRegisterAPIKeyHandler")
|
||||
}
|
||||
if o.OperatorAPIPostMPIntegrationHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.PostMPIntegrationHandler")
|
||||
}
|
||||
if o.OperatorAPIPutTenantYAMLHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.PutTenantYAMLHandler")
|
||||
}
|
||||
if o.AuthSessionCheckHandler == nil {
|
||||
unregistered = append(unregistered, "auth.SessionCheckHandler")
|
||||
}
|
||||
if o.OperatorAPISetTenantAdministratorsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.SetTenantAdministratorsHandler")
|
||||
}
|
||||
if o.OperatorAPISetTenantLogsHandler == nil {
|
||||
unregistered = append(unregistered, "operator_api.SetTenantLogsHandler")
|
||||
}
|
||||
@@ -755,6 +843,10 @@ func (o *OperatorAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/directpv/drives/format"] = operator_api.NewDirectPVFormatDrive(o.context, o.OperatorAPIDirectPVFormatDriveHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/disable-logging"] = operator_api.NewDisableTenantLogging(o.context, o.OperatorAPIDisableTenantLoggingHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
@@ -767,6 +859,18 @@ func (o *OperatorAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/directpv/drives"] = operator_api.NewGetDirectPVDriveList(o.context, o.OperatorAPIGetDirectPVDriveListHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/directpv/volumes"] = operator_api.NewGetDirectPVVolumeList(o.context, o.OperatorAPIGetDirectPVVolumeListHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/mp-integration"] = operator_api.NewGetMPIntegration(o.context, o.OperatorAPIGetMPIntegrationHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/cluster/max-allocatable-memory"] = operator_api.NewGetMaxAllocatableMem(o.context, o.OperatorAPIGetMaxAllocatableMemHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
@@ -856,6 +960,30 @@ func (o *OperatorAPI) initHandlerCache() {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/logout"] = auth.NewLogout(o.context, o.AuthLogoutHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/subnet/apikey/info"] = operator_api.NewOperatorSubnetAPIKeyInfo(o.context, o.OperatorAPIOperatorSubnetAPIKeyInfoHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/subnet/apikey"] = operator_api.NewOperatorSubnetAPIKey(o.context, o.OperatorAPIOperatorSubnetAPIKeyHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subnet/login"] = operator_api.NewOperatorSubnetLogin(o.context, o.OperatorAPIOperatorSubnetLoginHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subnet/login/mfa"] = operator_api.NewOperatorSubnetLoginMFA(o.context, o.OperatorAPIOperatorSubnetLoginMFAHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subnet/apikey/register"] = operator_api.NewOperatorSubnetRegisterAPIKey(o.context, o.OperatorAPIOperatorSubnetRegisterAPIKeyHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/mp-integration"] = operator_api.NewPostMPIntegration(o.context, o.OperatorAPIPostMPIntegrationHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -864,6 +992,10 @@ func (o *OperatorAPI) initHandlerCache() {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/session"] = auth.NewSessionCheck(o.context, o.AuthSessionCheckHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/set-administrators"] = operator_api.NewSetTenantAdministrators(o.context, o.OperatorAPISetTenantAdministratorsHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// DirectPVFormatDriveHandlerFunc turns a function with the right signature into a direct p v format drive handler
|
||||
type DirectPVFormatDriveHandlerFunc func(DirectPVFormatDriveParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn DirectPVFormatDriveHandlerFunc) Handle(params DirectPVFormatDriveParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// DirectPVFormatDriveHandler interface for that can handle valid direct p v format drive params
|
||||
type DirectPVFormatDriveHandler interface {
|
||||
Handle(DirectPVFormatDriveParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewDirectPVFormatDrive creates a new http.Handler for the direct p v format drive operation
|
||||
func NewDirectPVFormatDrive(ctx *middleware.Context, handler DirectPVFormatDriveHandler) *DirectPVFormatDrive {
|
||||
return &DirectPVFormatDrive{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* DirectPVFormatDrive swagger:route POST /directpv/drives/format OperatorAPI directPVFormatDrive
|
||||
|
||||
Format directpv drives from a list
|
||||
|
||||
*/
|
||||
type DirectPVFormatDrive struct {
|
||||
Context *middleware.Context
|
||||
Handler DirectPVFormatDriveHandler
|
||||
}
|
||||
|
||||
func (o *DirectPVFormatDrive) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewDirectPVFormatDriveParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewDirectPVFormatDriveParams creates a new DirectPVFormatDriveParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewDirectPVFormatDriveParams() DirectPVFormatDriveParams {
|
||||
|
||||
return DirectPVFormatDriveParams{}
|
||||
}
|
||||
|
||||
// DirectPVFormatDriveParams contains all the bound params for the direct p v format drive operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters DirectPVFormatDrive
|
||||
type DirectPVFormatDriveParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.FormatConfiguration
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewDirectPVFormatDriveParams() beforehand.
|
||||
func (o *DirectPVFormatDriveParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.FormatConfiguration
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(context.Background())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// DirectPVFormatDriveOKCode is the HTTP code returned for type DirectPVFormatDriveOK
|
||||
const DirectPVFormatDriveOKCode int = 200
|
||||
|
||||
/*DirectPVFormatDriveOK A successful response.
|
||||
|
||||
swagger:response directPVFormatDriveOK
|
||||
*/
|
||||
type DirectPVFormatDriveOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.FormatDirectPVDrivesResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDirectPVFormatDriveOK creates DirectPVFormatDriveOK with default headers values
|
||||
func NewDirectPVFormatDriveOK() *DirectPVFormatDriveOK {
|
||||
|
||||
return &DirectPVFormatDriveOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the direct p v format drive o k response
|
||||
func (o *DirectPVFormatDriveOK) WithPayload(payload *models.FormatDirectPVDrivesResponse) *DirectPVFormatDriveOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the direct p v format drive o k response
|
||||
func (o *DirectPVFormatDriveOK) SetPayload(payload *models.FormatDirectPVDrivesResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DirectPVFormatDriveOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*DirectPVFormatDriveDefault Generic error response.
|
||||
|
||||
swagger:response directPVFormatDriveDefault
|
||||
*/
|
||||
type DirectPVFormatDriveDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDirectPVFormatDriveDefault creates DirectPVFormatDriveDefault with default headers values
|
||||
func NewDirectPVFormatDriveDefault(code int) *DirectPVFormatDriveDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &DirectPVFormatDriveDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the direct p v format drive default response
|
||||
func (o *DirectPVFormatDriveDefault) WithStatusCode(code int) *DirectPVFormatDriveDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the direct p v format drive default response
|
||||
func (o *DirectPVFormatDriveDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the direct p v format drive default response
|
||||
func (o *DirectPVFormatDriveDefault) WithPayload(payload *models.Error) *DirectPVFormatDriveDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the direct p v format drive default response
|
||||
func (o *DirectPVFormatDriveDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DirectPVFormatDriveDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// DirectPVFormatDriveURL generates an URL for the direct p v format drive operation
|
||||
type DirectPVFormatDriveURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *DirectPVFormatDriveURL) WithBasePath(bp string) *DirectPVFormatDriveURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *DirectPVFormatDriveURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *DirectPVFormatDriveURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/directpv/drives/format"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *DirectPVFormatDriveURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *DirectPVFormatDriveURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *DirectPVFormatDriveURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on DirectPVFormatDriveURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on DirectPVFormatDriveURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *DirectPVFormatDriveURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// GetDirectPVDriveListHandlerFunc turns a function with the right signature into a get direct p v drive list handler
|
||||
type GetDirectPVDriveListHandlerFunc func(GetDirectPVDriveListParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GetDirectPVDriveListHandlerFunc) Handle(params GetDirectPVDriveListParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// GetDirectPVDriveListHandler interface for that can handle valid get direct p v drive list params
|
||||
type GetDirectPVDriveListHandler interface {
|
||||
Handle(GetDirectPVDriveListParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGetDirectPVDriveList creates a new http.Handler for the get direct p v drive list operation
|
||||
func NewGetDirectPVDriveList(ctx *middleware.Context, handler GetDirectPVDriveListHandler) *GetDirectPVDriveList {
|
||||
return &GetDirectPVDriveList{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetDirectPVDriveList swagger:route GET /directpv/drives OperatorAPI getDirectPVDriveList
|
||||
|
||||
Get directpv drives list
|
||||
|
||||
*/
|
||||
type GetDirectPVDriveList struct {
|
||||
Context *middleware.Context
|
||||
Handler GetDirectPVDriveListHandler
|
||||
}
|
||||
|
||||
func (o *GetDirectPVDriveList) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewGetDirectPVDriveListParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetDirectPVDriveListParams creates a new GetDirectPVDriveListParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewGetDirectPVDriveListParams() GetDirectPVDriveListParams {
|
||||
|
||||
return GetDirectPVDriveListParams{}
|
||||
}
|
||||
|
||||
// GetDirectPVDriveListParams contains all the bound params for the get direct p v drive list operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters GetDirectPVDriveList
|
||||
type GetDirectPVDriveListParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Drives *string
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Nodes *string
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewGetDirectPVDriveListParams() beforehand.
|
||||
func (o *GetDirectPVDriveListParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qDrives, qhkDrives, _ := qs.GetOK("drives")
|
||||
if err := o.bindDrives(qDrives, qhkDrives, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qNodes, qhkNodes, _ := qs.GetOK("nodes")
|
||||
if err := o.bindNodes(qNodes, qhkNodes, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindDrives binds and validates parameter Drives from query.
|
||||
func (o *GetDirectPVDriveListParams) bindDrives(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
o.Drives = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindNodes binds and validates parameter Nodes from query.
|
||||
func (o *GetDirectPVDriveListParams) bindNodes(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
o.Nodes = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// GetDirectPVDriveListOKCode is the HTTP code returned for type GetDirectPVDriveListOK
|
||||
const GetDirectPVDriveListOKCode int = 200
|
||||
|
||||
/*GetDirectPVDriveListOK A successful response.
|
||||
|
||||
swagger:response getDirectPVDriveListOK
|
||||
*/
|
||||
type GetDirectPVDriveListOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.GetDirectPVDriveListResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDirectPVDriveListOK creates GetDirectPVDriveListOK with default headers values
|
||||
func NewGetDirectPVDriveListOK() *GetDirectPVDriveListOK {
|
||||
|
||||
return &GetDirectPVDriveListOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get direct p v drive list o k response
|
||||
func (o *GetDirectPVDriveListOK) WithPayload(payload *models.GetDirectPVDriveListResponse) *GetDirectPVDriveListOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get direct p v drive list o k response
|
||||
func (o *GetDirectPVDriveListOK) SetPayload(payload *models.GetDirectPVDriveListResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDirectPVDriveListOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetDirectPVDriveListDefault Generic error response.
|
||||
|
||||
swagger:response getDirectPVDriveListDefault
|
||||
*/
|
||||
type GetDirectPVDriveListDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDirectPVDriveListDefault creates GetDirectPVDriveListDefault with default headers values
|
||||
func NewGetDirectPVDriveListDefault(code int) *GetDirectPVDriveListDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &GetDirectPVDriveListDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the get direct p v drive list default response
|
||||
func (o *GetDirectPVDriveListDefault) WithStatusCode(code int) *GetDirectPVDriveListDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the get direct p v drive list default response
|
||||
func (o *GetDirectPVDriveListDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get direct p v drive list default response
|
||||
func (o *GetDirectPVDriveListDefault) WithPayload(payload *models.Error) *GetDirectPVDriveListDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get direct p v drive list default response
|
||||
func (o *GetDirectPVDriveListDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDirectPVDriveListDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// GetDirectPVDriveListURL generates an URL for the get direct p v drive list operation
|
||||
type GetDirectPVDriveListURL struct {
|
||||
Drives *string
|
||||
Nodes *string
|
||||
|
||||
_basePath string
|
||||
// avoid unkeyed usage
|
||||
_ struct{}
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *GetDirectPVDriveListURL) WithBasePath(bp string) *GetDirectPVDriveListURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *GetDirectPVDriveListURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *GetDirectPVDriveListURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/directpv/drives"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
var drivesQ string
|
||||
if o.Drives != nil {
|
||||
drivesQ = *o.Drives
|
||||
}
|
||||
if drivesQ != "" {
|
||||
qs.Set("drives", drivesQ)
|
||||
}
|
||||
|
||||
var nodesQ string
|
||||
if o.Nodes != nil {
|
||||
nodesQ = *o.Nodes
|
||||
}
|
||||
if nodesQ != "" {
|
||||
qs.Set("nodes", nodesQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *GetDirectPVDriveListURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *GetDirectPVDriveListURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *GetDirectPVDriveListURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on GetDirectPVDriveListURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on GetDirectPVDriveListURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *GetDirectPVDriveListURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// GetDirectPVVolumeListHandlerFunc turns a function with the right signature into a get direct p v volume list handler
|
||||
type GetDirectPVVolumeListHandlerFunc func(GetDirectPVVolumeListParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GetDirectPVVolumeListHandlerFunc) Handle(params GetDirectPVVolumeListParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// GetDirectPVVolumeListHandler interface for that can handle valid get direct p v volume list params
|
||||
type GetDirectPVVolumeListHandler interface {
|
||||
Handle(GetDirectPVVolumeListParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGetDirectPVVolumeList creates a new http.Handler for the get direct p v volume list operation
|
||||
func NewGetDirectPVVolumeList(ctx *middleware.Context, handler GetDirectPVVolumeListHandler) *GetDirectPVVolumeList {
|
||||
return &GetDirectPVVolumeList{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetDirectPVVolumeList swagger:route GET /directpv/volumes OperatorAPI getDirectPVVolumeList
|
||||
|
||||
Get directpv volumes list
|
||||
|
||||
*/
|
||||
type GetDirectPVVolumeList struct {
|
||||
Context *middleware.Context
|
||||
Handler GetDirectPVVolumeListHandler
|
||||
}
|
||||
|
||||
func (o *GetDirectPVVolumeList) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewGetDirectPVVolumeListParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetDirectPVVolumeListParams creates a new GetDirectPVVolumeListParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewGetDirectPVVolumeListParams() GetDirectPVVolumeListParams {
|
||||
|
||||
return GetDirectPVVolumeListParams{}
|
||||
}
|
||||
|
||||
// GetDirectPVVolumeListParams contains all the bound params for the get direct p v volume list operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters GetDirectPVVolumeList
|
||||
type GetDirectPVVolumeListParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Drives *string
|
||||
/*
|
||||
In: query
|
||||
*/
|
||||
Nodes *string
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewGetDirectPVVolumeListParams() beforehand.
|
||||
func (o *GetDirectPVVolumeListParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qDrives, qhkDrives, _ := qs.GetOK("drives")
|
||||
if err := o.bindDrives(qDrives, qhkDrives, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qNodes, qhkNodes, _ := qs.GetOK("nodes")
|
||||
if err := o.bindNodes(qNodes, qhkNodes, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindDrives binds and validates parameter Drives from query.
|
||||
func (o *GetDirectPVVolumeListParams) bindDrives(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
o.Drives = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindNodes binds and validates parameter Nodes from query.
|
||||
func (o *GetDirectPVVolumeListParams) bindNodes(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: false
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if raw == "" { // empty values pass all other validations
|
||||
return nil
|
||||
}
|
||||
o.Nodes = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// GetDirectPVVolumeListOKCode is the HTTP code returned for type GetDirectPVVolumeListOK
|
||||
const GetDirectPVVolumeListOKCode int = 200
|
||||
|
||||
/*GetDirectPVVolumeListOK A successful response.
|
||||
|
||||
swagger:response getDirectPVVolumeListOK
|
||||
*/
|
||||
type GetDirectPVVolumeListOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.GetDirectPVVolumeListResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDirectPVVolumeListOK creates GetDirectPVVolumeListOK with default headers values
|
||||
func NewGetDirectPVVolumeListOK() *GetDirectPVVolumeListOK {
|
||||
|
||||
return &GetDirectPVVolumeListOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get direct p v volume list o k response
|
||||
func (o *GetDirectPVVolumeListOK) WithPayload(payload *models.GetDirectPVVolumeListResponse) *GetDirectPVVolumeListOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get direct p v volume list o k response
|
||||
func (o *GetDirectPVVolumeListOK) SetPayload(payload *models.GetDirectPVVolumeListResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDirectPVVolumeListOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetDirectPVVolumeListDefault Generic error response.
|
||||
|
||||
swagger:response getDirectPVVolumeListDefault
|
||||
*/
|
||||
type GetDirectPVVolumeListDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDirectPVVolumeListDefault creates GetDirectPVVolumeListDefault with default headers values
|
||||
func NewGetDirectPVVolumeListDefault(code int) *GetDirectPVVolumeListDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &GetDirectPVVolumeListDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the get direct p v volume list default response
|
||||
func (o *GetDirectPVVolumeListDefault) WithStatusCode(code int) *GetDirectPVVolumeListDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the get direct p v volume list default response
|
||||
func (o *GetDirectPVVolumeListDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get direct p v volume list default response
|
||||
func (o *GetDirectPVVolumeListDefault) WithPayload(payload *models.Error) *GetDirectPVVolumeListDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get direct p v volume list default response
|
||||
func (o *GetDirectPVVolumeListDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDirectPVVolumeListDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// GetDirectPVVolumeListURL generates an URL for the get direct p v volume list operation
|
||||
type GetDirectPVVolumeListURL struct {
|
||||
Drives *string
|
||||
Nodes *string
|
||||
|
||||
_basePath string
|
||||
// avoid unkeyed usage
|
||||
_ struct{}
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *GetDirectPVVolumeListURL) WithBasePath(bp string) *GetDirectPVVolumeListURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *GetDirectPVVolumeListURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *GetDirectPVVolumeListURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/directpv/volumes"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
var drivesQ string
|
||||
if o.Drives != nil {
|
||||
drivesQ = *o.Drives
|
||||
}
|
||||
if drivesQ != "" {
|
||||
qs.Set("drives", drivesQ)
|
||||
}
|
||||
|
||||
var nodesQ string
|
||||
if o.Nodes != nil {
|
||||
nodesQ = *o.Nodes
|
||||
}
|
||||
if nodesQ != "" {
|
||||
qs.Set("nodes", nodesQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *GetDirectPVVolumeListURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *GetDirectPVVolumeListURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *GetDirectPVVolumeListURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on GetDirectPVVolumeListURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on GetDirectPVVolumeListURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *GetDirectPVVolumeListURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
128
operatorapi/operations/operator_api/get_m_p_integration.go
Normal file
128
operatorapi/operations/operator_api/get_m_p_integration.go
Normal file
@@ -0,0 +1,128 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// GetMPIntegrationHandlerFunc turns a function with the right signature into a get m p integration handler
|
||||
type GetMPIntegrationHandlerFunc func(GetMPIntegrationParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GetMPIntegrationHandlerFunc) Handle(params GetMPIntegrationParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// GetMPIntegrationHandler interface for that can handle valid get m p integration params
|
||||
type GetMPIntegrationHandler interface {
|
||||
Handle(GetMPIntegrationParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGetMPIntegration creates a new http.Handler for the get m p integration operation
|
||||
func NewGetMPIntegration(ctx *middleware.Context, handler GetMPIntegrationHandler) *GetMPIntegration {
|
||||
return &GetMPIntegration{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetMPIntegration swagger:route GET /mp-integration OperatorAPI getMPIntegration
|
||||
|
||||
Returns email registered for marketplace integration
|
||||
|
||||
*/
|
||||
type GetMPIntegration struct {
|
||||
Context *middleware.Context
|
||||
Handler GetMPIntegrationHandler
|
||||
}
|
||||
|
||||
func (o *GetMPIntegration) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewGetMPIntegrationParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
|
||||
// GetMPIntegrationOKBody get m p integration o k body
|
||||
//
|
||||
// swagger:model GetMPIntegrationOKBody
|
||||
type GetMPIntegrationOKBody struct {
|
||||
|
||||
// is email set
|
||||
IsEmailSet bool `json:"isEmailSet,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this get m p integration o k body
|
||||
func (o *GetMPIntegrationOKBody) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this get m p integration o k body based on context it is used
|
||||
func (o *GetMPIntegrationOKBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (o *GetMPIntegrationOKBody) MarshalBinary() ([]byte, error) {
|
||||
if o == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(o)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (o *GetMPIntegrationOKBody) UnmarshalBinary(b []byte) error {
|
||||
var res GetMPIntegrationOKBody
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*o = res
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// NewGetMPIntegrationParams creates a new GetMPIntegrationParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewGetMPIntegrationParams() GetMPIntegrationParams {
|
||||
|
||||
return GetMPIntegrationParams{}
|
||||
}
|
||||
|
||||
// GetMPIntegrationParams contains all the bound params for the get m p integration operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters GetMPIntegration
|
||||
type GetMPIntegrationParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewGetMPIntegrationParams() beforehand.
|
||||
func (o *GetMPIntegrationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// GetMPIntegrationOKCode is the HTTP code returned for type GetMPIntegrationOK
|
||||
const GetMPIntegrationOKCode int = 200
|
||||
|
||||
/*GetMPIntegrationOK A successful response.
|
||||
|
||||
swagger:response getMPIntegrationOK
|
||||
*/
|
||||
type GetMPIntegrationOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *GetMPIntegrationOKBody `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetMPIntegrationOK creates GetMPIntegrationOK with default headers values
|
||||
func NewGetMPIntegrationOK() *GetMPIntegrationOK {
|
||||
|
||||
return &GetMPIntegrationOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get m p integration o k response
|
||||
func (o *GetMPIntegrationOK) WithPayload(payload *GetMPIntegrationOKBody) *GetMPIntegrationOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get m p integration o k response
|
||||
func (o *GetMPIntegrationOK) SetPayload(payload *GetMPIntegrationOKBody) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetMPIntegrationOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetMPIntegrationDefault Generic error response.
|
||||
|
||||
swagger:response getMPIntegrationDefault
|
||||
*/
|
||||
type GetMPIntegrationDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetMPIntegrationDefault creates GetMPIntegrationDefault with default headers values
|
||||
func NewGetMPIntegrationDefault(code int) *GetMPIntegrationDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &GetMPIntegrationDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the get m p integration default response
|
||||
func (o *GetMPIntegrationDefault) WithStatusCode(code int) *GetMPIntegrationDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the get m p integration default response
|
||||
func (o *GetMPIntegrationDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get m p integration default response
|
||||
func (o *GetMPIntegrationDefault) WithPayload(payload *models.Error) *GetMPIntegrationDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get m p integration default response
|
||||
func (o *GetMPIntegrationDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetMPIntegrationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// GetMPIntegrationURL generates an URL for the get m p integration operation
|
||||
type GetMPIntegrationURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *GetMPIntegrationURL) WithBasePath(bp string) *GetMPIntegrationURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *GetMPIntegrationURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *GetMPIntegrationURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/mp-integration"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *GetMPIntegrationURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *GetMPIntegrationURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *GetMPIntegrationURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on GetMPIntegrationURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on GetMPIntegrationURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *GetMPIntegrationURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -42,7 +42,7 @@ type ListTenantCertificateSigningRequestOK struct {
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.CsrElement `json:"body,omitempty"`
|
||||
Payload *models.CsrElements `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewListTenantCertificateSigningRequestOK creates ListTenantCertificateSigningRequestOK with default headers values
|
||||
@@ -52,13 +52,13 @@ func NewListTenantCertificateSigningRequestOK() *ListTenantCertificateSigningReq
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the list tenant certificate signing request o k response
|
||||
func (o *ListTenantCertificateSigningRequestOK) WithPayload(payload *models.CsrElement) *ListTenantCertificateSigningRequestOK {
|
||||
func (o *ListTenantCertificateSigningRequestOK) WithPayload(payload *models.CsrElements) *ListTenantCertificateSigningRequestOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the list tenant certificate signing request o k response
|
||||
func (o *ListTenantCertificateSigningRequestOK) SetPayload(payload *models.CsrElement) {
|
||||
func (o *ListTenantCertificateSigningRequestOK) SetPayload(payload *models.CsrElements) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// OperatorSubnetAPIKeyHandlerFunc turns a function with the right signature into a operator subnet Api key handler
|
||||
type OperatorSubnetAPIKeyHandlerFunc func(OperatorSubnetAPIKeyParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn OperatorSubnetAPIKeyHandlerFunc) Handle(params OperatorSubnetAPIKeyParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// OperatorSubnetAPIKeyHandler interface for that can handle valid operator subnet Api key params
|
||||
type OperatorSubnetAPIKeyHandler interface {
|
||||
Handle(OperatorSubnetAPIKeyParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewOperatorSubnetAPIKey creates a new http.Handler for the operator subnet Api key operation
|
||||
func NewOperatorSubnetAPIKey(ctx *middleware.Context, handler OperatorSubnetAPIKeyHandler) *OperatorSubnetAPIKey {
|
||||
return &OperatorSubnetAPIKey{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* OperatorSubnetAPIKey swagger:route GET /subnet/apikey OperatorAPI operatorSubnetApiKey
|
||||
|
||||
Subnet api key
|
||||
|
||||
*/
|
||||
type OperatorSubnetAPIKey struct {
|
||||
Context *middleware.Context
|
||||
Handler OperatorSubnetAPIKeyHandler
|
||||
}
|
||||
|
||||
func (o *OperatorSubnetAPIKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewOperatorSubnetAPIKeyParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// OperatorSubnetAPIKeyInfoHandlerFunc turns a function with the right signature into a operator subnet API key info handler
|
||||
type OperatorSubnetAPIKeyInfoHandlerFunc func(OperatorSubnetAPIKeyInfoParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn OperatorSubnetAPIKeyInfoHandlerFunc) Handle(params OperatorSubnetAPIKeyInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// OperatorSubnetAPIKeyInfoHandler interface for that can handle valid operator subnet API key info params
|
||||
type OperatorSubnetAPIKeyInfoHandler interface {
|
||||
Handle(OperatorSubnetAPIKeyInfoParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewOperatorSubnetAPIKeyInfo creates a new http.Handler for the operator subnet API key info operation
|
||||
func NewOperatorSubnetAPIKeyInfo(ctx *middleware.Context, handler OperatorSubnetAPIKeyInfoHandler) *OperatorSubnetAPIKeyInfo {
|
||||
return &OperatorSubnetAPIKeyInfo{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* OperatorSubnetAPIKeyInfo swagger:route GET /subnet/apikey/info OperatorAPI operatorSubnetApiKeyInfo
|
||||
|
||||
Subnet API key info
|
||||
|
||||
*/
|
||||
type OperatorSubnetAPIKeyInfo struct {
|
||||
Context *middleware.Context
|
||||
Handler OperatorSubnetAPIKeyInfoHandler
|
||||
}
|
||||
|
||||
func (o *OperatorSubnetAPIKeyInfo) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewOperatorSubnetAPIKeyInfoParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// NewOperatorSubnetAPIKeyInfoParams creates a new OperatorSubnetAPIKeyInfoParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewOperatorSubnetAPIKeyInfoParams() OperatorSubnetAPIKeyInfoParams {
|
||||
|
||||
return OperatorSubnetAPIKeyInfoParams{}
|
||||
}
|
||||
|
||||
// OperatorSubnetAPIKeyInfoParams contains all the bound params for the operator subnet API key info operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters OperatorSubnetAPIKeyInfo
|
||||
type OperatorSubnetAPIKeyInfoParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewOperatorSubnetAPIKeyInfoParams() beforehand.
|
||||
func (o *OperatorSubnetAPIKeyInfoParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// OperatorSubnetAPIKeyInfoOKCode is the HTTP code returned for type OperatorSubnetAPIKeyInfoOK
|
||||
const OperatorSubnetAPIKeyInfoOKCode int = 200
|
||||
|
||||
/*OperatorSubnetAPIKeyInfoOK A successful response.
|
||||
|
||||
swagger:response operatorSubnetApiKeyInfoOK
|
||||
*/
|
||||
type OperatorSubnetAPIKeyInfoOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.OperatorSubnetRegisterAPIKeyResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewOperatorSubnetAPIKeyInfoOK creates OperatorSubnetAPIKeyInfoOK with default headers values
|
||||
func NewOperatorSubnetAPIKeyInfoOK() *OperatorSubnetAPIKeyInfoOK {
|
||||
|
||||
return &OperatorSubnetAPIKeyInfoOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the operator subnet Api key info o k response
|
||||
func (o *OperatorSubnetAPIKeyInfoOK) WithPayload(payload *models.OperatorSubnetRegisterAPIKeyResponse) *OperatorSubnetAPIKeyInfoOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the operator subnet Api key info o k response
|
||||
func (o *OperatorSubnetAPIKeyInfoOK) SetPayload(payload *models.OperatorSubnetRegisterAPIKeyResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *OperatorSubnetAPIKeyInfoOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*OperatorSubnetAPIKeyInfoDefault Generic error response.
|
||||
|
||||
swagger:response operatorSubnetApiKeyInfoDefault
|
||||
*/
|
||||
type OperatorSubnetAPIKeyInfoDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewOperatorSubnetAPIKeyInfoDefault creates OperatorSubnetAPIKeyInfoDefault with default headers values
|
||||
func NewOperatorSubnetAPIKeyInfoDefault(code int) *OperatorSubnetAPIKeyInfoDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &OperatorSubnetAPIKeyInfoDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the operator subnet API key info default response
|
||||
func (o *OperatorSubnetAPIKeyInfoDefault) WithStatusCode(code int) *OperatorSubnetAPIKeyInfoDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the operator subnet API key info default response
|
||||
func (o *OperatorSubnetAPIKeyInfoDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the operator subnet API key info default response
|
||||
func (o *OperatorSubnetAPIKeyInfoDefault) WithPayload(payload *models.Error) *OperatorSubnetAPIKeyInfoDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the operator subnet API key info default response
|
||||
func (o *OperatorSubnetAPIKeyInfoDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *OperatorSubnetAPIKeyInfoDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// OperatorSubnetAPIKeyInfoURL generates an URL for the operator subnet API key info operation
|
||||
type OperatorSubnetAPIKeyInfoURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *OperatorSubnetAPIKeyInfoURL) WithBasePath(bp string) *OperatorSubnetAPIKeyInfoURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *OperatorSubnetAPIKeyInfoURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *OperatorSubnetAPIKeyInfoURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subnet/apikey/info"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *OperatorSubnetAPIKeyInfoURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *OperatorSubnetAPIKeyInfoURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *OperatorSubnetAPIKeyInfoURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on OperatorSubnetAPIKeyInfoURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on OperatorSubnetAPIKeyInfoURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *OperatorSubnetAPIKeyInfoURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewOperatorSubnetAPIKeyParams creates a new OperatorSubnetAPIKeyParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewOperatorSubnetAPIKeyParams() OperatorSubnetAPIKeyParams {
|
||||
|
||||
return OperatorSubnetAPIKeyParams{}
|
||||
}
|
||||
|
||||
// OperatorSubnetAPIKeyParams contains all the bound params for the operator subnet Api key operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters OperatorSubnetApiKey
|
||||
type OperatorSubnetAPIKeyParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: query
|
||||
*/
|
||||
Token string
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewOperatorSubnetAPIKeyParams() beforehand.
|
||||
func (o *OperatorSubnetAPIKeyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qToken, qhkToken, _ := qs.GetOK("token")
|
||||
if err := o.bindToken(qToken, qhkToken, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindToken binds and validates parameter Token from query.
|
||||
func (o *OperatorSubnetAPIKeyParams) bindToken(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("token", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("token", "query", raw); err != nil {
|
||||
return err
|
||||
}
|
||||
o.Token = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// OperatorSubnetAPIKeyOKCode is the HTTP code returned for type OperatorSubnetAPIKeyOK
|
||||
const OperatorSubnetAPIKeyOKCode int = 200
|
||||
|
||||
/*OperatorSubnetAPIKeyOK A successful response.
|
||||
|
||||
swagger:response operatorSubnetApiKeyOK
|
||||
*/
|
||||
type OperatorSubnetAPIKeyOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.OperatorSubnetAPIKey `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewOperatorSubnetAPIKeyOK creates OperatorSubnetAPIKeyOK with default headers values
|
||||
func NewOperatorSubnetAPIKeyOK() *OperatorSubnetAPIKeyOK {
|
||||
|
||||
return &OperatorSubnetAPIKeyOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the operator subnet Api key o k response
|
||||
func (o *OperatorSubnetAPIKeyOK) WithPayload(payload *models.OperatorSubnetAPIKey) *OperatorSubnetAPIKeyOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the operator subnet Api key o k response
|
||||
func (o *OperatorSubnetAPIKeyOK) SetPayload(payload *models.OperatorSubnetAPIKey) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *OperatorSubnetAPIKeyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*OperatorSubnetAPIKeyDefault Generic error response.
|
||||
|
||||
swagger:response operatorSubnetApiKeyDefault
|
||||
*/
|
||||
type OperatorSubnetAPIKeyDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewOperatorSubnetAPIKeyDefault creates OperatorSubnetAPIKeyDefault with default headers values
|
||||
func NewOperatorSubnetAPIKeyDefault(code int) *OperatorSubnetAPIKeyDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &OperatorSubnetAPIKeyDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the operator subnet Api key default response
|
||||
func (o *OperatorSubnetAPIKeyDefault) WithStatusCode(code int) *OperatorSubnetAPIKeyDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the operator subnet Api key default response
|
||||
func (o *OperatorSubnetAPIKeyDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the operator subnet Api key default response
|
||||
func (o *OperatorSubnetAPIKeyDefault) WithPayload(payload *models.Error) *OperatorSubnetAPIKeyDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the operator subnet Api key default response
|
||||
func (o *OperatorSubnetAPIKeyDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *OperatorSubnetAPIKeyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// OperatorSubnetAPIKeyURL generates an URL for the operator subnet Api key operation
|
||||
type OperatorSubnetAPIKeyURL struct {
|
||||
Token string
|
||||
|
||||
_basePath string
|
||||
// avoid unkeyed usage
|
||||
_ struct{}
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *OperatorSubnetAPIKeyURL) WithBasePath(bp string) *OperatorSubnetAPIKeyURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *OperatorSubnetAPIKeyURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *OperatorSubnetAPIKeyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subnet/apikey"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
tokenQ := o.Token
|
||||
if tokenQ != "" {
|
||||
qs.Set("token", tokenQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *OperatorSubnetAPIKeyURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *OperatorSubnetAPIKeyURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *OperatorSubnetAPIKeyURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on OperatorSubnetAPIKeyURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on OperatorSubnetAPIKeyURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *OperatorSubnetAPIKeyURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
88
operatorapi/operations/operator_api/operator_subnet_login.go
Normal file
88
operatorapi/operations/operator_api/operator_subnet_login.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginHandlerFunc turns a function with the right signature into a operator subnet login handler
|
||||
type OperatorSubnetLoginHandlerFunc func(OperatorSubnetLoginParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn OperatorSubnetLoginHandlerFunc) Handle(params OperatorSubnetLoginParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// OperatorSubnetLoginHandler interface for that can handle valid operator subnet login params
|
||||
type OperatorSubnetLoginHandler interface {
|
||||
Handle(OperatorSubnetLoginParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewOperatorSubnetLogin creates a new http.Handler for the operator subnet login operation
|
||||
func NewOperatorSubnetLogin(ctx *middleware.Context, handler OperatorSubnetLoginHandler) *OperatorSubnetLogin {
|
||||
return &OperatorSubnetLogin{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* OperatorSubnetLogin swagger:route POST /subnet/login OperatorAPI operatorSubnetLogin
|
||||
|
||||
Login to subnet
|
||||
|
||||
*/
|
||||
type OperatorSubnetLogin struct {
|
||||
Context *middleware.Context
|
||||
Handler OperatorSubnetLoginHandler
|
||||
}
|
||||
|
||||
func (o *OperatorSubnetLogin) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewOperatorSubnetLoginParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginMFAHandlerFunc turns a function with the right signature into a operator subnet login m f a handler
|
||||
type OperatorSubnetLoginMFAHandlerFunc func(OperatorSubnetLoginMFAParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn OperatorSubnetLoginMFAHandlerFunc) Handle(params OperatorSubnetLoginMFAParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// OperatorSubnetLoginMFAHandler interface for that can handle valid operator subnet login m f a params
|
||||
type OperatorSubnetLoginMFAHandler interface {
|
||||
Handle(OperatorSubnetLoginMFAParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewOperatorSubnetLoginMFA creates a new http.Handler for the operator subnet login m f a operation
|
||||
func NewOperatorSubnetLoginMFA(ctx *middleware.Context, handler OperatorSubnetLoginMFAHandler) *OperatorSubnetLoginMFA {
|
||||
return &OperatorSubnetLoginMFA{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* OperatorSubnetLoginMFA swagger:route POST /subnet/login/mfa OperatorAPI operatorSubnetLoginMFA
|
||||
|
||||
Login to subnet using mfa
|
||||
|
||||
*/
|
||||
type OperatorSubnetLoginMFA struct {
|
||||
Context *middleware.Context
|
||||
Handler OperatorSubnetLoginMFAHandler
|
||||
}
|
||||
|
||||
func (o *OperatorSubnetLoginMFA) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewOperatorSubnetLoginMFAParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewOperatorSubnetLoginMFAParams creates a new OperatorSubnetLoginMFAParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewOperatorSubnetLoginMFAParams() OperatorSubnetLoginMFAParams {
|
||||
|
||||
return OperatorSubnetLoginMFAParams{}
|
||||
}
|
||||
|
||||
// OperatorSubnetLoginMFAParams contains all the bound params for the operator subnet login m f a operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters OperatorSubnetLoginMFA
|
||||
type OperatorSubnetLoginMFAParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.OperatorSubnetLoginMFARequest
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewOperatorSubnetLoginMFAParams() beforehand.
|
||||
func (o *OperatorSubnetLoginMFAParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.OperatorSubnetLoginMFARequest
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(context.Background())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginMFAOKCode is the HTTP code returned for type OperatorSubnetLoginMFAOK
|
||||
const OperatorSubnetLoginMFAOKCode int = 200
|
||||
|
||||
/*OperatorSubnetLoginMFAOK A successful response.
|
||||
|
||||
swagger:response operatorSubnetLoginMFAOK
|
||||
*/
|
||||
type OperatorSubnetLoginMFAOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.OperatorSubnetLoginResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewOperatorSubnetLoginMFAOK creates OperatorSubnetLoginMFAOK with default headers values
|
||||
func NewOperatorSubnetLoginMFAOK() *OperatorSubnetLoginMFAOK {
|
||||
|
||||
return &OperatorSubnetLoginMFAOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the operator subnet login m f a o k response
|
||||
func (o *OperatorSubnetLoginMFAOK) WithPayload(payload *models.OperatorSubnetLoginResponse) *OperatorSubnetLoginMFAOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the operator subnet login m f a o k response
|
||||
func (o *OperatorSubnetLoginMFAOK) SetPayload(payload *models.OperatorSubnetLoginResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *OperatorSubnetLoginMFAOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*OperatorSubnetLoginMFADefault Generic error response.
|
||||
|
||||
swagger:response operatorSubnetLoginMFADefault
|
||||
*/
|
||||
type OperatorSubnetLoginMFADefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewOperatorSubnetLoginMFADefault creates OperatorSubnetLoginMFADefault with default headers values
|
||||
func NewOperatorSubnetLoginMFADefault(code int) *OperatorSubnetLoginMFADefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &OperatorSubnetLoginMFADefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the operator subnet login m f a default response
|
||||
func (o *OperatorSubnetLoginMFADefault) WithStatusCode(code int) *OperatorSubnetLoginMFADefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the operator subnet login m f a default response
|
||||
func (o *OperatorSubnetLoginMFADefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the operator subnet login m f a default response
|
||||
func (o *OperatorSubnetLoginMFADefault) WithPayload(payload *models.Error) *OperatorSubnetLoginMFADefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the operator subnet login m f a default response
|
||||
func (o *OperatorSubnetLoginMFADefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *OperatorSubnetLoginMFADefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginMFAURL generates an URL for the operator subnet login m f a operation
|
||||
type OperatorSubnetLoginMFAURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *OperatorSubnetLoginMFAURL) WithBasePath(bp string) *OperatorSubnetLoginMFAURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *OperatorSubnetLoginMFAURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *OperatorSubnetLoginMFAURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subnet/login/mfa"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *OperatorSubnetLoginMFAURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *OperatorSubnetLoginMFAURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *OperatorSubnetLoginMFAURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on OperatorSubnetLoginMFAURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on OperatorSubnetLoginMFAURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *OperatorSubnetLoginMFAURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewOperatorSubnetLoginParams creates a new OperatorSubnetLoginParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewOperatorSubnetLoginParams() OperatorSubnetLoginParams {
|
||||
|
||||
return OperatorSubnetLoginParams{}
|
||||
}
|
||||
|
||||
// OperatorSubnetLoginParams contains all the bound params for the operator subnet login operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters OperatorSubnetLogin
|
||||
type OperatorSubnetLoginParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.OperatorSubnetLoginRequest
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewOperatorSubnetLoginParams() beforehand.
|
||||
func (o *OperatorSubnetLoginParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.OperatorSubnetLoginRequest
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(context.Background())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginOKCode is the HTTP code returned for type OperatorSubnetLoginOK
|
||||
const OperatorSubnetLoginOKCode int = 200
|
||||
|
||||
/*OperatorSubnetLoginOK A successful response.
|
||||
|
||||
swagger:response operatorSubnetLoginOK
|
||||
*/
|
||||
type OperatorSubnetLoginOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.OperatorSubnetLoginResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewOperatorSubnetLoginOK creates OperatorSubnetLoginOK with default headers values
|
||||
func NewOperatorSubnetLoginOK() *OperatorSubnetLoginOK {
|
||||
|
||||
return &OperatorSubnetLoginOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the operator subnet login o k response
|
||||
func (o *OperatorSubnetLoginOK) WithPayload(payload *models.OperatorSubnetLoginResponse) *OperatorSubnetLoginOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the operator subnet login o k response
|
||||
func (o *OperatorSubnetLoginOK) SetPayload(payload *models.OperatorSubnetLoginResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *OperatorSubnetLoginOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*OperatorSubnetLoginDefault Generic error response.
|
||||
|
||||
swagger:response operatorSubnetLoginDefault
|
||||
*/
|
||||
type OperatorSubnetLoginDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewOperatorSubnetLoginDefault creates OperatorSubnetLoginDefault with default headers values
|
||||
func NewOperatorSubnetLoginDefault(code int) *OperatorSubnetLoginDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &OperatorSubnetLoginDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the operator subnet login default response
|
||||
func (o *OperatorSubnetLoginDefault) WithStatusCode(code int) *OperatorSubnetLoginDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the operator subnet login default response
|
||||
func (o *OperatorSubnetLoginDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the operator subnet login default response
|
||||
func (o *OperatorSubnetLoginDefault) WithPayload(payload *models.Error) *OperatorSubnetLoginDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the operator subnet login default response
|
||||
func (o *OperatorSubnetLoginDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *OperatorSubnetLoginDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// OperatorSubnetLoginURL generates an URL for the operator subnet login operation
|
||||
type OperatorSubnetLoginURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *OperatorSubnetLoginURL) WithBasePath(bp string) *OperatorSubnetLoginURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *OperatorSubnetLoginURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *OperatorSubnetLoginURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subnet/login"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *OperatorSubnetLoginURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *OperatorSubnetLoginURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *OperatorSubnetLoginURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on OperatorSubnetLoginURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on OperatorSubnetLoginURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *OperatorSubnetLoginURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// OperatorSubnetRegisterAPIKeyHandlerFunc turns a function with the right signature into a operator subnet register API key handler
|
||||
type OperatorSubnetRegisterAPIKeyHandlerFunc func(OperatorSubnetRegisterAPIKeyParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn OperatorSubnetRegisterAPIKeyHandlerFunc) Handle(params OperatorSubnetRegisterAPIKeyParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// OperatorSubnetRegisterAPIKeyHandler interface for that can handle valid operator subnet register API key params
|
||||
type OperatorSubnetRegisterAPIKeyHandler interface {
|
||||
Handle(OperatorSubnetRegisterAPIKeyParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewOperatorSubnetRegisterAPIKey creates a new http.Handler for the operator subnet register API key operation
|
||||
func NewOperatorSubnetRegisterAPIKey(ctx *middleware.Context, handler OperatorSubnetRegisterAPIKeyHandler) *OperatorSubnetRegisterAPIKey {
|
||||
return &OperatorSubnetRegisterAPIKey{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* OperatorSubnetRegisterAPIKey swagger:route POST /subnet/apikey/register OperatorAPI operatorSubnetRegisterApiKey
|
||||
|
||||
Register Operator with Subnet
|
||||
|
||||
*/
|
||||
type OperatorSubnetRegisterAPIKey struct {
|
||||
Context *middleware.Context
|
||||
Handler OperatorSubnetRegisterAPIKeyHandler
|
||||
}
|
||||
|
||||
func (o *OperatorSubnetRegisterAPIKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewOperatorSubnetRegisterAPIKeyParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewOperatorSubnetRegisterAPIKeyParams creates a new OperatorSubnetRegisterAPIKeyParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewOperatorSubnetRegisterAPIKeyParams() OperatorSubnetRegisterAPIKeyParams {
|
||||
|
||||
return OperatorSubnetRegisterAPIKeyParams{}
|
||||
}
|
||||
|
||||
// OperatorSubnetRegisterAPIKeyParams contains all the bound params for the operator subnet register API key operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters OperatorSubnetRegisterAPIKey
|
||||
type OperatorSubnetRegisterAPIKeyParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.OperatorSubnetAPIKey
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewOperatorSubnetRegisterAPIKeyParams() beforehand.
|
||||
func (o *OperatorSubnetRegisterAPIKeyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.OperatorSubnetAPIKey
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(context.Background())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// OperatorSubnetRegisterAPIKeyOKCode is the HTTP code returned for type OperatorSubnetRegisterAPIKeyOK
|
||||
const OperatorSubnetRegisterAPIKeyOKCode int = 200
|
||||
|
||||
/*OperatorSubnetRegisterAPIKeyOK A successful response.
|
||||
|
||||
swagger:response operatorSubnetRegisterApiKeyOK
|
||||
*/
|
||||
type OperatorSubnetRegisterAPIKeyOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.OperatorSubnetRegisterAPIKeyResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewOperatorSubnetRegisterAPIKeyOK creates OperatorSubnetRegisterAPIKeyOK with default headers values
|
||||
func NewOperatorSubnetRegisterAPIKeyOK() *OperatorSubnetRegisterAPIKeyOK {
|
||||
|
||||
return &OperatorSubnetRegisterAPIKeyOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the operator subnet register Api key o k response
|
||||
func (o *OperatorSubnetRegisterAPIKeyOK) WithPayload(payload *models.OperatorSubnetRegisterAPIKeyResponse) *OperatorSubnetRegisterAPIKeyOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the operator subnet register Api key o k response
|
||||
func (o *OperatorSubnetRegisterAPIKeyOK) SetPayload(payload *models.OperatorSubnetRegisterAPIKeyResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *OperatorSubnetRegisterAPIKeyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*OperatorSubnetRegisterAPIKeyDefault Generic error response.
|
||||
|
||||
swagger:response operatorSubnetRegisterApiKeyDefault
|
||||
*/
|
||||
type OperatorSubnetRegisterAPIKeyDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewOperatorSubnetRegisterAPIKeyDefault creates OperatorSubnetRegisterAPIKeyDefault with default headers values
|
||||
func NewOperatorSubnetRegisterAPIKeyDefault(code int) *OperatorSubnetRegisterAPIKeyDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &OperatorSubnetRegisterAPIKeyDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the operator subnet register API key default response
|
||||
func (o *OperatorSubnetRegisterAPIKeyDefault) WithStatusCode(code int) *OperatorSubnetRegisterAPIKeyDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the operator subnet register API key default response
|
||||
func (o *OperatorSubnetRegisterAPIKeyDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the operator subnet register API key default response
|
||||
func (o *OperatorSubnetRegisterAPIKeyDefault) WithPayload(payload *models.Error) *OperatorSubnetRegisterAPIKeyDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the operator subnet register API key default response
|
||||
func (o *OperatorSubnetRegisterAPIKeyDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *OperatorSubnetRegisterAPIKeyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// OperatorSubnetRegisterAPIKeyURL generates an URL for the operator subnet register API key operation
|
||||
type OperatorSubnetRegisterAPIKeyURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *OperatorSubnetRegisterAPIKeyURL) WithBasePath(bp string) *OperatorSubnetRegisterAPIKeyURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *OperatorSubnetRegisterAPIKeyURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *OperatorSubnetRegisterAPIKeyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/subnet/apikey/register"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *OperatorSubnetRegisterAPIKeyURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *OperatorSubnetRegisterAPIKeyURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *OperatorSubnetRegisterAPIKeyURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on OperatorSubnetRegisterAPIKeyURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on OperatorSubnetRegisterAPIKeyURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *OperatorSubnetRegisterAPIKeyURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
88
operatorapi/operations/operator_api/post_m_p_integration.go
Normal file
88
operatorapi/operations/operator_api/post_m_p_integration.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// PostMPIntegrationHandlerFunc turns a function with the right signature into a post m p integration handler
|
||||
type PostMPIntegrationHandlerFunc func(PostMPIntegrationParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn PostMPIntegrationHandlerFunc) Handle(params PostMPIntegrationParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// PostMPIntegrationHandler interface for that can handle valid post m p integration params
|
||||
type PostMPIntegrationHandler interface {
|
||||
Handle(PostMPIntegrationParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewPostMPIntegration creates a new http.Handler for the post m p integration operation
|
||||
func NewPostMPIntegration(ctx *middleware.Context, handler PostMPIntegrationHandler) *PostMPIntegration {
|
||||
return &PostMPIntegration{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* PostMPIntegration swagger:route POST /mp-integration OperatorAPI postMPIntegration
|
||||
|
||||
Set email to register for marketplace integration
|
||||
|
||||
*/
|
||||
type PostMPIntegration struct {
|
||||
Context *middleware.Context
|
||||
Handler PostMPIntegrationHandler
|
||||
}
|
||||
|
||||
func (o *PostMPIntegration) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewPostMPIntegrationParams()
|
||||
uprinc, aCtx, err := o.Context.Authorize(r, route)
|
||||
if err != nil {
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
if aCtx != nil {
|
||||
*r = *aCtx
|
||||
}
|
||||
var principal *models.Principal
|
||||
if uprinc != nil {
|
||||
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
|
||||
}
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(Params, principal) // actually handle the request
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/validate"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewPostMPIntegrationParams creates a new PostMPIntegrationParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewPostMPIntegrationParams() PostMPIntegrationParams {
|
||||
|
||||
return PostMPIntegrationParams{}
|
||||
}
|
||||
|
||||
// PostMPIntegrationParams contains all the bound params for the post m p integration operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters PostMPIntegration
|
||||
type PostMPIntegrationParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.MpIntegration
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls.
|
||||
//
|
||||
// To ensure default values, the struct must have been initialized with NewPostMPIntegrationParams() beforehand.
|
||||
func (o *PostMPIntegrationParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.MpIntegration
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
} else {
|
||||
res = append(res, errors.NewParseError("body", "body", "", err))
|
||||
}
|
||||
} else {
|
||||
// validate body object
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
ctx := validate.WithOperationRequest(context.Background())
|
||||
if err := body.ContextValidate(ctx, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Body = &body
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// PostMPIntegrationCreatedCode is the HTTP code returned for type PostMPIntegrationCreated
|
||||
const PostMPIntegrationCreatedCode int = 201
|
||||
|
||||
/*PostMPIntegrationCreated A successful response.
|
||||
|
||||
swagger:response postMPIntegrationCreated
|
||||
*/
|
||||
type PostMPIntegrationCreated struct {
|
||||
}
|
||||
|
||||
// NewPostMPIntegrationCreated creates PostMPIntegrationCreated with default headers values
|
||||
func NewPostMPIntegrationCreated() *PostMPIntegrationCreated {
|
||||
|
||||
return &PostMPIntegrationCreated{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PostMPIntegrationCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(201)
|
||||
}
|
||||
|
||||
/*PostMPIntegrationDefault Generic error response.
|
||||
|
||||
swagger:response postMPIntegrationDefault
|
||||
*/
|
||||
type PostMPIntegrationDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPostMPIntegrationDefault creates PostMPIntegrationDefault with default headers values
|
||||
func NewPostMPIntegrationDefault(code int) *PostMPIntegrationDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &PostMPIntegrationDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the post m p integration default response
|
||||
func (o *PostMPIntegrationDefault) WithStatusCode(code int) *PostMPIntegrationDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the post m p integration default response
|
||||
func (o *PostMPIntegrationDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the post m p integration default response
|
||||
func (o *PostMPIntegrationDefault) WithPayload(payload *models.Error) *PostMPIntegrationDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the post m p integration default response
|
||||
func (o *PostMPIntegrationDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PostMPIntegrationDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
payload := o.Payload
|
||||
if err := producer.Produce(rw, payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2022 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package operator_api
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
)
|
||||
|
||||
// PostMPIntegrationURL generates an URL for the post m p integration operation
|
||||
type PostMPIntegrationURL struct {
|
||||
_basePath string
|
||||
}
|
||||
|
||||
// WithBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *PostMPIntegrationURL) WithBasePath(bp string) *PostMPIntegrationURL {
|
||||
o.SetBasePath(bp)
|
||||
return o
|
||||
}
|
||||
|
||||
// SetBasePath sets the base path for this url builder, only required when it's different from the
|
||||
// base path specified in the swagger spec.
|
||||
// When the value of the base path is an empty string
|
||||
func (o *PostMPIntegrationURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *PostMPIntegrationURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/mp-integration"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *PostMPIntegrationURL) Must(u *url.URL, err error) *url.URL {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if u == nil {
|
||||
panic("url can't be nil")
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
// String returns the string representation of the path with query string
|
||||
func (o *PostMPIntegrationURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *PostMPIntegrationURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on PostMPIntegrationURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on PostMPIntegrationURL")
|
||||
}
|
||||
|
||||
base, err := o.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
base.Scheme = scheme
|
||||
base.Host = host
|
||||
return base, nil
|
||||
}
|
||||
|
||||
// StringFull returns the string representation of a complete url
|
||||
func (o *PostMPIntegrationURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user