Compare commits
67 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4a08fc0af | ||
|
|
115de8ee25 | ||
|
|
27cb17dbfd | ||
|
|
31a5d640eb | ||
|
|
b45e11ce7f | ||
|
|
4388ecc4eb | ||
|
|
656d8075b2 | ||
|
|
8b209a202f | ||
|
|
2e66a13f48 | ||
|
|
d54ed26c71 | ||
|
|
5cf02ffae9 | ||
|
|
6afd0b16dc | ||
|
|
0b8af385f1 | ||
|
|
9a3063b7da | ||
|
|
71541029e7 | ||
|
|
076b803a5c | ||
|
|
97ef82f831 | ||
|
|
2ca484c691 | ||
|
|
4e5dcf0fc3 | ||
|
|
18e50975d4 | ||
|
|
d425af3c85 | ||
|
|
fce84d1de0 | ||
|
|
dc19984f23 | ||
|
|
8c1ecae68a | ||
|
|
862d692444 | ||
|
|
854a0c16b3 | ||
|
|
3d74e9762c | ||
|
|
3d8b98f563 | ||
|
|
06af416642 | ||
|
|
01920841d2 | ||
|
|
78aceb2b53 | ||
|
|
dce9bbd046 | ||
|
|
9f4573ade8 | ||
|
|
24af63da42 | ||
|
|
52c77fd388 | ||
|
|
19e6cc87c2 | ||
|
|
9bfed73b03 | ||
|
|
095241517b | ||
|
|
339885b2a0 | ||
|
|
6cfc985337 | ||
|
|
1c47685aea | ||
|
|
efa74a5f50 | ||
|
|
4c432cd356 | ||
|
|
0b07cb3885 | ||
|
|
8d13be5e87 | ||
|
|
3c34602f9e | ||
|
|
adfc96074f | ||
|
|
7cc7b874d1 | ||
|
|
4d12a5061d | ||
|
|
b274add4da | ||
|
|
fd51c9dc4c | ||
|
|
51f8794aa6 | ||
|
|
3db998f9c4 | ||
|
|
0a2a7087a7 | ||
|
|
8f0eb11ced | ||
|
|
e3e3599095 | ||
|
|
aa74e31453 | ||
|
|
e1f6e729fd | ||
|
|
13d83a6d1c | ||
|
|
6075387654 | ||
|
|
69fad3f55f | ||
|
|
e3864b62a4 | ||
|
|
22176f4e0f | ||
|
|
a89d7ec0ea | ||
|
|
8262049e20 | ||
|
|
c61e1e0a2a | ||
|
|
b376cf6c65 |
396
.github/workflows/jobs.yaml
vendored
396
.github/workflows/jobs.yaml
vendored
@@ -22,17 +22,16 @@ jobs:
|
||||
runs-on: [ubuntu-latest]
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
@@ -65,7 +64,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -75,12 +74,12 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
cache: "yarn"
|
||||
cache-dependency-path: web-app/yarn.lock
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: assets-cache
|
||||
name: Assets Cache
|
||||
with:
|
||||
@@ -113,7 +112,7 @@ jobs:
|
||||
runs-on: [ubuntu-latest]
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
steps:
|
||||
# To build minio image, we need to clone the repository first
|
||||
- name: Clone github.com/minio/minio
|
||||
@@ -133,7 +132,7 @@ jobs:
|
||||
(git fetch alt && git checkout "alt/$GH_BRANCH") || echo "$ALTREPO ($GH_BRANCH) not available, so keeping default repository/branch"
|
||||
fi
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go-minio
|
||||
@@ -151,25 +150,24 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
./console
|
||||
key: ${{ runner.os }}-binary-${{ github.run_id }}
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: assets-cache
|
||||
name: Assets Cache
|
||||
with:
|
||||
@@ -191,7 +189,7 @@ jobs:
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -201,7 +199,7 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
@@ -210,7 +208,7 @@ jobs:
|
||||
run: |
|
||||
yarn add minio
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
@@ -230,7 +228,7 @@ jobs:
|
||||
run: npm install testcafe@3.5.0
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
run: npx testcafe "chrome:headless" web-app/tests/subpath-nginx/ -q --skip-js-errors -c 3
|
||||
run: npx testcafe "firefox:headless" web-app/tests/subpath-nginx/ -q --skip-js-errors -c 3
|
||||
|
||||
- name: Clean up docker
|
||||
if: always()
|
||||
@@ -245,7 +243,7 @@ jobs:
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -255,7 +253,7 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
@@ -264,7 +262,7 @@ jobs:
|
||||
run: |
|
||||
yarn add minio
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
@@ -284,7 +282,7 @@ jobs:
|
||||
run: npm install testcafe@3.5.0
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
run: npx testcafe "chrome:headless" web-app/tests/permissions-1/ -q --skip-js-errors -c 3
|
||||
run: npx testcafe "firefox:headless" web-app/tests/permissions-1/ -q --skip-js-errors -c 3
|
||||
|
||||
- name: Clean up users & policies
|
||||
run: |
|
||||
@@ -298,7 +296,7 @@ jobs:
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -308,7 +306,7 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
@@ -316,7 +314,7 @@ jobs:
|
||||
continue-on-error: false
|
||||
run: |
|
||||
yarn add minio
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
@@ -336,7 +334,7 @@ jobs:
|
||||
run: npm install testcafe@3.5.0
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
run: npx testcafe "chrome:headless" web-app/tests/permissions-2/ -q --skip-js-errors -c 3
|
||||
run: npx testcafe "firefox:headless" web-app/tests/permissions-2/ -q --skip-js-errors -c 3
|
||||
|
||||
- name: Clean up users & policies
|
||||
run: |
|
||||
@@ -350,7 +348,7 @@ jobs:
|
||||
timeout-minutes: 10
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -360,7 +358,7 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
@@ -368,7 +366,7 @@ jobs:
|
||||
continue-on-error: false
|
||||
run: |
|
||||
yarn add minio
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
@@ -388,7 +386,7 @@ jobs:
|
||||
run: npm install testcafe@3.5.0
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
run: npx testcafe "chrome:headless" web-app/tests/permissions-3/ -q --skip-js-errors -c 3
|
||||
run: npx testcafe "firefox:headless" web-app/tests/permissions-3/ -q --skip-js-errors -c 3
|
||||
|
||||
- name: Clean up users & policies
|
||||
run: |
|
||||
@@ -402,7 +400,7 @@ jobs:
|
||||
timeout-minutes: 15
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -412,7 +410,7 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
@@ -420,7 +418,7 @@ jobs:
|
||||
continue-on-error: false
|
||||
run: |
|
||||
yarn add minio
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
@@ -441,7 +439,7 @@ jobs:
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
timeout-minutes: 10
|
||||
run: npx testcafe "chrome:headless" web-app/tests/permissions-4/ --skip-js-errors
|
||||
run: npx testcafe "firefox:headless" web-app/tests/permissions-4/ --skip-js-errors
|
||||
|
||||
all-permissions-5:
|
||||
name: Permissions Tests Part 5
|
||||
@@ -450,7 +448,7 @@ jobs:
|
||||
runs-on: [ubuntu-latest]
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -460,7 +458,7 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
@@ -468,7 +466,7 @@ jobs:
|
||||
continue-on-error: false
|
||||
run: |
|
||||
yarn add minio
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
@@ -489,7 +487,7 @@ jobs:
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
timeout-minutes: 5
|
||||
run: npx testcafe "chrome:headless" web-app/tests/permissions-5/ --skip-js-errors
|
||||
run: npx testcafe "firefox:headless" web-app/tests/permissions-5/ --skip-js-errors
|
||||
|
||||
all-permissions-6:
|
||||
name: Permissions Tests Part 6
|
||||
@@ -498,7 +496,7 @@ jobs:
|
||||
runs-on: [ubuntu-latest]
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -508,7 +506,7 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
@@ -516,7 +514,7 @@ jobs:
|
||||
continue-on-error: false
|
||||
run: |
|
||||
yarn add minio
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
@@ -537,102 +535,7 @@ jobs:
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
timeout-minutes: 5
|
||||
run: npx testcafe "chrome:headless" web-app/tests/permissions-6/ --skip-js-errors
|
||||
|
||||
all-permissions-7:
|
||||
name: Permissions Tests Part 7
|
||||
needs:
|
||||
- compile-binary
|
||||
runs-on: [ubuntu-latest]
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
working-directory: ./
|
||||
continue-on-error: false
|
||||
run: |
|
||||
yarn add minio
|
||||
- uses: actions/cache@v3
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
./console
|
||||
key: ${{ runner.os }}-binary-${{ github.run_id }}
|
||||
|
||||
- name: clean-previous-containers-if-any
|
||||
run: |
|
||||
docker stop minio || true;
|
||||
docker container prune -f || true;
|
||||
|
||||
- name: Start Console, front-end app and initialize users/policies
|
||||
run: |
|
||||
(./console server) & (make initialize-permissions)
|
||||
- name: Install TestCafe
|
||||
run: npm install testcafe@3.5.0
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
timeout-minutes: 5
|
||||
run: npx testcafe "chrome:headless" web-app/tests/permissions-7/ --skip-js-errors
|
||||
|
||||
all-permissions-8:
|
||||
name: Permissions Tests Part 8
|
||||
needs:
|
||||
- compile-binary
|
||||
runs-on: [ubuntu-latest]
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
working-directory: ./
|
||||
continue-on-error: false
|
||||
run: |
|
||||
yarn add minio
|
||||
- uses: actions/cache@v3
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
./console
|
||||
key: ${{ runner.os }}-binary-${{ github.run_id }}
|
||||
|
||||
- name: clean-previous-containers-if-any
|
||||
run: |
|
||||
docker stop minio || true;
|
||||
docker container prune -f || true;
|
||||
|
||||
- name: Start Console, front-end app and initialize users/policies
|
||||
run: |
|
||||
(./console server) & (make initialize-permissions)
|
||||
|
||||
- name: Install TestCafe
|
||||
run: npm install testcafe@3.5.0
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
timeout-minutes: 5
|
||||
run: npx testcafe "chrome:headless" web-app/tests/permissions-8/ --skip-js-errors
|
||||
run: npx testcafe "firefox:headless" web-app/tests/permissions-6/ --skip-js-errors
|
||||
|
||||
all-permissions-A:
|
||||
name: Permissions Tests Part A
|
||||
@@ -641,7 +544,7 @@ jobs:
|
||||
runs-on: [ubuntu-latest]
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -651,7 +554,7 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
@@ -659,7 +562,7 @@ jobs:
|
||||
continue-on-error: false
|
||||
run: |
|
||||
yarn add minio
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
@@ -679,7 +582,7 @@ jobs:
|
||||
run: npm install testcafe@3.5.0
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
run: npx testcafe "chrome:headless" web-app/tests/permissions-A/ --skip-js-errors -c 3
|
||||
run: npx testcafe "firefox:headless" web-app/tests/permissions-A/ --skip-js-errors -c 3
|
||||
|
||||
- name: Clean up users & policies
|
||||
run: |
|
||||
@@ -692,7 +595,7 @@ jobs:
|
||||
runs-on: [ubuntu-latest]
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -702,7 +605,7 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Install MinIO JS
|
||||
@@ -710,7 +613,7 @@ jobs:
|
||||
continue-on-error: false
|
||||
run: |
|
||||
yarn add minio
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache
|
||||
with:
|
||||
path: |
|
||||
@@ -730,7 +633,7 @@ jobs:
|
||||
run: npm install testcafe@3.5.0
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
run: npx testcafe "chrome:headless" web-app/tests/permissions-B/ --skip-js-errors -c 3
|
||||
run: npx testcafe "firefox:headless" web-app/tests/permissions-B/ --skip-js-errors -c 3
|
||||
|
||||
- name: Clean up users & policies
|
||||
run: |
|
||||
@@ -745,17 +648,16 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
@@ -765,7 +667,7 @@ jobs:
|
||||
run: |
|
||||
make test-pkg
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: coverage-cache-pkg
|
||||
name: Coverage Cache Pkg
|
||||
with:
|
||||
@@ -781,17 +683,16 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
@@ -801,7 +702,7 @@ jobs:
|
||||
run: |
|
||||
make test
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: coverage-cache-api
|
||||
name: Coverage Cache API
|
||||
with:
|
||||
@@ -819,7 +720,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -841,7 +742,7 @@ jobs:
|
||||
git remote add alt $ALTREPO
|
||||
(git fetch alt && git checkout "alt/$GH_BRANCH") || echo "$ALTREPO ($GH_BRANCH) not available, so keeping default repository/branch"
|
||||
fi
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: minio-latest-cache
|
||||
name: MinIO Latest Cache
|
||||
with:
|
||||
@@ -849,10 +750,9 @@ jobs:
|
||||
./minio
|
||||
key: ${{ runner.os }}-minio-latest-${{ hashFiles('./minio_repository/go.sum') }}
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
@@ -881,7 +781,7 @@ jobs:
|
||||
echo "Create the folder to put the all.out file"
|
||||
make test-integration MINIO_VERSION=$MINIO_VERSION;
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: coverage-cache
|
||||
name: Coverage Cache
|
||||
with:
|
||||
@@ -905,89 +805,7 @@ jobs:
|
||||
- name: Run tests
|
||||
working-directory: ./web-app
|
||||
run: yarn test
|
||||
replication:
|
||||
name: Site Replication Test
|
||||
needs:
|
||||
- lint-job
|
||||
- ui-assets
|
||||
- semgrep-static-code-analysis
|
||||
- latest-minio
|
||||
runs-on: [ubuntu-latest]
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Clone github.com/minio/minio
|
||||
uses: actions/checkout@master
|
||||
with:
|
||||
repository: minio/minio
|
||||
path: "minio_repository"
|
||||
- name: Check-out matching MinIO branch
|
||||
env:
|
||||
GH_BRANCH: ${{ github.head_ref || github.ref_name }}
|
||||
GH_PR_REPO: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
run: |
|
||||
GH_PR_ACCOUNT=`echo $GH_PR_REPO | sed "s/\\/.*//"`
|
||||
if [ ! -z "$GH_PR_ACCOUNT" ] && [ ! "$GH_PR_ACCOUNT" = "minio" ]; then
|
||||
ALTREPO="https://github.com/$GH_PR_ACCOUNT/minio.git"
|
||||
echo "Attempting to fetch $ALTREPO..."
|
||||
git remote add alt $ALTREPO
|
||||
(git fetch alt && git checkout "alt/$GH_BRANCH") || echo "$ALTREPO ($GH_BRANCH) not available, so keeping default repository/branch"
|
||||
fi
|
||||
- uses: actions/cache@v3
|
||||
id: minio-latest-cache
|
||||
name: MinIO Latest Cache
|
||||
with:
|
||||
path: |
|
||||
./minio
|
||||
key: ${{ runner.os }}-minio-latest-${{ hashFiles('./minio_repository/go.sum') }}
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
run: |
|
||||
echo "The idea is to build minio image from downloaded repository";
|
||||
cd $GITHUB_WORKSPACE/minio_repository;
|
||||
echo "Get git version to build MinIO Image";
|
||||
VERSION=`git rev-parse HEAD`;
|
||||
echo $VERSION;
|
||||
echo "Create MinIO image";
|
||||
make docker VERSION=$VERSION;
|
||||
|
||||
docker build -q --no-cache -t minio/minio:$VERSION . -f Dockerfile
|
||||
echo "Jumping back to console repository to run the integration test"
|
||||
cd $GITHUB_WORKSPACE;
|
||||
|
||||
echo "We are going to use the built image on test-integration";
|
||||
MINIO_VERSION="minio/minio:$VERSION";
|
||||
echo $MINIO_VERSION;
|
||||
|
||||
make test-replication MINIO_VERSION=$MINIO_VERSION;
|
||||
- uses: actions/cache@v3
|
||||
id: coverage-cache-replication
|
||||
name: Coverage Cache Replication
|
||||
with:
|
||||
path: |
|
||||
./replication/coverage/
|
||||
key: ${{ runner.os }}-replication-coverage-2-${{ github.run_id }}
|
||||
|
||||
# To save our replication.out file into an artifact.
|
||||
# By default, GitHub stores build logs and artifacts for 90 days.
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: replication-artifact
|
||||
path: ./replication/coverage/replication.out
|
||||
if-no-files-found: error
|
||||
sso-integration:
|
||||
name: SSO Integration Test
|
||||
needs:
|
||||
@@ -999,17 +817,16 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Clone github.com/minio/minio
|
||||
@@ -1035,7 +852,7 @@ jobs:
|
||||
|
||||
git checkout "${{ github.head_ref || github.ref_name }}" || echo "Okay, we'll stay on the master branch"
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: minio-latest-cache
|
||||
name: MinIO Latest Cache
|
||||
with:
|
||||
@@ -1050,7 +867,7 @@ jobs:
|
||||
echo "replace github.com/minio/console => ../" >> go.mod
|
||||
|
||||
echo "updates to go.mod needed; to update it: go mod tidy"
|
||||
go mod tidy -compat=1.21
|
||||
go mod tidy -compat=1.23
|
||||
|
||||
echo "Get git version to build MinIO Image";
|
||||
VERSION=`git rev-parse HEAD`;
|
||||
@@ -1067,7 +884,7 @@ jobs:
|
||||
echo $MINIO_VERSION;
|
||||
|
||||
make test-sso-integration MINIO_VERSION=$MINIO_VERSION;
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: coverage-cache-sso
|
||||
name: Coverage Cache SSO
|
||||
with:
|
||||
@@ -1081,20 +898,18 @@ jobs:
|
||||
- test-api-on-go
|
||||
- test-pkg-on-go
|
||||
- sso-integration
|
||||
- replication
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
- name: Check out gocovmerge as a nested repository
|
||||
uses: actions/checkout@v3
|
||||
@@ -1102,7 +917,7 @@ jobs:
|
||||
repository: wadey/gocovmerge
|
||||
path: gocovmerge
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: coverage-cache
|
||||
name: Coverage Cache
|
||||
with:
|
||||
@@ -1110,7 +925,7 @@ jobs:
|
||||
./integration/coverage/
|
||||
key: ${{ runner.os }}-coverage-2-${{ github.run_id }}
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: coverage-cache-sso
|
||||
name: Coverage Cache SSO
|
||||
with:
|
||||
@@ -1118,15 +933,7 @@ jobs:
|
||||
./sso-integration/coverage/
|
||||
key: ${{ runner.os }}-sso-coverage-2-${{ github.run_id }}
|
||||
|
||||
- uses: actions/cache@v3
|
||||
id: coverage-cache-replication
|
||||
name: Coverage Cache Replication
|
||||
with:
|
||||
path: |
|
||||
./replication/coverage/
|
||||
key: ${{ runner.os }}-replication-coverage-2-${{ github.run_id }}
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: coverage-cache-api
|
||||
name: Coverage Cache API
|
||||
with:
|
||||
@@ -1134,7 +941,7 @@ jobs:
|
||||
./api/coverage/
|
||||
key: ${{ runner.os }}-coverage-api-2-${{ github.run_id }}
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: coverage-cache-pkg
|
||||
name: Coverage Cache Pkg
|
||||
with:
|
||||
@@ -1142,12 +949,6 @@ jobs:
|
||||
./pkg/coverage/
|
||||
key: ${{ runner.os }}-coverage-pkg-2-${{ github.run_id }}
|
||||
|
||||
# Get the replication.out file from the artifact since this is working for self host runner.
|
||||
- uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: replication-artifact
|
||||
path: replication/coverage
|
||||
|
||||
- name: Get coverage
|
||||
run: |
|
||||
echo "change directory to gocovmerge"
|
||||
@@ -1155,16 +956,16 @@ jobs:
|
||||
echo "download golang x tools"
|
||||
go mod download golang.org/x/tools
|
||||
echo "go mod tidy compat mode"
|
||||
go mod tidy -compat=1.21
|
||||
go mod tidy -compat=1.23
|
||||
echo "go build gocoverage.go"
|
||||
go build gocovmerge.go
|
||||
echo "put together the outs for final coverage resolution"
|
||||
./gocovmerge ../integration/coverage/system.out ../replication/coverage/replication.out ../sso-integration/coverage/sso-system.out ../api/coverage/coverage.out ../pkg/coverage/coverage-pkg.out > all.out
|
||||
./gocovmerge ../integration/coverage/system.out ../sso-integration/coverage/sso-system.out ../api/coverage/coverage.out ../pkg/coverage/coverage-pkg.out > all.out
|
||||
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 "Only run our test if play is up and running since we require it for replication tests here."
|
||||
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
|
||||
@@ -1188,11 +989,6 @@ jobs:
|
||||
./mc cp system.html play/builds/${{ github.repository }}/${{ github.event.number }}/latest/ || true
|
||||
./mc cp ../integration/coverage/system.out play/builds/${{ github.repository }}/${{ github.event.number }}/${{ github.run_id }}/ || true
|
||||
./mc cp ../integration/coverage/system.out play/builds/${{ github.repository }}/${{ github.event.number }}/latest/ || true
|
||||
go tool cover -html=../replication/coverage/replication.out -o replication.html
|
||||
./mc cp replication.html play/builds/${{ github.repository }}/${{ github.event.number }}/${{ github.run_id }}/ || true
|
||||
./mc cp replication.html play/builds/${{ github.repository }}/${{ github.event.number }}/latest/ || true
|
||||
./mc cp ../replication/coverage/replication.out play/builds/${{ github.repository }}/${{ github.event.number }}/${{ github.run_id }}/ || true
|
||||
./mc cp ../replication/coverage/replication.out play/builds/${{ github.repository }}/${{ github.event.number }}/latest/ || true
|
||||
go tool cover -html=../sso-integration/coverage/sso-system.out -o sso-system.html
|
||||
./mc cp sso-system.html play/builds/${{ github.repository }}/${{ github.event.number }}/${{ github.run_id }}/ || true
|
||||
./mc cp sso-system.html play/builds/${{ github.repository }}/${{ github.event.number }}/latest/ || true
|
||||
@@ -1231,7 +1027,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
@@ -1241,12 +1037,12 @@ jobs:
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
cache: "yarn"
|
||||
cache-dependency-path: web-app/yarn.lock
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: assets-cache-istanbul-coverage
|
||||
name: Assets Cache Istanbul Coverage
|
||||
with:
|
||||
@@ -1273,25 +1069,24 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache Istanbul Coverage
|
||||
with:
|
||||
path: |
|
||||
./console
|
||||
key: ${{ runner.os }}-binary-istanbul-coverage-${{ github.run_id }}
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
id: assets-cache-istanbul-coverage
|
||||
name: Assets Cache Istanbul Coverage
|
||||
with:
|
||||
@@ -1314,17 +1109,16 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
@@ -1343,16 +1137,15 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
@@ -1371,17 +1164,16 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
@@ -1400,17 +1192,16 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
@@ -1429,17 +1220,16 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.22.x]
|
||||
go-version: [1.23.x]
|
||||
os: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
@@ -1458,7 +1248,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
@@ -1474,7 +1264,7 @@ jobs:
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
name: Console Binary Cache Istanbul Coverage
|
||||
with:
|
||||
path: |
|
||||
@@ -1497,13 +1287,13 @@ jobs:
|
||||
npx nyc report # To see report printed in logs as text
|
||||
echo "npx nyc report --reporter=html"
|
||||
npx nyc report --reporter=html # to see report in ./coverage/index.html
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: coverage
|
||||
|
||||
19
.github/workflows/vulncheck.yaml
vendored
19
.github/workflows/vulncheck.yaml
vendored
@@ -15,11 +15,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.22.4
|
||||
go-version: 1.23.3
|
||||
check-latest: true
|
||||
- name: Get official govulncheck
|
||||
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
@@ -33,28 +33,21 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.22.4 ]
|
||||
go-version: [ 1.23.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Read .nvmrc
|
||||
id: node_version
|
||||
run: echo "$(cat .nvmrc)" && echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_ENV
|
||||
- name: Enable Corepack
|
||||
run: corepack enable
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
- name: Checks for known security issues with the installed packages
|
||||
working-directory: ./web-app
|
||||
continue-on-error: false
|
||||
run: |
|
||||
# Ignore "pdfjs-dist" advisory, because it's a dependency
|
||||
# of "react-pdf" that cannot be upgraded. Because the
|
||||
# "isEvalSupported" value is always set to "false", it
|
||||
# isn't a security problem. See also
|
||||
# - https://github.com/wojtekmaj/react-pdf/issues/1789
|
||||
# - https://github.com/wojtekmaj/react-pdf/discussions/1786
|
||||
# - https://www.npmjs.com/advisories/1097244
|
||||
yarn npm audit --recursive --environment production --no-deprecations
|
||||
|
||||
@@ -42,8 +42,5 @@ issues:
|
||||
- should have comment
|
||||
- use leading k in Go names
|
||||
- comment on exported const
|
||||
run:
|
||||
skip-dirs:
|
||||
- pkg/clientgen
|
||||
- pkg/apis/networking.gke.io
|
||||
exclude-dirs:
|
||||
- api/operations
|
||||
|
||||
104
CHANGELOG.md
104
CHANGELOG.md
@@ -1,7 +1,107 @@
|
||||
<!-- @format -->
|
||||
|
||||
# Changelog
|
||||
|
||||
## Release v1.7.6
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fix null pointer exception in Admin Info
|
||||
- Ignore leading or trailing spaces in login request
|
||||
- Fix file path on drag and drop
|
||||
- Fix typo in User DN Search Filter example
|
||||
|
||||
## Release v1.7.5
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed leaks during ZIP multiobject downloads
|
||||
- Allow spaces in Policy names
|
||||
|
||||
## Release v1.7.4
|
||||
|
||||
Deprecations:
|
||||
|
||||
- Deprecated support tools User Interface in favor of mc admin commands. Please refer to the [MinIO SUBNET Registration page](https://min.io/docs/minio/linux/administration/console/subnet-registration.html#subnet) for more information.
|
||||
- Deprecated Site replication User Interface in favor of mc admin commands. Please refer to the [MinIO Site Replication page](https://min.io/docs/minio/linux/operations/install-deploy-manage/multi-site-replication.html) for more information.
|
||||
- Deprecated Lifecycle & Tiers User Interface in favor of mc admin commands. Please refer to the [MinIO Tiers page](https://min.io/docs/minio/linux/reference/minio-mc/mc-ilm-tier.html) for more information.
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Avoid loading unpkg.com call when login animation is off
|
||||
|
||||
## Release v1.7.3
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Use a fixed public license verification key
|
||||
- Show non-expiring access keys as `no-expiry` instead of Jan 1, 1970
|
||||
- Use "join Slack" button for non-commercial edition instead of "Signup"
|
||||
- Fix setting policies on groups that have spaces
|
||||
|
||||
## Release v1.7.2
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed issue in Server Health Info
|
||||
- Fixed Security vulnerability in dependencies
|
||||
- Fixed client string in trace message
|
||||
|
||||
Additional Changes:
|
||||
|
||||
- Remove live logs in Call Home Page
|
||||
- Update License page
|
||||
|
||||
## Release v1.7.1
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed issue that could cause a failure when attempting to view deleted files in the object browser
|
||||
- Return network error when logging in and the network connection fails
|
||||
|
||||
Additional Changes:
|
||||
|
||||
- Added debug logging for console HTTP request (see [PR #3440](https://github.com/minio/console/pull/3440) for more detailed information)
|
||||
|
||||
## Release v1.7.0
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed directory listing
|
||||
- Fix MinIO videos link
|
||||
|
||||
Additional Changes:
|
||||
|
||||
- Removed deprecated KES functionality
|
||||
|
||||
## Release v1.6.3
|
||||
|
||||
Additional Changes:
|
||||
|
||||
- Updated go.mod version
|
||||
|
||||
## Release v1.6.2
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed minor user session issues
|
||||
- Updated project dependencies
|
||||
|
||||
Additional Changes:
|
||||
|
||||
- Improved Drives List visualization
|
||||
- Improved WS request logic
|
||||
- Updated License page with current MinIO plans.
|
||||
|
||||
## Release v1.6.1
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed objectManager issues under certain conditions
|
||||
- Fixed Security vulnerability in dependencies
|
||||
|
||||
Additional Changes:
|
||||
|
||||
- Improved Share Link behavior
|
||||
|
||||
## Release v1.6.0
|
||||
|
||||
Bug Fix:
|
||||
|
||||
7
Makefile
7
Makefile
@@ -216,11 +216,6 @@ test-permissions-6:
|
||||
@(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-6/")
|
||||
@(docker stop minio)
|
||||
|
||||
test-permissions-7:
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-7/")
|
||||
@(docker stop minio)
|
||||
|
||||
test-apply-permissions:
|
||||
@(env bash $(PWD)/web-app/tests/scripts/initialize-env.sh)
|
||||
|
||||
@@ -243,7 +238,7 @@ test-start-docker-minio-w-redirect-url: initialize-docker-network
|
||||
-e MINIO_SERVER_URL='http://localhost:9000' \
|
||||
-v /data1 -v /data2 -v /data3 -v /data4 \
|
||||
-d --network host --name minio --rm\
|
||||
quay.io/minio/minio:latest server /data{1...4})
|
||||
quay.io/minio/minio:latest server /data{1...4})
|
||||
|
||||
test-start-docker-nginx-w-subpath:
|
||||
@(docker run \
|
||||
|
||||
35
README.md
35
README.md
@@ -25,21 +25,7 @@ A graphical user interface for [MinIO](https://github.com/minio/minio)
|
||||
|
||||
<!-- markdown-toc end -->
|
||||
|
||||
## Install
|
||||
|
||||
MinIO Console is a library that provides a management and browser UI overlay for the MinIO Server.
|
||||
The standalone binary installation path has been removed.
|
||||
|
||||
In case a Console standalone binary is needed, it can be generated by building this package from source as follows:
|
||||
|
||||
### Build from source
|
||||
|
||||
> You will need a working Go environment. Therefore, please follow [How to install Go](https://golang.org/doc/install).
|
||||
> Minimum version required is go1.21
|
||||
|
||||
```
|
||||
go install github.com/minio/console/cmd/console@latest
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
@@ -205,6 +191,27 @@ export CONSOLE_MINIO_SERVER=https://localhost:9000
|
||||
|
||||
You can verify that the apis work by doing the request on `localhost:9090/api/v1/...`
|
||||
|
||||
## Debug logging
|
||||
|
||||
In some cases it may be convenient to log all HTTP requests. This can be enabled by setting
|
||||
the `CONSOLE_DEBUG_LOGLEVEL` environment variable to one of the following values:
|
||||
|
||||
- `0` (default) uses no logging.
|
||||
- `1` log single line per request for server-side errors (status-code 5xx).
|
||||
- `2` log single line per request for client-side and server-side errors (status-code 4xx/5xx).
|
||||
- `3` log single line per request for all requests (status-code 4xx/5xx).
|
||||
- `4` log details per request for server-side errors (status-code 5xx).
|
||||
- `5` log details per request for client-side and server-side errors (status-code 4xx/5xx).
|
||||
- `6` log details per request for all requests (status-code 4xx/5xx).
|
||||
|
||||
A single line logging has the following information:
|
||||
- Remote endpoint (IP + port) of the request. Note that reverse proxies may hide the actual remote endpoint of the client's browser.
|
||||
- HTTP method and URL
|
||||
- Status code of the response (websocket connections are hijacked, so no response is shown)
|
||||
- Duration of the request
|
||||
|
||||
The detailed logging also includes all request and response headers (if any).
|
||||
|
||||
# Contribute to console Project
|
||||
|
||||
Please follow console [Contributor's Guide](https://github.com/minio/console/blob/master/CONTRIBUTING.md)
|
||||
|
||||
@@ -55,8 +55,7 @@ var (
|
||||
minioAddPolicyMock func(name string, policy *iampolicy.Policy) error
|
||||
minioSetPolicyMock func(policyName, entityName string, isGroup bool) error
|
||||
|
||||
minioStartProfiling func(profiler madmin.ProfilerType) ([]madmin.StartProfilingResult, error)
|
||||
minioStopProfiling func() (io.ReadCloser, error)
|
||||
minioStartProfiling func(profiler madmin.ProfilerType, duration time.Duration) (io.ReadCloser, error)
|
||||
|
||||
minioServiceRestartMock func(ctx context.Context) error
|
||||
|
||||
@@ -216,10 +215,6 @@ func (ac AdminClientMock) createKey(_ context.Context, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) importKey(_ context.Context, _ string, _ []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) listKeys(_ context.Context, _ string) ([]madmin.KMSKeyInfo, error) {
|
||||
return []madmin.KMSKeyInfo{{
|
||||
Name: "name",
|
||||
@@ -231,55 +226,6 @@ func (ac AdminClientMock) keyStatus(_ context.Context, _ string) (*madmin.KMSKey
|
||||
return &madmin.KMSKeyStatus{KeyID: "key"}, nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) deleteKey(_ context.Context, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) setKMSPolicy(_ context.Context, _ string, _ []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) assignPolicy(_ context.Context, _ string, _ []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) describePolicy(_ context.Context, _ string) (*madmin.KMSDescribePolicy, error) {
|
||||
return &madmin.KMSDescribePolicy{Name: "name"}, nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) getKMSPolicy(_ context.Context, _ string) (*madmin.KMSPolicy, error) {
|
||||
return &madmin.KMSPolicy{Allow: []string{""}, Deny: []string{""}}, nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) listKMSPolicies(_ context.Context, _ string) ([]madmin.KMSPolicyInfo, error) {
|
||||
return []madmin.KMSPolicyInfo{{
|
||||
Name: "name",
|
||||
CreatedBy: "by",
|
||||
}}, nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) deletePolicy(_ context.Context, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) describeIdentity(_ context.Context, _ string) (*madmin.KMSDescribeIdentity, error) {
|
||||
return &madmin.KMSDescribeIdentity{}, nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) describeSelfIdentity(_ context.Context) (*madmin.KMSDescribeSelfIdentity, error) {
|
||||
return &madmin.KMSDescribeSelfIdentity{
|
||||
Policy: &madmin.KMSPolicy{Allow: []string{}, Deny: []string{}},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) deleteIdentity(_ context.Context, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) listIdentities(_ context.Context, _ string) ([]madmin.KMSIdentityInfo, error) {
|
||||
return []madmin.KMSIdentityInfo{{Identity: "identity"}}, nil
|
||||
}
|
||||
|
||||
func (ac AdminClientMock) listPolicies(_ context.Context) (map[string]*iampolicy.Policy, error) {
|
||||
return minioListPoliciesMock()
|
||||
}
|
||||
@@ -301,13 +247,8 @@ func (ac AdminClientMock) setPolicy(_ context.Context, policyName, entityName st
|
||||
}
|
||||
|
||||
// mock function for startProfiling()
|
||||
func (ac AdminClientMock) startProfiling(_ context.Context, profiler madmin.ProfilerType) ([]madmin.StartProfilingResult, error) {
|
||||
return minioStartProfiling(profiler)
|
||||
}
|
||||
|
||||
// mock function for stopProfiling()
|
||||
func (ac AdminClientMock) stopProfiling(_ context.Context) (io.ReadCloser, error) {
|
||||
return minioStopProfiling()
|
||||
func (ac AdminClientMock) startProfiling(_ context.Context, profiler madmin.ProfilerType, duration time.Duration) (io.ReadCloser, error) {
|
||||
return minioStartProfiling(profiler, duration)
|
||||
}
|
||||
|
||||
// mock function of serviceRestart()
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
b64 "encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/minio/console/pkg/logger"
|
||||
"github.com/minio/console/pkg/utils"
|
||||
|
||||
subnet "github.com/minio/console/pkg/subnet"
|
||||
mc "github.com/minio/mc/cmd"
|
||||
"github.com/minio/websocket"
|
||||
)
|
||||
|
||||
// startHealthInfo starts fetching mc.ServerHealthInfo and
|
||||
// sends messages with the corresponding data on the websocket connection
|
||||
func startHealthInfo(ctx context.Context, conn WSConn, client MinioAdmin, deadline *time.Duration) error {
|
||||
if deadline == nil {
|
||||
return errors.New("duration can't be nil on startHealthInfo")
|
||||
}
|
||||
|
||||
// Fetch info of all servers (cluster or single server)
|
||||
healthInfo, version, err := client.serverHealthInfo(ctx, *deadline)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
compressedDiag, err := mc.TarGZHealthInfo(healthInfo, version)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
encodedDiag := b64.StdEncoding.EncodeToString(compressedDiag)
|
||||
type messageReport struct {
|
||||
Encoded string `json:"encoded"`
|
||||
ServerHealthInfo interface{} `json:"serverHealthInfo"`
|
||||
SubnetResponse string `json:"subnetResponse"`
|
||||
}
|
||||
|
||||
ctx = context.WithValue(ctx, utils.ContextClientIP, conn.remoteAddress())
|
||||
err = sendHealthInfoToSubnet(ctx, compressedDiag, client)
|
||||
report := messageReport{
|
||||
Encoded: encodedDiag,
|
||||
ServerHealthInfo: healthInfo,
|
||||
SubnetResponse: mc.SubnetBaseURL() + "/health",
|
||||
}
|
||||
if err != nil {
|
||||
report.SubnetResponse = fmt.Sprintf("Error: %s", err.Error())
|
||||
}
|
||||
|
||||
message, err := json.Marshal(report)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Send Message through websocket connection
|
||||
return conn.writeMessage(websocket.TextMessage, message)
|
||||
}
|
||||
|
||||
// getHealthInfoOptionsFromReq gets duration for startHealthInfo request
|
||||
// path come as : `/health-info?deadline=2h`
|
||||
func getHealthInfoOptionsFromReq(req *http.Request) (*time.Duration, error) {
|
||||
deadlineDuration, err := time.ParseDuration(req.FormValue("deadline"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &deadlineDuration, nil
|
||||
}
|
||||
|
||||
func updateMcGlobals(subnetTokenConfig subnet.LicenseTokenConfig) error {
|
||||
mc.GlobalDevMode = getConsoleDevMode()
|
||||
if len(subnetTokenConfig.Proxy) > 0 {
|
||||
proxyURL, e := url.Parse(subnetTokenConfig.Proxy)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
mc.GlobalSubnetProxyURL = proxyURL
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func sendHealthInfoToSubnet(ctx context.Context, compressedHealthInfo []byte, client MinioAdmin) error {
|
||||
filename := fmt.Sprintf("health_%d.json.gz", time.Now().Unix())
|
||||
subnetTokenConfig, e := GetSubnetKeyFromMinIOConfig(ctx, client)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
e = updateMcGlobals(*subnetTokenConfig)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
var apiKey string
|
||||
if len(subnetTokenConfig.APIKey) != 0 {
|
||||
apiKey = subnetTokenConfig.APIKey
|
||||
} else {
|
||||
apiKey, e = subnet.GetSubnetAPIKeyUsingLicense(subnetTokenConfig.License)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
}
|
||||
e = os.WriteFile(filename, compressedHealthInfo, 0o666)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
headers := mc.SubnetAPIKeyAuthHeaders(apiKey)
|
||||
resp, e := (&mc.SubnetFileUploader{
|
||||
FilePath: filename,
|
||||
ReqURL: mc.SubnetUploadURL("health"),
|
||||
Headers: headers,
|
||||
DeleteAfterUpload: true,
|
||||
}).UploadFileToSubnet()
|
||||
if e != nil {
|
||||
// file gets deleted only if upload is successful
|
||||
// so we delete explicitly here as we already have the bytes
|
||||
logger.LogIf(ctx, os.Remove(filename))
|
||||
return e
|
||||
}
|
||||
|
||||
type SubnetResponse struct {
|
||||
LicenseV2 string `json:"license_v2,omitempty"`
|
||||
APIKey string `json:"api_key,omitempty"`
|
||||
}
|
||||
|
||||
var subnetResp SubnetResponse
|
||||
e = json.Unmarshal([]byte(resp), &subnetResp)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
madmin "github.com/minio/madmin-go/v3"
|
||||
)
|
||||
|
||||
func Test_serverHealthInfo(t *testing.T) {
|
||||
var testReceiver chan madmin.HealthInfo
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
client := AdminClientMock{}
|
||||
mockWSConn := mockConn{}
|
||||
deadlineDuration, _ := time.ParseDuration("1h")
|
||||
|
||||
type args struct {
|
||||
deadline time.Duration
|
||||
wsWriteMock func(messageType int, data []byte) error
|
||||
mockMessages []madmin.HealthInfo
|
||||
}
|
||||
tests := []struct {
|
||||
test string
|
||||
args args
|
||||
wantError error
|
||||
}{
|
||||
{
|
||||
test: "Return simple health info, no errors",
|
||||
args: args{
|
||||
deadline: deadlineDuration,
|
||||
mockMessages: []madmin.HealthInfo{{}, {}},
|
||||
wsWriteMock: func(_ int, data []byte) error {
|
||||
// mock connection WriteMessage() no error
|
||||
// emulate that receiver gets the message written
|
||||
var t madmin.HealthInfo
|
||||
_ = json.Unmarshal(data, &t)
|
||||
testReceiver <- t
|
||||
return nil
|
||||
},
|
||||
},
|
||||
wantError: nil,
|
||||
},
|
||||
{
|
||||
test: "Return simple health info2, no errors",
|
||||
args: args{
|
||||
deadline: deadlineDuration,
|
||||
mockMessages: []madmin.HealthInfo{{}},
|
||||
wsWriteMock: func(_ int, data []byte) error {
|
||||
// mock connection WriteMessage() no error
|
||||
// emulate that receiver gets the message written
|
||||
var t madmin.HealthInfo
|
||||
_ = json.Unmarshal(data, &t)
|
||||
testReceiver <- t
|
||||
return nil
|
||||
},
|
||||
},
|
||||
wantError: nil,
|
||||
},
|
||||
{
|
||||
test: "Handle error on ws write",
|
||||
args: args{
|
||||
deadline: deadlineDuration,
|
||||
mockMessages: []madmin.HealthInfo{{}},
|
||||
wsWriteMock: func(_ int, data []byte) error {
|
||||
// mock connection WriteMessage() no error
|
||||
// emulate that receiver gets the message written
|
||||
var t madmin.HealthInfo
|
||||
_ = json.Unmarshal(data, &t)
|
||||
return errors.New("error on write")
|
||||
},
|
||||
},
|
||||
wantError: errors.New("error on write"),
|
||||
},
|
||||
{
|
||||
test: "Handle error on health function",
|
||||
args: args{
|
||||
deadline: deadlineDuration,
|
||||
mockMessages: []madmin.HealthInfo{
|
||||
{
|
||||
Error: "error on healthInfo",
|
||||
},
|
||||
},
|
||||
wsWriteMock: func(_ int, data []byte) error {
|
||||
// mock connection WriteMessage() no error
|
||||
// emulate that receiver gets the message written
|
||||
var t madmin.HealthInfo
|
||||
_ = json.Unmarshal(data, &t)
|
||||
return nil
|
||||
},
|
||||
},
|
||||
wantError: nil,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.test, func(_ *testing.T) {
|
||||
// make testReceiver channel
|
||||
testReceiver = make(chan madmin.HealthInfo, len(tt.args.mockMessages))
|
||||
// mock function same for all tests, changes mockMessages
|
||||
minioServerHealthInfoMock = func(_ context.Context,
|
||||
_ time.Duration,
|
||||
) (interface{}, string, error) {
|
||||
info := tt.args.mockMessages[0]
|
||||
return info, madmin.HealthInfoVersion, nil
|
||||
}
|
||||
connWriteMessageMock = tt.args.wsWriteMock
|
||||
err := startHealthInfo(ctx, mockWSConn, client, &deadlineDuration)
|
||||
// close test mock channel
|
||||
close(testReceiver)
|
||||
// check that the TestReceiver got the same number of data from Console.
|
||||
index := 0
|
||||
for info := range testReceiver {
|
||||
if !reflect.DeepEqual(info, tt.args.mockMessages[index]) {
|
||||
t.Errorf("startHealthInfo() got: %v, want: %v", info, tt.args.mockMessages[index])
|
||||
return
|
||||
}
|
||||
index++
|
||||
}
|
||||
if !reflect.DeepEqual(err, tt.wantError) {
|
||||
t.Errorf("startHealthInfo() error: %v, wantError: %v", err, tt.wantError)
|
||||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1121,12 +1121,13 @@ LabelsWaitLoop:
|
||||
if inStep != nil && *inStep > 0 {
|
||||
step = *inStep
|
||||
}
|
||||
if step > 0 {
|
||||
extraParamters = fmt.Sprintf("%s&step=%d", extraParamters, step)
|
||||
}
|
||||
|
||||
if inStart != nil && inEnd != nil {
|
||||
extraParamters = fmt.Sprintf("&start=%d&end=%d&step=%d", *inStart, *inEnd, *inStep)
|
||||
extraParamters = fmt.Sprintf("&start=%d&end=%d", *inStart, *inEnd)
|
||||
}
|
||||
|
||||
if step > 0 {
|
||||
extraParamters = fmt.Sprintf("%s&step=%d", extraParamters, step)
|
||||
}
|
||||
|
||||
// replace the `$__rate_interval` global for step with unit (s for seconds)
|
||||
|
||||
385
api/admin_kms.go
385
api/admin_kms.go
@@ -19,7 +19,6 @@ package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"sort"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
@@ -32,8 +31,6 @@ import (
|
||||
func registerKMSHandlers(api *operations.ConsoleAPI) {
|
||||
registerKMSStatusHandlers(api)
|
||||
registerKMSKeyHandlers(api)
|
||||
registerKMSPolicyHandlers(api)
|
||||
registerKMSIdentityHandlers(api)
|
||||
}
|
||||
|
||||
func registerKMSStatusHandlers(api *operations.ConsoleAPI) {
|
||||
@@ -204,14 +201,6 @@ func registerKMSKeyHandlers(api *operations.ConsoleAPI) {
|
||||
return kmsAPI.NewKMSCreateKeyCreated()
|
||||
})
|
||||
|
||||
api.KmsKMSImportKeyHandler = kmsAPI.KMSImportKeyHandlerFunc(func(params kmsAPI.KMSImportKeyParams, session *models.Principal) middleware.Responder {
|
||||
err := GetKMSImportKeyResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSImportKeyDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSImportKeyCreated()
|
||||
})
|
||||
|
||||
api.KmsKMSListKeysHandler = kmsAPI.KMSListKeysHandlerFunc(func(params kmsAPI.KMSListKeysParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSListKeysResponse(session, params)
|
||||
if err != nil {
|
||||
@@ -227,14 +216,6 @@ func registerKMSKeyHandlers(api *operations.ConsoleAPI) {
|
||||
}
|
||||
return kmsAPI.NewKMSKeyStatusOK().WithPayload(resp)
|
||||
})
|
||||
|
||||
api.KmsKMSDeleteKeyHandler = kmsAPI.KMSDeleteKeyHandlerFunc(func(params kmsAPI.KMSDeleteKeyParams, session *models.Principal) middleware.Responder {
|
||||
err := GetKMSDeleteKeyResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSDeleteKeyDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSDeleteKeyOK()
|
||||
})
|
||||
}
|
||||
|
||||
func GetKMSCreateKeyResponse(session *models.Principal, params kmsAPI.KMSCreateKeyParams) *CodedAPIError {
|
||||
@@ -254,27 +235,6 @@ func createKey(ctx context.Context, key string, minioClient MinioAdmin) *CodedAP
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetKMSImportKeyResponse(session *models.Principal, params kmsAPI.KMSImportKeyParams) *CodedAPIError {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
bytes, err := json.Marshal(params.Body)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return importKey(ctx, params.Name, bytes, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func importKey(ctx context.Context, key string, bytes []byte, minioClient MinioAdmin) *CodedAPIError {
|
||||
if err := minioClient.importKey(ctx, key, bytes); err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetKMSListKeysResponse(session *models.Principal, params kmsAPI.KMSListKeysParams) (*models.KmsListKeysResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
@@ -297,10 +257,15 @@ func listKeys(ctx context.Context, pattern string, minioClient MinioAdmin) (*mod
|
||||
return &models.KmsListKeysResponse{Results: parseKeys(results)}, nil
|
||||
}
|
||||
|
||||
// printDate - human friendly formatted date.
|
||||
const (
|
||||
printDate = "2006-01-02 15:04:05 MST"
|
||||
)
|
||||
|
||||
func parseKeys(results []madmin.KMSKeyInfo) (data []*models.KmsKeyInfo) {
|
||||
for _, key := range results {
|
||||
data = append(data, &models.KmsKeyInfo{
|
||||
CreatedAt: key.CreatedAt,
|
||||
CreatedAt: key.CreatedAt.Format(printDate),
|
||||
CreatedBy: key.CreatedBy,
|
||||
Name: key.Name,
|
||||
})
|
||||
@@ -329,341 +294,3 @@ func keyStatus(ctx context.Context, key string, minioClient MinioAdmin) (*models
|
||||
DecryptionErr: ks.DecryptionErr,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func GetKMSDeleteKeyResponse(session *models.Principal, params kmsAPI.KMSDeleteKeyParams) *CodedAPIError {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return deleteKey(ctx, params.Name, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func deleteKey(ctx context.Context, key string, minioClient MinioAdmin) *CodedAPIError {
|
||||
if err := minioClient.deleteKey(ctx, key); err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func registerKMSPolicyHandlers(api *operations.ConsoleAPI) {
|
||||
api.KmsKMSSetPolicyHandler = kmsAPI.KMSSetPolicyHandlerFunc(func(params kmsAPI.KMSSetPolicyParams, session *models.Principal) middleware.Responder {
|
||||
err := GetKMSSetPolicyResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSSetPolicyDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSSetPolicyOK()
|
||||
})
|
||||
|
||||
api.KmsKMSAssignPolicyHandler = kmsAPI.KMSAssignPolicyHandlerFunc(func(params kmsAPI.KMSAssignPolicyParams, session *models.Principal) middleware.Responder {
|
||||
err := GetKMSAssignPolicyResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSAssignPolicyDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSAssignPolicyOK()
|
||||
})
|
||||
|
||||
api.KmsKMSDescribePolicyHandler = kmsAPI.KMSDescribePolicyHandlerFunc(func(params kmsAPI.KMSDescribePolicyParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSDescribePolicyResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSDescribePolicyDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSDescribePolicyOK().WithPayload(resp)
|
||||
})
|
||||
|
||||
api.KmsKMSGetPolicyHandler = kmsAPI.KMSGetPolicyHandlerFunc(func(params kmsAPI.KMSGetPolicyParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSGetPolicyResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSGetPolicyDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSGetPolicyOK().WithPayload(resp)
|
||||
})
|
||||
|
||||
api.KmsKMSListPoliciesHandler = kmsAPI.KMSListPoliciesHandlerFunc(func(params kmsAPI.KMSListPoliciesParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSListPoliciesResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSListPoliciesDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSListPoliciesOK().WithPayload(resp)
|
||||
})
|
||||
|
||||
api.KmsKMSDeletePolicyHandler = kmsAPI.KMSDeletePolicyHandlerFunc(func(params kmsAPI.KMSDeletePolicyParams, session *models.Principal) middleware.Responder {
|
||||
err := GetKMSDeletePolicyResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSDeletePolicyDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSDeletePolicyOK()
|
||||
})
|
||||
}
|
||||
|
||||
func GetKMSSetPolicyResponse(session *models.Principal, params kmsAPI.KMSSetPolicyParams) *CodedAPIError {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
bytes, err := json.Marshal(params.Body)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return setPolicy(ctx, *params.Body.Policy, bytes, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func setPolicy(ctx context.Context, policy string, content []byte, minioClient MinioAdmin) *CodedAPIError {
|
||||
if err := minioClient.setKMSPolicy(ctx, policy, content); err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetKMSAssignPolicyResponse(session *models.Principal, params kmsAPI.KMSAssignPolicyParams) *CodedAPIError {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
bytes, err := json.Marshal(params.Body)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return assignPolicy(ctx, params.Name, bytes, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func assignPolicy(ctx context.Context, policy string, content []byte, minioClient MinioAdmin) *CodedAPIError {
|
||||
if err := minioClient.assignPolicy(ctx, policy, content); err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetKMSDescribePolicyResponse(session *models.Principal, params kmsAPI.KMSDescribePolicyParams) (*models.KmsDescribePolicyResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return describePolicy(ctx, params.Name, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func describePolicy(ctx context.Context, policy string, minioClient MinioAdmin) (*models.KmsDescribePolicyResponse, *CodedAPIError) {
|
||||
dp, err := minioClient.describePolicy(ctx, policy)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsDescribePolicyResponse{
|
||||
Name: dp.Name,
|
||||
CreatedAt: dp.CreatedAt,
|
||||
CreatedBy: dp.CreatedBy,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func GetKMSGetPolicyResponse(session *models.Principal, params kmsAPI.KMSGetPolicyParams) (*models.KmsGetPolicyResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return getPolicy(ctx, params.Name, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func getPolicy(ctx context.Context, policy string, minioClient MinioAdmin) (*models.KmsGetPolicyResponse, *CodedAPIError) {
|
||||
p, err := minioClient.getKMSPolicy(ctx, policy)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsGetPolicyResponse{
|
||||
Allow: p.Allow,
|
||||
Deny: p.Deny,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func GetKMSListPoliciesResponse(session *models.Principal, params kmsAPI.KMSListPoliciesParams) (*models.KmsListPoliciesResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
pattern := ""
|
||||
if params.Pattern != nil {
|
||||
pattern = *params.Pattern
|
||||
}
|
||||
return listKMSPolicies(ctx, pattern, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func listKMSPolicies(ctx context.Context, pattern string, minioClient MinioAdmin) (*models.KmsListPoliciesResponse, *CodedAPIError) {
|
||||
results, err := minioClient.listKMSPolicies(ctx, pattern)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsListPoliciesResponse{Results: parsePolicies(results)}, nil
|
||||
}
|
||||
|
||||
func parsePolicies(results []madmin.KMSPolicyInfo) (data []*models.KmsPolicyInfo) {
|
||||
for _, policy := range results {
|
||||
data = append(data, &models.KmsPolicyInfo{
|
||||
CreatedAt: policy.CreatedAt,
|
||||
CreatedBy: policy.CreatedBy,
|
||||
Name: policy.Name,
|
||||
})
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
func GetKMSDeletePolicyResponse(session *models.Principal, params kmsAPI.KMSDeletePolicyParams) *CodedAPIError {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return deletePolicy(ctx, params.Name, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func deletePolicy(ctx context.Context, policy string, minioClient MinioAdmin) *CodedAPIError {
|
||||
if err := minioClient.deletePolicy(ctx, policy); err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func registerKMSIdentityHandlers(api *operations.ConsoleAPI) {
|
||||
api.KmsKMSDescribeIdentityHandler = kmsAPI.KMSDescribeIdentityHandlerFunc(func(params kmsAPI.KMSDescribeIdentityParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSDescribeIdentityResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSDescribeIdentityDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSDescribeIdentityOK().WithPayload(resp)
|
||||
})
|
||||
|
||||
api.KmsKMSDescribeSelfIdentityHandler = kmsAPI.KMSDescribeSelfIdentityHandlerFunc(func(params kmsAPI.KMSDescribeSelfIdentityParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSDescribeSelfIdentityResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSDescribeSelfIdentityDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSDescribeSelfIdentityOK().WithPayload(resp)
|
||||
})
|
||||
|
||||
api.KmsKMSListIdentitiesHandler = kmsAPI.KMSListIdentitiesHandlerFunc(func(params kmsAPI.KMSListIdentitiesParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetKMSListIdentitiesResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSListIdentitiesDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSListIdentitiesOK().WithPayload(resp)
|
||||
})
|
||||
api.KmsKMSDeleteIdentityHandler = kmsAPI.KMSDeleteIdentityHandlerFunc(func(params kmsAPI.KMSDeleteIdentityParams, session *models.Principal) middleware.Responder {
|
||||
err := GetKMSDeleteIdentityResponse(session, params)
|
||||
if err != nil {
|
||||
return kmsAPI.NewKMSDeleteIdentityDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return kmsAPI.NewKMSDeleteIdentityOK()
|
||||
})
|
||||
}
|
||||
|
||||
func GetKMSDescribeIdentityResponse(session *models.Principal, params kmsAPI.KMSDescribeIdentityParams) (*models.KmsDescribeIdentityResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return describeIdentity(ctx, params.Name, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func describeIdentity(ctx context.Context, identity string, minioClient MinioAdmin) (*models.KmsDescribeIdentityResponse, *CodedAPIError) {
|
||||
i, err := minioClient.describeIdentity(ctx, identity)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsDescribeIdentityResponse{
|
||||
Policy: i.Policy,
|
||||
Admin: i.IsAdmin,
|
||||
Identity: i.Identity,
|
||||
CreatedAt: i.CreatedAt,
|
||||
CreatedBy: i.CreatedBy,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func GetKMSDescribeSelfIdentityResponse(session *models.Principal, params kmsAPI.KMSDescribeSelfIdentityParams) (*models.KmsDescribeSelfIdentityResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return describeSelfIdentity(ctx, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func describeSelfIdentity(ctx context.Context, minioClient MinioAdmin) (*models.KmsDescribeSelfIdentityResponse, *CodedAPIError) {
|
||||
i, err := minioClient.describeSelfIdentity(ctx)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsDescribeSelfIdentityResponse{
|
||||
Policy: &models.KmsGetPolicyResponse{
|
||||
Allow: i.Policy.Allow,
|
||||
Deny: i.Policy.Deny,
|
||||
},
|
||||
Identity: i.Identity,
|
||||
Admin: i.IsAdmin,
|
||||
CreatedAt: i.CreatedAt,
|
||||
CreatedBy: i.CreatedBy,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func GetKMSListIdentitiesResponse(session *models.Principal, params kmsAPI.KMSListIdentitiesParams) (*models.KmsListIdentitiesResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
pattern := ""
|
||||
if params.Pattern != nil {
|
||||
pattern = *params.Pattern
|
||||
}
|
||||
return listIdentities(ctx, pattern, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func listIdentities(ctx context.Context, pattern string, minioClient MinioAdmin) (*models.KmsListIdentitiesResponse, *CodedAPIError) {
|
||||
results, err := minioClient.listIdentities(ctx, pattern)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.KmsListIdentitiesResponse{Results: parseIdentities(results)}, nil
|
||||
}
|
||||
|
||||
func parseIdentities(results []madmin.KMSIdentityInfo) (data []*models.KmsIdentityInfo) {
|
||||
for _, policy := range results {
|
||||
data = append(data, &models.KmsIdentityInfo{
|
||||
CreatedAt: policy.CreatedAt,
|
||||
CreatedBy: policy.CreatedBy,
|
||||
Identity: policy.Identity,
|
||||
Error: policy.Error,
|
||||
Policy: policy.Policy,
|
||||
})
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
func GetKMSDeleteIdentityResponse(session *models.Principal, params kmsAPI.KMSDeleteIdentityParams) *CodedAPIError {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return deleteIdentity(ctx, params.Name, AdminClient{Client: mAdmin})
|
||||
}
|
||||
|
||||
func deleteIdentity(ctx context.Context, identity string, minioClient MinioAdmin) *CodedAPIError {
|
||||
if err := minioClient.deleteIdentity(ctx, identity); err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -78,20 +78,8 @@ func (suite *KMSTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) {
|
||||
suite.assert.Nil(api.KmsKMSAPIsHandler)
|
||||
suite.assert.Nil(api.KmsKMSVersionHandler)
|
||||
suite.assert.Nil(api.KmsKMSCreateKeyHandler)
|
||||
suite.assert.Nil(api.KmsKMSImportKeyHandler)
|
||||
suite.assert.Nil(api.KmsKMSListKeysHandler)
|
||||
suite.assert.Nil(api.KmsKMSKeyStatusHandler)
|
||||
suite.assert.Nil(api.KmsKMSDeleteKeyHandler)
|
||||
suite.assert.Nil(api.KmsKMSSetPolicyHandler)
|
||||
suite.assert.Nil(api.KmsKMSAssignPolicyHandler)
|
||||
suite.assert.Nil(api.KmsKMSDescribePolicyHandler)
|
||||
suite.assert.Nil(api.KmsKMSGetPolicyHandler)
|
||||
suite.assert.Nil(api.KmsKMSListPoliciesHandler)
|
||||
suite.assert.Nil(api.KmsKMSDeletePolicyHandler)
|
||||
suite.assert.Nil(api.KmsKMSDescribeIdentityHandler)
|
||||
suite.assert.Nil(api.KmsKMSDescribeSelfIdentityHandler)
|
||||
suite.assert.Nil(api.KmsKMSListIdentitiesHandler)
|
||||
suite.assert.Nil(api.KmsKMSDeleteIdentityHandler)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) {
|
||||
@@ -100,20 +88,8 @@ func (suite *KMSTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) {
|
||||
suite.assert.NotNil(api.KmsKMSAPIsHandler)
|
||||
suite.assert.NotNil(api.KmsKMSVersionHandler)
|
||||
suite.assert.NotNil(api.KmsKMSCreateKeyHandler)
|
||||
suite.assert.NotNil(api.KmsKMSImportKeyHandler)
|
||||
suite.assert.NotNil(api.KmsKMSListKeysHandler)
|
||||
suite.assert.NotNil(api.KmsKMSKeyStatusHandler)
|
||||
suite.assert.NotNil(api.KmsKMSDeleteKeyHandler)
|
||||
suite.assert.NotNil(api.KmsKMSSetPolicyHandler)
|
||||
suite.assert.NotNil(api.KmsKMSAssignPolicyHandler)
|
||||
suite.assert.NotNil(api.KmsKMSDescribePolicyHandler)
|
||||
suite.assert.NotNil(api.KmsKMSGetPolicyHandler)
|
||||
suite.assert.NotNil(api.KmsKMSListPoliciesHandler)
|
||||
suite.assert.NotNil(api.KmsKMSDeletePolicyHandler)
|
||||
suite.assert.NotNil(api.KmsKMSDescribeIdentityHandler)
|
||||
suite.assert.NotNil(api.KmsKMSDescribeSelfIdentityHandler)
|
||||
suite.assert.NotNil(api.KmsKMSListIdentitiesHandler)
|
||||
suite.assert.NotNil(api.KmsKMSDeleteIdentityHandler)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSStatusHandlerWithError() {
|
||||
@@ -217,25 +193,6 @@ func (suite *KMSTestSuite) TestKMSCreateKeyWithoutError() {
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSImportKeyHandlerWithError() {
|
||||
params, api := suite.initKMSImportKeyRequest()
|
||||
response := api.KmsKMSImportKeyHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSImportKeyDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSImportKeyRequest() (params kmsAPI.KMSImportKeyParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSImportKeyWithoutError() {
|
||||
ctx := context.Background()
|
||||
err := importKey(ctx, "key", []byte(""), suite.adminClient)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSListKeysHandlerWithError() {
|
||||
params, api := suite.initKMSListKeysRequest()
|
||||
response := api.KmsKMSListKeysHandler.Handle(params, &models.Principal{})
|
||||
@@ -276,223 +233,6 @@ func (suite *KMSTestSuite) TestKMSKeyStatusWithoutError() {
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDeleteKeyHandlerWithError() {
|
||||
params, api := suite.initKMSDeleteKeyRequest()
|
||||
response := api.KmsKMSDeleteKeyHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSDeleteKeyDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSDeleteKeyRequest() (params kmsAPI.KMSDeleteKeyParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDeleteKeyWithoutError() {
|
||||
ctx := context.Background()
|
||||
err := deleteKey(ctx, "key", suite.adminClient)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSSetPolicyHandlerWithError() {
|
||||
params, api := suite.initKMSSetPolicyRequest()
|
||||
response := api.KmsKMSSetPolicyHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSSetPolicyDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSSetPolicyRequest() (params kmsAPI.KMSSetPolicyParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
policy := "policy"
|
||||
params.Body = &models.KmsSetPolicyRequest{Policy: &policy}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSSetPolicyWithoutError() {
|
||||
ctx := context.Background()
|
||||
err := setPolicy(ctx, "policy", []byte(""), suite.adminClient)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSAssignPolicyHandlerWithError() {
|
||||
params, api := suite.initKMSAssignPolicyRequest()
|
||||
response := api.KmsKMSAssignPolicyHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSAssignPolicyDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSAssignPolicyRequest() (params kmsAPI.KMSAssignPolicyParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSAssignPolicyWithoutError() {
|
||||
ctx := context.Background()
|
||||
err := assignPolicy(ctx, "policy", []byte(""), suite.adminClient)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDescribePolicyHandlerWithError() {
|
||||
params, api := suite.initKMSDescribePolicyRequest()
|
||||
response := api.KmsKMSDescribePolicyHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSDescribePolicyDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSDescribePolicyRequest() (params kmsAPI.KMSDescribePolicyParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDescribePolicyWithoutError() {
|
||||
ctx := context.Background()
|
||||
res, err := describePolicy(ctx, "policy", suite.adminClient)
|
||||
suite.assert.NotNil(res)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSGetPolicyHandlerWithError() {
|
||||
params, api := suite.initKMSGetPolicyRequest()
|
||||
response := api.KmsKMSGetPolicyHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSGetPolicyDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSGetPolicyRequest() (params kmsAPI.KMSGetPolicyParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSGetPolicyWithoutError() {
|
||||
ctx := context.Background()
|
||||
res, err := getPolicy(ctx, "policy", suite.adminClient)
|
||||
suite.assert.NotNil(res)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSListPoliciesHandlerWithError() {
|
||||
params, api := suite.initKMSListPoliciesRequest()
|
||||
response := api.KmsKMSListPoliciesHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSListPoliciesDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSListPoliciesRequest() (params kmsAPI.KMSListPoliciesParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSListPoliciesWithoutError() {
|
||||
ctx := context.Background()
|
||||
res, err := listKMSPolicies(ctx, "", suite.adminClient)
|
||||
suite.assert.NotNil(res)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDeletePolicyHandlerWithError() {
|
||||
params, api := suite.initKMSDeletePolicyRequest()
|
||||
response := api.KmsKMSDeletePolicyHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSDeletePolicyDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSDeletePolicyRequest() (params kmsAPI.KMSDeletePolicyParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDeletePolicyWithoutError() {
|
||||
ctx := context.Background()
|
||||
err := deletePolicy(ctx, "policy", suite.adminClient)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDescribeIdentityHandlerWithError() {
|
||||
params, api := suite.initKMSDescribeIdentityRequest()
|
||||
response := api.KmsKMSDescribeIdentityHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSDescribeIdentityDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSDescribeIdentityRequest() (params kmsAPI.KMSDescribeIdentityParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDescribeIdentityWithoutError() {
|
||||
ctx := context.Background()
|
||||
res, err := describeIdentity(ctx, "identity", suite.adminClient)
|
||||
suite.assert.NotNil(res)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDescribeSelfIdentityHandlerWithError() {
|
||||
params, api := suite.initKMSDescribeSelfIdentityRequest()
|
||||
response := api.KmsKMSDescribeSelfIdentityHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSDescribeSelfIdentityDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSDescribeSelfIdentityRequest() (params kmsAPI.KMSDescribeSelfIdentityParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDescribeSelfIdentityWithoutError() {
|
||||
ctx := context.Background()
|
||||
res, err := describeSelfIdentity(ctx, suite.adminClient)
|
||||
suite.assert.NotNil(res)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSListIdentitiesHandlerWithError() {
|
||||
params, api := suite.initKMSListIdentitiesRequest()
|
||||
response := api.KmsKMSListIdentitiesHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSListIdentitiesDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSListIdentitiesRequest() (params kmsAPI.KMSListIdentitiesParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSListIdentitiesWithoutError() {
|
||||
ctx := context.Background()
|
||||
res, err := listIdentities(ctx, "", suite.adminClient)
|
||||
suite.assert.NotNil(res)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDeleteIdentityHandlerWithError() {
|
||||
params, api := suite.initKMSDeleteIdentityRequest()
|
||||
response := api.KmsKMSDeleteIdentityHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*kmsAPI.KMSDeleteIdentityDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) initKMSDeleteIdentityRequest() (params kmsAPI.KMSDeleteIdentityParams, api operations.ConsoleAPI) {
|
||||
registerKMSHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *KMSTestSuite) TestKMSDeleteIdentityWithoutError() {
|
||||
ctx := context.Background()
|
||||
err := deleteIdentity(ctx, "identity", suite.adminClient)
|
||||
suite.assert.Nil(err)
|
||||
}
|
||||
|
||||
func TestKMS(t *testing.T) {
|
||||
suite.Run(t, new(KMSTestSuite))
|
||||
}
|
||||
|
||||
@@ -550,9 +550,6 @@ func getAddPolicyResponse(session *models.Principal, params policyApi.AddPolicyP
|
||||
if params.Body == nil {
|
||||
return nil, ErrorWithContext(ctx, ErrPolicyBodyNotInRequest)
|
||||
}
|
||||
if strings.Contains(*params.Body.Name, " ") {
|
||||
return nil, ErrorWithContext(ctx, ErrPolicyNameContainsSpace)
|
||||
}
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
|
||||
@@ -20,42 +20,30 @@ import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/madmin-go/v3"
|
||||
"github.com/minio/websocket"
|
||||
)
|
||||
|
||||
var items []*models.StartProfilingItem
|
||||
|
||||
type profileOptions struct {
|
||||
Types string
|
||||
Types string
|
||||
Duration time.Duration
|
||||
}
|
||||
|
||||
func getProfileOptionsFromReq(req *http.Request) (*profileOptions, error) {
|
||||
pOptions := profileOptions{}
|
||||
pOptions.Types = req.FormValue("types")
|
||||
pOptions.Duration = 10 * time.Second // TODO: make this configurable
|
||||
return &pOptions, nil
|
||||
}
|
||||
|
||||
func startProfiling(ctx context.Context, conn WSConn, client MinioAdmin, pOpts *profileOptions) error {
|
||||
profilingResults, err := client.startProfiling(ctx, madmin.ProfilerType(pOpts.Types))
|
||||
data, err := client.startProfiling(ctx, madmin.ProfilerType(pOpts.Types), pOpts.Duration)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
items = []*models.StartProfilingItem{}
|
||||
for _, result := range profilingResults {
|
||||
items = append(items, &models.StartProfilingItem{
|
||||
Success: result.Success,
|
||||
Error: result.Error,
|
||||
NodeName: result.NodeName,
|
||||
})
|
||||
}
|
||||
zippedData, err := client.stopProfiling(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
message, err := io.ReadAll(zippedData)
|
||||
message, err := io.ReadAll(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/minio/madmin-go/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -52,22 +53,7 @@ func TestStartProfiling(t *testing.T) {
|
||||
|
||||
// Test-1 : startProfiling() Get response from MinIO server with one profiling object without errors
|
||||
// mock function response from startProfiling()
|
||||
minioStartProfiling = func(_ madmin.ProfilerType) ([]madmin.StartProfilingResult, error) {
|
||||
return []madmin.StartProfilingResult{
|
||||
{
|
||||
NodeName: "http://127.0.0.1:9000/",
|
||||
Success: true,
|
||||
Error: "",
|
||||
},
|
||||
{
|
||||
NodeName: "http://127.0.0.1:9001/",
|
||||
Success: true,
|
||||
Error: "",
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
// mock function response from stopProfiling()
|
||||
minioStopProfiling = func() (io.ReadCloser, error) {
|
||||
minioStartProfiling = func(_ madmin.ProfilerType, _ time.Duration) (io.ReadCloser, error) {
|
||||
return &ClosingBuffer{bytes.NewBufferString("In memory string eaeae")}, nil
|
||||
}
|
||||
// mock function response from mockConn.writeMessage()
|
||||
@@ -82,7 +68,7 @@ func TestStartProfiling(t *testing.T) {
|
||||
|
||||
// Test-2 : startProfiling() Correctly handles errors returned by MinIO
|
||||
// mock function response from startProfiling()
|
||||
minioStartProfiling = func(_ madmin.ProfilerType) ([]madmin.StartProfilingResult, error) {
|
||||
minioStartProfiling = func(_ madmin.ProfilerType, _ time.Duration) (io.ReadCloser, error) {
|
||||
return nil, errors.New("error")
|
||||
}
|
||||
err = startProfiling(ctx, mockWSConn, adminClient, testOptions)
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
// 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 api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/minio/console/api/operations"
|
||||
siteRepApi "github.com/minio/console/api/operations/site_replication"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/madmin-go/v3"
|
||||
)
|
||||
|
||||
func registerSiteReplicationStatusHandler(api *operations.ConsoleAPI) {
|
||||
api.SiteReplicationGetSiteReplicationStatusHandler = siteRepApi.GetSiteReplicationStatusHandlerFunc(func(params siteRepApi.GetSiteReplicationStatusParams, session *models.Principal) middleware.Responder {
|
||||
rInfo, err := getSRStatusResponse(session, params)
|
||||
if err != nil {
|
||||
return siteRepApi.NewGetSiteReplicationStatusDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return siteRepApi.NewGetSiteReplicationStatusOK().WithPayload(rInfo)
|
||||
})
|
||||
}
|
||||
|
||||
func getSRStatusResponse(session *models.Principal, params siteRepApi.GetSiteReplicationStatusParams) (*models.SiteReplicationStatusResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
res, err := getSRStats(ctx, adminClient, params)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func getSRStats(ctx context.Context, client MinioAdmin, params siteRepApi.GetSiteReplicationStatusParams) (info *models.SiteReplicationStatusResponse, err error) {
|
||||
srParams := madmin.SRStatusOptions{
|
||||
Buckets: *params.Buckets,
|
||||
Policies: *params.Policies,
|
||||
Users: *params.Users,
|
||||
Groups: *params.Groups,
|
||||
}
|
||||
if params.EntityType != nil && params.EntityValue != nil {
|
||||
srParams.Entity = madmin.GetSREntityType(*params.EntityType)
|
||||
srParams.EntityValue = *params.EntityValue
|
||||
}
|
||||
|
||||
srInfo, err := client.getSiteReplicationStatus(ctx, srParams)
|
||||
|
||||
retInfo := models.SiteReplicationStatusResponse{
|
||||
BucketStats: &srInfo.BucketStats,
|
||||
Enabled: srInfo.Enabled,
|
||||
GroupStats: srInfo.GroupStats,
|
||||
MaxBuckets: int64(srInfo.MaxBuckets),
|
||||
MaxGroups: int64(srInfo.MaxGroups),
|
||||
MaxPolicies: int64(srInfo.MaxPolicies),
|
||||
MaxUsers: int64(srInfo.MaxUsers),
|
||||
PolicyStats: &srInfo.PolicyStats,
|
||||
Sites: &srInfo.Sites,
|
||||
StatsSummary: srInfo.StatsSummary,
|
||||
UserStats: &srInfo.UserStats,
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &retInfo, nil
|
||||
}
|
||||
@@ -1,242 +0,0 @@
|
||||
// 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 api
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/minio/console/api/operations"
|
||||
siteRepApi "github.com/minio/console/api/operations/site_replication"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/madmin-go/v3"
|
||||
)
|
||||
|
||||
func registerSiteReplicationHandler(api *operations.ConsoleAPI) {
|
||||
api.SiteReplicationGetSiteReplicationInfoHandler = siteRepApi.GetSiteReplicationInfoHandlerFunc(func(params siteRepApi.GetSiteReplicationInfoParams, session *models.Principal) middleware.Responder {
|
||||
rInfo, err := getSRInfoResponse(session, params)
|
||||
if err != nil {
|
||||
return siteRepApi.NewGetSiteReplicationInfoDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return siteRepApi.NewGetSiteReplicationInfoOK().WithPayload(rInfo)
|
||||
})
|
||||
|
||||
api.SiteReplicationSiteReplicationInfoAddHandler = siteRepApi.SiteReplicationInfoAddHandlerFunc(func(params siteRepApi.SiteReplicationInfoAddParams, session *models.Principal) middleware.Responder {
|
||||
eInfo, err := getSRAddResponse(session, params)
|
||||
if err != nil {
|
||||
return siteRepApi.NewSiteReplicationInfoAddDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return siteRepApi.NewSiteReplicationInfoAddOK().WithPayload(eInfo)
|
||||
})
|
||||
|
||||
api.SiteReplicationSiteReplicationRemoveHandler = siteRepApi.SiteReplicationRemoveHandlerFunc(func(params siteRepApi.SiteReplicationRemoveParams, session *models.Principal) middleware.Responder {
|
||||
remRes, err := getSRRemoveResponse(session, params)
|
||||
if err != nil {
|
||||
return siteRepApi.NewSiteReplicationRemoveDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return siteRepApi.NewSiteReplicationRemoveNoContent().WithPayload(remRes)
|
||||
})
|
||||
|
||||
api.SiteReplicationSiteReplicationEditHandler = siteRepApi.SiteReplicationEditHandlerFunc(func(params siteRepApi.SiteReplicationEditParams, session *models.Principal) middleware.Responder {
|
||||
eInfo, err := getSREditResponse(session, params)
|
||||
if err != nil {
|
||||
return siteRepApi.NewSiteReplicationRemoveDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return siteRepApi.NewSiteReplicationEditOK().WithPayload(eInfo)
|
||||
})
|
||||
}
|
||||
|
||||
func getSRInfoResponse(session *models.Principal, params siteRepApi.GetSiteReplicationInfoParams) (*models.SiteReplicationInfoResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
|
||||
res, err := getSRConfig(ctx, adminClient)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func getSRAddResponse(session *models.Principal, params siteRepApi.SiteReplicationInfoAddParams) (*models.SiteReplicationAddResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
|
||||
res, err := addSiteReplication(ctx, adminClient, ¶ms)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func getSREditResponse(session *models.Principal, params siteRepApi.SiteReplicationEditParams) (*models.PeerSiteEditResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
eRes, err := editSiteReplication(ctx, adminClient, ¶ms)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return eRes, nil
|
||||
}
|
||||
|
||||
func getSRRemoveResponse(session *models.Principal, params siteRepApi.SiteReplicationRemoveParams) (*models.PeerSiteRemoveResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
rRes, err := removeSiteReplication(ctx, adminClient, ¶ms)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return rRes, nil
|
||||
}
|
||||
|
||||
func getSRConfig(ctx context.Context, client MinioAdmin) (info *models.SiteReplicationInfoResponse, err error) {
|
||||
srInfo, err := client.getSiteReplicationInfo(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var sites []*models.PeerInfo
|
||||
|
||||
if len(srInfo.Sites) > 0 {
|
||||
for _, s := range srInfo.Sites {
|
||||
pInfo := &models.PeerInfo{
|
||||
DeploymentID: s.DeploymentID,
|
||||
Endpoint: s.Endpoint,
|
||||
Name: s.Name,
|
||||
}
|
||||
sites = append(sites, pInfo)
|
||||
}
|
||||
}
|
||||
res := &models.SiteReplicationInfoResponse{
|
||||
Enabled: srInfo.Enabled,
|
||||
Name: srInfo.Name,
|
||||
ServiceAccountAccessKey: srInfo.ServiceAccountAccessKey,
|
||||
Sites: sites,
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func addSiteReplication(ctx context.Context, client MinioAdmin, params *siteRepApi.SiteReplicationInfoAddParams) (info *models.SiteReplicationAddResponse, err error) {
|
||||
var rSites []madmin.PeerSite
|
||||
|
||||
if len(params.Body) > 0 {
|
||||
for _, aSite := range params.Body {
|
||||
pInfo := &madmin.PeerSite{
|
||||
AccessKey: aSite.AccessKey,
|
||||
Name: aSite.Name,
|
||||
SecretKey: aSite.SecretKey,
|
||||
Endpoint: aSite.Endpoint,
|
||||
}
|
||||
rSites = append(rSites, *pInfo)
|
||||
}
|
||||
}
|
||||
qs := runtime.Values(params.HTTPRequest.URL.Query())
|
||||
_, qhkReplicateILMExpiry, _ := qs.GetOK("replicate-ilm-expiry")
|
||||
var opts madmin.SRAddOptions
|
||||
if qhkReplicateILMExpiry {
|
||||
opts.ReplicateILMExpiry = true
|
||||
}
|
||||
cc, err := client.addSiteReplicationInfo(ctx, rSites, opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res := &models.SiteReplicationAddResponse{
|
||||
ErrorDetail: cc.ErrDetail,
|
||||
InitialSyncErrorMessage: cc.InitialSyncErrorMessage,
|
||||
Status: cc.Status,
|
||||
Success: cc.Success,
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func editSiteReplication(ctx context.Context, client MinioAdmin, params *siteRepApi.SiteReplicationEditParams) (info *models.PeerSiteEditResponse, err error) {
|
||||
peerSiteInfo := &madmin.PeerInfo{
|
||||
Endpoint: params.Body.Endpoint, // only endpoint can be edited.
|
||||
Name: params.Body.Name, // does not get updated.
|
||||
DeploymentID: params.Body.DeploymentID, // readonly
|
||||
}
|
||||
qs := runtime.Values(params.HTTPRequest.URL.Query())
|
||||
_, qhkDisableILMExpiryReplication, _ := qs.GetOK("disable-ilm-expiry-replication")
|
||||
_, qhkEnableILMExpiryReplication, _ := qs.GetOK("enable-ilm-expiry-replication")
|
||||
var opts madmin.SREditOptions
|
||||
if qhkDisableILMExpiryReplication {
|
||||
opts.DisableILMExpiryReplication = true
|
||||
}
|
||||
if qhkEnableILMExpiryReplication {
|
||||
opts.EnableILMExpiryReplication = true
|
||||
}
|
||||
eRes, err := client.editSiteReplicationInfo(ctx, *peerSiteInfo, opts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
editRes := &models.PeerSiteEditResponse{
|
||||
ErrorDetail: eRes.ErrDetail,
|
||||
Status: eRes.Status,
|
||||
Success: eRes.Success,
|
||||
}
|
||||
return editRes, nil
|
||||
}
|
||||
|
||||
func removeSiteReplication(ctx context.Context, client MinioAdmin, params *siteRepApi.SiteReplicationRemoveParams) (info *models.PeerSiteRemoveResponse, err error) {
|
||||
delAll := params.Body.All
|
||||
siteNames := params.Body.Sites
|
||||
|
||||
var req *madmin.SRRemoveReq
|
||||
if delAll {
|
||||
req = &madmin.SRRemoveReq{
|
||||
RemoveAll: delAll,
|
||||
}
|
||||
} else {
|
||||
req = &madmin.SRRemoveReq{
|
||||
SiteNames: siteNames,
|
||||
RemoveAll: delAll,
|
||||
}
|
||||
}
|
||||
|
||||
rRes, err := client.deleteSiteReplicationInfo(ctx, *req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
removeRes := &models.PeerSiteRemoveResponse{
|
||||
ErrorDetail: rRes.ErrDetail,
|
||||
Status: rRes.Status,
|
||||
}
|
||||
return removeRes, nil
|
||||
}
|
||||
@@ -1,255 +0,0 @@
|
||||
// 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/>.
|
||||
|
||||
// These tests are for AdminAPI Tag based on swagger-console.yml
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/minio/madmin-go/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetSiteReplicationInfo(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// mock minIO client
|
||||
adminClient := AdminClientMock{}
|
||||
|
||||
function := "getSiteReplicationInfo()"
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
retValueMock := madmin.SiteReplicationInfo{
|
||||
Enabled: true,
|
||||
Name: "site1",
|
||||
Sites: []madmin.PeerInfo{
|
||||
{
|
||||
Endpoint: "http://localhost:9000",
|
||||
Name: "site1",
|
||||
DeploymentID: "12345",
|
||||
},
|
||||
{
|
||||
Endpoint: "http://localhost:9001",
|
||||
Name: "site2",
|
||||
DeploymentID: "123456",
|
||||
},
|
||||
},
|
||||
ServiceAccountAccessKey: "test-key",
|
||||
}
|
||||
|
||||
expValueMock := &madmin.SiteReplicationInfo{
|
||||
Enabled: true,
|
||||
Name: "site1",
|
||||
Sites: []madmin.PeerInfo{
|
||||
{
|
||||
Endpoint: "http://localhost:9000",
|
||||
Name: "site1",
|
||||
DeploymentID: "12345",
|
||||
},
|
||||
{
|
||||
Endpoint: "http://localhost:9001",
|
||||
Name: "site2",
|
||||
DeploymentID: "123456",
|
||||
},
|
||||
},
|
||||
ServiceAccountAccessKey: "test-key",
|
||||
}
|
||||
|
||||
getSiteReplicationInfo = func(_ context.Context) (info *madmin.SiteReplicationInfo, err error) {
|
||||
return &retValueMock, nil
|
||||
}
|
||||
|
||||
srInfo, err := adminClient.getSiteReplicationInfo(ctx)
|
||||
assert.Nil(err)
|
||||
assert.Equal(expValueMock, srInfo, fmt.Sprintf("Failed on %s: length of lists is not the same", function))
|
||||
}
|
||||
|
||||
func TestAddSiteReplicationInfo(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// mock minIO client
|
||||
adminClient := AdminClientMock{}
|
||||
|
||||
function := "addSiteReplicationInfo()"
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
retValueMock := &madmin.ReplicateAddStatus{
|
||||
Success: true,
|
||||
Status: "success",
|
||||
ErrDetail: "",
|
||||
InitialSyncErrorMessage: "",
|
||||
}
|
||||
|
||||
expValueMock := &madmin.ReplicateAddStatus{
|
||||
Success: true,
|
||||
Status: "success",
|
||||
ErrDetail: "",
|
||||
InitialSyncErrorMessage: "",
|
||||
}
|
||||
|
||||
addSiteReplicationInfo = func(_ context.Context, _ []madmin.PeerSite) (res *madmin.ReplicateAddStatus, err error) {
|
||||
return retValueMock, nil
|
||||
}
|
||||
|
||||
sites := []madmin.PeerSite{
|
||||
{
|
||||
Name: "site1",
|
||||
Endpoint: "http://localhost:9000",
|
||||
AccessKey: "test",
|
||||
SecretKey: "test",
|
||||
},
|
||||
{
|
||||
Name: "site2",
|
||||
Endpoint: "http://localhost:9001",
|
||||
AccessKey: "test",
|
||||
SecretKey: "test",
|
||||
},
|
||||
}
|
||||
|
||||
srInfo, err := adminClient.addSiteReplicationInfo(ctx, sites, madmin.SRAddOptions{})
|
||||
assert.Nil(err)
|
||||
assert.Equal(expValueMock, srInfo, fmt.Sprintf("Failed on %s: length of lists is not the same", function))
|
||||
}
|
||||
|
||||
func TestEditSiteReplicationInfo(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// mock minIO client
|
||||
adminClient := AdminClientMock{}
|
||||
|
||||
function := "editSiteReplicationInfo()"
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
retValueMock := &madmin.ReplicateEditStatus{
|
||||
Success: true,
|
||||
Status: "success",
|
||||
ErrDetail: "",
|
||||
}
|
||||
|
||||
expValueMock := &madmin.ReplicateEditStatus{
|
||||
Success: true,
|
||||
Status: "success",
|
||||
ErrDetail: "",
|
||||
}
|
||||
|
||||
editSiteReplicationInfo = func(_ context.Context, _ madmin.PeerInfo) (res *madmin.ReplicateEditStatus, err error) {
|
||||
return retValueMock, nil
|
||||
}
|
||||
|
||||
site := madmin.PeerInfo{
|
||||
Name: "",
|
||||
Endpoint: "",
|
||||
DeploymentID: "12345",
|
||||
}
|
||||
|
||||
srInfo, err := adminClient.editSiteReplicationInfo(ctx, site, madmin.SREditOptions{})
|
||||
assert.Nil(err)
|
||||
assert.Equal(expValueMock, srInfo, fmt.Sprintf("Failed on %s: length of lists is not the same", function))
|
||||
}
|
||||
|
||||
func TestDeleteSiteReplicationInfo(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// mock minIO client
|
||||
adminClient := AdminClientMock{}
|
||||
|
||||
function := "deleteSiteReplicationInfo()"
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
retValueMock := &madmin.ReplicateRemoveStatus{
|
||||
Status: "success",
|
||||
ErrDetail: "",
|
||||
}
|
||||
|
||||
expValueMock := &madmin.ReplicateRemoveStatus{
|
||||
Status: "success",
|
||||
ErrDetail: "",
|
||||
}
|
||||
|
||||
deleteSiteReplicationInfoMock = func(_ context.Context, _ madmin.SRRemoveReq) (res *madmin.ReplicateRemoveStatus, err error) {
|
||||
return retValueMock, nil
|
||||
}
|
||||
|
||||
remReq := madmin.SRRemoveReq{
|
||||
SiteNames: []string{
|
||||
"test1",
|
||||
},
|
||||
RemoveAll: false,
|
||||
}
|
||||
|
||||
srInfo, err := adminClient.deleteSiteReplicationInfo(ctx, remReq)
|
||||
assert.Nil(err)
|
||||
assert.Equal(expValueMock, srInfo, fmt.Sprintf("Failed on %s: length of lists is not the same", function))
|
||||
}
|
||||
|
||||
func TestSiteReplicationStatus(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// mock minIO client
|
||||
adminClient := AdminClientMock{}
|
||||
|
||||
function := "getSiteReplicationStatus()"
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
|
||||
retValueMock := madmin.SRStatusInfo{
|
||||
Enabled: true,
|
||||
MaxBuckets: 0,
|
||||
MaxUsers: 0,
|
||||
MaxGroups: 0,
|
||||
MaxPolicies: 0,
|
||||
Sites: nil,
|
||||
StatsSummary: nil,
|
||||
BucketStats: nil,
|
||||
PolicyStats: nil,
|
||||
UserStats: nil,
|
||||
GroupStats: nil,
|
||||
}
|
||||
|
||||
expValueMock := &madmin.SRStatusInfo{
|
||||
Enabled: true,
|
||||
MaxBuckets: 0,
|
||||
MaxUsers: 0,
|
||||
MaxGroups: 0,
|
||||
MaxPolicies: 0,
|
||||
Sites: nil,
|
||||
StatsSummary: nil,
|
||||
BucketStats: nil,
|
||||
PolicyStats: nil,
|
||||
UserStats: nil,
|
||||
GroupStats: nil,
|
||||
}
|
||||
|
||||
getSiteReplicationStatus = func(_ context.Context, _ madmin.SRStatusOptions) (info *madmin.SRStatusInfo, err error) {
|
||||
return &retValueMock, nil
|
||||
}
|
||||
|
||||
reqValues := madmin.SRStatusOptions{
|
||||
Buckets: true,
|
||||
Policies: true,
|
||||
Users: true,
|
||||
Groups: true,
|
||||
}
|
||||
srInfo, err := adminClient.getSiteReplicationStatus(ctx, reqValues)
|
||||
if err != nil {
|
||||
assert.Error(err)
|
||||
}
|
||||
|
||||
assert.Equal(expValueMock, srInfo, fmt.Sprintf("Failed on %s: expected result is not same", function))
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/minio/madmin-go/v3"
|
||||
"github.com/minio/websocket"
|
||||
)
|
||||
|
||||
// getSpeedtesthOptionsFromReq gets duration, size & concurrent requests from a websocket
|
||||
// path come as : `/speedtest?duration=2h&size=12MiB&concurrent=10`
|
||||
func getSpeedtestOptionsFromReq(req *http.Request) (*madmin.SpeedtestOpts, error) {
|
||||
optionsSet := madmin.SpeedtestOpts{}
|
||||
|
||||
queryPairs := req.URL.Query()
|
||||
|
||||
paramDuration := queryPairs.Get("duration")
|
||||
|
||||
if paramDuration == "" {
|
||||
paramDuration = "10s"
|
||||
}
|
||||
|
||||
duration, err := time.ParseDuration(paramDuration)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to parse duration: %s", paramDuration)
|
||||
}
|
||||
|
||||
if duration <= 0 {
|
||||
return nil, fmt.Errorf("duration cannot be 0 or negative")
|
||||
}
|
||||
|
||||
optionsSet.Duration = duration
|
||||
|
||||
paramSize := queryPairs.Get("size")
|
||||
|
||||
if paramSize == "" {
|
||||
paramSize = "64MiB"
|
||||
}
|
||||
|
||||
size, err := humanize.ParseBytes(paramSize)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to parse object size")
|
||||
}
|
||||
|
||||
optionsSet.Size = int(size)
|
||||
|
||||
paramConcurrent := queryPairs.Get("concurrent")
|
||||
|
||||
if paramConcurrent == "" {
|
||||
paramConcurrent = "32"
|
||||
}
|
||||
|
||||
concurrent, err := strconv.Atoi(paramConcurrent)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid concurrent value: %s", paramConcurrent)
|
||||
}
|
||||
|
||||
if concurrent <= 0 {
|
||||
return nil, fmt.Errorf("concurrency cannot be '0' or negative")
|
||||
}
|
||||
|
||||
optionsSet.Concurrency = concurrent
|
||||
|
||||
autotune := queryPairs.Get("autotune")
|
||||
|
||||
if autotune == "true" {
|
||||
optionsSet.Autotune = true
|
||||
}
|
||||
|
||||
return &optionsSet, nil
|
||||
}
|
||||
|
||||
func startSpeedtest(ctx context.Context, conn WSConn, client MinioAdmin, speedtestOpts *madmin.SpeedtestOpts) error {
|
||||
speedtestRes, err := client.speedtest(ctx, *speedtestOpts)
|
||||
if err != nil {
|
||||
LogError("error initializing speedtest: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
for result := range speedtestRes {
|
||||
// Serializing message
|
||||
bytes, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
LogError("error serializing json: %v", err)
|
||||
return err
|
||||
}
|
||||
// Send Message through websocket connection
|
||||
err = conn.writeMessage(websocket.TextMessage, bytes)
|
||||
if err != nil {
|
||||
LogError("error writing speedtest response: %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,435 +0,0 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/minio/console/pkg/utils"
|
||||
|
||||
xhttp "github.com/minio/console/pkg/http"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/minio/console/api/operations"
|
||||
subnetApi "github.com/minio/console/api/operations/subnet"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/console/pkg/subnet"
|
||||
"github.com/minio/madmin-go/v3"
|
||||
)
|
||||
|
||||
func registerSubnetHandlers(api *operations.ConsoleAPI) {
|
||||
// Get subnet login handler
|
||||
api.SubnetSubnetLoginHandler = subnetApi.SubnetLoginHandlerFunc(func(params subnetApi.SubnetLoginParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetSubnetLoginResponse(session, params)
|
||||
if err != nil {
|
||||
return subnetApi.NewSubnetLoginDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return subnetApi.NewSubnetLoginOK().WithPayload(resp)
|
||||
})
|
||||
// Get subnet login with MFA handler
|
||||
api.SubnetSubnetLoginMFAHandler = subnetApi.SubnetLoginMFAHandlerFunc(func(params subnetApi.SubnetLoginMFAParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetSubnetLoginWithMFAResponse(session, params)
|
||||
if err != nil {
|
||||
return subnetApi.NewSubnetLoginMFADefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return subnetApi.NewSubnetLoginMFAOK().WithPayload(resp)
|
||||
})
|
||||
// Get subnet register
|
||||
api.SubnetSubnetRegisterHandler = subnetApi.SubnetRegisterHandlerFunc(func(params subnetApi.SubnetRegisterParams, session *models.Principal) middleware.Responder {
|
||||
err := GetSubnetRegisterResponse(session, params)
|
||||
if err != nil {
|
||||
return subnetApi.NewSubnetRegisterDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return subnetApi.NewSubnetRegisterOK()
|
||||
})
|
||||
// Get subnet info
|
||||
api.SubnetSubnetInfoHandler = subnetApi.SubnetInfoHandlerFunc(func(params subnetApi.SubnetInfoParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetSubnetInfoResponse(session, params)
|
||||
if err != nil {
|
||||
return subnetApi.NewSubnetInfoDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return subnetApi.NewSubnetInfoOK().WithPayload(resp)
|
||||
})
|
||||
// Get subnet registration token
|
||||
api.SubnetSubnetRegTokenHandler = subnetApi.SubnetRegTokenHandlerFunc(func(params subnetApi.SubnetRegTokenParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetSubnetRegTokenResponse(session, params)
|
||||
if err != nil {
|
||||
return subnetApi.NewSubnetRegTokenDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return subnetApi.NewSubnetRegTokenOK().WithPayload(resp)
|
||||
})
|
||||
|
||||
api.SubnetSubnetAPIKeyHandler = subnetApi.SubnetAPIKeyHandlerFunc(func(params subnetApi.SubnetAPIKeyParams, session *models.Principal) middleware.Responder {
|
||||
resp, err := GetSubnetAPIKeyResponse(session, params)
|
||||
if err != nil {
|
||||
return subnetApi.NewSubnetAPIKeyDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return subnetApi.NewSubnetAPIKeyOK().WithPayload(resp)
|
||||
})
|
||||
}
|
||||
|
||||
const EnvSubnetLicense = "CONSOLE_SUBNET_LICENSE"
|
||||
|
||||
func SubnetRegisterWithAPIKey(ctx context.Context, minioClient MinioAdmin, apiKey string) (bool, error) {
|
||||
serverInfo, err := minioClient.serverInfo(ctx)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
clientIP := utils.ClientIPFromContext(ctx)
|
||||
registerResult, err := subnet.Register(GetConsoleHTTPClient(clientIP), serverInfo, apiKey, "", "")
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
// Keep existing subnet proxy if exists
|
||||
subnetKey, err := GetSubnetKeyFromMinIOConfig(ctx, minioClient)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
configStr := fmt.Sprintf("subnet license=%s api_key=%s proxy=%s", registerResult.License, registerResult.APIKey, subnetKey.Proxy)
|
||||
_, err = minioClient.setConfigKV(ctx, configStr)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
// cluster registered correctly
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func SubnetLogin(client xhttp.ClientI, username, password string) (string, string, error) {
|
||||
tokens, err := subnet.Login(client, username, password)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
if tokens.MfaToken != "" {
|
||||
// user needs to complete login flow using mfa
|
||||
return "", tokens.MfaToken, nil
|
||||
}
|
||||
if tokens.AccessToken != "" {
|
||||
// register token to minio
|
||||
return tokens.AccessToken, "", nil
|
||||
}
|
||||
return "", "", errors.New("something went wrong")
|
||||
}
|
||||
|
||||
func GetSubnetLoginResponse(session *models.Principal, params subnetApi.SubnetLoginParams) (*models.SubnetLoginResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return subnetLoginResponse(ctx, AdminClient{Client: mAdmin}, params)
|
||||
}
|
||||
|
||||
func subnetLoginResponse(ctx context.Context, minioClient MinioAdmin, params subnetApi.SubnetLoginParams) (*models.SubnetLoginResponse, *CodedAPIError) {
|
||||
subnetHTTPClient, err := GetSubnetHTTPClient(ctx, minioClient)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
apiKey := params.Body.APIKey
|
||||
if apiKey != "" {
|
||||
registered, err := SubnetRegisterWithAPIKey(ctx, minioClient, apiKey)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.SubnetLoginResponse{
|
||||
Registered: registered,
|
||||
Organizations: []*models.SubnetOrganization{},
|
||||
}, nil
|
||||
}
|
||||
username := params.Body.Username
|
||||
password := params.Body.Password
|
||||
if username != "" && password != "" {
|
||||
token, mfa, err := SubnetLogin(subnetHTTPClient, username, password)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.SubnetLoginResponse{
|
||||
MfaToken: mfa,
|
||||
AccessToken: token,
|
||||
Organizations: []*models.SubnetOrganization{},
|
||||
}, nil
|
||||
}
|
||||
return nil, ErrorWithContext(ctx, ErrDefault)
|
||||
}
|
||||
|
||||
type SubnetRegistration struct {
|
||||
AccessToken string
|
||||
MFAToken string
|
||||
Organizations []models.SubnetOrganization
|
||||
}
|
||||
|
||||
func SubnetLoginWithMFA(client xhttp.ClientI, username, mfaToken, otp string) (*models.SubnetLoginResponse, error) {
|
||||
tokens, err := subnet.LoginWithMFA(client, username, mfaToken, otp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tokens.AccessToken != "" {
|
||||
organizations, errOrg := subnet.GetOrganizations(client, tokens.AccessToken)
|
||||
if errOrg != nil {
|
||||
return nil, errOrg
|
||||
}
|
||||
return &models.SubnetLoginResponse{
|
||||
AccessToken: tokens.AccessToken,
|
||||
Organizations: organizations,
|
||||
}, nil
|
||||
}
|
||||
return nil, errors.New("something went wrong")
|
||||
}
|
||||
|
||||
// GetSubnetHTTPClient will return a client with proxy if configured, otherwise will return the default console http client
|
||||
func GetSubnetHTTPClient(ctx context.Context, minioClient MinioAdmin) (*xhttp.Client, error) {
|
||||
clientIP := utils.ClientIPFromContext(ctx)
|
||||
subnetKey, err := GetSubnetKeyFromMinIOConfig(ctx, minioClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
proxy := getSubnetProxy()
|
||||
if subnetKey.Proxy != "" {
|
||||
proxy = subnetKey.Proxy
|
||||
}
|
||||
|
||||
tr := GlobalTransport.Clone()
|
||||
if proxy != "" {
|
||||
u, err := url.Parse(proxy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tr.Proxy = http.ProxyURL(u)
|
||||
}
|
||||
|
||||
return &xhttp.Client{
|
||||
Client: &http.Client{
|
||||
Transport: &ConsoleTransport{
|
||||
Transport: tr,
|
||||
ClientIP: clientIP,
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func GetSubnetLoginWithMFAResponse(session *models.Principal, params subnetApi.SubnetLoginMFAParams) (*models.SubnetLoginResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
minioClient := AdminClient{Client: mAdmin}
|
||||
return subnetLoginWithMFAResponse(ctx, minioClient, params)
|
||||
}
|
||||
|
||||
func subnetLoginWithMFAResponse(ctx context.Context, minioClient MinioAdmin, params subnetApi.SubnetLoginMFAParams) (*models.SubnetLoginResponse, *CodedAPIError) {
|
||||
subnetHTTPClient, err := GetSubnetHTTPClient(ctx, minioClient)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
resp, err := SubnetLoginWithMFA(subnetHTTPClient, *params.Body.Username, *params.Body.MfaToken, *params.Body.Otp)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func GetSubnetKeyFromMinIOConfig(ctx context.Context, minioClient MinioAdmin) (*subnet.LicenseTokenConfig, error) {
|
||||
buf, err := minioClient.getConfigKV(ctx, madmin.SubnetSubSys)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
subSysConfigs, err := madmin.ParseServerConfigOutput(string(buf))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, scfg := range subSysConfigs {
|
||||
if scfg.Target == "" {
|
||||
res := subnet.LicenseTokenConfig{}
|
||||
res.APIKey, _ = scfg.Lookup("api_key")
|
||||
res.License, _ = scfg.Lookup("license")
|
||||
res.Proxy, _ = scfg.Lookup("proxy")
|
||||
return &res, nil
|
||||
}
|
||||
}
|
||||
|
||||
return nil, errors.New("unable to find subnet configuration")
|
||||
}
|
||||
|
||||
func GetSubnetRegister(ctx context.Context, minioClient MinioAdmin, httpClient xhttp.ClientI, params subnetApi.SubnetRegisterParams) error {
|
||||
serverInfo, err := minioClient.serverInfo(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
registerResult, err := subnet.Register(httpClient, serverInfo, "", *params.Body.Token, *params.Body.AccountID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Keep existing subnet proxy if exists
|
||||
subnetKey, err := GetSubnetKeyFromMinIOConfig(ctx, minioClient)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
configStr := fmt.Sprintf("subnet license=%s api_key=%s proxy=%s", registerResult.License, registerResult.APIKey, subnetKey.Proxy)
|
||||
_, err = minioClient.setConfigKV(ctx, configStr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetSubnetRegisterResponse(session *models.Principal, params subnetApi.SubnetRegisterParams) *CodedAPIError {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
return subnetRegisterResponse(ctx, adminClient, params)
|
||||
}
|
||||
|
||||
func subnetRegisterResponse(ctx context.Context, minioClient MinioAdmin, params subnetApi.SubnetRegisterParams) *CodedAPIError {
|
||||
subnetHTTPClient, err := GetSubnetHTTPClient(ctx, minioClient)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
err = GetSubnetRegister(ctx, minioClient, subnetHTTPClient, params)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var ErrSubnetLicenseNotFound = errors.New("license not found")
|
||||
|
||||
func GetSubnetInfoResponse(session *models.Principal, params subnetApi.SubnetInfoParams) (*models.License, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
clientIP := utils.ClientIPFromContext(ctx)
|
||||
client := &xhttp.Client{
|
||||
Client: GetConsoleHTTPClient(clientIP),
|
||||
}
|
||||
// license gets seeded to us by MinIO
|
||||
seededLicense := os.Getenv(EnvSubnetLicense)
|
||||
// if it's missing, we will gracefully fallback to attempt to fetch it from MinIO
|
||||
if seededLicense == "" {
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
|
||||
configBytes, err := adminClient.getConfigKV(params.HTTPRequest.Context(), "subnet")
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
subSysConfigs, err := madmin.ParseServerConfigOutput(string(configBytes))
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
// search for licese
|
||||
for _, v := range subSysConfigs {
|
||||
for _, sv := range v.KV {
|
||||
if sv.Key == "license" {
|
||||
seededLicense = sv.Value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// still empty means not found
|
||||
if seededLicense == "" {
|
||||
return nil, ErrorWithContext(ctx, ErrSubnetLicenseNotFound)
|
||||
}
|
||||
|
||||
licenseInfo, err := getLicenseInfo(*client.Client, seededLicense)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
license := &models.License{
|
||||
Email: licenseInfo.Email,
|
||||
AccountID: licenseInfo.AccountID,
|
||||
StorageCapacity: licenseInfo.StorageCapacity,
|
||||
Plan: licenseInfo.Plan,
|
||||
ExpiresAt: licenseInfo.ExpiresAt.String(),
|
||||
Organization: licenseInfo.Organization,
|
||||
}
|
||||
return license, nil
|
||||
}
|
||||
|
||||
func GetSubnetRegToken(ctx context.Context, minioClient MinioAdmin) (string, error) {
|
||||
serverInfo, err := minioClient.serverInfo(ctx)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
regInfo := subnet.GetClusterRegInfo(serverInfo)
|
||||
regToken, err := subnet.GenerateRegToken(regInfo)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return regToken, nil
|
||||
}
|
||||
|
||||
func GetSubnetRegTokenResponse(session *models.Principal, params subnetApi.SubnetRegTokenParams) (*models.SubnetRegTokenResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
return subnetRegTokenResponse(ctx, adminClient)
|
||||
}
|
||||
|
||||
func subnetRegTokenResponse(ctx context.Context, minioClient MinioAdmin) (*models.SubnetRegTokenResponse, *CodedAPIError) {
|
||||
token, err := GetSubnetRegToken(ctx, minioClient)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.SubnetRegTokenResponse{
|
||||
RegToken: token,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func GetSubnetAPIKeyResponse(session *models.Principal, params subnetApi.SubnetAPIKeyParams) (*models.APIKey, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
return subnetAPIKeyResponse(ctx, adminClient, params)
|
||||
}
|
||||
|
||||
func subnetAPIKeyResponse(ctx context.Context, minioClient MinioAdmin, params subnetApi.SubnetAPIKeyParams) (*models.APIKey, *CodedAPIError) {
|
||||
subnetHTTPClient, err := GetSubnetHTTPClient(ctx, minioClient)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
token := params.HTTPRequest.URL.Query().Get("token")
|
||||
apiKey, err := subnet.GetAPIKey(subnetHTTPClient, token)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return &models.APIKey{APIKey: apiKey}, nil
|
||||
}
|
||||
@@ -1,233 +0,0 @@
|
||||
// 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 api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/minio/console/api/operations"
|
||||
subnetApi "github.com/minio/console/api/operations/subnet"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/madmin-go/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type AdminSubnetTestSuite struct {
|
||||
suite.Suite
|
||||
assert *assert.Assertions
|
||||
currentServer string
|
||||
isServerSet bool
|
||||
server *httptest.Server
|
||||
adminClient AdminClientMock
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) SetupSuite() {
|
||||
suite.assert = assert.New(suite.T())
|
||||
suite.adminClient = AdminClientMock{}
|
||||
minioGetConfigKVMock = func(_ string) ([]byte, error) {
|
||||
return []byte("subnet license=mock api_key=mock proxy=http://mock.com"), nil
|
||||
}
|
||||
MinioServerInfoMock = func(_ context.Context) (madmin.InfoMessage, error) {
|
||||
return madmin.InfoMessage{Servers: []madmin.ServerProperties{{}}}, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) SetupTest() {
|
||||
suite.server = httptest.NewServer(http.HandlerFunc(suite.serverHandler))
|
||||
suite.currentServer, suite.isServerSet = os.LookupEnv(ConsoleMinIOServer)
|
||||
os.Setenv(ConsoleMinIOServer, suite.server.URL)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) serverHandler(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(400)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TearDownSuite() {
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TearDownTest() {
|
||||
if suite.isServerSet {
|
||||
os.Setenv(ConsoleMinIOServer, suite.currentServer)
|
||||
} else {
|
||||
os.Unsetenv(ConsoleMinIOServer)
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestRegisterSubnetHandlers() {
|
||||
api := &operations.ConsoleAPI{}
|
||||
suite.assertHandlersAreNil(api)
|
||||
registerSubnetHandlers(api)
|
||||
suite.assertHandlersAreNotNil(api)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) assertHandlersAreNil(api *operations.ConsoleAPI) {
|
||||
suite.assert.Nil(api.SubnetSubnetLoginHandler)
|
||||
suite.assert.Nil(api.SubnetSubnetLoginMFAHandler)
|
||||
suite.assert.Nil(api.SubnetSubnetRegisterHandler)
|
||||
suite.assert.Nil(api.SubnetSubnetInfoHandler)
|
||||
suite.assert.Nil(api.SubnetSubnetRegTokenHandler)
|
||||
suite.assert.Nil(api.SubnetSubnetAPIKeyHandler)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) assertHandlersAreNotNil(api *operations.ConsoleAPI) {
|
||||
suite.assert.NotNil(api.SubnetSubnetLoginHandler)
|
||||
suite.assert.NotNil(api.SubnetSubnetLoginMFAHandler)
|
||||
suite.assert.NotNil(api.SubnetSubnetRegisterHandler)
|
||||
suite.assert.NotNil(api.SubnetSubnetInfoHandler)
|
||||
suite.assert.NotNil(api.SubnetSubnetRegTokenHandler)
|
||||
suite.assert.NotNil(api.SubnetSubnetAPIKeyHandler)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetLoginWithSubnetClientError() {
|
||||
params, api := suite.initSubnetLoginRequest("", "", "")
|
||||
response := api.SubnetSubnetLoginHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*subnetApi.SubnetLoginDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetLoginResponseWithApiKeyError() {
|
||||
params, _ := suite.initSubnetLoginRequest("mock", "", "")
|
||||
res, err := subnetLoginResponse(context.TODO(), suite.adminClient, params)
|
||||
suite.assert.NotNil(err)
|
||||
suite.assert.Nil(res)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetLoginResponseWithCredentialsError() {
|
||||
params, _ := suite.initSubnetLoginRequest("", "mock", "mock")
|
||||
res, err := subnetLoginResponse(context.TODO(), suite.adminClient, params)
|
||||
suite.assert.NotNil(err)
|
||||
suite.assert.Nil(res)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) initSubnetLoginRequest(apiKey, username, password string) (params subnetApi.SubnetLoginParams, api operations.ConsoleAPI) {
|
||||
registerSubnetHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
params.Body = &models.SubnetLoginRequest{}
|
||||
params.Body.APIKey = apiKey
|
||||
params.Body.Username = username
|
||||
params.Body.Password = password
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetLoginMFAWithSubnetClientError() {
|
||||
params, api := suite.initSubnetLoginMFARequest("", "", "")
|
||||
response := api.SubnetSubnetLoginMFAHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*subnetApi.SubnetLoginMFADefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetLoginWithMFAResponseError() {
|
||||
params, _ := suite.initSubnetLoginMFARequest("mock", "mock", "mock")
|
||||
res, err := subnetLoginWithMFAResponse(context.TODO(), suite.adminClient, params)
|
||||
suite.assert.NotNil(err)
|
||||
suite.assert.Nil(res)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) initSubnetLoginMFARequest(username, mfaToken, otp string) (params subnetApi.SubnetLoginMFAParams, api operations.ConsoleAPI) {
|
||||
registerSubnetHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
params.Body = &models.SubnetLoginMFARequest{}
|
||||
params.Body.Username = &username
|
||||
params.Body.MfaToken = &mfaToken
|
||||
params.Body.Otp = &otp
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetRegisterClientError() {
|
||||
params, api := suite.initSubnetRegisterRequest("", "")
|
||||
response := api.SubnetSubnetRegisterHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*subnetApi.SubnetRegisterDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetRegisterResponseError() {
|
||||
params, _ := suite.initSubnetRegisterRequest("mock", "mock")
|
||||
err := subnetRegisterResponse(context.TODO(), suite.adminClient, params)
|
||||
suite.assert.NotNil(err)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) initSubnetRegisterRequest(token, accountID string) (params subnetApi.SubnetRegisterParams, api operations.ConsoleAPI) {
|
||||
registerSubnetHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
params.Body = &models.SubnetRegisterRequest{}
|
||||
params.Body.Token = &token
|
||||
params.Body.AccountID = &accountID
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetInfoError() {
|
||||
params, api := suite.initSubnetInfoRequest()
|
||||
response := api.SubnetSubnetInfoHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*subnetApi.SubnetInfoDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) initSubnetInfoRequest() (params subnetApi.SubnetInfoParams, api operations.ConsoleAPI) {
|
||||
registerSubnetHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetRegTokenError() {
|
||||
params, api := suite.initSubnetRegTokenRequest()
|
||||
response := api.SubnetSubnetRegTokenHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*subnetApi.SubnetRegTokenDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetRegTokenResponse() {
|
||||
res, err := subnetRegTokenResponse(context.TODO(), suite.adminClient)
|
||||
suite.assert.Nil(err)
|
||||
suite.assert.NotEqual("", res)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) initSubnetRegTokenRequest() (params subnetApi.SubnetRegTokenParams, api operations.ConsoleAPI) {
|
||||
registerSubnetHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetAPIKeyWithClientError() {
|
||||
params, api := suite.initSubnetAPIKeyRequest()
|
||||
response := api.SubnetSubnetAPIKeyHandler.Handle(params, &models.Principal{})
|
||||
_, ok := response.(*subnetApi.SubnetAPIKeyDefault)
|
||||
suite.assert.True(ok)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) TestSubnetAPIKeyResponseError() {
|
||||
params, _ := suite.initSubnetAPIKeyRequest()
|
||||
res, err := subnetAPIKeyResponse(context.TODO(), suite.adminClient, params)
|
||||
suite.assert.NotNil(err)
|
||||
suite.assert.Nil(res)
|
||||
}
|
||||
|
||||
func (suite *AdminSubnetTestSuite) initSubnetAPIKeyRequest() (params subnetApi.SubnetAPIKeyParams, api operations.ConsoleAPI) {
|
||||
registerSubnetHandlers(&api)
|
||||
params.HTTPRequest = &http.Request{}
|
||||
params.HTTPRequest.URL = &url.URL{}
|
||||
return params, api
|
||||
}
|
||||
|
||||
func TestAdminSubnet(t *testing.T) {
|
||||
suite.Run(t, new(AdminSubnetTestSuite))
|
||||
}
|
||||
@@ -1,488 +0,0 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"strconv"
|
||||
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/minio/console/api/operations"
|
||||
"github.com/minio/console/api/operations/tiering"
|
||||
tieringApi "github.com/minio/console/api/operations/tiering"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/madmin-go/v3"
|
||||
)
|
||||
|
||||
func registerAdminTiersHandlers(api *operations.ConsoleAPI) {
|
||||
// return a list of notification endpoints
|
||||
api.TieringTiersListHandler = tieringApi.TiersListHandlerFunc(func(params tieringApi.TiersListParams, session *models.Principal) middleware.Responder {
|
||||
tierList, err := getTiersResponse(session, params)
|
||||
if err != nil {
|
||||
return tieringApi.NewTiersListDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return tieringApi.NewTiersListOK().WithPayload(tierList)
|
||||
})
|
||||
api.TieringTiersListNamesHandler = tiering.TiersListNamesHandlerFunc(func(params tiering.TiersListNamesParams, session *models.Principal) middleware.Responder {
|
||||
tierList, err := getTiersNameResponse(session, params)
|
||||
if err != nil {
|
||||
return tieringApi.NewTiersListDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return tieringApi.NewTiersListNamesOK().WithPayload(tierList)
|
||||
})
|
||||
// add a new tiers
|
||||
api.TieringAddTierHandler = tieringApi.AddTierHandlerFunc(func(params tieringApi.AddTierParams, session *models.Principal) middleware.Responder {
|
||||
err := getAddTierResponse(session, params)
|
||||
if err != nil {
|
||||
return tieringApi.NewAddTierDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return tieringApi.NewAddTierCreated()
|
||||
})
|
||||
// get a tier
|
||||
api.TieringGetTierHandler = tieringApi.GetTierHandlerFunc(func(params tieringApi.GetTierParams, session *models.Principal) middleware.Responder {
|
||||
notifEndpoints, err := getGetTierResponse(session, params)
|
||||
if err != nil {
|
||||
return tieringApi.NewGetTierDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return tieringApi.NewGetTierOK().WithPayload(notifEndpoints)
|
||||
})
|
||||
// edit credentials for a tier
|
||||
api.TieringEditTierCredentialsHandler = tieringApi.EditTierCredentialsHandlerFunc(func(params tieringApi.EditTierCredentialsParams, session *models.Principal) middleware.Responder {
|
||||
err := getEditTierCredentialsResponse(session, params)
|
||||
if err != nil {
|
||||
return tieringApi.NewEditTierCredentialsDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return tieringApi.NewEditTierCredentialsOK()
|
||||
})
|
||||
// remove an empty tier
|
||||
api.TieringRemoveTierHandler = tieringApi.RemoveTierHandlerFunc(func(params tieringApi.RemoveTierParams, session *models.Principal) middleware.Responder {
|
||||
err := getRemoveTierResponse(session, params)
|
||||
if err != nil {
|
||||
return tieringApi.NewRemoveTierDefault(err.Code).WithPayload(err.APIError)
|
||||
}
|
||||
return tieringApi.NewRemoveTierNoContent()
|
||||
})
|
||||
}
|
||||
|
||||
// getTiers returns a list of tiers with their stats
|
||||
func getTiers(ctx context.Context, client MinioAdmin) (*models.TierListResponse, error) {
|
||||
tiers, err := client.listTiers(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tierStatsInfo, err := client.tierStats(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tiersStatsMap := make(map[string]madmin.TierStats, len(tierStatsInfo))
|
||||
for _, stat := range tierStatsInfo {
|
||||
tiersStatsMap[stat.Name] = stat.Stats
|
||||
}
|
||||
|
||||
var tiersList []*models.Tier
|
||||
for _, tierData := range tiers {
|
||||
// Default Tier Stats
|
||||
tierStats := madmin.TierStats{
|
||||
NumObjects: 0,
|
||||
NumVersions: 0,
|
||||
TotalSize: 0,
|
||||
}
|
||||
if stats, ok := tiersStatsMap[tierData.Name]; ok {
|
||||
tierStats = stats
|
||||
}
|
||||
|
||||
status := client.verifyTierStatus(ctx, tierData.Name) == nil
|
||||
|
||||
switch tierData.Type {
|
||||
case madmin.S3:
|
||||
tiersList = append(tiersList, &models.Tier{
|
||||
Type: models.TierTypeS3,
|
||||
S3: &models.TierS3{
|
||||
Accesskey: tierData.S3.AccessKey,
|
||||
Bucket: tierData.S3.Bucket,
|
||||
Endpoint: tierData.S3.Endpoint,
|
||||
Name: tierData.Name,
|
||||
Prefix: tierData.S3.Prefix,
|
||||
Region: tierData.S3.Region,
|
||||
Secretkey: tierData.S3.SecretKey,
|
||||
Storageclass: tierData.S3.StorageClass,
|
||||
Usage: humanize.IBytes(tierStats.TotalSize),
|
||||
Objects: strconv.Itoa(tierStats.NumObjects),
|
||||
Versions: strconv.Itoa(tierStats.NumVersions),
|
||||
},
|
||||
Status: status,
|
||||
})
|
||||
case madmin.MinIO:
|
||||
tiersList = append(tiersList, &models.Tier{
|
||||
Type: models.TierTypeMinio,
|
||||
Minio: &models.TierMinio{
|
||||
Accesskey: tierData.MinIO.AccessKey,
|
||||
Bucket: tierData.MinIO.Bucket,
|
||||
Endpoint: tierData.MinIO.Endpoint,
|
||||
Name: tierData.Name,
|
||||
Prefix: tierData.MinIO.Prefix,
|
||||
Region: tierData.MinIO.Region,
|
||||
Secretkey: tierData.MinIO.SecretKey,
|
||||
Usage: humanize.IBytes(tierStats.TotalSize),
|
||||
Objects: strconv.Itoa(tierStats.NumObjects),
|
||||
Versions: strconv.Itoa(tierStats.NumVersions),
|
||||
},
|
||||
Status: status,
|
||||
})
|
||||
case madmin.GCS:
|
||||
tiersList = append(tiersList, &models.Tier{
|
||||
Type: models.TierTypeGcs,
|
||||
Gcs: &models.TierGcs{
|
||||
Bucket: tierData.GCS.Bucket,
|
||||
Creds: tierData.GCS.Creds,
|
||||
Endpoint: tierData.GCS.Endpoint,
|
||||
Name: tierData.Name,
|
||||
Prefix: tierData.GCS.Prefix,
|
||||
Region: tierData.GCS.Region,
|
||||
Usage: humanize.IBytes(tierStats.TotalSize),
|
||||
Objects: strconv.Itoa(tierStats.NumObjects),
|
||||
Versions: strconv.Itoa(tierStats.NumVersions),
|
||||
},
|
||||
Status: status,
|
||||
})
|
||||
case madmin.Azure:
|
||||
tiersList = append(tiersList, &models.Tier{
|
||||
Type: models.TierTypeAzure,
|
||||
Azure: &models.TierAzure{
|
||||
Accountkey: tierData.Azure.AccountKey,
|
||||
Accountname: tierData.Azure.AccountName,
|
||||
Bucket: tierData.Azure.Bucket,
|
||||
Endpoint: tierData.Azure.Endpoint,
|
||||
Name: tierData.Name,
|
||||
Prefix: tierData.Azure.Prefix,
|
||||
Region: tierData.Azure.Region,
|
||||
Usage: humanize.IBytes(tierStats.TotalSize),
|
||||
Objects: strconv.Itoa(tierStats.NumObjects),
|
||||
Versions: strconv.Itoa(tierStats.NumVersions),
|
||||
},
|
||||
Status: status,
|
||||
})
|
||||
case madmin.Unsupported:
|
||||
tiersList = append(tiersList, &models.Tier{
|
||||
Type: models.TierTypeUnsupported,
|
||||
Status: status,
|
||||
})
|
||||
}
|
||||
}
|
||||
// build response
|
||||
return &models.TierListResponse{
|
||||
Items: tiersList,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// getTiersResponse returns a response with a list of tiers
|
||||
func getTiersResponse(session *models.Principal, params tieringApi.TiersListParams) (*models.TierListResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
// create a minioClient interface implementation
|
||||
// defining the client to be used
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
// serialize output
|
||||
tiersResp, err := getTiers(ctx, adminClient)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return tiersResp, nil
|
||||
}
|
||||
|
||||
// getTiersNameResponse returns a response with a list of tiers' names
|
||||
func getTiersNameResponse(session *models.Principal, params tieringApi.TiersListNamesParams) (*models.TiersNameListResponse, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
// create a minioClient interface implementation
|
||||
// defining the client to be used
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
// serialize output
|
||||
tiersResp, err := getTiersName(ctx, adminClient)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return tiersResp, nil
|
||||
}
|
||||
|
||||
// getTiersName fetches listTiers and returns a list of the tiers' names
|
||||
func getTiersName(ctx context.Context, client MinioAdmin) (*models.TiersNameListResponse, error) {
|
||||
tiers, err := client.listTiers(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
tiersNameList := make([]string, len(tiers))
|
||||
for i, tierData := range tiers {
|
||||
tiersNameList[i] = tierData.Name
|
||||
}
|
||||
|
||||
return &models.TiersNameListResponse{
|
||||
Items: tiersNameList,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func addTier(ctx context.Context, client MinioAdmin, params *tieringApi.AddTierParams) error {
|
||||
var cfg *madmin.TierConfig
|
||||
var err error
|
||||
|
||||
switch params.Body.Type {
|
||||
|
||||
case models.TierTypeS3:
|
||||
cfg, err = madmin.NewTierS3(
|
||||
params.Body.S3.Name,
|
||||
params.Body.S3.Accesskey,
|
||||
params.Body.S3.Secretkey,
|
||||
params.Body.S3.Bucket,
|
||||
madmin.S3Region(params.Body.S3.Region),
|
||||
madmin.S3Prefix(params.Body.S3.Prefix),
|
||||
madmin.S3Endpoint(params.Body.S3.Endpoint),
|
||||
madmin.S3StorageClass(params.Body.S3.Storageclass),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case models.TierTypeMinio:
|
||||
cfg, err = madmin.NewTierMinIO(
|
||||
params.Body.Minio.Name,
|
||||
params.Body.Minio.Endpoint,
|
||||
params.Body.Minio.Accesskey,
|
||||
params.Body.Minio.Secretkey,
|
||||
params.Body.Minio.Bucket,
|
||||
madmin.MinIORegion(params.Body.Minio.Region),
|
||||
madmin.MinIOPrefix(params.Body.Minio.Prefix),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case models.TierTypeGcs:
|
||||
gcsOpts := []madmin.GCSOptions{}
|
||||
prefix := params.Body.Gcs.Prefix
|
||||
if prefix != "" {
|
||||
gcsOpts = append(gcsOpts, madmin.GCSPrefix(prefix))
|
||||
}
|
||||
|
||||
region := params.Body.Gcs.Region
|
||||
if region != "" {
|
||||
gcsOpts = append(gcsOpts, madmin.GCSRegion(region))
|
||||
}
|
||||
base64Text := make([]byte, base64.StdEncoding.EncodedLen(len(params.Body.Gcs.Creds)))
|
||||
l, _ := base64.StdEncoding.Decode(base64Text, []byte(params.Body.Gcs.Creds))
|
||||
|
||||
cfg, err = madmin.NewTierGCS(
|
||||
params.Body.Gcs.Name,
|
||||
base64Text[:l],
|
||||
params.Body.Gcs.Bucket,
|
||||
gcsOpts...,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case models.TierTypeAzure:
|
||||
cfg, err = madmin.NewTierAzure(
|
||||
params.Body.Azure.Name,
|
||||
params.Body.Azure.Accountname,
|
||||
params.Body.Azure.Accountkey,
|
||||
params.Body.Azure.Bucket,
|
||||
madmin.AzurePrefix(params.Body.Azure.Prefix),
|
||||
madmin.AzureEndpoint(params.Body.Azure.Endpoint),
|
||||
madmin.AzureRegion(params.Body.Azure.Region),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
case models.TierTypeUnsupported:
|
||||
cfg = &madmin.TierConfig{
|
||||
Type: madmin.Unsupported,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
err = client.addTier(ctx, cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// getAddTierResponse returns the response of admin tier
|
||||
func getAddTierResponse(session *models.Principal, params tieringApi.AddTierParams) *CodedAPIError {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
// create a minioClient interface implementation
|
||||
// defining the client to be used
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
|
||||
// serialize output
|
||||
errTier := addTier(ctx, adminClient, ¶ms)
|
||||
if errTier != nil {
|
||||
return ErrorWithContext(ctx, errTier)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func getTier(ctx context.Context, client MinioAdmin, params *tieringApi.GetTierParams) (*models.Tier, error) {
|
||||
tiers, err := client.listTiers(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for i := range tiers {
|
||||
switch tiers[i].Type {
|
||||
case madmin.S3:
|
||||
if params.Type != models.TierTypeS3 || tiers[i].Name != params.Name {
|
||||
continue
|
||||
}
|
||||
return &models.Tier{
|
||||
Type: models.TierTypeS3,
|
||||
S3: &models.TierS3{
|
||||
Accesskey: tiers[i].S3.AccessKey,
|
||||
Bucket: tiers[i].S3.Bucket,
|
||||
Endpoint: tiers[i].S3.Endpoint,
|
||||
Name: tiers[i].Name,
|
||||
Prefix: tiers[i].S3.Prefix,
|
||||
Region: tiers[i].S3.Region,
|
||||
Secretkey: tiers[i].S3.SecretKey,
|
||||
Storageclass: tiers[i].S3.StorageClass,
|
||||
},
|
||||
}, err
|
||||
case madmin.GCS:
|
||||
if params.Type != models.TierTypeGcs || tiers[i].Name != params.Name {
|
||||
continue
|
||||
}
|
||||
return &models.Tier{
|
||||
Type: models.TierTypeGcs,
|
||||
Gcs: &models.TierGcs{
|
||||
Bucket: tiers[i].GCS.Bucket,
|
||||
Creds: tiers[i].GCS.Creds,
|
||||
Endpoint: tiers[i].GCS.Endpoint,
|
||||
Name: tiers[i].Name,
|
||||
Prefix: tiers[i].GCS.Prefix,
|
||||
Region: tiers[i].GCS.Region,
|
||||
},
|
||||
}, nil
|
||||
case madmin.Azure:
|
||||
if params.Type != models.TierTypeAzure || tiers[i].Name != params.Name {
|
||||
continue
|
||||
}
|
||||
return &models.Tier{
|
||||
Type: models.TierTypeAzure,
|
||||
Azure: &models.TierAzure{
|
||||
Accountkey: tiers[i].Azure.AccountKey,
|
||||
Accountname: tiers[i].Azure.AccountName,
|
||||
Bucket: tiers[i].Azure.Bucket,
|
||||
Endpoint: tiers[i].Azure.Endpoint,
|
||||
Name: tiers[i].Name,
|
||||
Prefix: tiers[i].Azure.Prefix,
|
||||
Region: tiers[i].Azure.Region,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
// build response
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
// getGetTierResponse returns a tier
|
||||
func getGetTierResponse(session *models.Principal, params tieringApi.GetTierParams) (*models.Tier, *CodedAPIError) {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
// create a minioClient interface implementation
|
||||
// defining the client to be used
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
// serialize output
|
||||
addTierResp, err := getTier(ctx, adminClient, ¶ms)
|
||||
if err != nil {
|
||||
return nil, ErrorWithContext(ctx, err)
|
||||
}
|
||||
return addTierResp, nil
|
||||
}
|
||||
|
||||
func editTierCredentials(ctx context.Context, client MinioAdmin, params *tieringApi.EditTierCredentialsParams) error {
|
||||
base64Text := make([]byte, base64.StdEncoding.EncodedLen(len(params.Body.Creds)))
|
||||
l, err := base64.StdEncoding.Decode(base64Text, []byte(params.Body.Creds))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
creds := madmin.TierCreds{
|
||||
AccessKey: params.Body.AccessKey,
|
||||
SecretKey: params.Body.SecretKey,
|
||||
CredsJSON: base64Text[:l],
|
||||
}
|
||||
return client.editTierCreds(ctx, params.Name, creds)
|
||||
}
|
||||
|
||||
// getEditTierCredentialsResponse returns the result of editing credentials for a tier
|
||||
func getEditTierCredentialsResponse(session *models.Principal, params tieringApi.EditTierCredentialsParams) *CodedAPIError {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
// create a minioClient interface implementation
|
||||
// defining the client to be used
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
// serialize output
|
||||
err = editTierCredentials(ctx, adminClient, ¶ms)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func removeTier(ctx context.Context, client MinioAdmin, params *tieringApi.RemoveTierParams) error {
|
||||
return client.removeTier(ctx, params.Name)
|
||||
}
|
||||
|
||||
func getRemoveTierResponse(session *models.Principal, params tieringApi.RemoveTierParams) *CodedAPIError {
|
||||
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
|
||||
defer cancel()
|
||||
mAdmin, err := NewMinioAdminClient(params.HTTPRequest.Context(), session)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
// create a minioClient interface implementation
|
||||
// defining the client to be used
|
||||
adminClient := AdminClient{Client: mAdmin}
|
||||
// serialize output
|
||||
err = removeTier(ctx, adminClient, ¶ms)
|
||||
if err != nil {
|
||||
return ErrorWithContext(ctx, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,310 +0,0 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
tieringApi "github.com/minio/console/api/operations/tiering"
|
||||
"github.com/minio/console/models"
|
||||
"github.com/minio/madmin-go/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestGetTiers(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// mock minIO client
|
||||
adminClient := AdminClientMock{}
|
||||
|
||||
function := "getTiers()"
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
// Test-1 : getTiers() get list of tiers
|
||||
// mock lifecycle response from MinIO
|
||||
returnListMock := []*madmin.TierConfig{
|
||||
{
|
||||
Version: "V1",
|
||||
Type: madmin.S3,
|
||||
Name: "S3 Tier",
|
||||
S3: &madmin.TierS3{
|
||||
Endpoint: "https://s3tier.test.com/",
|
||||
AccessKey: "Access Key",
|
||||
SecretKey: "Secret Key",
|
||||
Bucket: "buckets3",
|
||||
Prefix: "pref1",
|
||||
Region: "us-west-1",
|
||||
StorageClass: "TT1",
|
||||
},
|
||||
},
|
||||
{
|
||||
Version: "V1",
|
||||
Type: madmin.MinIO,
|
||||
Name: "MinIO Tier",
|
||||
MinIO: &madmin.TierMinIO{
|
||||
Endpoint: "https://minio-endpoint.test.com/",
|
||||
AccessKey: "access",
|
||||
SecretKey: "secret",
|
||||
Bucket: "somebucket",
|
||||
Prefix: "p1",
|
||||
Region: "us-east-2",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
returnStatsMock := []madmin.TierInfo{
|
||||
{
|
||||
Name: "STANDARD",
|
||||
Type: "internal",
|
||||
Stats: madmin.TierStats{NumObjects: 2, NumVersions: 2, TotalSize: 228915},
|
||||
},
|
||||
{
|
||||
Name: "MinIO Tier",
|
||||
Type: "internal",
|
||||
Stats: madmin.TierStats{NumObjects: 10, NumVersions: 3, TotalSize: 132788},
|
||||
},
|
||||
{
|
||||
Name: "S3 Tier",
|
||||
Type: "s3",
|
||||
Stats: madmin.TierStats{NumObjects: 0, NumVersions: 0, TotalSize: 0},
|
||||
},
|
||||
}
|
||||
|
||||
expectedOutput := &models.TierListResponse{
|
||||
Items: []*models.Tier{
|
||||
{
|
||||
Type: models.TierTypeS3,
|
||||
S3: &models.TierS3{
|
||||
Accesskey: "Access Key",
|
||||
Secretkey: "Secret Key",
|
||||
Bucket: "buckets3",
|
||||
Endpoint: "https://s3tier.test.com/",
|
||||
Name: "S3 Tier",
|
||||
Prefix: "pref1",
|
||||
Region: "us-west-1",
|
||||
Storageclass: "TT1",
|
||||
Usage: "0 B",
|
||||
Objects: "0",
|
||||
Versions: "0",
|
||||
},
|
||||
Status: false,
|
||||
},
|
||||
{
|
||||
Type: models.TierTypeMinio,
|
||||
Minio: &models.TierMinio{
|
||||
Accesskey: "access",
|
||||
Secretkey: "secret",
|
||||
Bucket: "somebucket",
|
||||
Endpoint: "https://minio-endpoint.test.com/",
|
||||
Name: "MinIO Tier",
|
||||
Prefix: "p1",
|
||||
Region: "us-east-2",
|
||||
Usage: "130 KiB",
|
||||
Objects: "10",
|
||||
Versions: "3",
|
||||
},
|
||||
Status: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) {
|
||||
return returnListMock, nil
|
||||
}
|
||||
|
||||
minioTierStatsMock = func(_ context.Context) ([]madmin.TierInfo, error) {
|
||||
return returnStatsMock, nil
|
||||
}
|
||||
|
||||
minioVerifyTierStatusMock = func(_ context.Context, _ string) error {
|
||||
return fmt.Errorf("someerror")
|
||||
}
|
||||
|
||||
tiersList, err := getTiers(ctx, adminClient)
|
||||
if err != nil {
|
||||
t.Errorf("Failed on %s:, error occurred: %s", function, err.Error())
|
||||
}
|
||||
// verify length of tiers list is correct
|
||||
assert.Equal(len(tiersList.Items), len(returnListMock), fmt.Sprintf("Failed on %s: length of lists is not the same", function))
|
||||
assert.Equal(expectedOutput, tiersList)
|
||||
|
||||
// Test-2 : getTiers() list is empty
|
||||
returnListMockT2 := []*madmin.TierConfig{}
|
||||
minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) {
|
||||
return returnListMockT2, nil
|
||||
}
|
||||
|
||||
tiersListT2, err := getTiers(ctx, adminClient)
|
||||
if err != nil {
|
||||
t.Errorf("Failed on %s:, error occurred: %s", function, err.Error())
|
||||
}
|
||||
|
||||
if len(tiersListT2.Items) != 0 {
|
||||
t.Errorf("Failed on %s:, returned list was not empty", function)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetTiersName(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// mock minIO client
|
||||
adminClient := AdminClientMock{}
|
||||
|
||||
function := "getTiersName()"
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
// Test-1 : getTiersName() get list tiers' names
|
||||
// mock lifecycle response from MinIO
|
||||
returnListMock := []*madmin.TierConfig{
|
||||
{
|
||||
Version: "V1",
|
||||
Type: madmin.S3,
|
||||
Name: "S3 Tier",
|
||||
S3: &madmin.TierS3{
|
||||
Endpoint: "https://s3tier.test.com/",
|
||||
AccessKey: "Access Key",
|
||||
SecretKey: "Secret Key",
|
||||
Bucket: "buckets3",
|
||||
Prefix: "pref1",
|
||||
Region: "us-west-1",
|
||||
StorageClass: "TT1",
|
||||
},
|
||||
},
|
||||
{
|
||||
Version: "V1",
|
||||
Type: madmin.MinIO,
|
||||
Name: "MinIO Tier",
|
||||
MinIO: &madmin.TierMinIO{
|
||||
Endpoint: "https://minio-endpoint.test.com/",
|
||||
AccessKey: "access",
|
||||
SecretKey: "secret",
|
||||
Bucket: "somebucket",
|
||||
Prefix: "p1",
|
||||
Region: "us-east-2",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
expectedOutput := &models.TiersNameListResponse{
|
||||
Items: []string{"S3 Tier", "MinIO Tier"},
|
||||
}
|
||||
|
||||
minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) {
|
||||
return returnListMock, nil
|
||||
}
|
||||
|
||||
tiersList, err := getTiersName(ctx, adminClient)
|
||||
if err != nil {
|
||||
t.Errorf("Failed on %s:, error occurred: %s", function, err.Error())
|
||||
}
|
||||
// verify length of tiers list is correct
|
||||
assert.Equal(len(tiersList.Items), len(returnListMock), fmt.Sprintf("Failed on %s: length of lists is not the same", function))
|
||||
assert.Equal(expectedOutput, tiersList)
|
||||
|
||||
// Test-2 : getTiersName() list is empty
|
||||
returnListMockT2 := []*madmin.TierConfig{}
|
||||
minioListTiersMock = func(_ context.Context) ([]*madmin.TierConfig, error) {
|
||||
return returnListMockT2, nil
|
||||
}
|
||||
|
||||
emptyTierList, err := getTiersName(ctx, adminClient)
|
||||
if err != nil {
|
||||
t.Errorf("Failed on %s:, error occurred: %s", function, err.Error())
|
||||
}
|
||||
|
||||
if len(emptyTierList.Items) != 0 {
|
||||
t.Errorf("Failed on %s:, returned list was not empty", function)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAddTier(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// mock minIO client
|
||||
adminClient := AdminClientMock{}
|
||||
|
||||
function := "addTier()"
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
// Test-1: addTier() add new Tier
|
||||
minioAddTiersMock = func(_ context.Context, _ *madmin.TierConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
paramsToAdd := tieringApi.AddTierParams{
|
||||
Body: &models.Tier{
|
||||
Type: "S3",
|
||||
S3: &models.TierS3{
|
||||
Accesskey: "TestAK",
|
||||
Bucket: "bucket1",
|
||||
Endpoint: "https://test.com/",
|
||||
Name: "TIERS3",
|
||||
Prefix: "Pr1",
|
||||
Region: "us-west-1",
|
||||
Secretkey: "SecretK",
|
||||
Storageclass: "STCLASS",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
err := addTier(ctx, adminClient, ¶msToAdd)
|
||||
assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function))
|
||||
|
||||
// Test-2: addTier() error adding Tier
|
||||
minioAddTiersMock = func(_ context.Context, _ *madmin.TierConfig) error {
|
||||
return errors.New("error setting new tier")
|
||||
}
|
||||
|
||||
err2 := addTier(ctx, adminClient, ¶msToAdd)
|
||||
|
||||
assert.Equal(errors.New("error setting new tier"), err2, fmt.Sprintf("Failed on %s: Error returned", function))
|
||||
}
|
||||
|
||||
func TestUpdateTierCreds(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// mock minIO client
|
||||
adminClient := AdminClientMock{}
|
||||
|
||||
function := "editTierCredentials()"
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
// Test-1: editTierCredentials() update Tier configuration
|
||||
minioEditTiersMock = func(_ context.Context, _ string, _ madmin.TierCreds) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
params := &tieringApi.EditTierCredentialsParams{
|
||||
Name: "TESTTIER",
|
||||
Body: &models.TierCredentialsRequest{
|
||||
AccessKey: "New Key",
|
||||
SecretKey: "Secret Key",
|
||||
},
|
||||
}
|
||||
|
||||
err := editTierCredentials(ctx, adminClient, params)
|
||||
|
||||
assert.Equal(nil, err, fmt.Sprintf("Failed on %s: Error returned", function))
|
||||
|
||||
// Test-2: editTierCredentials() update Tier configuration failure
|
||||
minioEditTiersMock = func(_ context.Context, _ string, _ madmin.TierCreds) error {
|
||||
return errors.New("error message")
|
||||
}
|
||||
|
||||
errT2 := editTierCredentials(ctx, adminClient, params)
|
||||
|
||||
assert.Equal(errors.New("error message"), errT2, fmt.Sprintf("Failed on %s: Error returned", function))
|
||||
}
|
||||
@@ -146,8 +146,7 @@ func shortTrace(info *madmin.ServiceTraceInfo) shortTraceMsg {
|
||||
if host, ok := t.HTTP.ReqInfo.Headers["Host"]; ok {
|
||||
s.Host = strings.Join(host, "")
|
||||
}
|
||||
cSlice := strings.Split(t.HTTP.ReqInfo.Client, ":")
|
||||
s.Client = cSlice[0]
|
||||
s.Client = t.HTTP.ReqInfo.Client
|
||||
}
|
||||
|
||||
return s
|
||||
|
||||
@@ -65,8 +65,7 @@ type MinioAdmin interface {
|
||||
delConfigKV(ctx context.Context, kv string) (err error)
|
||||
serviceRestart(ctx context.Context) error
|
||||
serverInfo(ctx context.Context) (madmin.InfoMessage, error)
|
||||
startProfiling(ctx context.Context, profiler madmin.ProfilerType) ([]madmin.StartProfilingResult, error)
|
||||
stopProfiling(ctx context.Context) (io.ReadCloser, error)
|
||||
startProfiling(ctx context.Context, profiler madmin.ProfilerType, duration time.Duration) (io.ReadCloser, error)
|
||||
serviceTrace(ctx context.Context, threshold int64, s3, internal, storage, os, errTrace bool) <-chan madmin.ServiceTraceInfo
|
||||
getLogs(ctx context.Context, node string, lineCnt int, logKind string) <-chan madmin.LogInfo
|
||||
AccountInfo(ctx context.Context) (madmin.AccountInfo, error)
|
||||
@@ -115,20 +114,8 @@ type MinioAdmin interface {
|
||||
kmsAPIs(ctx context.Context) ([]madmin.KMSAPI, error)
|
||||
kmsVersion(ctx context.Context) (*madmin.KMSVersion, error)
|
||||
createKey(ctx context.Context, key string) error
|
||||
importKey(ctx context.Context, key string, content []byte) error
|
||||
listKeys(ctx context.Context, pattern string) ([]madmin.KMSKeyInfo, error)
|
||||
keyStatus(ctx context.Context, key string) (*madmin.KMSKeyStatus, error)
|
||||
deleteKey(ctx context.Context, key string) error
|
||||
setKMSPolicy(ctx context.Context, policy string, content []byte) error
|
||||
assignPolicy(ctx context.Context, policy string, content []byte) error
|
||||
describePolicy(ctx context.Context, policy string) (*madmin.KMSDescribePolicy, error)
|
||||
getKMSPolicy(ctx context.Context, policy string) (*madmin.KMSPolicy, error)
|
||||
listKMSPolicies(ctx context.Context, pattern string) ([]madmin.KMSPolicyInfo, error)
|
||||
deletePolicy(ctx context.Context, policy string) error
|
||||
describeIdentity(ctx context.Context, identity string) (*madmin.KMSDescribeIdentity, error)
|
||||
describeSelfIdentity(ctx context.Context) (*madmin.KMSDescribeSelfIdentity, error)
|
||||
deleteIdentity(ctx context.Context, identity string) error
|
||||
listIdentities(ctx context.Context, pattern string) ([]madmin.KMSIdentityInfo, error)
|
||||
|
||||
// IDP
|
||||
addOrUpdateIDPConfig(ctx context.Context, idpType, cfgName, cfgData string, update bool) (restart bool, err error)
|
||||
@@ -271,7 +258,7 @@ func (ac AdminClient) delConfigKV(ctx context.Context, kv string) (err error) {
|
||||
|
||||
// implements madmin.ServiceRestart()
|
||||
func (ac AdminClient) serviceRestart(ctx context.Context) (err error) {
|
||||
return ac.Client.ServiceRestart(ctx)
|
||||
return ac.Client.ServiceRestartV2(ctx)
|
||||
}
|
||||
|
||||
// implements madmin.ServerInfo()
|
||||
@@ -280,13 +267,8 @@ func (ac AdminClient) serverInfo(ctx context.Context) (madmin.InfoMessage, error
|
||||
}
|
||||
|
||||
// implements madmin.StartProfiling()
|
||||
func (ac AdminClient) startProfiling(ctx context.Context, profiler madmin.ProfilerType) ([]madmin.StartProfilingResult, error) {
|
||||
return ac.Client.StartProfiling(ctx, profiler)
|
||||
}
|
||||
|
||||
// implements madmin.DownloadProfilingData()
|
||||
func (ac AdminClient) stopProfiling(ctx context.Context) (io.ReadCloser, error) {
|
||||
return ac.Client.DownloadProfilingData(ctx)
|
||||
func (ac AdminClient) startProfiling(ctx context.Context, profiler madmin.ProfilerType, duration time.Duration) (io.ReadCloser, error) {
|
||||
return ac.Client.Profile(ctx, profiler, duration)
|
||||
}
|
||||
|
||||
// implements madmin.ServiceTrace()
|
||||
@@ -395,22 +377,17 @@ func (ac AdminClient) serverHealthInfo(ctx context.Context, deadline time.Durati
|
||||
info := madmin.HealthInfo{}
|
||||
var healthInfo interface{}
|
||||
var version string
|
||||
var tryCount int
|
||||
for info.Version == "" && tryCount < 10 {
|
||||
var resp *http.Response
|
||||
var err error
|
||||
resp, version, err = ac.Client.ServerHealthInfo(ctx, madmin.HealthDataTypesList, deadline, "")
|
||||
if err != nil {
|
||||
return nil, version, err
|
||||
var resp *http.Response
|
||||
var err error
|
||||
resp, version, err = ac.Client.ServerHealthInfo(ctx, madmin.HealthDataTypesList, deadline, "")
|
||||
if err != nil {
|
||||
return nil, version, err
|
||||
}
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
for {
|
||||
if err = decoder.Decode(&info); err != nil {
|
||||
break
|
||||
}
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
for {
|
||||
if err = decoder.Decode(&info); err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
tryCount++
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
if info.Version == "" {
|
||||
return nil, "", ErrHealthReportFail
|
||||
@@ -675,10 +652,6 @@ func (ac AdminClient) createKey(ctx context.Context, key string) error {
|
||||
return ac.Client.CreateKey(ctx, key)
|
||||
}
|
||||
|
||||
func (ac AdminClient) importKey(ctx context.Context, key string, content []byte) error {
|
||||
return ac.Client.ImportKey(ctx, key, content)
|
||||
}
|
||||
|
||||
func (ac AdminClient) listKeys(ctx context.Context, pattern string) ([]madmin.KMSKeyInfo, error) {
|
||||
return ac.Client.ListKeys(ctx, pattern)
|
||||
}
|
||||
@@ -687,50 +660,6 @@ func (ac AdminClient) keyStatus(ctx context.Context, key string) (*madmin.KMSKey
|
||||
return ac.Client.GetKeyStatus(ctx, key)
|
||||
}
|
||||
|
||||
func (ac AdminClient) deleteKey(ctx context.Context, key string) error {
|
||||
return ac.Client.DeleteKey(ctx, key)
|
||||
}
|
||||
|
||||
func (ac AdminClient) setKMSPolicy(ctx context.Context, policy string, content []byte) error {
|
||||
return ac.Client.SetKMSPolicy(ctx, policy, content)
|
||||
}
|
||||
|
||||
func (ac AdminClient) assignPolicy(ctx context.Context, policy string, content []byte) error {
|
||||
return ac.Client.AssignPolicy(ctx, policy, content)
|
||||
}
|
||||
|
||||
func (ac AdminClient) describePolicy(ctx context.Context, policy string) (*madmin.KMSDescribePolicy, error) {
|
||||
return ac.Client.DescribePolicy(ctx, policy)
|
||||
}
|
||||
|
||||
func (ac AdminClient) getKMSPolicy(ctx context.Context, policy string) (*madmin.KMSPolicy, error) {
|
||||
return ac.Client.GetPolicy(ctx, policy)
|
||||
}
|
||||
|
||||
func (ac AdminClient) listKMSPolicies(ctx context.Context, pattern string) ([]madmin.KMSPolicyInfo, error) {
|
||||
return ac.Client.ListPolicies(ctx, pattern)
|
||||
}
|
||||
|
||||
func (ac AdminClient) deletePolicy(ctx context.Context, policy string) error {
|
||||
return ac.Client.DeletePolicy(ctx, policy)
|
||||
}
|
||||
|
||||
func (ac AdminClient) describeIdentity(ctx context.Context, identity string) (*madmin.KMSDescribeIdentity, error) {
|
||||
return ac.Client.DescribeIdentity(ctx, identity)
|
||||
}
|
||||
|
||||
func (ac AdminClient) describeSelfIdentity(ctx context.Context) (*madmin.KMSDescribeSelfIdentity, error) {
|
||||
return ac.Client.DescribeSelfIdentity(ctx)
|
||||
}
|
||||
|
||||
func (ac AdminClient) deleteIdentity(ctx context.Context, identity string) error {
|
||||
return ac.Client.DeleteIdentity(ctx, identity)
|
||||
}
|
||||
|
||||
func (ac AdminClient) listIdentities(ctx context.Context, pattern string) ([]madmin.KMSIdentityInfo, error) {
|
||||
return ac.Client.ListIdentities(ctx, pattern)
|
||||
}
|
||||
|
||||
func (ac AdminClient) addOrUpdateIDPConfig(ctx context.Context, idpType, cfgName, cfgData string, update bool) (restart bool, err error) {
|
||||
return ac.Client.AddOrUpdateIDPConfig(ctx, idpType, cfgName, cfgData, update)
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -38,7 +39,6 @@ import (
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
"github.com/minio/minio-go/v7/pkg/lifecycle"
|
||||
"github.com/minio/minio-go/v7/pkg/notification"
|
||||
"github.com/minio/minio-go/v7/pkg/tags"
|
||||
)
|
||||
@@ -74,8 +74,6 @@ type MinioClient interface {
|
||||
setObjectLockConfig(ctx context.Context, bucketName string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit) error
|
||||
getBucketObjectLockConfig(ctx context.Context, bucketName string) (mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error)
|
||||
getObjectLockConfig(ctx context.Context, bucketName string) (lock string, mode *minio.RetentionMode, validity *uint, unit *minio.ValidityUnit, err error)
|
||||
getLifecycleRules(ctx context.Context, bucketName string) (lifecycle *lifecycle.Configuration, err error)
|
||||
setBucketLifecycle(ctx context.Context, bucketName string, config *lifecycle.Configuration) error
|
||||
copyObject(ctx context.Context, dst minio.CopyDestOptions, src minio.CopySrcOptions) (minio.UploadInfo, error)
|
||||
GetBucketTagging(ctx context.Context, bucketName string) (*tags.Tags, error)
|
||||
SetBucketTagging(ctx context.Context, bucketName string, tags *tags.Tags) error
|
||||
@@ -209,14 +207,6 @@ func (c minioClient) getObjectLockConfig(ctx context.Context, bucketName string)
|
||||
return c.client.GetObjectLockConfig(ctx, bucketName)
|
||||
}
|
||||
|
||||
func (c minioClient) getLifecycleRules(ctx context.Context, bucketName string) (lifecycle *lifecycle.Configuration, err error) {
|
||||
return c.client.GetBucketLifecycle(ctx, bucketName)
|
||||
}
|
||||
|
||||
func (c minioClient) setBucketLifecycle(ctx context.Context, bucketName string, config *lifecycle.Configuration) error {
|
||||
return c.client.SetBucketLifecycle(ctx, bucketName, config)
|
||||
}
|
||||
|
||||
func (c minioClient) copyObject(ctx context.Context, dst minio.CopyDestOptions, src minio.CopySrcOptions) (minio.UploadInfo, error) {
|
||||
return c.client.CopyObject(ctx, dst, src)
|
||||
}
|
||||
@@ -299,6 +289,7 @@ type ConsoleCredentialsI interface {
|
||||
type ConsoleCredentials struct {
|
||||
ConsoleCredentials *credentials.Credentials
|
||||
AccountAccessKey string
|
||||
CredContext *credentials.CredContext
|
||||
}
|
||||
|
||||
func (c ConsoleCredentials) GetAccountAccessKey() string {
|
||||
@@ -307,7 +298,7 @@ func (c ConsoleCredentials) GetAccountAccessKey() string {
|
||||
|
||||
// Get implements *Login.Get()
|
||||
func (c ConsoleCredentials) Get() (credentials.Value, error) {
|
||||
return c.ConsoleCredentials.Get()
|
||||
return c.ConsoleCredentials.GetWithContext(c.CredContext)
|
||||
}
|
||||
|
||||
// Expire implements *Login.Expire()
|
||||
@@ -322,6 +313,10 @@ type consoleSTSAssumeRole struct {
|
||||
stsAssumeRole *credentials.STSAssumeRole
|
||||
}
|
||||
|
||||
func (s consoleSTSAssumeRole) RetrieveWithCredContext(cc *credentials.CredContext) (credentials.Value, error) {
|
||||
return s.stsAssumeRole.RetrieveWithCredContext(cc)
|
||||
}
|
||||
|
||||
func (s consoleSTSAssumeRole) Retrieve() (credentials.Value, error) {
|
||||
return s.stsAssumeRole.Retrieve()
|
||||
}
|
||||
@@ -330,7 +325,7 @@ func (s consoleSTSAssumeRole) IsExpired() bool {
|
||||
return s.stsAssumeRole.IsExpired()
|
||||
}
|
||||
|
||||
func stsCredentials(minioURL, accessKey, secretKey, location, clientIP string) (*credentials.Credentials, error) {
|
||||
func stsCredentials(minioURL, accessKey, secretKey, location string, client *http.Client) (*credentials.Credentials, error) {
|
||||
if accessKey == "" || secretKey == "" {
|
||||
return nil, errors.New("credentials endpoint, access and secret key are mandatory for AssumeRoleSTS")
|
||||
}
|
||||
@@ -341,7 +336,7 @@ func stsCredentials(minioURL, accessKey, secretKey, location, clientIP string) (
|
||||
DurationSeconds: int(xjwt.GetConsoleSTSDuration().Seconds()),
|
||||
}
|
||||
stsAssumeRole := &credentials.STSAssumeRole{
|
||||
Client: GetConsoleHTTPClient(clientIP),
|
||||
Client: client,
|
||||
STSEndpoint: minioURL,
|
||||
Options: opts,
|
||||
}
|
||||
@@ -349,51 +344,48 @@ func stsCredentials(minioURL, accessKey, secretKey, location, clientIP string) (
|
||||
return credentials.New(consoleSTSWrapper), nil
|
||||
}
|
||||
|
||||
func NewConsoleCredentials(accessKey, secretKey, location, clientIP string) (*credentials.Credentials, error) {
|
||||
func NewConsoleCredentials(accessKey, secretKey, location string, client *http.Client) (*credentials.Credentials, error) {
|
||||
minioURL := getMinIOServer()
|
||||
|
||||
// Future authentication methods can be added under this switch statement
|
||||
switch {
|
||||
// LDAP authentication for Console
|
||||
case ldap.GetLDAPEnabled():
|
||||
{
|
||||
creds, err := auth.GetCredentialsFromLDAP(GetConsoleHTTPClient(clientIP), minioURL, accessKey, secretKey)
|
||||
if ldap.GetLDAPEnabled() {
|
||||
creds, err := auth.GetCredentialsFromLDAP(client, minioURL, accessKey, secretKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
credContext := &credentials.CredContext{
|
||||
Client: client,
|
||||
}
|
||||
|
||||
// We verify if LDAP credentials are correct and no error is returned
|
||||
_, err = creds.GetWithContext(credContext)
|
||||
|
||||
if err != nil && strings.Contains(strings.ToLower(err.Error()), "not found") {
|
||||
// We try to use STS Credentials in case LDAP credentials are incorrect.
|
||||
stsCreds, errSTS := stsCredentials(minioURL, accessKey, secretKey, location, client)
|
||||
|
||||
// If there is an error with STS too, then we return the original LDAP error
|
||||
if errSTS != nil {
|
||||
LogError("error in STS credentials for LDAP case: %v ", errSTS)
|
||||
|
||||
// We return LDAP result
|
||||
return creds, nil
|
||||
}
|
||||
|
||||
_, err := stsCreds.GetWithContext(credContext)
|
||||
// There is an error with STS credentials, We return the result of LDAP as STS is not a priority in this case.
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return creds, nil
|
||||
}
|
||||
|
||||
// We verify if LDAP credentials are correct and no error is returned
|
||||
_, err = creds.Get()
|
||||
|
||||
if err != nil && strings.Contains(strings.ToLower(err.Error()), "not found") {
|
||||
// We try to use STS Credentials in case LDAP credentials are incorrect.
|
||||
stsCreds, errSTS := stsCredentials(minioURL, accessKey, secretKey, location, clientIP)
|
||||
|
||||
// If there is an error with STS too, then we return the original LDAP error
|
||||
if errSTS != nil {
|
||||
LogError("error in STS credentials for LDAP case: %v ", errSTS)
|
||||
|
||||
// We return LDAP result
|
||||
return creds, nil
|
||||
}
|
||||
|
||||
_, err := stsCreds.Get()
|
||||
// There is an error with STS credentials, We return the result of LDAP as STS is not a priority in this case.
|
||||
if err != nil {
|
||||
return creds, nil
|
||||
}
|
||||
|
||||
return stsCreds, nil
|
||||
}
|
||||
|
||||
return creds, nil
|
||||
}
|
||||
// default authentication for Console is via STS (Security Token Service) against MinIO
|
||||
default:
|
||||
{
|
||||
return stsCredentials(minioURL, accessKey, secretKey, location, clientIP)
|
||||
return stsCreds, nil
|
||||
}
|
||||
|
||||
return creds, nil
|
||||
}
|
||||
|
||||
return stsCredentials(minioURL, accessKey, secretKey, location, client)
|
||||
}
|
||||
|
||||
// getConsoleCredentialsFromSession returns the *consoleCredentials.Login associated to the
|
||||
|
||||
@@ -98,10 +98,6 @@ func getMinIOServer() string {
|
||||
return strings.TrimSpace(env.Get(ConsoleMinIOServer, "http://localhost:9000"))
|
||||
}
|
||||
|
||||
func getSubnetProxy() string {
|
||||
return strings.TrimSpace(env.Get(ConsoleSubnetProxy, ""))
|
||||
}
|
||||
|
||||
func GetMinIORegion() string {
|
||||
return strings.TrimSpace(env.Get(ConsoleMinIORegion, ""))
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ import (
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -123,8 +125,6 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler {
|
||||
registerConfigHandlers(api)
|
||||
// Register bucket events handlers
|
||||
registerBucketEventsHandlers(api)
|
||||
// Register bucket lifecycle handlers
|
||||
registerBucketsLifecycleHandlers(api)
|
||||
// Register service handlers
|
||||
registerServiceHandlers(api)
|
||||
// Register session handlers
|
||||
@@ -141,24 +141,15 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler {
|
||||
registerAdminBucketRemoteHandlers(api)
|
||||
// Register admin log search
|
||||
registerLogSearchHandlers(api)
|
||||
// Register admin subnet handlers
|
||||
registerSubnetHandlers(api)
|
||||
// Register admin KMS handlers
|
||||
registerKMSHandlers(api)
|
||||
// Register admin IDP handlers
|
||||
registerIDPHandlers(api)
|
||||
// Register Account handlers
|
||||
registerAdminTiersHandlers(api)
|
||||
// Register Inspect Handler
|
||||
registerInspectHandler(api)
|
||||
// Register nodes handlers
|
||||
registerNodesHandler(api)
|
||||
|
||||
registerSiteReplicationHandler(api)
|
||||
registerSiteReplicationStatusHandler(api)
|
||||
// Register Support Handler
|
||||
registerSupportHandlers(api)
|
||||
|
||||
// Operator Console
|
||||
|
||||
// Register Object's Handlers
|
||||
@@ -176,9 +167,6 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler {
|
||||
|
||||
api.ServerShutdown = func() {}
|
||||
|
||||
// do an initial subnet plan caching
|
||||
fetchLicensePlan()
|
||||
|
||||
return setupGlobalMiddleware(api.Serve(setupMiddlewares))
|
||||
}
|
||||
|
||||
@@ -216,6 +204,97 @@ func AuditLogMiddleware(next http.Handler) http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
func DebugLogMiddleware(next http.Handler) http.Handler {
|
||||
debugLogLevel, _ := env.GetInt("CONSOLE_DEBUG_LOGLEVEL", 0)
|
||||
if debugLogLevel == 0 {
|
||||
return next
|
||||
}
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
rw := logger.NewResponseWriter(w)
|
||||
next.ServeHTTP(rw, r)
|
||||
debugLog(debugLogLevel, r, rw)
|
||||
})
|
||||
}
|
||||
|
||||
func debugLog(debugLogLevel int, r *http.Request, rw *logger.ResponseWriter) {
|
||||
switch debugLogLevel {
|
||||
case 1:
|
||||
// Log server errors only (summary)
|
||||
if rw.StatusCode >= 500 {
|
||||
debugLogSummary(r, rw)
|
||||
}
|
||||
case 2:
|
||||
// Log server and client errors (summary)
|
||||
if rw.StatusCode >= 400 {
|
||||
debugLogSummary(r, rw)
|
||||
}
|
||||
case 3:
|
||||
// Log all requests (summary)
|
||||
debugLogSummary(r, rw)
|
||||
case 4:
|
||||
// Log server errors only (including headers)
|
||||
if rw.StatusCode >= 500 {
|
||||
debugLogDetails(r, rw)
|
||||
}
|
||||
case 5:
|
||||
// Log server and client errors (including headers)
|
||||
if rw.StatusCode >= 400 {
|
||||
debugLogDetails(r, rw)
|
||||
}
|
||||
case 6:
|
||||
// Log all requests (including headers)
|
||||
debugLogDetails(r, rw)
|
||||
}
|
||||
}
|
||||
|
||||
func debugLogSummary(r *http.Request, rw *logger.ResponseWriter) {
|
||||
statusCode := strconv.Itoa(rw.StatusCode)
|
||||
if rw.Hijacked {
|
||||
statusCode = "hijacked"
|
||||
}
|
||||
logger.Info(fmt.Sprintf("%s %s %s %s %dms", r.RemoteAddr, r.Method, r.URL, statusCode, time.Since(rw.StartTime).Milliseconds()))
|
||||
}
|
||||
|
||||
func debugLogDetails(r *http.Request, rw *logger.ResponseWriter) {
|
||||
var sb strings.Builder
|
||||
sb.WriteString(fmt.Sprintf("- Method/URL: %s %s\n", r.Method, r.URL))
|
||||
sb.WriteString(fmt.Sprintf(" Remote endpoint: %s\n", r.RemoteAddr))
|
||||
if rw.Hijacked {
|
||||
sb.WriteString(" Status code: <hijacked, probably a websocket>\n")
|
||||
} else {
|
||||
sb.WriteString(fmt.Sprintf(" Status code: %d\n", rw.StatusCode))
|
||||
}
|
||||
sb.WriteString(fmt.Sprintf(" Duration (ms): %d\n", time.Since(rw.StartTime).Milliseconds()))
|
||||
sb.WriteString(" Request headers: ")
|
||||
debugLogHeaders(&sb, r.Header)
|
||||
sb.WriteString(" Response headers: ")
|
||||
debugLogHeaders(&sb, rw.Header())
|
||||
logger.Info(sb.String())
|
||||
}
|
||||
|
||||
func debugLogHeaders(sb *strings.Builder, h http.Header) {
|
||||
keys := make([]string, 0, len(h))
|
||||
for key := range h {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
first := true
|
||||
for _, key := range keys {
|
||||
values := h[key]
|
||||
for _, value := range values {
|
||||
if !first {
|
||||
sb.WriteString(" ")
|
||||
} else {
|
||||
first = false
|
||||
}
|
||||
sb.WriteString(fmt.Sprintf("%s: %s\n", key, value))
|
||||
}
|
||||
}
|
||||
if first {
|
||||
sb.WriteRune('\n')
|
||||
}
|
||||
}
|
||||
|
||||
// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document.
|
||||
// So this is a good place to plug in a panic handling middleware, logger and metrics
|
||||
func setupGlobalMiddleware(handler http.Handler) http.Handler {
|
||||
@@ -228,6 +307,8 @@ func setupGlobalMiddleware(handler http.Handler) http.Handler {
|
||||
next = ContextMiddleware(next)
|
||||
// handle cookie or authorization header for session
|
||||
next = AuthenticationMiddleware(next)
|
||||
// handle debug logging
|
||||
next = DebugLogMiddleware(next)
|
||||
|
||||
sslHostFn := secure.SSLHostFunc(func(host string) string {
|
||||
xhost, err := xnet.ParseHost(host)
|
||||
@@ -313,6 +394,12 @@ func AuthenticationMiddleware(next http.Handler) http.Handler {
|
||||
|
||||
// FileServerMiddleware serves files from the static folder
|
||||
func FileServerMiddleware(next http.Handler) http.Handler {
|
||||
buildFs, err := fs.Sub(portal_ui.GetStaticAssets(), "build")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
spaFileHandler := wrapHandlerSinglePageApplication(requestBounce(http.FileServer(http.FS(buildFs))))
|
||||
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Server", globalAppName) // do not add version information
|
||||
switch {
|
||||
@@ -321,11 +408,7 @@ func FileServerMiddleware(next http.Handler) http.Handler {
|
||||
case strings.HasPrefix(r.URL.Path, "/api"):
|
||||
next.ServeHTTP(w, r)
|
||||
default:
|
||||
buildFs, err := fs.Sub(portal_ui.GetStaticAssets(), "build")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
wrapHandlerSinglePageApplication(requestBounce(http.FileServer(http.FS(buildFs)))).ServeHTTP(w, r)
|
||||
spaFileHandler.ServeHTTP(w, r)
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -424,13 +507,10 @@ func handleSPA(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
indexPageBytes = replaceLicense(indexPageBytes)
|
||||
|
||||
mimeType := mimedb.TypeByExtension(filepath.Ext(r.URL.Path))
|
||||
|
||||
if mimeType == "application/octet-stream" {
|
||||
mimeType = "text/html"
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", mimeType)
|
||||
// it's important to force "Content-Type: text/html", because a previous
|
||||
// handler may have already set the content-type to a different value.
|
||||
// (i.e. the FileServer when it detected that it couldn't find the file)
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
http.ServeContent(w, r, "index.html", time.Now(), bytes.NewReader(indexPageBytes))
|
||||
}
|
||||
|
||||
@@ -507,8 +587,6 @@ func replaceBaseInIndex(indexPageBytes []byte, basePath string) []byte {
|
||||
|
||||
func replaceLicense(indexPageBytes []byte) []byte {
|
||||
indexPageStr := string(indexPageBytes)
|
||||
newPlan := fmt.Sprintf("<meta name=\"minio-license\" content=\"%s\" />", InstanceLicensePlan.String())
|
||||
indexPageStr = strings.Replace(indexPageStr, "<meta name=\"minio-license\" content=\"agpl\"/>", newPlan, 1)
|
||||
indexPageBytes = []byte(indexPageStr)
|
||||
return indexPageBytes
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// - multipart/form-data
|
||||
//
|
||||
// Produces:
|
||||
// - application/zip
|
||||
// - application/octet-stream
|
||||
// - application/json
|
||||
//
|
||||
|
||||
4026
api/embedded_spec.go
4026
api/embedded_spec.go
File diff suppressed because it is too large
Load Diff
@@ -29,7 +29,7 @@ import (
|
||||
|
||||
var (
|
||||
ErrDefault = errors.New("an error occurred, please try again")
|
||||
ErrInvalidLogin = errors.New("invalid Login")
|
||||
ErrInvalidLogin = errors.New("invalid login")
|
||||
ErrForbidden = errors.New("403 Forbidden")
|
||||
ErrBadRequest = errors.New("400 Bad Request")
|
||||
ErrFileTooLarge = errors.New("413 File too Large")
|
||||
@@ -43,7 +43,6 @@ var (
|
||||
ErrGroupNameNotInRequest = errors.New("error group name not in request")
|
||||
ErrPolicyNameNotInRequest = errors.New("error policy name not in request")
|
||||
ErrPolicyBodyNotInRequest = errors.New("error policy body not in request")
|
||||
ErrPolicyNameContainsSpace = errors.New("error policy name cannot contain spaces")
|
||||
ErrInvalidEncryptionAlgorithm = errors.New("error invalid encryption algorithm")
|
||||
ErrSSENotConfigured = errors.New("error server side encryption configuration not found")
|
||||
ErrBucketLifeCycleNotConfigured = errors.New("error bucket life cycle configuration not found")
|
||||
@@ -73,6 +72,7 @@ var (
|
||||
ErrPolicyNotFound = errors.New("policy does not exist")
|
||||
ErrLoginNotAllowed = errors.New("login not allowed")
|
||||
ErrHealthReportFail = errors.New("failure to generate Health report")
|
||||
ErrNetworkError = errors.New("unable to login due to network error")
|
||||
)
|
||||
|
||||
type CodedAPIError struct {
|
||||
@@ -111,6 +111,11 @@ func ErrorWithContext(ctx context.Context, err ...interface{}) *CodedAPIError {
|
||||
errorCode = 401
|
||||
errorMessage = ErrInvalidLogin.Error()
|
||||
}
|
||||
if errors.Is(err1, ErrNetworkError) {
|
||||
detailedMessage = ""
|
||||
errorCode = 503
|
||||
errorMessage = ErrNetworkError.Error()
|
||||
}
|
||||
if strings.Contains(strings.ToLower(err1.Error()), ErrAccessDenied.Error()) {
|
||||
errorCode = 403
|
||||
errorMessage = err1.Error()
|
||||
@@ -155,10 +160,6 @@ func ErrorWithContext(ctx context.Context, err ...interface{}) *CodedAPIError {
|
||||
errorCode = 400
|
||||
errorMessage = ErrPolicyBodyNotInRequest.Error()
|
||||
}
|
||||
if errors.Is(err1, ErrPolicyNameContainsSpace) {
|
||||
errorCode = 400
|
||||
errorMessage = ErrPolicyNameContainsSpace.Error()
|
||||
}
|
||||
// console invalid session errors
|
||||
if errors.Is(err1, ErrInvalidSession) {
|
||||
errorCode = 401
|
||||
|
||||
@@ -46,25 +46,24 @@ func TestError(t *testing.T) {
|
||||
appErrors := map[string]expectedError{
|
||||
"ErrDefault": {code: 500, err: ErrDefault},
|
||||
|
||||
"ErrForbidden": {code: 403, err: ErrForbidden},
|
||||
"ErrFileTooLarge": {code: 413, err: ErrFileTooLarge},
|
||||
"ErrInvalidSession": {code: 401, err: ErrInvalidSession},
|
||||
"ErrNotFound": {code: 404, err: ErrNotFound},
|
||||
"ErrGroupAlreadyExists": {code: 400, err: ErrGroupAlreadyExists},
|
||||
"ErrInvalidErasureCodingValue": {code: 400, err: ErrInvalidErasureCodingValue},
|
||||
"ErrBucketBodyNotInRequest": {code: 400, err: ErrBucketBodyNotInRequest},
|
||||
"ErrBucketNameNotInRequest": {code: 400, err: ErrBucketNameNotInRequest},
|
||||
"ErrGroupBodyNotInRequest": {code: 400, err: ErrGroupBodyNotInRequest},
|
||||
"ErrGroupNameNotInRequest": {code: 400, err: ErrGroupNameNotInRequest},
|
||||
"ErrPolicyNameNotInRequest": {code: 400, err: ErrPolicyNameNotInRequest},
|
||||
"ErrPolicyBodyNotInRequest": {code: 400, err: ErrPolicyBodyNotInRequest},
|
||||
"ErrInvalidEncryptionAlgorithm": {code: 500, err: ErrInvalidEncryptionAlgorithm},
|
||||
"ErrSSENotConfigured": {code: 404, err: ErrSSENotConfigured},
|
||||
"ErrBucketLifeCycleNotConfigured": {code: 404, err: ErrBucketLifeCycleNotConfigured},
|
||||
"ErrChangePassword": {code: 403, err: ErrChangePassword},
|
||||
"ErrInvalidLicense": {code: 404, err: ErrInvalidLicense},
|
||||
"ErrLicenseNotFound": {code: 404, err: ErrLicenseNotFound},
|
||||
"ErrAvoidSelfAccountDelete": {code: 403, err: ErrAvoidSelfAccountDelete},
|
||||
"ErrForbidden": {code: 403, err: ErrForbidden},
|
||||
"ErrFileTooLarge": {code: 413, err: ErrFileTooLarge},
|
||||
"ErrInvalidSession": {code: 401, err: ErrInvalidSession},
|
||||
"ErrNotFound": {code: 404, err: ErrNotFound},
|
||||
"ErrGroupAlreadyExists": {code: 400, err: ErrGroupAlreadyExists},
|
||||
"ErrInvalidErasureCodingValue": {code: 400, err: ErrInvalidErasureCodingValue},
|
||||
"ErrBucketBodyNotInRequest": {code: 400, err: ErrBucketBodyNotInRequest},
|
||||
"ErrBucketNameNotInRequest": {code: 400, err: ErrBucketNameNotInRequest},
|
||||
"ErrGroupBodyNotInRequest": {code: 400, err: ErrGroupBodyNotInRequest},
|
||||
"ErrGroupNameNotInRequest": {code: 400, err: ErrGroupNameNotInRequest},
|
||||
"ErrPolicyNameNotInRequest": {code: 400, err: ErrPolicyNameNotInRequest},
|
||||
"ErrPolicyBodyNotInRequest": {code: 400, err: ErrPolicyBodyNotInRequest},
|
||||
"ErrInvalidEncryptionAlgorithm": {code: 500, err: ErrInvalidEncryptionAlgorithm},
|
||||
"ErrSSENotConfigured": {code: 404, err: ErrSSENotConfigured},
|
||||
"ErrChangePassword": {code: 403, err: ErrChangePassword},
|
||||
"ErrInvalidLicense": {code: 404, err: ErrInvalidLicense},
|
||||
"ErrLicenseNotFound": {code: 404, err: ErrLicenseNotFound},
|
||||
"ErrAvoidSelfAccountDelete": {code: 403, err: ErrAvoidSelfAccountDelete},
|
||||
|
||||
"ErrNonUniqueAccessKey": {code: 500, err: ErrNonUniqueAccessKey},
|
||||
"ErrRemoteTierExists": {code: 400, err: ErrRemoteTierExists},
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/minio/pkg/v3/licverifier"
|
||||
"github.com/minio/pkg/v3/subnet"
|
||||
)
|
||||
|
||||
type SubnetPlan int
|
||||
|
||||
const (
|
||||
PlanAGPL SubnetPlan = iota
|
||||
PlanStandard
|
||||
PlanEnterprise
|
||||
PlanEnterpriseLite
|
||||
PlanEnterprisePlus
|
||||
)
|
||||
|
||||
func (sp SubnetPlan) String() string {
|
||||
switch sp {
|
||||
case PlanStandard:
|
||||
return "standard"
|
||||
case PlanEnterprise:
|
||||
return "enterprise"
|
||||
case PlanEnterpriseLite:
|
||||
return "enterprise-lite"
|
||||
case PlanEnterprisePlus:
|
||||
return "enterprise-plus"
|
||||
default:
|
||||
return "agpl"
|
||||
}
|
||||
}
|
||||
|
||||
var InstanceLicensePlan = PlanAGPL
|
||||
|
||||
func getLicenseInfo(client http.Client, license string) (*licverifier.LicenseInfo, error) {
|
||||
lv := subnet.LicenseValidator{
|
||||
Client: client,
|
||||
ExpiryGracePeriod: 0,
|
||||
}
|
||||
lv.Init(getConsoleDevMode())
|
||||
return lv.ParseLicense(license)
|
||||
}
|
||||
|
||||
func fetchLicensePlan() {
|
||||
client := GetConsoleHTTPClient("127.0.0.1")
|
||||
licenseInfo, err := getLicenseInfo(*client, os.Getenv(EnvSubnetLicense))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
switch licenseInfo.Plan {
|
||||
case "STANDARD":
|
||||
InstanceLicensePlan = PlanStandard
|
||||
case "ENTERPRISE":
|
||||
InstanceLicensePlan = PlanEnterprise
|
||||
case "ENTERPRISE-LITE":
|
||||
InstanceLicensePlan = PlanEnterpriseLite
|
||||
case "ENTERPRISE-PLUS":
|
||||
InstanceLicensePlan = PlanEnterprisePlus
|
||||
default:
|
||||
InstanceLicensePlan = PlanAGPL
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AddBucketLifecycleHandlerFunc turns a function with the right signature into a add bucket lifecycle handler
|
||||
type AddBucketLifecycleHandlerFunc func(AddBucketLifecycleParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn AddBucketLifecycleHandlerFunc) Handle(params AddBucketLifecycleParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// AddBucketLifecycleHandler interface for that can handle valid add bucket lifecycle params
|
||||
type AddBucketLifecycleHandler interface {
|
||||
Handle(AddBucketLifecycleParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewAddBucketLifecycle creates a new http.Handler for the add bucket lifecycle operation
|
||||
func NewAddBucketLifecycle(ctx *middleware.Context, handler AddBucketLifecycleHandler) *AddBucketLifecycle {
|
||||
return &AddBucketLifecycle{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
AddBucketLifecycle swagger:route POST /buckets/{bucket_name}/lifecycle Bucket addBucketLifecycle
|
||||
|
||||
Add Bucket Lifecycle
|
||||
*/
|
||||
type AddBucketLifecycle struct {
|
||||
Context *middleware.Context
|
||||
Handler AddBucketLifecycleHandler
|
||||
}
|
||||
|
||||
func (o *AddBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewAddBucketLifecycleParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"io"
|
||||
"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"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewAddBucketLifecycleParams creates a new AddBucketLifecycleParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewAddBucketLifecycleParams() AddBucketLifecycleParams {
|
||||
|
||||
return AddBucketLifecycleParams{}
|
||||
}
|
||||
|
||||
// AddBucketLifecycleParams contains all the bound params for the add bucket lifecycle operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters AddBucketLifecycle
|
||||
type AddBucketLifecycleParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.AddBucketLifecycle
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
BucketName 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 NewAddBucketLifecycleParams() beforehand.
|
||||
func (o *AddBucketLifecycleParams) 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.AddBucketLifecycle
|
||||
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(r.Context())
|
||||
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", ""))
|
||||
}
|
||||
|
||||
rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name")
|
||||
if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindBucketName binds and validates parameter BucketName from path.
|
||||
func (o *AddBucketLifecycleParams) bindBucketName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.BucketName = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AddBucketLifecycleCreatedCode is the HTTP code returned for type AddBucketLifecycleCreated
|
||||
const AddBucketLifecycleCreatedCode int = 201
|
||||
|
||||
/*
|
||||
AddBucketLifecycleCreated A successful response.
|
||||
|
||||
swagger:response addBucketLifecycleCreated
|
||||
*/
|
||||
type AddBucketLifecycleCreated struct {
|
||||
}
|
||||
|
||||
// NewAddBucketLifecycleCreated creates AddBucketLifecycleCreated with default headers values
|
||||
func NewAddBucketLifecycleCreated() *AddBucketLifecycleCreated {
|
||||
|
||||
return &AddBucketLifecycleCreated{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *AddBucketLifecycleCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(201)
|
||||
}
|
||||
|
||||
/*
|
||||
AddBucketLifecycleDefault Generic error response.
|
||||
|
||||
swagger:response addBucketLifecycleDefault
|
||||
*/
|
||||
type AddBucketLifecycleDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewAddBucketLifecycleDefault creates AddBucketLifecycleDefault with default headers values
|
||||
func NewAddBucketLifecycleDefault(code int) *AddBucketLifecycleDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &AddBucketLifecycleDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the add bucket lifecycle default response
|
||||
func (o *AddBucketLifecycleDefault) WithStatusCode(code int) *AddBucketLifecycleDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the add bucket lifecycle default response
|
||||
func (o *AddBucketLifecycleDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the add bucket lifecycle default response
|
||||
func (o *AddBucketLifecycleDefault) WithPayload(payload *models.APIError) *AddBucketLifecycleDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the add bucket lifecycle default response
|
||||
func (o *AddBucketLifecycleDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *AddBucketLifecycleDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// AddBucketLifecycleURL generates an URL for the add bucket lifecycle operation
|
||||
type AddBucketLifecycleURL struct {
|
||||
BucketName 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 *AddBucketLifecycleURL) WithBasePath(bp string) *AddBucketLifecycleURL {
|
||||
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 *AddBucketLifecycleURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *AddBucketLifecycleURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/buckets/{bucket_name}/lifecycle"
|
||||
|
||||
bucketName := o.BucketName
|
||||
if bucketName != "" {
|
||||
_path = strings.Replace(_path, "{bucket_name}", bucketName, -1)
|
||||
} else {
|
||||
return nil, errors.New("bucketName is required on AddBucketLifecycleURL")
|
||||
}
|
||||
|
||||
_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 *AddBucketLifecycleURL) 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 *AddBucketLifecycleURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *AddBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on AddBucketLifecycleURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on AddBucketLifecycleURL")
|
||||
}
|
||||
|
||||
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 *AddBucketLifecycleURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AddMultiBucketLifecycleHandlerFunc turns a function with the right signature into a add multi bucket lifecycle handler
|
||||
type AddMultiBucketLifecycleHandlerFunc func(AddMultiBucketLifecycleParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn AddMultiBucketLifecycleHandlerFunc) Handle(params AddMultiBucketLifecycleParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// AddMultiBucketLifecycleHandler interface for that can handle valid add multi bucket lifecycle params
|
||||
type AddMultiBucketLifecycleHandler interface {
|
||||
Handle(AddMultiBucketLifecycleParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewAddMultiBucketLifecycle creates a new http.Handler for the add multi bucket lifecycle operation
|
||||
func NewAddMultiBucketLifecycle(ctx *middleware.Context, handler AddMultiBucketLifecycleHandler) *AddMultiBucketLifecycle {
|
||||
return &AddMultiBucketLifecycle{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
AddMultiBucketLifecycle swagger:route POST /buckets/multi-lifecycle Bucket addMultiBucketLifecycle
|
||||
|
||||
Add Multi Bucket Lifecycle
|
||||
*/
|
||||
type AddMultiBucketLifecycle struct {
|
||||
Context *middleware.Context
|
||||
Handler AddMultiBucketLifecycleHandler
|
||||
}
|
||||
|
||||
func (o *AddMultiBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewAddMultiBucketLifecycleParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"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"
|
||||
)
|
||||
|
||||
// NewAddMultiBucketLifecycleParams creates a new AddMultiBucketLifecycleParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewAddMultiBucketLifecycleParams() AddMultiBucketLifecycleParams {
|
||||
|
||||
return AddMultiBucketLifecycleParams{}
|
||||
}
|
||||
|
||||
// AddMultiBucketLifecycleParams contains all the bound params for the add multi bucket lifecycle operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters AddMultiBucketLifecycle
|
||||
type AddMultiBucketLifecycleParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.AddMultiBucketLifecycle
|
||||
}
|
||||
|
||||
// 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 NewAddMultiBucketLifecycleParams() beforehand.
|
||||
func (o *AddMultiBucketLifecycleParams) 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.AddMultiBucketLifecycle
|
||||
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(r.Context())
|
||||
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
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AddMultiBucketLifecycleOKCode is the HTTP code returned for type AddMultiBucketLifecycleOK
|
||||
const AddMultiBucketLifecycleOKCode int = 200
|
||||
|
||||
/*
|
||||
AddMultiBucketLifecycleOK A successful response.
|
||||
|
||||
swagger:response addMultiBucketLifecycleOK
|
||||
*/
|
||||
type AddMultiBucketLifecycleOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.MultiLifecycleResult `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewAddMultiBucketLifecycleOK creates AddMultiBucketLifecycleOK with default headers values
|
||||
func NewAddMultiBucketLifecycleOK() *AddMultiBucketLifecycleOK {
|
||||
|
||||
return &AddMultiBucketLifecycleOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the add multi bucket lifecycle o k response
|
||||
func (o *AddMultiBucketLifecycleOK) WithPayload(payload *models.MultiLifecycleResult) *AddMultiBucketLifecycleOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the add multi bucket lifecycle o k response
|
||||
func (o *AddMultiBucketLifecycleOK) SetPayload(payload *models.MultiLifecycleResult) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *AddMultiBucketLifecycleOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
AddMultiBucketLifecycleDefault Generic error response.
|
||||
|
||||
swagger:response addMultiBucketLifecycleDefault
|
||||
*/
|
||||
type AddMultiBucketLifecycleDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewAddMultiBucketLifecycleDefault creates AddMultiBucketLifecycleDefault with default headers values
|
||||
func NewAddMultiBucketLifecycleDefault(code int) *AddMultiBucketLifecycleDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &AddMultiBucketLifecycleDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the add multi bucket lifecycle default response
|
||||
func (o *AddMultiBucketLifecycleDefault) WithStatusCode(code int) *AddMultiBucketLifecycleDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the add multi bucket lifecycle default response
|
||||
func (o *AddMultiBucketLifecycleDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the add multi bucket lifecycle default response
|
||||
func (o *AddMultiBucketLifecycleDefault) WithPayload(payload *models.APIError) *AddMultiBucketLifecycleDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the add multi bucket lifecycle default response
|
||||
func (o *AddMultiBucketLifecycleDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *AddMultiBucketLifecycleDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// AddMultiBucketLifecycleURL generates an URL for the add multi bucket lifecycle operation
|
||||
type AddMultiBucketLifecycleURL 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 *AddMultiBucketLifecycleURL) WithBasePath(bp string) *AddMultiBucketLifecycleURL {
|
||||
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 *AddMultiBucketLifecycleURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *AddMultiBucketLifecycleURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/buckets/multi-lifecycle"
|
||||
|
||||
_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 *AddMultiBucketLifecycleURL) 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 *AddMultiBucketLifecycleURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *AddMultiBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on AddMultiBucketLifecycleURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on AddMultiBucketLifecycleURL")
|
||||
}
|
||||
|
||||
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 *AddMultiBucketLifecycleURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DeleteBucketLifecycleRuleHandlerFunc turns a function with the right signature into a delete bucket lifecycle rule handler
|
||||
type DeleteBucketLifecycleRuleHandlerFunc func(DeleteBucketLifecycleRuleParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn DeleteBucketLifecycleRuleHandlerFunc) Handle(params DeleteBucketLifecycleRuleParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// DeleteBucketLifecycleRuleHandler interface for that can handle valid delete bucket lifecycle rule params
|
||||
type DeleteBucketLifecycleRuleHandler interface {
|
||||
Handle(DeleteBucketLifecycleRuleParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewDeleteBucketLifecycleRule creates a new http.Handler for the delete bucket lifecycle rule operation
|
||||
func NewDeleteBucketLifecycleRule(ctx *middleware.Context, handler DeleteBucketLifecycleRuleHandler) *DeleteBucketLifecycleRule {
|
||||
return &DeleteBucketLifecycleRule{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteBucketLifecycleRule swagger:route DELETE /buckets/{bucket_name}/lifecycle/{lifecycle_id} Bucket deleteBucketLifecycleRule
|
||||
|
||||
Delete Lifecycle rule
|
||||
*/
|
||||
type DeleteBucketLifecycleRule struct {
|
||||
Context *middleware.Context
|
||||
Handler DeleteBucketLifecycleRuleHandler
|
||||
}
|
||||
|
||||
func (o *DeleteBucketLifecycleRule) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewDeleteBucketLifecycleRuleParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeleteBucketLifecycleRuleParams creates a new DeleteBucketLifecycleRuleParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewDeleteBucketLifecycleRuleParams() DeleteBucketLifecycleRuleParams {
|
||||
|
||||
return DeleteBucketLifecycleRuleParams{}
|
||||
}
|
||||
|
||||
// DeleteBucketLifecycleRuleParams contains all the bound params for the delete bucket lifecycle rule operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters DeleteBucketLifecycleRule
|
||||
type DeleteBucketLifecycleRuleParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
BucketName string
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
LifecycleID 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 NewDeleteBucketLifecycleRuleParams() beforehand.
|
||||
func (o *DeleteBucketLifecycleRuleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name")
|
||||
if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rLifecycleID, rhkLifecycleID, _ := route.Params.GetOK("lifecycle_id")
|
||||
if err := o.bindLifecycleID(rLifecycleID, rhkLifecycleID, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindBucketName binds and validates parameter BucketName from path.
|
||||
func (o *DeleteBucketLifecycleRuleParams) bindBucketName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.BucketName = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindLifecycleID binds and validates parameter LifecycleID from path.
|
||||
func (o *DeleteBucketLifecycleRuleParams) bindLifecycleID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.LifecycleID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// DeleteBucketLifecycleRuleNoContentCode is the HTTP code returned for type DeleteBucketLifecycleRuleNoContent
|
||||
const DeleteBucketLifecycleRuleNoContentCode int = 204
|
||||
|
||||
/*
|
||||
DeleteBucketLifecycleRuleNoContent A successful response.
|
||||
|
||||
swagger:response deleteBucketLifecycleRuleNoContent
|
||||
*/
|
||||
type DeleteBucketLifecycleRuleNoContent struct {
|
||||
}
|
||||
|
||||
// NewDeleteBucketLifecycleRuleNoContent creates DeleteBucketLifecycleRuleNoContent with default headers values
|
||||
func NewDeleteBucketLifecycleRuleNoContent() *DeleteBucketLifecycleRuleNoContent {
|
||||
|
||||
return &DeleteBucketLifecycleRuleNoContent{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteBucketLifecycleRuleNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(204)
|
||||
}
|
||||
|
||||
/*
|
||||
DeleteBucketLifecycleRuleDefault Generic error response.
|
||||
|
||||
swagger:response deleteBucketLifecycleRuleDefault
|
||||
*/
|
||||
type DeleteBucketLifecycleRuleDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDeleteBucketLifecycleRuleDefault creates DeleteBucketLifecycleRuleDefault with default headers values
|
||||
func NewDeleteBucketLifecycleRuleDefault(code int) *DeleteBucketLifecycleRuleDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &DeleteBucketLifecycleRuleDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the delete bucket lifecycle rule default response
|
||||
func (o *DeleteBucketLifecycleRuleDefault) WithStatusCode(code int) *DeleteBucketLifecycleRuleDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the delete bucket lifecycle rule default response
|
||||
func (o *DeleteBucketLifecycleRuleDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the delete bucket lifecycle rule default response
|
||||
func (o *DeleteBucketLifecycleRuleDefault) WithPayload(payload *models.APIError) *DeleteBucketLifecycleRuleDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the delete bucket lifecycle rule default response
|
||||
func (o *DeleteBucketLifecycleRuleDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteBucketLifecycleRuleDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// DeleteBucketLifecycleRuleURL generates an URL for the delete bucket lifecycle rule operation
|
||||
type DeleteBucketLifecycleRuleURL struct {
|
||||
BucketName string
|
||||
LifecycleID 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 *DeleteBucketLifecycleRuleURL) WithBasePath(bp string) *DeleteBucketLifecycleRuleURL {
|
||||
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 *DeleteBucketLifecycleRuleURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *DeleteBucketLifecycleRuleURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/buckets/{bucket_name}/lifecycle/{lifecycle_id}"
|
||||
|
||||
bucketName := o.BucketName
|
||||
if bucketName != "" {
|
||||
_path = strings.Replace(_path, "{bucket_name}", bucketName, -1)
|
||||
} else {
|
||||
return nil, errors.New("bucketName is required on DeleteBucketLifecycleRuleURL")
|
||||
}
|
||||
|
||||
lifecycleID := o.LifecycleID
|
||||
if lifecycleID != "" {
|
||||
_path = strings.Replace(_path, "{lifecycle_id}", lifecycleID, -1)
|
||||
} else {
|
||||
return nil, errors.New("lifecycleId is required on DeleteBucketLifecycleRuleURL")
|
||||
}
|
||||
|
||||
_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 *DeleteBucketLifecycleRuleURL) 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 *DeleteBucketLifecycleRuleURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *DeleteBucketLifecycleRuleURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on DeleteBucketLifecycleRuleURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on DeleteBucketLifecycleRuleURL")
|
||||
}
|
||||
|
||||
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 *DeleteBucketLifecycleRuleURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// GetBucketLifecycleHandlerFunc turns a function with the right signature into a get bucket lifecycle handler
|
||||
type GetBucketLifecycleHandlerFunc func(GetBucketLifecycleParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GetBucketLifecycleHandlerFunc) Handle(params GetBucketLifecycleParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// GetBucketLifecycleHandler interface for that can handle valid get bucket lifecycle params
|
||||
type GetBucketLifecycleHandler interface {
|
||||
Handle(GetBucketLifecycleParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGetBucketLifecycle creates a new http.Handler for the get bucket lifecycle operation
|
||||
func NewGetBucketLifecycle(ctx *middleware.Context, handler GetBucketLifecycleHandler) *GetBucketLifecycle {
|
||||
return &GetBucketLifecycle{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
GetBucketLifecycle swagger:route GET /buckets/{bucket_name}/lifecycle Bucket getBucketLifecycle
|
||||
|
||||
Bucket Lifecycle
|
||||
*/
|
||||
type GetBucketLifecycle struct {
|
||||
Context *middleware.Context
|
||||
Handler GetBucketLifecycleHandler
|
||||
}
|
||||
|
||||
func (o *GetBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewGetBucketLifecycleParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetBucketLifecycleParams creates a new GetBucketLifecycleParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewGetBucketLifecycleParams() GetBucketLifecycleParams {
|
||||
|
||||
return GetBucketLifecycleParams{}
|
||||
}
|
||||
|
||||
// GetBucketLifecycleParams contains all the bound params for the get bucket lifecycle operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters GetBucketLifecycle
|
||||
type GetBucketLifecycleParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
BucketName 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 NewGetBucketLifecycleParams() beforehand.
|
||||
func (o *GetBucketLifecycleParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name")
|
||||
if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindBucketName binds and validates parameter BucketName from path.
|
||||
func (o *GetBucketLifecycleParams) bindBucketName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.BucketName = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// GetBucketLifecycleOKCode is the HTTP code returned for type GetBucketLifecycleOK
|
||||
const GetBucketLifecycleOKCode int = 200
|
||||
|
||||
/*
|
||||
GetBucketLifecycleOK A successful response.
|
||||
|
||||
swagger:response getBucketLifecycleOK
|
||||
*/
|
||||
type GetBucketLifecycleOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.BucketLifecycleResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetBucketLifecycleOK creates GetBucketLifecycleOK with default headers values
|
||||
func NewGetBucketLifecycleOK() *GetBucketLifecycleOK {
|
||||
|
||||
return &GetBucketLifecycleOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get bucket lifecycle o k response
|
||||
func (o *GetBucketLifecycleOK) WithPayload(payload *models.BucketLifecycleResponse) *GetBucketLifecycleOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get bucket lifecycle o k response
|
||||
func (o *GetBucketLifecycleOK) SetPayload(payload *models.BucketLifecycleResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetBucketLifecycleOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
GetBucketLifecycleDefault Generic error response.
|
||||
|
||||
swagger:response getBucketLifecycleDefault
|
||||
*/
|
||||
type GetBucketLifecycleDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetBucketLifecycleDefault creates GetBucketLifecycleDefault with default headers values
|
||||
func NewGetBucketLifecycleDefault(code int) *GetBucketLifecycleDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &GetBucketLifecycleDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the get bucket lifecycle default response
|
||||
func (o *GetBucketLifecycleDefault) WithStatusCode(code int) *GetBucketLifecycleDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the get bucket lifecycle default response
|
||||
func (o *GetBucketLifecycleDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get bucket lifecycle default response
|
||||
func (o *GetBucketLifecycleDefault) WithPayload(payload *models.APIError) *GetBucketLifecycleDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get bucket lifecycle default response
|
||||
func (o *GetBucketLifecycleDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetBucketLifecycleDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GetBucketLifecycleURL generates an URL for the get bucket lifecycle operation
|
||||
type GetBucketLifecycleURL struct {
|
||||
BucketName 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 *GetBucketLifecycleURL) WithBasePath(bp string) *GetBucketLifecycleURL {
|
||||
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 *GetBucketLifecycleURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *GetBucketLifecycleURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/buckets/{bucket_name}/lifecycle"
|
||||
|
||||
bucketName := o.BucketName
|
||||
if bucketName != "" {
|
||||
_path = strings.Replace(_path, "{bucket_name}", bucketName, -1)
|
||||
} else {
|
||||
return nil, errors.New("bucketName is required on GetBucketLifecycleURL")
|
||||
}
|
||||
|
||||
_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 *GetBucketLifecycleURL) 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 *GetBucketLifecycleURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *GetBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on GetBucketLifecycleURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on GetBucketLifecycleURL")
|
||||
}
|
||||
|
||||
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 *GetBucketLifecycleURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// UpdateBucketLifecycleHandlerFunc turns a function with the right signature into a update bucket lifecycle handler
|
||||
type UpdateBucketLifecycleHandlerFunc func(UpdateBucketLifecycleParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn UpdateBucketLifecycleHandlerFunc) Handle(params UpdateBucketLifecycleParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// UpdateBucketLifecycleHandler interface for that can handle valid update bucket lifecycle params
|
||||
type UpdateBucketLifecycleHandler interface {
|
||||
Handle(UpdateBucketLifecycleParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewUpdateBucketLifecycle creates a new http.Handler for the update bucket lifecycle operation
|
||||
func NewUpdateBucketLifecycle(ctx *middleware.Context, handler UpdateBucketLifecycleHandler) *UpdateBucketLifecycle {
|
||||
return &UpdateBucketLifecycle{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateBucketLifecycle swagger:route PUT /buckets/{bucket_name}/lifecycle/{lifecycle_id} Bucket updateBucketLifecycle
|
||||
|
||||
Update Lifecycle rule
|
||||
*/
|
||||
type UpdateBucketLifecycle struct {
|
||||
Context *middleware.Context
|
||||
Handler UpdateBucketLifecycleHandler
|
||||
}
|
||||
|
||||
func (o *UpdateBucketLifecycle) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewUpdateBucketLifecycleParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"io"
|
||||
"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"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewUpdateBucketLifecycleParams creates a new UpdateBucketLifecycleParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewUpdateBucketLifecycleParams() UpdateBucketLifecycleParams {
|
||||
|
||||
return UpdateBucketLifecycleParams{}
|
||||
}
|
||||
|
||||
// UpdateBucketLifecycleParams contains all the bound params for the update bucket lifecycle operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters UpdateBucketLifecycle
|
||||
type UpdateBucketLifecycleParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.UpdateBucketLifecycle
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
BucketName string
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
LifecycleID 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 NewUpdateBucketLifecycleParams() beforehand.
|
||||
func (o *UpdateBucketLifecycleParams) 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.UpdateBucketLifecycle
|
||||
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(r.Context())
|
||||
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", ""))
|
||||
}
|
||||
|
||||
rBucketName, rhkBucketName, _ := route.Params.GetOK("bucket_name")
|
||||
if err := o.bindBucketName(rBucketName, rhkBucketName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
rLifecycleID, rhkLifecycleID, _ := route.Params.GetOK("lifecycle_id")
|
||||
if err := o.bindLifecycleID(rLifecycleID, rhkLifecycleID, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindBucketName binds and validates parameter BucketName from path.
|
||||
func (o *UpdateBucketLifecycleParams) bindBucketName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.BucketName = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindLifecycleID binds and validates parameter LifecycleID from path.
|
||||
func (o *UpdateBucketLifecycleParams) bindLifecycleID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.LifecycleID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// UpdateBucketLifecycleOKCode is the HTTP code returned for type UpdateBucketLifecycleOK
|
||||
const UpdateBucketLifecycleOKCode int = 200
|
||||
|
||||
/*
|
||||
UpdateBucketLifecycleOK A successful response.
|
||||
|
||||
swagger:response updateBucketLifecycleOK
|
||||
*/
|
||||
type UpdateBucketLifecycleOK struct {
|
||||
}
|
||||
|
||||
// NewUpdateBucketLifecycleOK creates UpdateBucketLifecycleOK with default headers values
|
||||
func NewUpdateBucketLifecycleOK() *UpdateBucketLifecycleOK {
|
||||
|
||||
return &UpdateBucketLifecycleOK{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *UpdateBucketLifecycleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(200)
|
||||
}
|
||||
|
||||
/*
|
||||
UpdateBucketLifecycleDefault Generic error response.
|
||||
|
||||
swagger:response updateBucketLifecycleDefault
|
||||
*/
|
||||
type UpdateBucketLifecycleDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewUpdateBucketLifecycleDefault creates UpdateBucketLifecycleDefault with default headers values
|
||||
func NewUpdateBucketLifecycleDefault(code int) *UpdateBucketLifecycleDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &UpdateBucketLifecycleDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the update bucket lifecycle default response
|
||||
func (o *UpdateBucketLifecycleDefault) WithStatusCode(code int) *UpdateBucketLifecycleDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the update bucket lifecycle default response
|
||||
func (o *UpdateBucketLifecycleDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the update bucket lifecycle default response
|
||||
func (o *UpdateBucketLifecycleDefault) WithPayload(payload *models.APIError) *UpdateBucketLifecycleDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the update bucket lifecycle default response
|
||||
func (o *UpdateBucketLifecycleDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *UpdateBucketLifecycleDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 bucket
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// UpdateBucketLifecycleURL generates an URL for the update bucket lifecycle operation
|
||||
type UpdateBucketLifecycleURL struct {
|
||||
BucketName string
|
||||
LifecycleID 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 *UpdateBucketLifecycleURL) WithBasePath(bp string) *UpdateBucketLifecycleURL {
|
||||
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 *UpdateBucketLifecycleURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *UpdateBucketLifecycleURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/buckets/{bucket_name}/lifecycle/{lifecycle_id}"
|
||||
|
||||
bucketName := o.BucketName
|
||||
if bucketName != "" {
|
||||
_path = strings.Replace(_path, "{bucket_name}", bucketName, -1)
|
||||
} else {
|
||||
return nil, errors.New("bucketName is required on UpdateBucketLifecycleURL")
|
||||
}
|
||||
|
||||
lifecycleID := o.LifecycleID
|
||||
if lifecycleID != "" {
|
||||
_path = strings.Replace(_path, "{lifecycle_id}", lifecycleID, -1)
|
||||
} else {
|
||||
return nil, errors.New("lifecycleId is required on UpdateBucketLifecycleURL")
|
||||
}
|
||||
|
||||
_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 *UpdateBucketLifecycleURL) 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 *UpdateBucketLifecycleURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *UpdateBucketLifecycleURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on UpdateBucketLifecycleURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on UpdateBucketLifecycleURL")
|
||||
}
|
||||
|
||||
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 *UpdateBucketLifecycleURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -24,7 +24,6 @@ package operations
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@@ -48,16 +47,11 @@ import (
|
||||
"github.com/minio/console/api/operations/logging"
|
||||
"github.com/minio/console/api/operations/object"
|
||||
"github.com/minio/console/api/operations/policy"
|
||||
"github.com/minio/console/api/operations/profile"
|
||||
"github.com/minio/console/api/operations/public"
|
||||
"github.com/minio/console/api/operations/release"
|
||||
"github.com/minio/console/api/operations/service"
|
||||
"github.com/minio/console/api/operations/service_account"
|
||||
"github.com/minio/console/api/operations/site_replication"
|
||||
"github.com/minio/console/api/operations/subnet"
|
||||
"github.com/minio/console/api/operations/support"
|
||||
"github.com/minio/console/api/operations/system"
|
||||
"github.com/minio/console/api/operations/tiering"
|
||||
"github.com/minio/console/api/operations/user"
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
@@ -83,24 +77,15 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
JSONConsumer: runtime.JSONConsumer(),
|
||||
MultipartformConsumer: runtime.DiscardConsumer,
|
||||
|
||||
ApplicationZipProducer: runtime.ProducerFunc(func(w io.Writer, data interface{}) error {
|
||||
return errors.NotImplemented("applicationZip producer has not yet been implemented")
|
||||
}),
|
||||
BinProducer: runtime.ByteStreamProducer(),
|
||||
JSONProducer: runtime.JSONProducer(),
|
||||
|
||||
AccountAccountChangePasswordHandler: account.AccountChangePasswordHandlerFunc(func(params account.AccountChangePasswordParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation account.AccountChangePassword has not yet been implemented")
|
||||
}),
|
||||
BucketAddBucketLifecycleHandler: bucket.AddBucketLifecycleHandlerFunc(func(params bucket.AddBucketLifecycleParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.AddBucketLifecycle has not yet been implemented")
|
||||
}),
|
||||
GroupAddGroupHandler: group.AddGroupHandlerFunc(func(params group.AddGroupParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation group.AddGroup has not yet been implemented")
|
||||
}),
|
||||
BucketAddMultiBucketLifecycleHandler: bucket.AddMultiBucketLifecycleHandlerFunc(func(params bucket.AddMultiBucketLifecycleParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.AddMultiBucketLifecycle has not yet been implemented")
|
||||
}),
|
||||
ConfigurationAddNotificationEndpointHandler: configuration.AddNotificationEndpointHandlerFunc(func(params configuration.AddNotificationEndpointParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation configuration.AddNotificationEndpoint has not yet been implemented")
|
||||
}),
|
||||
@@ -110,9 +95,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
BucketAddRemoteBucketHandler: bucket.AddRemoteBucketHandlerFunc(func(params bucket.AddRemoteBucketParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.AddRemoteBucket has not yet been implemented")
|
||||
}),
|
||||
TieringAddTierHandler: tiering.AddTierHandlerFunc(func(params tiering.AddTierParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation tiering.AddTier has not yet been implemented")
|
||||
}),
|
||||
UserAddUserHandler: user.AddUserHandlerFunc(func(params user.AddUserParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user.AddUser has not yet been implemented")
|
||||
}),
|
||||
@@ -173,9 +155,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
BucketDeleteBucketEventHandler: bucket.DeleteBucketEventHandlerFunc(func(params bucket.DeleteBucketEventParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.DeleteBucketEvent has not yet been implemented")
|
||||
}),
|
||||
BucketDeleteBucketLifecycleRuleHandler: bucket.DeleteBucketLifecycleRuleHandlerFunc(func(params bucket.DeleteBucketLifecycleRuleParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.DeleteBucketLifecycleRule has not yet been implemented")
|
||||
}),
|
||||
BucketDeleteBucketReplicationRuleHandler: bucket.DeleteBucketReplicationRuleHandlerFunc(func(params bucket.DeleteBucketReplicationRuleParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.DeleteBucketReplicationRule has not yet been implemented")
|
||||
}),
|
||||
@@ -215,9 +194,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
PublicDownloadSharedObjectHandler: public.DownloadSharedObjectHandlerFunc(func(params public.DownloadSharedObjectParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation public.DownloadSharedObject has not yet been implemented")
|
||||
}),
|
||||
TieringEditTierCredentialsHandler: tiering.EditTierCredentialsHandlerFunc(func(params tiering.EditTierCredentialsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation tiering.EditTierCredentials has not yet been implemented")
|
||||
}),
|
||||
BucketEnableBucketEncryptionHandler: bucket.EnableBucketEncryptionHandlerFunc(func(params bucket.EnableBucketEncryptionParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.EnableBucketEncryption has not yet been implemented")
|
||||
}),
|
||||
@@ -227,9 +203,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
BucketGetBucketEncryptionInfoHandler: bucket.GetBucketEncryptionInfoHandlerFunc(func(params bucket.GetBucketEncryptionInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.GetBucketEncryptionInfo has not yet been implemented")
|
||||
}),
|
||||
BucketGetBucketLifecycleHandler: bucket.GetBucketLifecycleHandlerFunc(func(params bucket.GetBucketLifecycleParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.GetBucketLifecycle has not yet been implemented")
|
||||
}),
|
||||
BucketGetBucketObjectLockingStatusHandler: bucket.GetBucketObjectLockingStatusHandlerFunc(func(params bucket.GetBucketObjectLockingStatusParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.GetBucketObjectLockingStatus has not yet been implemented")
|
||||
}),
|
||||
@@ -251,9 +224,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
BucketGetBucketVersioningHandler: bucket.GetBucketVersioningHandlerFunc(func(params bucket.GetBucketVersioningParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.GetBucketVersioning has not yet been implemented")
|
||||
}),
|
||||
SupportGetCallHomeOptionValueHandler: support.GetCallHomeOptionValueHandlerFunc(func(params support.GetCallHomeOptionValueParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation support.GetCallHomeOptionValue has not yet been implemented")
|
||||
}),
|
||||
IdpGetConfigurationHandler: idp.GetConfigurationHandlerFunc(func(params idp.GetConfigurationParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation idp.GetConfiguration has not yet been implemented")
|
||||
}),
|
||||
@@ -272,15 +242,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
ServiceAccountGetServiceAccountHandler: service_account.GetServiceAccountHandlerFunc(func(params service_account.GetServiceAccountParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation service_account.GetServiceAccount has not yet been implemented")
|
||||
}),
|
||||
SiteReplicationGetSiteReplicationInfoHandler: site_replication.GetSiteReplicationInfoHandlerFunc(func(params site_replication.GetSiteReplicationInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation site_replication.GetSiteReplicationInfo has not yet been implemented")
|
||||
}),
|
||||
SiteReplicationGetSiteReplicationStatusHandler: site_replication.GetSiteReplicationStatusHandlerFunc(func(params site_replication.GetSiteReplicationStatusParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation site_replication.GetSiteReplicationStatus has not yet been implemented")
|
||||
}),
|
||||
TieringGetTierHandler: tiering.GetTierHandlerFunc(func(params tiering.GetTierParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation tiering.GetTier has not yet been implemented")
|
||||
}),
|
||||
UserGetUserInfoHandler: user.GetUserInfoHandlerFunc(func(params user.GetUserInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user.GetUserInfo has not yet been implemented")
|
||||
}),
|
||||
@@ -296,54 +257,18 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
KmsKMSAPIsHandler: k_m_s.KMSAPIsHandlerFunc(func(params k_m_s.KMSAPIsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSAPIs has not yet been implemented")
|
||||
}),
|
||||
KmsKMSAssignPolicyHandler: k_m_s.KMSAssignPolicyHandlerFunc(func(params k_m_s.KMSAssignPolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSAssignPolicy has not yet been implemented")
|
||||
}),
|
||||
KmsKMSCreateKeyHandler: k_m_s.KMSCreateKeyHandlerFunc(func(params k_m_s.KMSCreateKeyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSCreateKey has not yet been implemented")
|
||||
}),
|
||||
KmsKMSDeleteIdentityHandler: k_m_s.KMSDeleteIdentityHandlerFunc(func(params k_m_s.KMSDeleteIdentityParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSDeleteIdentity has not yet been implemented")
|
||||
}),
|
||||
KmsKMSDeleteKeyHandler: k_m_s.KMSDeleteKeyHandlerFunc(func(params k_m_s.KMSDeleteKeyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSDeleteKey has not yet been implemented")
|
||||
}),
|
||||
KmsKMSDeletePolicyHandler: k_m_s.KMSDeletePolicyHandlerFunc(func(params k_m_s.KMSDeletePolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSDeletePolicy has not yet been implemented")
|
||||
}),
|
||||
KmsKMSDescribeIdentityHandler: k_m_s.KMSDescribeIdentityHandlerFunc(func(params k_m_s.KMSDescribeIdentityParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSDescribeIdentity has not yet been implemented")
|
||||
}),
|
||||
KmsKMSDescribePolicyHandler: k_m_s.KMSDescribePolicyHandlerFunc(func(params k_m_s.KMSDescribePolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSDescribePolicy has not yet been implemented")
|
||||
}),
|
||||
KmsKMSDescribeSelfIdentityHandler: k_m_s.KMSDescribeSelfIdentityHandlerFunc(func(params k_m_s.KMSDescribeSelfIdentityParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSDescribeSelfIdentity has not yet been implemented")
|
||||
}),
|
||||
KmsKMSGetPolicyHandler: k_m_s.KMSGetPolicyHandlerFunc(func(params k_m_s.KMSGetPolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSGetPolicy has not yet been implemented")
|
||||
}),
|
||||
KmsKMSImportKeyHandler: k_m_s.KMSImportKeyHandlerFunc(func(params k_m_s.KMSImportKeyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSImportKey has not yet been implemented")
|
||||
}),
|
||||
KmsKMSKeyStatusHandler: k_m_s.KMSKeyStatusHandlerFunc(func(params k_m_s.KMSKeyStatusParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSKeyStatus has not yet been implemented")
|
||||
}),
|
||||
KmsKMSListIdentitiesHandler: k_m_s.KMSListIdentitiesHandlerFunc(func(params k_m_s.KMSListIdentitiesParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSListIdentities has not yet been implemented")
|
||||
}),
|
||||
KmsKMSListKeysHandler: k_m_s.KMSListKeysHandlerFunc(func(params k_m_s.KMSListKeysParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSListKeys has not yet been implemented")
|
||||
}),
|
||||
KmsKMSListPoliciesHandler: k_m_s.KMSListPoliciesHandlerFunc(func(params k_m_s.KMSListPoliciesParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSListPolicies has not yet been implemented")
|
||||
}),
|
||||
KmsKMSMetricsHandler: k_m_s.KMSMetricsHandlerFunc(func(params k_m_s.KMSMetricsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSMetrics has not yet been implemented")
|
||||
}),
|
||||
KmsKMSSetPolicyHandler: k_m_s.KMSSetPolicyHandlerFunc(func(params k_m_s.KMSSetPolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSSetPolicy has not yet been implemented")
|
||||
}),
|
||||
KmsKMSStatusHandler: k_m_s.KMSStatusHandlerFunc(func(params k_m_s.KMSStatusParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation k_m_s.KMSStatus has not yet been implemented")
|
||||
}),
|
||||
@@ -437,12 +362,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
ConfigurationPostConfigsImportHandler: configuration.PostConfigsImportHandlerFunc(func(params configuration.PostConfigsImportParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation configuration.PostConfigsImport has not yet been implemented")
|
||||
}),
|
||||
ProfileProfilingStartHandler: profile.ProfilingStartHandlerFunc(func(params profile.ProfilingStartParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation profile.ProfilingStart has not yet been implemented")
|
||||
}),
|
||||
ProfileProfilingStopHandler: profile.ProfilingStopHandlerFunc(func(params profile.ProfilingStopParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation profile.ProfilingStop has not yet been implemented")
|
||||
}),
|
||||
BucketPutBucketTagsHandler: bucket.PutBucketTagsHandlerFunc(func(params bucket.PutBucketTagsParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.PutBucketTags has not yet been implemented")
|
||||
}),
|
||||
@@ -467,9 +386,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
PolicyRemovePolicyHandler: policy.RemovePolicyHandlerFunc(func(params policy.RemovePolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation policy.RemovePolicy has not yet been implemented")
|
||||
}),
|
||||
TieringRemoveTierHandler: tiering.RemoveTierHandlerFunc(func(params tiering.RemoveTierParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation tiering.RemoveTier has not yet been implemented")
|
||||
}),
|
||||
UserRemoveUserHandler: user.RemoveUserHandlerFunc(func(params user.RemoveUserParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation user.RemoveUser has not yet been implemented")
|
||||
}),
|
||||
@@ -494,9 +410,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
BucketSetBucketVersioningHandler: bucket.SetBucketVersioningHandlerFunc(func(params bucket.SetBucketVersioningParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.SetBucketVersioning has not yet been implemented")
|
||||
}),
|
||||
SupportSetCallHomeStatusHandler: support.SetCallHomeStatusHandlerFunc(func(params support.SetCallHomeStatusParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation support.SetCallHomeStatus has not yet been implemented")
|
||||
}),
|
||||
ConfigurationSetConfigHandler: configuration.SetConfigHandlerFunc(func(params configuration.SetConfigParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation configuration.SetConfig has not yet been implemented")
|
||||
}),
|
||||
@@ -512,42 +425,6 @@ func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
|
||||
ObjectShareObjectHandler: object.ShareObjectHandlerFunc(func(params object.ShareObjectParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation object.ShareObject has not yet been implemented")
|
||||
}),
|
||||
SiteReplicationSiteReplicationEditHandler: site_replication.SiteReplicationEditHandlerFunc(func(params site_replication.SiteReplicationEditParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation site_replication.SiteReplicationEdit has not yet been implemented")
|
||||
}),
|
||||
SiteReplicationSiteReplicationInfoAddHandler: site_replication.SiteReplicationInfoAddHandlerFunc(func(params site_replication.SiteReplicationInfoAddParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation site_replication.SiteReplicationInfoAdd has not yet been implemented")
|
||||
}),
|
||||
SiteReplicationSiteReplicationRemoveHandler: site_replication.SiteReplicationRemoveHandlerFunc(func(params site_replication.SiteReplicationRemoveParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation site_replication.SiteReplicationRemove has not yet been implemented")
|
||||
}),
|
||||
SubnetSubnetAPIKeyHandler: subnet.SubnetAPIKeyHandlerFunc(func(params subnet.SubnetAPIKeyParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation subnet.SubnetAPIKey has not yet been implemented")
|
||||
}),
|
||||
SubnetSubnetInfoHandler: subnet.SubnetInfoHandlerFunc(func(params subnet.SubnetInfoParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation subnet.SubnetInfo has not yet been implemented")
|
||||
}),
|
||||
SubnetSubnetLoginHandler: subnet.SubnetLoginHandlerFunc(func(params subnet.SubnetLoginParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation subnet.SubnetLogin has not yet been implemented")
|
||||
}),
|
||||
SubnetSubnetLoginMFAHandler: subnet.SubnetLoginMFAHandlerFunc(func(params subnet.SubnetLoginMFAParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation subnet.SubnetLoginMFA has not yet been implemented")
|
||||
}),
|
||||
SubnetSubnetRegTokenHandler: subnet.SubnetRegTokenHandlerFunc(func(params subnet.SubnetRegTokenParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation subnet.SubnetRegToken has not yet been implemented")
|
||||
}),
|
||||
SubnetSubnetRegisterHandler: subnet.SubnetRegisterHandlerFunc(func(params subnet.SubnetRegisterParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation subnet.SubnetRegister has not yet been implemented")
|
||||
}),
|
||||
TieringTiersListHandler: tiering.TiersListHandlerFunc(func(params tiering.TiersListParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation tiering.TiersList has not yet been implemented")
|
||||
}),
|
||||
TieringTiersListNamesHandler: tiering.TiersListNamesHandlerFunc(func(params tiering.TiersListNamesParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation tiering.TiersListNames has not yet been implemented")
|
||||
}),
|
||||
BucketUpdateBucketLifecycleHandler: bucket.UpdateBucketLifecycleHandlerFunc(func(params bucket.UpdateBucketLifecycleParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation bucket.UpdateBucketLifecycle has not yet been implemented")
|
||||
}),
|
||||
IdpUpdateConfigurationHandler: idp.UpdateConfigurationHandlerFunc(func(params idp.UpdateConfigurationParams, principal *models.Principal) middleware.Responder {
|
||||
return middleware.NotImplemented("operation idp.UpdateConfiguration has not yet been implemented")
|
||||
}),
|
||||
@@ -611,9 +488,6 @@ type ConsoleAPI struct {
|
||||
// - multipart/form-data
|
||||
MultipartformConsumer runtime.Consumer
|
||||
|
||||
// ApplicationZipProducer registers a producer for the following mime types:
|
||||
// - application/zip
|
||||
ApplicationZipProducer runtime.Producer
|
||||
// BinProducer registers a producer for the following mime types:
|
||||
// - application/octet-stream
|
||||
BinProducer runtime.Producer
|
||||
@@ -634,20 +508,14 @@ type ConsoleAPI struct {
|
||||
|
||||
// AccountAccountChangePasswordHandler sets the operation handler for the account change password operation
|
||||
AccountAccountChangePasswordHandler account.AccountChangePasswordHandler
|
||||
// BucketAddBucketLifecycleHandler sets the operation handler for the add bucket lifecycle operation
|
||||
BucketAddBucketLifecycleHandler bucket.AddBucketLifecycleHandler
|
||||
// GroupAddGroupHandler sets the operation handler for the add group operation
|
||||
GroupAddGroupHandler group.AddGroupHandler
|
||||
// BucketAddMultiBucketLifecycleHandler sets the operation handler for the add multi bucket lifecycle operation
|
||||
BucketAddMultiBucketLifecycleHandler bucket.AddMultiBucketLifecycleHandler
|
||||
// ConfigurationAddNotificationEndpointHandler sets the operation handler for the add notification endpoint operation
|
||||
ConfigurationAddNotificationEndpointHandler configuration.AddNotificationEndpointHandler
|
||||
// PolicyAddPolicyHandler sets the operation handler for the add policy operation
|
||||
PolicyAddPolicyHandler policy.AddPolicyHandler
|
||||
// BucketAddRemoteBucketHandler sets the operation handler for the add remote bucket operation
|
||||
BucketAddRemoteBucketHandler bucket.AddRemoteBucketHandler
|
||||
// TieringAddTierHandler sets the operation handler for the add tier operation
|
||||
TieringAddTierHandler tiering.AddTierHandler
|
||||
// UserAddUserHandler sets the operation handler for the add user operation
|
||||
UserAddUserHandler user.AddUserHandler
|
||||
// SystemAdminInfoHandler sets the operation handler for the admin info operation
|
||||
@@ -688,8 +556,6 @@ type ConsoleAPI struct {
|
||||
BucketDeleteBucketHandler bucket.DeleteBucketHandler
|
||||
// BucketDeleteBucketEventHandler sets the operation handler for the delete bucket event operation
|
||||
BucketDeleteBucketEventHandler bucket.DeleteBucketEventHandler
|
||||
// BucketDeleteBucketLifecycleRuleHandler sets the operation handler for the delete bucket lifecycle rule operation
|
||||
BucketDeleteBucketLifecycleRuleHandler bucket.DeleteBucketLifecycleRuleHandler
|
||||
// BucketDeleteBucketReplicationRuleHandler sets the operation handler for the delete bucket replication rule operation
|
||||
BucketDeleteBucketReplicationRuleHandler bucket.DeleteBucketReplicationRuleHandler
|
||||
// IdpDeleteConfigurationHandler sets the operation handler for the delete configuration operation
|
||||
@@ -716,16 +582,12 @@ type ConsoleAPI struct {
|
||||
ObjectDownloadMultipleObjectsHandler object.DownloadMultipleObjectsHandler
|
||||
// PublicDownloadSharedObjectHandler sets the operation handler for the download shared object operation
|
||||
PublicDownloadSharedObjectHandler public.DownloadSharedObjectHandler
|
||||
// TieringEditTierCredentialsHandler sets the operation handler for the edit tier credentials operation
|
||||
TieringEditTierCredentialsHandler tiering.EditTierCredentialsHandler
|
||||
// BucketEnableBucketEncryptionHandler sets the operation handler for the enable bucket encryption operation
|
||||
BucketEnableBucketEncryptionHandler bucket.EnableBucketEncryptionHandler
|
||||
// ConfigurationExportConfigHandler sets the operation handler for the export config operation
|
||||
ConfigurationExportConfigHandler configuration.ExportConfigHandler
|
||||
// BucketGetBucketEncryptionInfoHandler sets the operation handler for the get bucket encryption info operation
|
||||
BucketGetBucketEncryptionInfoHandler bucket.GetBucketEncryptionInfoHandler
|
||||
// BucketGetBucketLifecycleHandler sets the operation handler for the get bucket lifecycle operation
|
||||
BucketGetBucketLifecycleHandler bucket.GetBucketLifecycleHandler
|
||||
// BucketGetBucketObjectLockingStatusHandler sets the operation handler for the get bucket object locking status operation
|
||||
BucketGetBucketObjectLockingStatusHandler bucket.GetBucketObjectLockingStatusHandler
|
||||
// BucketGetBucketQuotaHandler sets the operation handler for the get bucket quota operation
|
||||
@@ -740,8 +602,6 @@ type ConsoleAPI struct {
|
||||
BucketGetBucketRewindHandler bucket.GetBucketRewindHandler
|
||||
// BucketGetBucketVersioningHandler sets the operation handler for the get bucket versioning operation
|
||||
BucketGetBucketVersioningHandler bucket.GetBucketVersioningHandler
|
||||
// SupportGetCallHomeOptionValueHandler sets the operation handler for the get call home option value operation
|
||||
SupportGetCallHomeOptionValueHandler support.GetCallHomeOptionValueHandler
|
||||
// IdpGetConfigurationHandler sets the operation handler for the get configuration operation
|
||||
IdpGetConfigurationHandler idp.GetConfigurationHandler
|
||||
// IdpGetLDAPEntitiesHandler sets the operation handler for the get l d a p entities operation
|
||||
@@ -754,12 +614,6 @@ type ConsoleAPI struct {
|
||||
PolicyGetSAUserPolicyHandler policy.GetSAUserPolicyHandler
|
||||
// ServiceAccountGetServiceAccountHandler sets the operation handler for the get service account operation
|
||||
ServiceAccountGetServiceAccountHandler service_account.GetServiceAccountHandler
|
||||
// SiteReplicationGetSiteReplicationInfoHandler sets the operation handler for the get site replication info operation
|
||||
SiteReplicationGetSiteReplicationInfoHandler site_replication.GetSiteReplicationInfoHandler
|
||||
// SiteReplicationGetSiteReplicationStatusHandler sets the operation handler for the get site replication status operation
|
||||
SiteReplicationGetSiteReplicationStatusHandler site_replication.GetSiteReplicationStatusHandler
|
||||
// TieringGetTierHandler sets the operation handler for the get tier operation
|
||||
TieringGetTierHandler tiering.GetTierHandler
|
||||
// UserGetUserInfoHandler sets the operation handler for the get user info operation
|
||||
UserGetUserInfoHandler user.GetUserInfoHandler
|
||||
// PolicyGetUserPolicyHandler sets the operation handler for the get user policy operation
|
||||
@@ -770,38 +624,14 @@ type ConsoleAPI struct {
|
||||
InspectInspectHandler inspect.InspectHandler
|
||||
// KmsKMSAPIsHandler sets the operation handler for the k m s a p is operation
|
||||
KmsKMSAPIsHandler k_m_s.KMSAPIsHandler
|
||||
// KmsKMSAssignPolicyHandler sets the operation handler for the k m s assign policy operation
|
||||
KmsKMSAssignPolicyHandler k_m_s.KMSAssignPolicyHandler
|
||||
// KmsKMSCreateKeyHandler sets the operation handler for the k m s create key operation
|
||||
KmsKMSCreateKeyHandler k_m_s.KMSCreateKeyHandler
|
||||
// KmsKMSDeleteIdentityHandler sets the operation handler for the k m s delete identity operation
|
||||
KmsKMSDeleteIdentityHandler k_m_s.KMSDeleteIdentityHandler
|
||||
// KmsKMSDeleteKeyHandler sets the operation handler for the k m s delete key operation
|
||||
KmsKMSDeleteKeyHandler k_m_s.KMSDeleteKeyHandler
|
||||
// KmsKMSDeletePolicyHandler sets the operation handler for the k m s delete policy operation
|
||||
KmsKMSDeletePolicyHandler k_m_s.KMSDeletePolicyHandler
|
||||
// KmsKMSDescribeIdentityHandler sets the operation handler for the k m s describe identity operation
|
||||
KmsKMSDescribeIdentityHandler k_m_s.KMSDescribeIdentityHandler
|
||||
// KmsKMSDescribePolicyHandler sets the operation handler for the k m s describe policy operation
|
||||
KmsKMSDescribePolicyHandler k_m_s.KMSDescribePolicyHandler
|
||||
// KmsKMSDescribeSelfIdentityHandler sets the operation handler for the k m s describe self identity operation
|
||||
KmsKMSDescribeSelfIdentityHandler k_m_s.KMSDescribeSelfIdentityHandler
|
||||
// KmsKMSGetPolicyHandler sets the operation handler for the k m s get policy operation
|
||||
KmsKMSGetPolicyHandler k_m_s.KMSGetPolicyHandler
|
||||
// KmsKMSImportKeyHandler sets the operation handler for the k m s import key operation
|
||||
KmsKMSImportKeyHandler k_m_s.KMSImportKeyHandler
|
||||
// KmsKMSKeyStatusHandler sets the operation handler for the k m s key status operation
|
||||
KmsKMSKeyStatusHandler k_m_s.KMSKeyStatusHandler
|
||||
// KmsKMSListIdentitiesHandler sets the operation handler for the k m s list identities operation
|
||||
KmsKMSListIdentitiesHandler k_m_s.KMSListIdentitiesHandler
|
||||
// KmsKMSListKeysHandler sets the operation handler for the k m s list keys operation
|
||||
KmsKMSListKeysHandler k_m_s.KMSListKeysHandler
|
||||
// KmsKMSListPoliciesHandler sets the operation handler for the k m s list policies operation
|
||||
KmsKMSListPoliciesHandler k_m_s.KMSListPoliciesHandler
|
||||
// KmsKMSMetricsHandler sets the operation handler for the k m s metrics operation
|
||||
KmsKMSMetricsHandler k_m_s.KMSMetricsHandler
|
||||
// KmsKMSSetPolicyHandler sets the operation handler for the k m s set policy operation
|
||||
KmsKMSSetPolicyHandler k_m_s.KMSSetPolicyHandler
|
||||
// KmsKMSStatusHandler sets the operation handler for the k m s status operation
|
||||
KmsKMSStatusHandler k_m_s.KMSStatusHandler
|
||||
// KmsKMSVersionHandler sets the operation handler for the k m s version operation
|
||||
@@ -864,10 +694,6 @@ type ConsoleAPI struct {
|
||||
ObjectPostBucketsBucketNameObjectsUploadHandler object.PostBucketsBucketNameObjectsUploadHandler
|
||||
// ConfigurationPostConfigsImportHandler sets the operation handler for the post configs import operation
|
||||
ConfigurationPostConfigsImportHandler configuration.PostConfigsImportHandler
|
||||
// ProfileProfilingStartHandler sets the operation handler for the profiling start operation
|
||||
ProfileProfilingStartHandler profile.ProfilingStartHandler
|
||||
// ProfileProfilingStopHandler sets the operation handler for the profiling stop operation
|
||||
ProfileProfilingStopHandler profile.ProfilingStopHandler
|
||||
// BucketPutBucketTagsHandler sets the operation handler for the put bucket tags operation
|
||||
BucketPutBucketTagsHandler bucket.PutBucketTagsHandler
|
||||
// ObjectPutObjectLegalHoldHandler sets the operation handler for the put object legal hold operation
|
||||
@@ -884,8 +710,6 @@ type ConsoleAPI struct {
|
||||
GroupRemoveGroupHandler group.RemoveGroupHandler
|
||||
// PolicyRemovePolicyHandler sets the operation handler for the remove policy operation
|
||||
PolicyRemovePolicyHandler policy.RemovePolicyHandler
|
||||
// TieringRemoveTierHandler sets the operation handler for the remove tier operation
|
||||
TieringRemoveTierHandler tiering.RemoveTierHandler
|
||||
// UserRemoveUserHandler sets the operation handler for the remove user operation
|
||||
UserRemoveUserHandler user.RemoveUserHandler
|
||||
// ConfigurationResetConfigHandler sets the operation handler for the reset config operation
|
||||
@@ -902,8 +726,6 @@ type ConsoleAPI struct {
|
||||
BucketSetBucketRetentionConfigHandler bucket.SetBucketRetentionConfigHandler
|
||||
// BucketSetBucketVersioningHandler sets the operation handler for the set bucket versioning operation
|
||||
BucketSetBucketVersioningHandler bucket.SetBucketVersioningHandler
|
||||
// SupportSetCallHomeStatusHandler sets the operation handler for the set call home status operation
|
||||
SupportSetCallHomeStatusHandler support.SetCallHomeStatusHandler
|
||||
// ConfigurationSetConfigHandler sets the operation handler for the set config operation
|
||||
ConfigurationSetConfigHandler configuration.SetConfigHandler
|
||||
// BucketSetMultiBucketReplicationHandler sets the operation handler for the set multi bucket replication operation
|
||||
@@ -914,30 +736,6 @@ type ConsoleAPI struct {
|
||||
PolicySetPolicyMultipleHandler policy.SetPolicyMultipleHandler
|
||||
// ObjectShareObjectHandler sets the operation handler for the share object operation
|
||||
ObjectShareObjectHandler object.ShareObjectHandler
|
||||
// SiteReplicationSiteReplicationEditHandler sets the operation handler for the site replication edit operation
|
||||
SiteReplicationSiteReplicationEditHandler site_replication.SiteReplicationEditHandler
|
||||
// SiteReplicationSiteReplicationInfoAddHandler sets the operation handler for the site replication info add operation
|
||||
SiteReplicationSiteReplicationInfoAddHandler site_replication.SiteReplicationInfoAddHandler
|
||||
// SiteReplicationSiteReplicationRemoveHandler sets the operation handler for the site replication remove operation
|
||||
SiteReplicationSiteReplicationRemoveHandler site_replication.SiteReplicationRemoveHandler
|
||||
// SubnetSubnetAPIKeyHandler sets the operation handler for the subnet Api key operation
|
||||
SubnetSubnetAPIKeyHandler subnet.SubnetAPIKeyHandler
|
||||
// SubnetSubnetInfoHandler sets the operation handler for the subnet info operation
|
||||
SubnetSubnetInfoHandler subnet.SubnetInfoHandler
|
||||
// SubnetSubnetLoginHandler sets the operation handler for the subnet login operation
|
||||
SubnetSubnetLoginHandler subnet.SubnetLoginHandler
|
||||
// SubnetSubnetLoginMFAHandler sets the operation handler for the subnet login m f a operation
|
||||
SubnetSubnetLoginMFAHandler subnet.SubnetLoginMFAHandler
|
||||
// SubnetSubnetRegTokenHandler sets the operation handler for the subnet reg token operation
|
||||
SubnetSubnetRegTokenHandler subnet.SubnetRegTokenHandler
|
||||
// SubnetSubnetRegisterHandler sets the operation handler for the subnet register operation
|
||||
SubnetSubnetRegisterHandler subnet.SubnetRegisterHandler
|
||||
// TieringTiersListHandler sets the operation handler for the tiers list operation
|
||||
TieringTiersListHandler tiering.TiersListHandler
|
||||
// TieringTiersListNamesHandler sets the operation handler for the tiers list names operation
|
||||
TieringTiersListNamesHandler tiering.TiersListNamesHandler
|
||||
// BucketUpdateBucketLifecycleHandler sets the operation handler for the update bucket lifecycle operation
|
||||
BucketUpdateBucketLifecycleHandler bucket.UpdateBucketLifecycleHandler
|
||||
// IdpUpdateConfigurationHandler sets the operation handler for the update configuration operation
|
||||
IdpUpdateConfigurationHandler idp.UpdateConfigurationHandler
|
||||
// GroupUpdateGroupHandler sets the operation handler for the update group operation
|
||||
@@ -1026,9 +824,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
unregistered = append(unregistered, "MultipartformConsumer")
|
||||
}
|
||||
|
||||
if o.ApplicationZipProducer == nil {
|
||||
unregistered = append(unregistered, "ApplicationZipProducer")
|
||||
}
|
||||
if o.BinProducer == nil {
|
||||
unregistered = append(unregistered, "BinProducer")
|
||||
}
|
||||
@@ -1046,15 +841,9 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.AccountAccountChangePasswordHandler == nil {
|
||||
unregistered = append(unregistered, "account.AccountChangePasswordHandler")
|
||||
}
|
||||
if o.BucketAddBucketLifecycleHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.AddBucketLifecycleHandler")
|
||||
}
|
||||
if o.GroupAddGroupHandler == nil {
|
||||
unregistered = append(unregistered, "group.AddGroupHandler")
|
||||
}
|
||||
if o.BucketAddMultiBucketLifecycleHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.AddMultiBucketLifecycleHandler")
|
||||
}
|
||||
if o.ConfigurationAddNotificationEndpointHandler == nil {
|
||||
unregistered = append(unregistered, "configuration.AddNotificationEndpointHandler")
|
||||
}
|
||||
@@ -1064,9 +853,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.BucketAddRemoteBucketHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.AddRemoteBucketHandler")
|
||||
}
|
||||
if o.TieringAddTierHandler == nil {
|
||||
unregistered = append(unregistered, "tiering.AddTierHandler")
|
||||
}
|
||||
if o.UserAddUserHandler == nil {
|
||||
unregistered = append(unregistered, "user.AddUserHandler")
|
||||
}
|
||||
@@ -1127,9 +913,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.BucketDeleteBucketEventHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.DeleteBucketEventHandler")
|
||||
}
|
||||
if o.BucketDeleteBucketLifecycleRuleHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.DeleteBucketLifecycleRuleHandler")
|
||||
}
|
||||
if o.BucketDeleteBucketReplicationRuleHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.DeleteBucketReplicationRuleHandler")
|
||||
}
|
||||
@@ -1169,9 +952,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.PublicDownloadSharedObjectHandler == nil {
|
||||
unregistered = append(unregistered, "public.DownloadSharedObjectHandler")
|
||||
}
|
||||
if o.TieringEditTierCredentialsHandler == nil {
|
||||
unregistered = append(unregistered, "tiering.EditTierCredentialsHandler")
|
||||
}
|
||||
if o.BucketEnableBucketEncryptionHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.EnableBucketEncryptionHandler")
|
||||
}
|
||||
@@ -1181,9 +961,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.BucketGetBucketEncryptionInfoHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.GetBucketEncryptionInfoHandler")
|
||||
}
|
||||
if o.BucketGetBucketLifecycleHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.GetBucketLifecycleHandler")
|
||||
}
|
||||
if o.BucketGetBucketObjectLockingStatusHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.GetBucketObjectLockingStatusHandler")
|
||||
}
|
||||
@@ -1205,9 +982,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.BucketGetBucketVersioningHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.GetBucketVersioningHandler")
|
||||
}
|
||||
if o.SupportGetCallHomeOptionValueHandler == nil {
|
||||
unregistered = append(unregistered, "support.GetCallHomeOptionValueHandler")
|
||||
}
|
||||
if o.IdpGetConfigurationHandler == nil {
|
||||
unregistered = append(unregistered, "idp.GetConfigurationHandler")
|
||||
}
|
||||
@@ -1226,15 +1000,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.ServiceAccountGetServiceAccountHandler == nil {
|
||||
unregistered = append(unregistered, "service_account.GetServiceAccountHandler")
|
||||
}
|
||||
if o.SiteReplicationGetSiteReplicationInfoHandler == nil {
|
||||
unregistered = append(unregistered, "site_replication.GetSiteReplicationInfoHandler")
|
||||
}
|
||||
if o.SiteReplicationGetSiteReplicationStatusHandler == nil {
|
||||
unregistered = append(unregistered, "site_replication.GetSiteReplicationStatusHandler")
|
||||
}
|
||||
if o.TieringGetTierHandler == nil {
|
||||
unregistered = append(unregistered, "tiering.GetTierHandler")
|
||||
}
|
||||
if o.UserGetUserInfoHandler == nil {
|
||||
unregistered = append(unregistered, "user.GetUserInfoHandler")
|
||||
}
|
||||
@@ -1250,54 +1015,18 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.KmsKMSAPIsHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSAPIsHandler")
|
||||
}
|
||||
if o.KmsKMSAssignPolicyHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSAssignPolicyHandler")
|
||||
}
|
||||
if o.KmsKMSCreateKeyHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSCreateKeyHandler")
|
||||
}
|
||||
if o.KmsKMSDeleteIdentityHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSDeleteIdentityHandler")
|
||||
}
|
||||
if o.KmsKMSDeleteKeyHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSDeleteKeyHandler")
|
||||
}
|
||||
if o.KmsKMSDeletePolicyHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSDeletePolicyHandler")
|
||||
}
|
||||
if o.KmsKMSDescribeIdentityHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSDescribeIdentityHandler")
|
||||
}
|
||||
if o.KmsKMSDescribePolicyHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSDescribePolicyHandler")
|
||||
}
|
||||
if o.KmsKMSDescribeSelfIdentityHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSDescribeSelfIdentityHandler")
|
||||
}
|
||||
if o.KmsKMSGetPolicyHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSGetPolicyHandler")
|
||||
}
|
||||
if o.KmsKMSImportKeyHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSImportKeyHandler")
|
||||
}
|
||||
if o.KmsKMSKeyStatusHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSKeyStatusHandler")
|
||||
}
|
||||
if o.KmsKMSListIdentitiesHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSListIdentitiesHandler")
|
||||
}
|
||||
if o.KmsKMSListKeysHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSListKeysHandler")
|
||||
}
|
||||
if o.KmsKMSListPoliciesHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSListPoliciesHandler")
|
||||
}
|
||||
if o.KmsKMSMetricsHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSMetricsHandler")
|
||||
}
|
||||
if o.KmsKMSSetPolicyHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSSetPolicyHandler")
|
||||
}
|
||||
if o.KmsKMSStatusHandler == nil {
|
||||
unregistered = append(unregistered, "k_m_s.KMSStatusHandler")
|
||||
}
|
||||
@@ -1391,12 +1120,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.ConfigurationPostConfigsImportHandler == nil {
|
||||
unregistered = append(unregistered, "configuration.PostConfigsImportHandler")
|
||||
}
|
||||
if o.ProfileProfilingStartHandler == nil {
|
||||
unregistered = append(unregistered, "profile.ProfilingStartHandler")
|
||||
}
|
||||
if o.ProfileProfilingStopHandler == nil {
|
||||
unregistered = append(unregistered, "profile.ProfilingStopHandler")
|
||||
}
|
||||
if o.BucketPutBucketTagsHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.PutBucketTagsHandler")
|
||||
}
|
||||
@@ -1421,9 +1144,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.PolicyRemovePolicyHandler == nil {
|
||||
unregistered = append(unregistered, "policy.RemovePolicyHandler")
|
||||
}
|
||||
if o.TieringRemoveTierHandler == nil {
|
||||
unregistered = append(unregistered, "tiering.RemoveTierHandler")
|
||||
}
|
||||
if o.UserRemoveUserHandler == nil {
|
||||
unregistered = append(unregistered, "user.RemoveUserHandler")
|
||||
}
|
||||
@@ -1448,9 +1168,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.BucketSetBucketVersioningHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.SetBucketVersioningHandler")
|
||||
}
|
||||
if o.SupportSetCallHomeStatusHandler == nil {
|
||||
unregistered = append(unregistered, "support.SetCallHomeStatusHandler")
|
||||
}
|
||||
if o.ConfigurationSetConfigHandler == nil {
|
||||
unregistered = append(unregistered, "configuration.SetConfigHandler")
|
||||
}
|
||||
@@ -1466,42 +1183,6 @@ func (o *ConsoleAPI) Validate() error {
|
||||
if o.ObjectShareObjectHandler == nil {
|
||||
unregistered = append(unregistered, "object.ShareObjectHandler")
|
||||
}
|
||||
if o.SiteReplicationSiteReplicationEditHandler == nil {
|
||||
unregistered = append(unregistered, "site_replication.SiteReplicationEditHandler")
|
||||
}
|
||||
if o.SiteReplicationSiteReplicationInfoAddHandler == nil {
|
||||
unregistered = append(unregistered, "site_replication.SiteReplicationInfoAddHandler")
|
||||
}
|
||||
if o.SiteReplicationSiteReplicationRemoveHandler == nil {
|
||||
unregistered = append(unregistered, "site_replication.SiteReplicationRemoveHandler")
|
||||
}
|
||||
if o.SubnetSubnetAPIKeyHandler == nil {
|
||||
unregistered = append(unregistered, "subnet.SubnetAPIKeyHandler")
|
||||
}
|
||||
if o.SubnetSubnetInfoHandler == nil {
|
||||
unregistered = append(unregistered, "subnet.SubnetInfoHandler")
|
||||
}
|
||||
if o.SubnetSubnetLoginHandler == nil {
|
||||
unregistered = append(unregistered, "subnet.SubnetLoginHandler")
|
||||
}
|
||||
if o.SubnetSubnetLoginMFAHandler == nil {
|
||||
unregistered = append(unregistered, "subnet.SubnetLoginMFAHandler")
|
||||
}
|
||||
if o.SubnetSubnetRegTokenHandler == nil {
|
||||
unregistered = append(unregistered, "subnet.SubnetRegTokenHandler")
|
||||
}
|
||||
if o.SubnetSubnetRegisterHandler == nil {
|
||||
unregistered = append(unregistered, "subnet.SubnetRegisterHandler")
|
||||
}
|
||||
if o.TieringTiersListHandler == nil {
|
||||
unregistered = append(unregistered, "tiering.TiersListHandler")
|
||||
}
|
||||
if o.TieringTiersListNamesHandler == nil {
|
||||
unregistered = append(unregistered, "tiering.TiersListNamesHandler")
|
||||
}
|
||||
if o.BucketUpdateBucketLifecycleHandler == nil {
|
||||
unregistered = append(unregistered, "bucket.UpdateBucketLifecycleHandler")
|
||||
}
|
||||
if o.IdpUpdateConfigurationHandler == nil {
|
||||
unregistered = append(unregistered, "idp.UpdateConfigurationHandler")
|
||||
}
|
||||
@@ -1584,8 +1265,6 @@ func (o *ConsoleAPI) ProducersFor(mediaTypes []string) map[string]runtime.Produc
|
||||
result := make(map[string]runtime.Producer, len(mediaTypes))
|
||||
for _, mt := range mediaTypes {
|
||||
switch mt {
|
||||
case "application/zip":
|
||||
result["application/zip"] = o.ApplicationZipProducer
|
||||
case "application/octet-stream":
|
||||
result["application/octet-stream"] = o.BinProducer
|
||||
case "application/json":
|
||||
@@ -1637,18 +1316,10 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/buckets/{bucket_name}/lifecycle"] = bucket.NewAddBucketLifecycle(o.context, o.BucketAddBucketLifecycleHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/groups"] = group.NewAddGroup(o.context, o.GroupAddGroupHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/buckets/multi-lifecycle"] = bucket.NewAddMultiBucketLifecycle(o.context, o.BucketAddMultiBucketLifecycleHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/admin/notification_endpoints"] = configuration.NewAddNotificationEndpoint(o.context, o.ConfigurationAddNotificationEndpointHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
@@ -1661,10 +1332,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/admin/tiers"] = tiering.NewAddTier(o.context, o.TieringAddTierHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/users"] = user.NewAddUser(o.context, o.UserAddUserHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
@@ -1745,10 +1412,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/buckets/{bucket_name}/lifecycle/{lifecycle_id}"] = bucket.NewDeleteBucketLifecycleRule(o.context, o.BucketDeleteBucketLifecycleRuleHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/buckets/{bucket_name}/replication/{rule_id}"] = bucket.NewDeleteBucketReplicationRule(o.context, o.BucketDeleteBucketReplicationRuleHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
@@ -1798,10 +1461,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/download-shared-object/{url}"] = public.NewDownloadSharedObject(o.context, o.PublicDownloadSharedObjectHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/admin/tiers/{type}/{name}/credentials"] = tiering.NewEditTierCredentials(o.context, o.TieringEditTierCredentialsHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -1817,10 +1476,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/buckets/{bucket_name}/lifecycle"] = bucket.NewGetBucketLifecycle(o.context, o.BucketGetBucketLifecycleHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/buckets/{bucket_name}/object-locking"] = bucket.NewGetBucketObjectLockingStatus(o.context, o.BucketGetBucketObjectLockingStatusHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
@@ -1849,10 +1504,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/support/callhome"] = support.NewGetCallHomeOptionValue(o.context, o.SupportGetCallHomeOptionValueHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/idp/{type}/{name}"] = idp.NewGetConfiguration(o.context, o.IdpGetConfigurationHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
@@ -1877,18 +1528,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/admin/site-replication"] = site_replication.NewGetSiteReplicationInfo(o.context, o.SiteReplicationGetSiteReplicationInfoHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/admin/site-replication/status"] = site_replication.NewGetSiteReplicationStatus(o.context, o.SiteReplicationGetSiteReplicationStatusHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/admin/tiers/{type}/{name}"] = tiering.NewGetTier(o.context, o.TieringGetTierHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/user/{name}"] = user.NewGetUserInfo(o.context, o.UserGetUserInfoHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
@@ -1909,43 +1548,7 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/kms/policies/{name}/assign"] = k_m_s.NewKMSAssignPolicy(o.context, o.KmsKMSAssignPolicyHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/kms/keys"] = k_m_s.NewKMSCreateKey(o.context, o.KmsKMSCreateKeyHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/kms/identities/{name}"] = k_m_s.NewKMSDeleteIdentity(o.context, o.KmsKMSDeleteIdentityHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/kms/keys/{name}"] = k_m_s.NewKMSDeleteKey(o.context, o.KmsKMSDeleteKeyHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/kms/policies/{name}"] = k_m_s.NewKMSDeletePolicy(o.context, o.KmsKMSDeletePolicyHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/identities/{name}/describe"] = k_m_s.NewKMSDescribeIdentity(o.context, o.KmsKMSDescribeIdentityHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/policies/{name}/describe"] = k_m_s.NewKMSDescribePolicy(o.context, o.KmsKMSDescribePolicyHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/describe-self/identity"] = k_m_s.NewKMSDescribeSelfIdentity(o.context, o.KmsKMSDescribeSelfIdentityHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/policies/{name}"] = k_m_s.NewKMSGetPolicy(o.context, o.KmsKMSGetPolicyHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/kms/keys/{name}/import"] = k_m_s.NewKMSImportKey(o.context, o.KmsKMSImportKeyHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -1953,23 +1556,11 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/identities"] = k_m_s.NewKMSListIdentities(o.context, o.KmsKMSListIdentitiesHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/keys"] = k_m_s.NewKMSListKeys(o.context, o.KmsKMSListKeysHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/policies"] = k_m_s.NewKMSListPolicies(o.context, o.KmsKMSListPoliciesHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/kms/metrics"] = k_m_s.NewKMSMetrics(o.context, o.KmsKMSMetricsHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/kms/policies"] = k_m_s.NewKMSSetPolicy(o.context, o.KmsKMSSetPolicyHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -2094,14 +1685,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/configs/import"] = configuration.NewPostConfigsImport(o.context, o.ConfigurationPostConfigsImportHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/profiling/start"] = profile.NewProfilingStart(o.context, o.ProfileProfilingStartHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/profiling/stop"] = profile.NewProfilingStop(o.context, o.ProfileProfilingStopHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -2137,10 +1720,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/admin/tiers/{name}/remove"] = tiering.NewRemoveTier(o.context, o.TieringRemoveTierHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/user/{name}"] = user.NewRemoveUser(o.context, o.UserRemoveUserHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
@@ -2173,10 +1752,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/support/callhome"] = support.NewSetCallHomeStatus(o.context, o.SupportSetCallHomeStatusHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/configs/{name}"] = configuration.NewSetConfig(o.context, o.ConfigurationSetConfigHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
@@ -2197,54 +1772,6 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/admin/site-replication"] = site_replication.NewSiteReplicationEdit(o.context, o.SiteReplicationSiteReplicationEditHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/admin/site-replication"] = site_replication.NewSiteReplicationInfoAdd(o.context, o.SiteReplicationSiteReplicationInfoAddHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/admin/site-replication"] = site_replication.NewSiteReplicationRemove(o.context, o.SiteReplicationSiteReplicationRemoveHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/subnet/apikey"] = subnet.NewSubnetAPIKey(o.context, o.SubnetSubnetAPIKeyHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/subnet/info"] = subnet.NewSubnetInfo(o.context, o.SubnetSubnetInfoHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subnet/login"] = subnet.NewSubnetLogin(o.context, o.SubnetSubnetLoginHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subnet/login/mfa"] = subnet.NewSubnetLoginMFA(o.context, o.SubnetSubnetLoginMFAHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/subnet/registration-token"] = subnet.NewSubnetRegToken(o.context, o.SubnetSubnetRegTokenHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/subnet/register"] = subnet.NewSubnetRegister(o.context, o.SubnetSubnetRegisterHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/admin/tiers"] = tiering.NewTiersList(o.context, o.TieringTiersListHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/admin/tiers/names"] = tiering.NewTiersListNames(o.context, o.TieringTiersListNamesHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/buckets/{bucket_name}/lifecycle/{lifecycle_id}"] = bucket.NewUpdateBucketLifecycle(o.context, o.BucketUpdateBucketLifecycleHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/idp/{type}/{name}"] = idp.NewUpdateConfiguration(o.context, o.IdpUpdateConfigurationHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSAssignPolicyHandlerFunc turns a function with the right signature into a k m s assign policy handler
|
||||
type KMSAssignPolicyHandlerFunc func(KMSAssignPolicyParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSAssignPolicyHandlerFunc) Handle(params KMSAssignPolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSAssignPolicyHandler interface for that can handle valid k m s assign policy params
|
||||
type KMSAssignPolicyHandler interface {
|
||||
Handle(KMSAssignPolicyParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSAssignPolicy creates a new http.Handler for the k m s assign policy operation
|
||||
func NewKMSAssignPolicy(ctx *middleware.Context, handler KMSAssignPolicyHandler) *KMSAssignPolicy {
|
||||
return &KMSAssignPolicy{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSAssignPolicy swagger:route POST /kms/policies/{name}/assign KMS kMSAssignPolicy
|
||||
|
||||
KMS assign policy
|
||||
*/
|
||||
type KMSAssignPolicy struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSAssignPolicyHandler
|
||||
}
|
||||
|
||||
func (o *KMSAssignPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSAssignPolicyParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"io"
|
||||
"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"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewKMSAssignPolicyParams creates a new KMSAssignPolicyParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSAssignPolicyParams() KMSAssignPolicyParams {
|
||||
|
||||
return KMSAssignPolicyParams{}
|
||||
}
|
||||
|
||||
// KMSAssignPolicyParams contains all the bound params for the k m s assign policy operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSAssignPolicy
|
||||
type KMSAssignPolicyParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.KmsAssignPolicyRequest
|
||||
/*KMS policy name
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name 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 NewKMSAssignPolicyParams() beforehand.
|
||||
func (o *KMSAssignPolicyParams) 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.KmsAssignPolicyRequest
|
||||
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(r.Context())
|
||||
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", ""))
|
||||
}
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
func (o *KMSAssignPolicyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSAssignPolicyOKCode is the HTTP code returned for type KMSAssignPolicyOK
|
||||
const KMSAssignPolicyOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSAssignPolicyOK A successful response.
|
||||
|
||||
swagger:response kMSAssignPolicyOK
|
||||
*/
|
||||
type KMSAssignPolicyOK struct {
|
||||
}
|
||||
|
||||
// NewKMSAssignPolicyOK creates KMSAssignPolicyOK with default headers values
|
||||
func NewKMSAssignPolicyOK() *KMSAssignPolicyOK {
|
||||
|
||||
return &KMSAssignPolicyOK{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSAssignPolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(200)
|
||||
}
|
||||
|
||||
/*
|
||||
KMSAssignPolicyDefault Generic error response.
|
||||
|
||||
swagger:response kMSAssignPolicyDefault
|
||||
*/
|
||||
type KMSAssignPolicyDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSAssignPolicyDefault creates KMSAssignPolicyDefault with default headers values
|
||||
func NewKMSAssignPolicyDefault(code int) *KMSAssignPolicyDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSAssignPolicyDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s assign policy default response
|
||||
func (o *KMSAssignPolicyDefault) WithStatusCode(code int) *KMSAssignPolicyDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s assign policy default response
|
||||
func (o *KMSAssignPolicyDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s assign policy default response
|
||||
func (o *KMSAssignPolicyDefault) WithPayload(payload *models.APIError) *KMSAssignPolicyDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s assign policy default response
|
||||
func (o *KMSAssignPolicyDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSAssignPolicyDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// KMSAssignPolicyURL generates an URL for the k m s assign policy operation
|
||||
type KMSAssignPolicyURL struct {
|
||||
Name 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 *KMSAssignPolicyURL) WithBasePath(bp string) *KMSAssignPolicyURL {
|
||||
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 *KMSAssignPolicyURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSAssignPolicyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policies/{name}/assign"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on KMSAssignPolicyURL")
|
||||
}
|
||||
|
||||
_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 *KMSAssignPolicyURL) 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 *KMSAssignPolicyURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSAssignPolicyURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSAssignPolicyURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSAssignPolicyURL")
|
||||
}
|
||||
|
||||
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 *KMSAssignPolicyURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDeleteIdentityHandlerFunc turns a function with the right signature into a k m s delete identity handler
|
||||
type KMSDeleteIdentityHandlerFunc func(KMSDeleteIdentityParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSDeleteIdentityHandlerFunc) Handle(params KMSDeleteIdentityParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSDeleteIdentityHandler interface for that can handle valid k m s delete identity params
|
||||
type KMSDeleteIdentityHandler interface {
|
||||
Handle(KMSDeleteIdentityParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSDeleteIdentity creates a new http.Handler for the k m s delete identity operation
|
||||
func NewKMSDeleteIdentity(ctx *middleware.Context, handler KMSDeleteIdentityHandler) *KMSDeleteIdentity {
|
||||
return &KMSDeleteIdentity{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDeleteIdentity swagger:route DELETE /kms/identities/{name} KMS kMSDeleteIdentity
|
||||
|
||||
KMS delete identity
|
||||
*/
|
||||
type KMSDeleteIdentity struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSDeleteIdentityHandler
|
||||
}
|
||||
|
||||
func (o *KMSDeleteIdentity) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSDeleteIdentityParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewKMSDeleteIdentityParams creates a new KMSDeleteIdentityParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSDeleteIdentityParams() KMSDeleteIdentityParams {
|
||||
|
||||
return KMSDeleteIdentityParams{}
|
||||
}
|
||||
|
||||
// KMSDeleteIdentityParams contains all the bound params for the k m s delete identity operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSDeleteIdentity
|
||||
type KMSDeleteIdentityParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*KMS identity name
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name 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 NewKMSDeleteIdentityParams() beforehand.
|
||||
func (o *KMSDeleteIdentityParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
func (o *KMSDeleteIdentityParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDeleteIdentityOKCode is the HTTP code returned for type KMSDeleteIdentityOK
|
||||
const KMSDeleteIdentityOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSDeleteIdentityOK A successful response.
|
||||
|
||||
swagger:response kMSDeleteIdentityOK
|
||||
*/
|
||||
type KMSDeleteIdentityOK struct {
|
||||
}
|
||||
|
||||
// NewKMSDeleteIdentityOK creates KMSDeleteIdentityOK with default headers values
|
||||
func NewKMSDeleteIdentityOK() *KMSDeleteIdentityOK {
|
||||
|
||||
return &KMSDeleteIdentityOK{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDeleteIdentityOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(200)
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDeleteIdentityDefault Generic error response.
|
||||
|
||||
swagger:response kMSDeleteIdentityDefault
|
||||
*/
|
||||
type KMSDeleteIdentityDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDeleteIdentityDefault creates KMSDeleteIdentityDefault with default headers values
|
||||
func NewKMSDeleteIdentityDefault(code int) *KMSDeleteIdentityDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSDeleteIdentityDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s delete identity default response
|
||||
func (o *KMSDeleteIdentityDefault) WithStatusCode(code int) *KMSDeleteIdentityDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s delete identity default response
|
||||
func (o *KMSDeleteIdentityDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s delete identity default response
|
||||
func (o *KMSDeleteIdentityDefault) WithPayload(payload *models.APIError) *KMSDeleteIdentityDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s delete identity default response
|
||||
func (o *KMSDeleteIdentityDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDeleteIdentityDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// KMSDeleteIdentityURL generates an URL for the k m s delete identity operation
|
||||
type KMSDeleteIdentityURL struct {
|
||||
Name 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 *KMSDeleteIdentityURL) WithBasePath(bp string) *KMSDeleteIdentityURL {
|
||||
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 *KMSDeleteIdentityURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSDeleteIdentityURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/identities/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on KMSDeleteIdentityURL")
|
||||
}
|
||||
|
||||
_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 *KMSDeleteIdentityURL) 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 *KMSDeleteIdentityURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSDeleteIdentityURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSDeleteIdentityURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSDeleteIdentityURL")
|
||||
}
|
||||
|
||||
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 *KMSDeleteIdentityURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDeleteKeyHandlerFunc turns a function with the right signature into a k m s delete key handler
|
||||
type KMSDeleteKeyHandlerFunc func(KMSDeleteKeyParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSDeleteKeyHandlerFunc) Handle(params KMSDeleteKeyParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSDeleteKeyHandler interface for that can handle valid k m s delete key params
|
||||
type KMSDeleteKeyHandler interface {
|
||||
Handle(KMSDeleteKeyParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSDeleteKey creates a new http.Handler for the k m s delete key operation
|
||||
func NewKMSDeleteKey(ctx *middleware.Context, handler KMSDeleteKeyHandler) *KMSDeleteKey {
|
||||
return &KMSDeleteKey{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDeleteKey swagger:route DELETE /kms/keys/{name} KMS kMSDeleteKey
|
||||
|
||||
KMS delete key
|
||||
*/
|
||||
type KMSDeleteKey struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSDeleteKeyHandler
|
||||
}
|
||||
|
||||
func (o *KMSDeleteKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSDeleteKeyParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewKMSDeleteKeyParams creates a new KMSDeleteKeyParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSDeleteKeyParams() KMSDeleteKeyParams {
|
||||
|
||||
return KMSDeleteKeyParams{}
|
||||
}
|
||||
|
||||
// KMSDeleteKeyParams contains all the bound params for the k m s delete key operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSDeleteKey
|
||||
type KMSDeleteKeyParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*KMS key name
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name 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 NewKMSDeleteKeyParams() beforehand.
|
||||
func (o *KMSDeleteKeyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
func (o *KMSDeleteKeyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDeleteKeyOKCode is the HTTP code returned for type KMSDeleteKeyOK
|
||||
const KMSDeleteKeyOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSDeleteKeyOK A successful response.
|
||||
|
||||
swagger:response kMSDeleteKeyOK
|
||||
*/
|
||||
type KMSDeleteKeyOK struct {
|
||||
}
|
||||
|
||||
// NewKMSDeleteKeyOK creates KMSDeleteKeyOK with default headers values
|
||||
func NewKMSDeleteKeyOK() *KMSDeleteKeyOK {
|
||||
|
||||
return &KMSDeleteKeyOK{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDeleteKeyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(200)
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDeleteKeyDefault Generic error response.
|
||||
|
||||
swagger:response kMSDeleteKeyDefault
|
||||
*/
|
||||
type KMSDeleteKeyDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDeleteKeyDefault creates KMSDeleteKeyDefault with default headers values
|
||||
func NewKMSDeleteKeyDefault(code int) *KMSDeleteKeyDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSDeleteKeyDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s delete key default response
|
||||
func (o *KMSDeleteKeyDefault) WithStatusCode(code int) *KMSDeleteKeyDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s delete key default response
|
||||
func (o *KMSDeleteKeyDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s delete key default response
|
||||
func (o *KMSDeleteKeyDefault) WithPayload(payload *models.APIError) *KMSDeleteKeyDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s delete key default response
|
||||
func (o *KMSDeleteKeyDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDeleteKeyDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// KMSDeleteKeyURL generates an URL for the k m s delete key operation
|
||||
type KMSDeleteKeyURL struct {
|
||||
Name 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 *KMSDeleteKeyURL) WithBasePath(bp string) *KMSDeleteKeyURL {
|
||||
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 *KMSDeleteKeyURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSDeleteKeyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/keys/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on KMSDeleteKeyURL")
|
||||
}
|
||||
|
||||
_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 *KMSDeleteKeyURL) 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 *KMSDeleteKeyURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSDeleteKeyURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSDeleteKeyURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSDeleteKeyURL")
|
||||
}
|
||||
|
||||
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 *KMSDeleteKeyURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDeletePolicyHandlerFunc turns a function with the right signature into a k m s delete policy handler
|
||||
type KMSDeletePolicyHandlerFunc func(KMSDeletePolicyParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSDeletePolicyHandlerFunc) Handle(params KMSDeletePolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSDeletePolicyHandler interface for that can handle valid k m s delete policy params
|
||||
type KMSDeletePolicyHandler interface {
|
||||
Handle(KMSDeletePolicyParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSDeletePolicy creates a new http.Handler for the k m s delete policy operation
|
||||
func NewKMSDeletePolicy(ctx *middleware.Context, handler KMSDeletePolicyHandler) *KMSDeletePolicy {
|
||||
return &KMSDeletePolicy{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDeletePolicy swagger:route DELETE /kms/policies/{name} KMS kMSDeletePolicy
|
||||
|
||||
KMS delete policy
|
||||
*/
|
||||
type KMSDeletePolicy struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSDeletePolicyHandler
|
||||
}
|
||||
|
||||
func (o *KMSDeletePolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSDeletePolicyParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewKMSDeletePolicyParams creates a new KMSDeletePolicyParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSDeletePolicyParams() KMSDeletePolicyParams {
|
||||
|
||||
return KMSDeletePolicyParams{}
|
||||
}
|
||||
|
||||
// KMSDeletePolicyParams contains all the bound params for the k m s delete policy operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSDeletePolicy
|
||||
type KMSDeletePolicyParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*KMS policy name
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name 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 NewKMSDeletePolicyParams() beforehand.
|
||||
func (o *KMSDeletePolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
func (o *KMSDeletePolicyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDeletePolicyOKCode is the HTTP code returned for type KMSDeletePolicyOK
|
||||
const KMSDeletePolicyOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSDeletePolicyOK A successful response.
|
||||
|
||||
swagger:response kMSDeletePolicyOK
|
||||
*/
|
||||
type KMSDeletePolicyOK struct {
|
||||
}
|
||||
|
||||
// NewKMSDeletePolicyOK creates KMSDeletePolicyOK with default headers values
|
||||
func NewKMSDeletePolicyOK() *KMSDeletePolicyOK {
|
||||
|
||||
return &KMSDeletePolicyOK{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDeletePolicyOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(200)
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDeletePolicyDefault Generic error response.
|
||||
|
||||
swagger:response kMSDeletePolicyDefault
|
||||
*/
|
||||
type KMSDeletePolicyDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDeletePolicyDefault creates KMSDeletePolicyDefault with default headers values
|
||||
func NewKMSDeletePolicyDefault(code int) *KMSDeletePolicyDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSDeletePolicyDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s delete policy default response
|
||||
func (o *KMSDeletePolicyDefault) WithStatusCode(code int) *KMSDeletePolicyDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s delete policy default response
|
||||
func (o *KMSDeletePolicyDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s delete policy default response
|
||||
func (o *KMSDeletePolicyDefault) WithPayload(payload *models.APIError) *KMSDeletePolicyDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s delete policy default response
|
||||
func (o *KMSDeletePolicyDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDeletePolicyDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// KMSDeletePolicyURL generates an URL for the k m s delete policy operation
|
||||
type KMSDeletePolicyURL struct {
|
||||
Name 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 *KMSDeletePolicyURL) WithBasePath(bp string) *KMSDeletePolicyURL {
|
||||
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 *KMSDeletePolicyURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSDeletePolicyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policies/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on KMSDeletePolicyURL")
|
||||
}
|
||||
|
||||
_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 *KMSDeletePolicyURL) 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 *KMSDeletePolicyURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSDeletePolicyURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSDeletePolicyURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSDeletePolicyURL")
|
||||
}
|
||||
|
||||
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 *KMSDeletePolicyURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDescribeIdentityHandlerFunc turns a function with the right signature into a k m s describe identity handler
|
||||
type KMSDescribeIdentityHandlerFunc func(KMSDescribeIdentityParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSDescribeIdentityHandlerFunc) Handle(params KMSDescribeIdentityParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSDescribeIdentityHandler interface for that can handle valid k m s describe identity params
|
||||
type KMSDescribeIdentityHandler interface {
|
||||
Handle(KMSDescribeIdentityParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSDescribeIdentity creates a new http.Handler for the k m s describe identity operation
|
||||
func NewKMSDescribeIdentity(ctx *middleware.Context, handler KMSDescribeIdentityHandler) *KMSDescribeIdentity {
|
||||
return &KMSDescribeIdentity{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDescribeIdentity swagger:route GET /kms/identities/{name}/describe KMS kMSDescribeIdentity
|
||||
|
||||
KMS describe identity
|
||||
*/
|
||||
type KMSDescribeIdentity struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSDescribeIdentityHandler
|
||||
}
|
||||
|
||||
func (o *KMSDescribeIdentity) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSDescribeIdentityParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewKMSDescribeIdentityParams creates a new KMSDescribeIdentityParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSDescribeIdentityParams() KMSDescribeIdentityParams {
|
||||
|
||||
return KMSDescribeIdentityParams{}
|
||||
}
|
||||
|
||||
// KMSDescribeIdentityParams contains all the bound params for the k m s describe identity operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSDescribeIdentity
|
||||
type KMSDescribeIdentityParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*KMS identity name
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name 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 NewKMSDescribeIdentityParams() beforehand.
|
||||
func (o *KMSDescribeIdentityParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
func (o *KMSDescribeIdentityParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDescribeIdentityOKCode is the HTTP code returned for type KMSDescribeIdentityOK
|
||||
const KMSDescribeIdentityOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSDescribeIdentityOK A successful response.
|
||||
|
||||
swagger:response kMSDescribeIdentityOK
|
||||
*/
|
||||
type KMSDescribeIdentityOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.KmsDescribeIdentityResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDescribeIdentityOK creates KMSDescribeIdentityOK with default headers values
|
||||
func NewKMSDescribeIdentityOK() *KMSDescribeIdentityOK {
|
||||
|
||||
return &KMSDescribeIdentityOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s describe identity o k response
|
||||
func (o *KMSDescribeIdentityOK) WithPayload(payload *models.KmsDescribeIdentityResponse) *KMSDescribeIdentityOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s describe identity o k response
|
||||
func (o *KMSDescribeIdentityOK) SetPayload(payload *models.KmsDescribeIdentityResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDescribeIdentityOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDescribeIdentityDefault Generic error response.
|
||||
|
||||
swagger:response kMSDescribeIdentityDefault
|
||||
*/
|
||||
type KMSDescribeIdentityDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDescribeIdentityDefault creates KMSDescribeIdentityDefault with default headers values
|
||||
func NewKMSDescribeIdentityDefault(code int) *KMSDescribeIdentityDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSDescribeIdentityDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s describe identity default response
|
||||
func (o *KMSDescribeIdentityDefault) WithStatusCode(code int) *KMSDescribeIdentityDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s describe identity default response
|
||||
func (o *KMSDescribeIdentityDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s describe identity default response
|
||||
func (o *KMSDescribeIdentityDefault) WithPayload(payload *models.APIError) *KMSDescribeIdentityDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s describe identity default response
|
||||
func (o *KMSDescribeIdentityDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDescribeIdentityDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// KMSDescribeIdentityURL generates an URL for the k m s describe identity operation
|
||||
type KMSDescribeIdentityURL struct {
|
||||
Name 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 *KMSDescribeIdentityURL) WithBasePath(bp string) *KMSDescribeIdentityURL {
|
||||
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 *KMSDescribeIdentityURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSDescribeIdentityURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/identities/{name}/describe"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on KMSDescribeIdentityURL")
|
||||
}
|
||||
|
||||
_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 *KMSDescribeIdentityURL) 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 *KMSDescribeIdentityURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSDescribeIdentityURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSDescribeIdentityURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSDescribeIdentityURL")
|
||||
}
|
||||
|
||||
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 *KMSDescribeIdentityURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDescribePolicyHandlerFunc turns a function with the right signature into a k m s describe policy handler
|
||||
type KMSDescribePolicyHandlerFunc func(KMSDescribePolicyParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSDescribePolicyHandlerFunc) Handle(params KMSDescribePolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSDescribePolicyHandler interface for that can handle valid k m s describe policy params
|
||||
type KMSDescribePolicyHandler interface {
|
||||
Handle(KMSDescribePolicyParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSDescribePolicy creates a new http.Handler for the k m s describe policy operation
|
||||
func NewKMSDescribePolicy(ctx *middleware.Context, handler KMSDescribePolicyHandler) *KMSDescribePolicy {
|
||||
return &KMSDescribePolicy{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDescribePolicy swagger:route GET /kms/policies/{name}/describe KMS kMSDescribePolicy
|
||||
|
||||
KMS describe policy
|
||||
*/
|
||||
type KMSDescribePolicy struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSDescribePolicyHandler
|
||||
}
|
||||
|
||||
func (o *KMSDescribePolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSDescribePolicyParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewKMSDescribePolicyParams creates a new KMSDescribePolicyParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSDescribePolicyParams() KMSDescribePolicyParams {
|
||||
|
||||
return KMSDescribePolicyParams{}
|
||||
}
|
||||
|
||||
// KMSDescribePolicyParams contains all the bound params for the k m s describe policy operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSDescribePolicy
|
||||
type KMSDescribePolicyParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*KMS policy name
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name 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 NewKMSDescribePolicyParams() beforehand.
|
||||
func (o *KMSDescribePolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
func (o *KMSDescribePolicyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDescribePolicyOKCode is the HTTP code returned for type KMSDescribePolicyOK
|
||||
const KMSDescribePolicyOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSDescribePolicyOK A successful response.
|
||||
|
||||
swagger:response kMSDescribePolicyOK
|
||||
*/
|
||||
type KMSDescribePolicyOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.KmsDescribePolicyResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDescribePolicyOK creates KMSDescribePolicyOK with default headers values
|
||||
func NewKMSDescribePolicyOK() *KMSDescribePolicyOK {
|
||||
|
||||
return &KMSDescribePolicyOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s describe policy o k response
|
||||
func (o *KMSDescribePolicyOK) WithPayload(payload *models.KmsDescribePolicyResponse) *KMSDescribePolicyOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s describe policy o k response
|
||||
func (o *KMSDescribePolicyOK) SetPayload(payload *models.KmsDescribePolicyResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDescribePolicyOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDescribePolicyDefault Generic error response.
|
||||
|
||||
swagger:response kMSDescribePolicyDefault
|
||||
*/
|
||||
type KMSDescribePolicyDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDescribePolicyDefault creates KMSDescribePolicyDefault with default headers values
|
||||
func NewKMSDescribePolicyDefault(code int) *KMSDescribePolicyDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSDescribePolicyDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s describe policy default response
|
||||
func (o *KMSDescribePolicyDefault) WithStatusCode(code int) *KMSDescribePolicyDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s describe policy default response
|
||||
func (o *KMSDescribePolicyDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s describe policy default response
|
||||
func (o *KMSDescribePolicyDefault) WithPayload(payload *models.APIError) *KMSDescribePolicyDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s describe policy default response
|
||||
func (o *KMSDescribePolicyDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDescribePolicyDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// KMSDescribePolicyURL generates an URL for the k m s describe policy operation
|
||||
type KMSDescribePolicyURL struct {
|
||||
Name 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 *KMSDescribePolicyURL) WithBasePath(bp string) *KMSDescribePolicyURL {
|
||||
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 *KMSDescribePolicyURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSDescribePolicyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policies/{name}/describe"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on KMSDescribePolicyURL")
|
||||
}
|
||||
|
||||
_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 *KMSDescribePolicyURL) 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 *KMSDescribePolicyURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSDescribePolicyURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSDescribePolicyURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSDescribePolicyURL")
|
||||
}
|
||||
|
||||
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 *KMSDescribePolicyURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDescribeSelfIdentityHandlerFunc turns a function with the right signature into a k m s describe self identity handler
|
||||
type KMSDescribeSelfIdentityHandlerFunc func(KMSDescribeSelfIdentityParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSDescribeSelfIdentityHandlerFunc) Handle(params KMSDescribeSelfIdentityParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSDescribeSelfIdentityHandler interface for that can handle valid k m s describe self identity params
|
||||
type KMSDescribeSelfIdentityHandler interface {
|
||||
Handle(KMSDescribeSelfIdentityParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSDescribeSelfIdentity creates a new http.Handler for the k m s describe self identity operation
|
||||
func NewKMSDescribeSelfIdentity(ctx *middleware.Context, handler KMSDescribeSelfIdentityHandler) *KMSDescribeSelfIdentity {
|
||||
return &KMSDescribeSelfIdentity{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDescribeSelfIdentity swagger:route GET /kms/describe-self/identity KMS kMSDescribeSelfIdentity
|
||||
|
||||
KMS describe self identity
|
||||
*/
|
||||
type KMSDescribeSelfIdentity struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSDescribeSelfIdentityHandler
|
||||
}
|
||||
|
||||
func (o *KMSDescribeSelfIdentity) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSDescribeSelfIdentityParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NewKMSDescribeSelfIdentityParams creates a new KMSDescribeSelfIdentityParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSDescribeSelfIdentityParams() KMSDescribeSelfIdentityParams {
|
||||
|
||||
return KMSDescribeSelfIdentityParams{}
|
||||
}
|
||||
|
||||
// KMSDescribeSelfIdentityParams contains all the bound params for the k m s describe self identity operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSDescribeSelfIdentity
|
||||
type KMSDescribeSelfIdentityParams 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 NewKMSDescribeSelfIdentityParams() beforehand.
|
||||
func (o *KMSDescribeSelfIdentityParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDescribeSelfIdentityOKCode is the HTTP code returned for type KMSDescribeSelfIdentityOK
|
||||
const KMSDescribeSelfIdentityOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSDescribeSelfIdentityOK A successful response.
|
||||
|
||||
swagger:response kMSDescribeSelfIdentityOK
|
||||
*/
|
||||
type KMSDescribeSelfIdentityOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.KmsDescribeSelfIdentityResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDescribeSelfIdentityOK creates KMSDescribeSelfIdentityOK with default headers values
|
||||
func NewKMSDescribeSelfIdentityOK() *KMSDescribeSelfIdentityOK {
|
||||
|
||||
return &KMSDescribeSelfIdentityOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s describe self identity o k response
|
||||
func (o *KMSDescribeSelfIdentityOK) WithPayload(payload *models.KmsDescribeSelfIdentityResponse) *KMSDescribeSelfIdentityOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s describe self identity o k response
|
||||
func (o *KMSDescribeSelfIdentityOK) SetPayload(payload *models.KmsDescribeSelfIdentityResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDescribeSelfIdentityOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSDescribeSelfIdentityDefault Generic error response.
|
||||
|
||||
swagger:response kMSDescribeSelfIdentityDefault
|
||||
*/
|
||||
type KMSDescribeSelfIdentityDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSDescribeSelfIdentityDefault creates KMSDescribeSelfIdentityDefault with default headers values
|
||||
func NewKMSDescribeSelfIdentityDefault(code int) *KMSDescribeSelfIdentityDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSDescribeSelfIdentityDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s describe self identity default response
|
||||
func (o *KMSDescribeSelfIdentityDefault) WithStatusCode(code int) *KMSDescribeSelfIdentityDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s describe self identity default response
|
||||
func (o *KMSDescribeSelfIdentityDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s describe self identity default response
|
||||
func (o *KMSDescribeSelfIdentityDefault) WithPayload(payload *models.APIError) *KMSDescribeSelfIdentityDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s describe self identity default response
|
||||
func (o *KMSDescribeSelfIdentityDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSDescribeSelfIdentityDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSDescribeSelfIdentityURL generates an URL for the k m s describe self identity operation
|
||||
type KMSDescribeSelfIdentityURL 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 *KMSDescribeSelfIdentityURL) WithBasePath(bp string) *KMSDescribeSelfIdentityURL {
|
||||
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 *KMSDescribeSelfIdentityURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSDescribeSelfIdentityURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/describe-self/identity"
|
||||
|
||||
_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 *KMSDescribeSelfIdentityURL) 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 *KMSDescribeSelfIdentityURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSDescribeSelfIdentityURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSDescribeSelfIdentityURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSDescribeSelfIdentityURL")
|
||||
}
|
||||
|
||||
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 *KMSDescribeSelfIdentityURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSGetPolicyHandlerFunc turns a function with the right signature into a k m s get policy handler
|
||||
type KMSGetPolicyHandlerFunc func(KMSGetPolicyParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSGetPolicyHandlerFunc) Handle(params KMSGetPolicyParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSGetPolicyHandler interface for that can handle valid k m s get policy params
|
||||
type KMSGetPolicyHandler interface {
|
||||
Handle(KMSGetPolicyParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSGetPolicy creates a new http.Handler for the k m s get policy operation
|
||||
func NewKMSGetPolicy(ctx *middleware.Context, handler KMSGetPolicyHandler) *KMSGetPolicy {
|
||||
return &KMSGetPolicy{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSGetPolicy swagger:route GET /kms/policies/{name} KMS kMSGetPolicy
|
||||
|
||||
KMS get policy
|
||||
*/
|
||||
type KMSGetPolicy struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSGetPolicyHandler
|
||||
}
|
||||
|
||||
func (o *KMSGetPolicy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSGetPolicyParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewKMSGetPolicyParams creates a new KMSGetPolicyParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSGetPolicyParams() KMSGetPolicyParams {
|
||||
|
||||
return KMSGetPolicyParams{}
|
||||
}
|
||||
|
||||
// KMSGetPolicyParams contains all the bound params for the k m s get policy operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSGetPolicy
|
||||
type KMSGetPolicyParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*KMS policy name
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name 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 NewKMSGetPolicyParams() beforehand.
|
||||
func (o *KMSGetPolicyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
func (o *KMSGetPolicyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSGetPolicyOKCode is the HTTP code returned for type KMSGetPolicyOK
|
||||
const KMSGetPolicyOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSGetPolicyOK A successful response.
|
||||
|
||||
swagger:response kMSGetPolicyOK
|
||||
*/
|
||||
type KMSGetPolicyOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.KmsGetPolicyResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSGetPolicyOK creates KMSGetPolicyOK with default headers values
|
||||
func NewKMSGetPolicyOK() *KMSGetPolicyOK {
|
||||
|
||||
return &KMSGetPolicyOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s get policy o k response
|
||||
func (o *KMSGetPolicyOK) WithPayload(payload *models.KmsGetPolicyResponse) *KMSGetPolicyOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s get policy o k response
|
||||
func (o *KMSGetPolicyOK) SetPayload(payload *models.KmsGetPolicyResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSGetPolicyOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSGetPolicyDefault Generic error response.
|
||||
|
||||
swagger:response kMSGetPolicyDefault
|
||||
*/
|
||||
type KMSGetPolicyDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSGetPolicyDefault creates KMSGetPolicyDefault with default headers values
|
||||
func NewKMSGetPolicyDefault(code int) *KMSGetPolicyDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSGetPolicyDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s get policy default response
|
||||
func (o *KMSGetPolicyDefault) WithStatusCode(code int) *KMSGetPolicyDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s get policy default response
|
||||
func (o *KMSGetPolicyDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s get policy default response
|
||||
func (o *KMSGetPolicyDefault) WithPayload(payload *models.APIError) *KMSGetPolicyDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s get policy default response
|
||||
func (o *KMSGetPolicyDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSGetPolicyDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// KMSGetPolicyURL generates an URL for the k m s get policy operation
|
||||
type KMSGetPolicyURL struct {
|
||||
Name 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 *KMSGetPolicyURL) WithBasePath(bp string) *KMSGetPolicyURL {
|
||||
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 *KMSGetPolicyURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSGetPolicyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policies/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on KMSGetPolicyURL")
|
||||
}
|
||||
|
||||
_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 *KMSGetPolicyURL) 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 *KMSGetPolicyURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSGetPolicyURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSGetPolicyURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSGetPolicyURL")
|
||||
}
|
||||
|
||||
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 *KMSGetPolicyURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSImportKeyHandlerFunc turns a function with the right signature into a k m s import key handler
|
||||
type KMSImportKeyHandlerFunc func(KMSImportKeyParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSImportKeyHandlerFunc) Handle(params KMSImportKeyParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSImportKeyHandler interface for that can handle valid k m s import key params
|
||||
type KMSImportKeyHandler interface {
|
||||
Handle(KMSImportKeyParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSImportKey creates a new http.Handler for the k m s import key operation
|
||||
func NewKMSImportKey(ctx *middleware.Context, handler KMSImportKeyHandler) *KMSImportKey {
|
||||
return &KMSImportKey{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSImportKey swagger:route POST /kms/keys/{name}/import KMS kMSImportKey
|
||||
|
||||
KMS import key
|
||||
*/
|
||||
type KMSImportKey struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSImportKeyHandler
|
||||
}
|
||||
|
||||
func (o *KMSImportKey) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSImportKeyParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"io"
|
||||
"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"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
)
|
||||
|
||||
// NewKMSImportKeyParams creates a new KMSImportKeyParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSImportKeyParams() KMSImportKeyParams {
|
||||
|
||||
return KMSImportKeyParams{}
|
||||
}
|
||||
|
||||
// KMSImportKeyParams contains all the bound params for the k m s import key operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSImportKey
|
||||
type KMSImportKeyParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Body *models.KmsImportKeyRequest
|
||||
/*KMS key name
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
Name 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 NewKMSImportKeyParams() beforehand.
|
||||
func (o *KMSImportKeyParams) 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.KmsImportKeyRequest
|
||||
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(r.Context())
|
||||
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", ""))
|
||||
}
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
func (o *KMSImportKeyParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSImportKeyCreatedCode is the HTTP code returned for type KMSImportKeyCreated
|
||||
const KMSImportKeyCreatedCode int = 201
|
||||
|
||||
/*
|
||||
KMSImportKeyCreated A successful response.
|
||||
|
||||
swagger:response kMSImportKeyCreated
|
||||
*/
|
||||
type KMSImportKeyCreated struct {
|
||||
}
|
||||
|
||||
// NewKMSImportKeyCreated creates KMSImportKeyCreated with default headers values
|
||||
func NewKMSImportKeyCreated() *KMSImportKeyCreated {
|
||||
|
||||
return &KMSImportKeyCreated{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSImportKeyCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
|
||||
|
||||
rw.WriteHeader(201)
|
||||
}
|
||||
|
||||
/*
|
||||
KMSImportKeyDefault Generic error response.
|
||||
|
||||
swagger:response kMSImportKeyDefault
|
||||
*/
|
||||
type KMSImportKeyDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSImportKeyDefault creates KMSImportKeyDefault with default headers values
|
||||
func NewKMSImportKeyDefault(code int) *KMSImportKeyDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSImportKeyDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s import key default response
|
||||
func (o *KMSImportKeyDefault) WithStatusCode(code int) *KMSImportKeyDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s import key default response
|
||||
func (o *KMSImportKeyDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s import key default response
|
||||
func (o *KMSImportKeyDefault) WithPayload(payload *models.APIError) *KMSImportKeyDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s import key default response
|
||||
func (o *KMSImportKeyDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSImportKeyDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// KMSImportKeyURL generates an URL for the k m s import key operation
|
||||
type KMSImportKeyURL struct {
|
||||
Name 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 *KMSImportKeyURL) WithBasePath(bp string) *KMSImportKeyURL {
|
||||
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 *KMSImportKeyURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSImportKeyURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/keys/{name}/import"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on KMSImportKeyURL")
|
||||
}
|
||||
|
||||
_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 *KMSImportKeyURL) 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 *KMSImportKeyURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSImportKeyURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSImportKeyURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSImportKeyURL")
|
||||
}
|
||||
|
||||
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 *KMSImportKeyURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSListIdentitiesHandlerFunc turns a function with the right signature into a k m s list identities handler
|
||||
type KMSListIdentitiesHandlerFunc func(KMSListIdentitiesParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSListIdentitiesHandlerFunc) Handle(params KMSListIdentitiesParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSListIdentitiesHandler interface for that can handle valid k m s list identities params
|
||||
type KMSListIdentitiesHandler interface {
|
||||
Handle(KMSListIdentitiesParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSListIdentities creates a new http.Handler for the k m s list identities operation
|
||||
func NewKMSListIdentities(ctx *middleware.Context, handler KMSListIdentitiesHandler) *KMSListIdentities {
|
||||
return &KMSListIdentities{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSListIdentities swagger:route GET /kms/identities KMS kMSListIdentities
|
||||
|
||||
KMS list identities
|
||||
*/
|
||||
type KMSListIdentities struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSListIdentitiesHandler
|
||||
}
|
||||
|
||||
func (o *KMSListIdentities) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSListIdentitiesParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NewKMSListIdentitiesParams creates a new KMSListIdentitiesParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSListIdentitiesParams() KMSListIdentitiesParams {
|
||||
|
||||
return KMSListIdentitiesParams{}
|
||||
}
|
||||
|
||||
// KMSListIdentitiesParams contains all the bound params for the k m s list identities operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSListIdentities
|
||||
type KMSListIdentitiesParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*pattern to retrieve identities
|
||||
In: query
|
||||
*/
|
||||
Pattern *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 NewKMSListIdentitiesParams() beforehand.
|
||||
func (o *KMSListIdentitiesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qPattern, qhkPattern, _ := qs.GetOK("pattern")
|
||||
if err := o.bindPattern(qPattern, qhkPattern, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindPattern binds and validates parameter Pattern from query.
|
||||
func (o *KMSListIdentitiesParams) bindPattern(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.Pattern = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSListIdentitiesOKCode is the HTTP code returned for type KMSListIdentitiesOK
|
||||
const KMSListIdentitiesOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSListIdentitiesOK A successful response.
|
||||
|
||||
swagger:response kMSListIdentitiesOK
|
||||
*/
|
||||
type KMSListIdentitiesOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.KmsListIdentitiesResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSListIdentitiesOK creates KMSListIdentitiesOK with default headers values
|
||||
func NewKMSListIdentitiesOK() *KMSListIdentitiesOK {
|
||||
|
||||
return &KMSListIdentitiesOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s list identities o k response
|
||||
func (o *KMSListIdentitiesOK) WithPayload(payload *models.KmsListIdentitiesResponse) *KMSListIdentitiesOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s list identities o k response
|
||||
func (o *KMSListIdentitiesOK) SetPayload(payload *models.KmsListIdentitiesResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSListIdentitiesOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSListIdentitiesDefault Generic error response.
|
||||
|
||||
swagger:response kMSListIdentitiesDefault
|
||||
*/
|
||||
type KMSListIdentitiesDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSListIdentitiesDefault creates KMSListIdentitiesDefault with default headers values
|
||||
func NewKMSListIdentitiesDefault(code int) *KMSListIdentitiesDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSListIdentitiesDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s list identities default response
|
||||
func (o *KMSListIdentitiesDefault) WithStatusCode(code int) *KMSListIdentitiesDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s list identities default response
|
||||
func (o *KMSListIdentitiesDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s list identities default response
|
||||
func (o *KMSListIdentitiesDefault) WithPayload(payload *models.APIError) *KMSListIdentitiesDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s list identities default response
|
||||
func (o *KMSListIdentitiesDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSListIdentitiesDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSListIdentitiesURL generates an URL for the k m s list identities operation
|
||||
type KMSListIdentitiesURL struct {
|
||||
Pattern *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 *KMSListIdentitiesURL) WithBasePath(bp string) *KMSListIdentitiesURL {
|
||||
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 *KMSListIdentitiesURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSListIdentitiesURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/identities"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
var patternQ string
|
||||
if o.Pattern != nil {
|
||||
patternQ = *o.Pattern
|
||||
}
|
||||
if patternQ != "" {
|
||||
qs.Set("pattern", patternQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *KMSListIdentitiesURL) 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 *KMSListIdentitiesURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSListIdentitiesURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSListIdentitiesURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSListIdentitiesURL")
|
||||
}
|
||||
|
||||
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 *KMSListIdentitiesURL) StringFull(scheme, host string) string {
|
||||
return o.Must(o.BuildFull(scheme, host)).String()
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSListPoliciesHandlerFunc turns a function with the right signature into a k m s list policies handler
|
||||
type KMSListPoliciesHandlerFunc func(KMSListPoliciesParams, *models.Principal) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn KMSListPoliciesHandlerFunc) Handle(params KMSListPoliciesParams, principal *models.Principal) middleware.Responder {
|
||||
return fn(params, principal)
|
||||
}
|
||||
|
||||
// KMSListPoliciesHandler interface for that can handle valid k m s list policies params
|
||||
type KMSListPoliciesHandler interface {
|
||||
Handle(KMSListPoliciesParams, *models.Principal) middleware.Responder
|
||||
}
|
||||
|
||||
// NewKMSListPolicies creates a new http.Handler for the k m s list policies operation
|
||||
func NewKMSListPolicies(ctx *middleware.Context, handler KMSListPoliciesHandler) *KMSListPolicies {
|
||||
return &KMSListPolicies{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSListPolicies swagger:route GET /kms/policies KMS kMSListPolicies
|
||||
|
||||
KMS list policies
|
||||
*/
|
||||
type KMSListPolicies struct {
|
||||
Context *middleware.Context
|
||||
Handler KMSListPoliciesHandler
|
||||
}
|
||||
|
||||
func (o *KMSListPolicies) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, rCtx, _ := o.Context.RouteInfo(r)
|
||||
if rCtx != nil {
|
||||
*r = *rCtx
|
||||
}
|
||||
var Params = NewKMSListPoliciesParams()
|
||||
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)
|
||||
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// NewKMSListPoliciesParams creates a new KMSListPoliciesParams object
|
||||
//
|
||||
// There are no default values defined in the spec.
|
||||
func NewKMSListPoliciesParams() KMSListPoliciesParams {
|
||||
|
||||
return KMSListPoliciesParams{}
|
||||
}
|
||||
|
||||
// KMSListPoliciesParams contains all the bound params for the k m s list policies operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters KMSListPolicies
|
||||
type KMSListPoliciesParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request `json:"-"`
|
||||
|
||||
/*pattern to retrieve policies
|
||||
In: query
|
||||
*/
|
||||
Pattern *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 NewKMSListPoliciesParams() beforehand.
|
||||
func (o *KMSListPoliciesParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qPattern, qhkPattern, _ := qs.GetOK("pattern")
|
||||
if err := o.bindPattern(qPattern, qhkPattern, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindPattern binds and validates parameter Pattern from query.
|
||||
func (o *KMSListPoliciesParams) bindPattern(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.Pattern = &raw
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSListPoliciesOKCode is the HTTP code returned for type KMSListPoliciesOK
|
||||
const KMSListPoliciesOKCode int = 200
|
||||
|
||||
/*
|
||||
KMSListPoliciesOK A successful response.
|
||||
|
||||
swagger:response kMSListPoliciesOK
|
||||
*/
|
||||
type KMSListPoliciesOK struct {
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.KmsListPoliciesResponse `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSListPoliciesOK creates KMSListPoliciesOK with default headers values
|
||||
func NewKMSListPoliciesOK() *KMSListPoliciesOK {
|
||||
|
||||
return &KMSListPoliciesOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s list policies o k response
|
||||
func (o *KMSListPoliciesOK) WithPayload(payload *models.KmsListPoliciesResponse) *KMSListPoliciesOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s list policies o k response
|
||||
func (o *KMSListPoliciesOK) SetPayload(payload *models.KmsListPoliciesResponse) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSListPoliciesOK) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
KMSListPoliciesDefault Generic error response.
|
||||
|
||||
swagger:response kMSListPoliciesDefault
|
||||
*/
|
||||
type KMSListPoliciesDefault struct {
|
||||
_statusCode int
|
||||
|
||||
/*
|
||||
In: Body
|
||||
*/
|
||||
Payload *models.APIError `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewKMSListPoliciesDefault creates KMSListPoliciesDefault with default headers values
|
||||
func NewKMSListPoliciesDefault(code int) *KMSListPoliciesDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &KMSListPoliciesDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the k m s list policies default response
|
||||
func (o *KMSListPoliciesDefault) WithStatusCode(code int) *KMSListPoliciesDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the k m s list policies default response
|
||||
func (o *KMSListPoliciesDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the k m s list policies default response
|
||||
func (o *KMSListPoliciesDefault) WithPayload(payload *models.APIError) *KMSListPoliciesDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the k m s list policies default response
|
||||
func (o *KMSListPoliciesDefault) SetPayload(payload *models.APIError) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *KMSListPoliciesDefault) 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 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 k_m_s
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// KMSListPoliciesURL generates an URL for the k m s list policies operation
|
||||
type KMSListPoliciesURL struct {
|
||||
Pattern *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 *KMSListPoliciesURL) WithBasePath(bp string) *KMSListPoliciesURL {
|
||||
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 *KMSListPoliciesURL) SetBasePath(bp string) {
|
||||
o._basePath = bp
|
||||
}
|
||||
|
||||
// Build a url path and query string
|
||||
func (o *KMSListPoliciesURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/kms/policies"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
_basePath = "/api/v1"
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
var patternQ string
|
||||
if o.Pattern != nil {
|
||||
patternQ = *o.Pattern
|
||||
}
|
||||
if patternQ != "" {
|
||||
qs.Set("pattern", patternQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
// Must is a helper function to panic when the url builder returns an error
|
||||
func (o *KMSListPoliciesURL) 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 *KMSListPoliciesURL) String() string {
|
||||
return o.Must(o.Build()).String()
|
||||
}
|
||||
|
||||
// BuildFull builds a full url with scheme, host, path and query string
|
||||
func (o *KMSListPoliciesURL) BuildFull(scheme, host string) (*url.URL, error) {
|
||||
if scheme == "" {
|
||||
return nil, errors.New("scheme is required for a full url on KMSListPoliciesURL")
|
||||
}
|
||||
if host == "" {
|
||||
return nil, errors.New("host is required for a full url on KMSListPoliciesURL")
|
||||
}
|
||||
|
||||
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 *KMSListPoliciesURL) 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