Compare commits

...

350 Commits

Author SHA1 Message Date
Alex
220a55500c Release v2.0.1 (#3542)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2025-05-16 15:23:19 -06:00
Alex
a4281edbc4 Updated project dependencies (#3541)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
2025-05-16 12:40:29 -07:00
Alex
0398c69c7f Updated design of License page (#3540)
- This change doesn't include the new logo for Object Store, this needs to be addressed on MDS

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2025-05-16 12:04:38 -06:00
Alex
7871f6bc27 UI Forms Cleanup (#3538) 2025-05-14 19:24:04 -07:00
Daniel Valdivia
3dc0fdc039 Remove more unused APIs (#3537)
* Remove more unused APIs

* prettier

* Fix Test

* Fix tests

* Remove SSO Integreation

* fix tests

* lint
2025-05-14 15:41:50 -07:00
Daniel Valdivia
e2bbf91e8a Vacuum Swagger (#3533) 2025-05-09 16:41:27 -07:00
Alex
ee974a5961 Release v2.0.0 (#3526)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2025-05-07 15:37:20 -06:00
Daniel Valdivia
40c4ce76c5 License Comparisson updates (#3532)
* License Comparisson updates

Signed-off-by: Daniel Valdivia <hola@danielvaldivia.com>

* Prettier

---------

Signed-off-by: Daniel Valdivia <hola@danielvaldivia.com>
2025-05-07 13:40:42 -07:00
Alex
28b080122a Fixed vulnerabilities in go packages (#3531)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
2025-05-05 13:50:36 -07:00
dependabot[bot]
6df2db82af Bump formidable from 3.5.2 to 3.5.4 in /web-app (#3530) 2025-05-05 11:05:51 -06:00
dependabot[bot]
ff2b72f869 Bump http-proxy-middleware from 2.0.7 to 2.0.9 in /web-app (#3529)
Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.7 to 2.0.9.
- [Release notes](https://github.com/chimurai/http-proxy-middleware/releases)
- [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.9/CHANGELOG.md)
- [Commits](https://github.com/chimurai/http-proxy-middleware/compare/v2.0.7...v2.0.9)

---
updated-dependencies:
- dependency-name: http-proxy-middleware
  dependency-version: 2.0.9
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-29 15:49:25 +02:00
Alex
f5ad4defc9 Updated Packages & versions (#3525)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2025-04-03 01:29:17 -06:00
Cesar N.
6499469487 Update jwt package (#3522) 2025-03-21 17:33:58 -06:00
Ramon de Klein
71b1b708b7 Clean-up after PR 3509 (#3517) 2025-03-21 13:43:10 -06:00
Alex
63c6d8952b Implemented AGPL MinIO Object Browser simplified Console (#3509)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2025-03-11 02:30:53 -07:00
Quentin JOLY
33a7fbb205 Fix regex pattern in webhook management (#3512) 2025-03-06 17:41:04 -06:00
Alex
36d0e78834 Updated Project dependencies (#3508)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
2025-02-21 14:20:45 -08:00
Allan Roger Reid
9e0416f1ab Allow console to recognize s3.Delete* (#3507) 2025-02-21 12:04:08 -06:00
Cesar N.
f4a08fc0af Release v1.7.6 (#3504) 2025-02-10 21:41:20 -06:00
Burkov Egor
115de8ee25 fix: possible nil deref in admin_info (#3500) 2025-02-10 18:04:21 -08:00
Harshavardhana
27cb17dbfd make sure go toolchain is correctly set (#3502)
and update deps
2025-02-10 12:41:51 -08:00
Chai-Shi
31a5d640eb Support login request with leading or trailing whitespace from payload (#3496)
* trim whitespaces for login request
* simplify trimspace calls
2025-01-23 12:23:46 +01:00
dependabot[bot]
b45e11ce7f Bump nanoid from 3.3.7 to 3.3.8 in /web-app (#3486)
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.3.7...3.3.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Prakash Senthil Vel <23444145+prakashsvmx@users.noreply.github.com>
2025-01-13 21:50:17 -06:00
Prakash Senthil Vel
4388ecc4eb Fix sanitize file path while drag and drop (#3492) 2025-01-13 21:46:47 -06:00
Harshavardhana
656d8075b2 update all deps to new changes (#3489) 2024-12-30 10:29:10 -08:00
Harshavardhana
8b209a202f update deps as regular cadence (#3488) 2024-12-18 14:37:19 -08:00
brandongevat
2e66a13f48 Fix typo in User DN Search Filter example (#3485) 2024-12-11 08:39:13 +05:30
Alex
d54ed26c71 Release v1.7.5 (#3484)
* Release v1.7.5

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>

* Update CHANGELOG.md

Co-authored-by: Victor Bayas <victorsbayas@gmail.com>

---------

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
Co-authored-by: Cesar N. <11819101+cesnietor@users.noreply.github.com>
Co-authored-by: Victor Bayas <victorsbayas@gmail.com>
2024-12-06 19:42:16 -05:00
Cesar Celis
5cf02ffae9 Allow spaces in policy names (#3482) 2024-12-05 09:55:57 -08:00
Harshavardhana
6afd0b16dc avoid leaks during zip download and multi-object downloads (#3481) 2024-12-02 18:17:32 -08:00
dependabot[bot]
0b8af385f1 Bump cross-spawn from 7.0.3 to 7.0.6 in /web-app (#3474)
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-29 14:09:44 -06:00
Alex
9a3063b7da Release v1.7.4 (#3472)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-11-26 14:47:40 -06:00
Anis Eleuch
71541029e7 openid: Gather the refresh token if found. (#3478)
When the openid login page sends the refresh token in 
the login redirection url, the code will get it. This is
helpful to support refresh openid user claims routine.

Co-authored-by: Anis Eleuch <anis@min.io>
2024-11-26 10:28:15 -08:00
Ramon de Klein
076b803a5c Upgrade to MDS v1.0.4 (#3473)
upgrade to MDS v1.0.4
2024-11-19 22:09:37 +01:00
Alex
97ef82f831 Fixed UI Tests (#3471)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
2024-11-11 16:49:47 -08:00
Alex
2ca484c691 Deprecated Lifecycle and Tiering UI (#3470)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-11-11 17:36:14 -06:00
Alex
4e5dcf0fc3 Deprecated Site Replication in UI (#3469)
* Deprecated Sire Replication in UI

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>

* fix-workflow-issue

---------

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
2024-11-11 12:26:19 -08:00
Alex
18e50975d4 Removed Tools support (#3467)
- Removed Menu links for Support tools
- Removed support in UI for registering cluster
- Removed Subnet support
- Removed Websockets for tools support
- Removed Support endpoint
- Removed Subnet support endpoints

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-11-05 12:56:53 -08:00
dependabot[bot]
d425af3c85 Bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1 (#3466)
Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.0...v4.5.1)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-05 10:56:10 -06:00
Ramon de Klein
fce84d1de0 Release v1.7.3 (#3464) 2024-10-30 10:06:40 -07:00
Cesar N.
dc19984f23 Fix Set Policy on Groups with spaces (#3453) 2024-10-28 20:28:07 +01:00
tnfAngel
8c1ecae68a Fix join slack button (#3460)
* Fix join slack button

* run prettier on changes
2024-10-28 20:21:54 +01:00
dependabot[bot]
862d692444 Bump http-proxy-middleware from 2.0.6 to 2.0.7 in /web-app (#3461)
Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.6 to 2.0.7.
- [Release notes](https://github.com/chimurai/http-proxy-middleware/releases)
- [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.7/CHANGELOG.md)
- [Commits](https://github.com/chimurai/http-proxy-middleware/compare/v2.0.6...v2.0.7)

---
updated-dependencies:
- dependency-name: http-proxy-middleware
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-28 20:20:18 +01:00
Prakash Senthil Vel
854a0c16b3 error handling in bucket creation ui (#3455) 2024-10-28 11:16:01 -07:00
Ramon de Klein
3d74e9762c Disable download public verification key (#3462)
update minio/pkg (to disable downloading public key)
2024-10-28 09:36:10 -07:00
Ramon de Klein
3d8b98f563 Show epoch expiry as no-expiry (#3459) 2024-10-26 09:49:51 -06:00
Cesar N.
06af416642 Release v1.7.2 (#3452) 2024-10-16 09:00:37 -07:00
Javier Adriel
01920841d2 Remove live logs support from UI (#3451) 2024-10-09 15:08:48 -07:00
Javier Adriel
78aceb2b53 Return full value of client in trace message (#3450) 2024-10-09 14:54:17 -07:00
Cesar N.
dce9bbd046 Fix vulnerabilities in npm packages (#3449) 2024-10-08 13:25:52 -07:00
Prakash Senthil Vel
9f4573ade8 enterprise license page update (#3443) 2024-09-30 14:20:49 -07:00
Shireesh Anjal
24af63da42 Fix incorrect logic in serverHealthInfo (#3442)
It was being assumed that whole response has been received as soon as
info.Version is non-empty. This is wrong as the very first response by
minio contains the version. So removed the unnecessary for loop that had
this check to ensure that the whole report is received properly.
2024-09-26 21:53:34 -07:00
Ramon de Klein
52c77fd388 Release v1.7.1 (#3441) 2024-09-20 10:18:54 -07:00
Mark Theunissen
19e6cc87c2 Return network error when logging in and the network connection fails (#3432) 2024-09-20 09:55:47 -06:00
dependabot[bot]
9bfed73b03 Bump webpack from 5.91.0 to 5.94.0 in /web-app (#3431)
Bumps [webpack](https://github.com/webpack/webpack) from 5.91.0 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.91.0...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ramon de Klein <mail@ramondeklein.nl>
2024-09-20 12:21:26 +02:00
dependabot[bot]
095241517b Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows (#3433)
* Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.1.7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4.1.7)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Use latest v4 instead of a specific version

* upgrade to `actions/upload-artifact@v4`

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Cesar N. <11819101+cesnietor@users.noreply.github.com>
Co-authored-by: Ramon de Klein <mail@ramondeklein.nl>
2024-09-20 12:21:08 +02:00
dependabot[bot]
339885b2a0 Bump express from 4.19.2 to 4.21.0 in /web-app (#3438)
Bumps [express](https://github.com/expressjs/express) from 4.19.2 to 4.21.0.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.0/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.0)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ramon de Klein <mail@ramondeklein.nl>
2024-09-20 12:20:27 +02:00
Ramon de Klein
6cfc985337 Add (optional) debug logging for console requests (#3440)
* Add (optional) debug logging for console requests
* Check vulnerabilities with 1.22.7
2024-09-20 10:21:28 +02:00
William Entriken
1c47685aea Use setup-node@v4's new node-version-file directly (#3435) 2024-09-16 11:48:49 -06:00
dependabot[bot]
efa74a5f50 Bump micromatch from 4.0.7 to 4.0.8 in /web-app (#3437)
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.7 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.7...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-16 11:47:29 -06:00
Victor Bayas
4c432cd356 Use Knip for detecting dead code (#3426) 2024-08-21 10:35:02 -06:00
Harshavardhana
0b07cb3885 update deps to latest releases (#3425) 2024-08-17 14:52:48 -07:00
Ramon de Klein
8d13be5e87 Fix content type issue (#3424)
Fix content type issue
2024-08-13 17:49:06 -06:00
Victor Bayas
3c34602f9e Fix Web App workflows (#3423)
* Fix Web App workflows

* Update Yarn to 4.4.0
2024-08-08 12:56:03 -07:00
Cesar N.
adfc96074f Release v1.7.0 (#3418) 2024-08-02 15:20:47 -07:00
jinapurapu
7cc7b874d1 Fix MinIO videos link (#3417) 2024-08-02 13:48:54 -07:00
Ramon de Klein
4d12a5061d Remove obsolete KES functionality (#3414) 2024-08-02 11:50:33 -06:00
Prakash Senthil Vel
b274add4da fix nested directory object display (#3415) 2024-08-02 10:06:10 -07:00
Alex
fd51c9dc4c Updated UI dependencies (#3411)
- Fixed an issue with servers list not closing correctly in certain circumstances
- Updated internal UI dependencies

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-07-22 10:44:46 -06:00
Alex
51f8794aa6 Release v1.6.3 (#3408) 2024-07-12 16:07:49 -06:00
Alex
3db998f9c4 Release v1.6.2 (#3407)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-07-12 12:43:59 -07:00
Alex
0a2a7087a7 Updated UI Project Dependencies (#3406)
Updated Project Dependencies

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-07-12 13:08:30 -06:00
Alex
8f0eb11ced Updated License page with new design (#3405) 2024-07-12 10:18:17 -06:00
Anis Eleuch
e3e3599095 ws: Calculate the client IP from the WS request headers as well (#3403)
Currently, the websocket code adds an IP to X-Forwarded-For where the IP is
calculated from the TCP connection established to Console, however the established
TCP connection can be coming from the load balancer as well, hence the
necesssity to evaluate the client IP based on X-Forwarded-For or
X-Real-IP headers

Look for client IPs in the websocket request connection.

Co-authored-by: Anis Eleuch <anis@min.io>
2024-07-10 08:04:50 -07:00
dependabot[bot]
aa74e31453 Bump google.golang.org/grpc from 1.64.0 to 1.64.1 (#3404)
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.64.0 to 1.64.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.64.0...v1.64.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-10 09:15:51 +02:00
jiuker
e1f6e729fd format to loginfo (#3400) 2024-07-08 09:08:27 -06:00
Ramon de Klein
13d83a6d1c User session fixes (#3397) 2024-07-04 18:22:36 -07:00
Ramon de Klein
6075387654 Upgrade Go to v1.22.5 and upgrade Github actions (#3398) 2024-07-04 07:28:24 -07:00
Victor Bayas
69fad3f55f Improvements to Drives list UI (#3395) 2024-07-01 17:27:33 -06:00
Alex
e3864b62a4 Release v1.6.1 (#3393) 2024-06-25 10:26:58 -07:00
Harshavardhana
22176f4e0f fix: objectManager implementation avoid racy goroutines (#3392)
fixes #3391
2024-06-25 08:50:31 -07:00
dependabot[bot]
a89d7ec0ea Bump ws from 7.5.9 to 7.5.10 in /web-app (#3390) 2024-06-18 15:22:19 -07:00
Ramon de Klein
8262049e20 Fix showing object-name in legal hold dialog (#3389) 2024-06-18 15:20:03 -07:00
Alex
c61e1e0a2a Added debounce to Share file fields (#3388)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-06-17 16:02:13 -06:00
Alex
b376cf6c65 Improvements to Share Link component behavior (#3387)
Improvements to Share Link component to avoid multiple re-renders during common actions

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-06-17 11:40:27 -06:00
Cesar N
16bae25ce6 Release v1.6.0 (#3386) 2024-06-13 14:26:03 -07:00
Alex
57ba17a12e Changed License plans validation to not allow AGPL as a registered plan (#3385)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-06-13 14:36:08 -06:00
Ramon de Klein
f4d98a4910 Fix share link issue (#3382) (#3384) 2024-06-13 13:30:33 -06:00
Cesar N
fa32d78ff1 Add Tiers improvements for Bucket Lifecycle management (#3380) 2024-06-13 13:17:49 -06:00
jinapurapu
56f22a4479 Fix storageClass on EditLifecycleModal (#3379) 2024-06-13 11:06:30 -07:00
Alex
7b88d3a1bc Updated UI package dependencies (#3381)
Updated package dependencies

- Updated react-pdf to fix security vulnerability
- Removed ignored security alerts

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-06-13 11:23:50 -06:00
Prakash Senthil Vel
c8a39f9544 update logo as per mineos plans (#3383) 2024-06-13 08:01:25 -07:00
Cesar N
e77d1be53e Release v1.5.0 (#3373)
update assets with latest fix

Co-authored-by: cesnietor <cesar.nieto@min.io>
2024-06-07 19:00:37 -07:00
jinapurapu
6765bd0624 Fix remove tier error handling (#3375) 2024-06-07 16:39:18 -06:00
jinapurapu
5f7b563a01 Add Remove Tier feature (#3371) 2024-06-07 10:01:10 -07:00
jinapurapu
3885875149 Add ILM rule tags generated by mc to getBucketLifecycle response (#3369) 2024-06-06 15:22:18 -07:00
Cesar N
cf05d5026f Use sync.Map for websocket cancelContext map (#3368) 2024-06-06 11:38:55 -07:00
Harshavardhana
3e83a30739 go1.22.4 upgrade for vulncheck (#3370) 2024-06-06 10:23:43 -07:00
Ramon de Klein
49c5f5a8f0 Use automatic URI encoding (#3352) 2024-06-05 14:48:27 -07:00
Ramon de Klein
72939e0cd7 Provide workaround for circular dependency (#3361) 2024-06-05 11:36:58 -07:00
Javier Adriel
271560894a Fix mapping over null reference for KMS endpoints (#3367) 2024-06-03 14:03:35 -07:00
Javier Adriel
6a591c1bcd Fix wrong comparisons (#3365) 2024-05-29 15:50:23 -07:00
Victor Bayas
3fdcfef1b4 Set Yarn checksumBehavior to reset (#3366)
* Set Yarn checksumBehavior to reset

* Update .gitignore according to Yarn docs
See https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored

* Update yarn.lock

---------

Co-authored-by: Harshavardhana <harsha@minio.io>
2024-05-29 15:50:12 -07:00
Ramon de Klein
7b8cfa2062 Attempt to fix resolution issues (#3364) 2024-05-29 15:12:02 -07:00
Harshavardhana
cc5921fd74 chore: update all deps (#3363) 2024-05-28 22:19:47 -06:00
Daniel Valdivia
d027b7f759 Release v1.4.1 (#3360)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2024-05-24 12:35:06 -07:00
Aditya Manthramurthy
f1524b0120 Bump up minio/pkg to v3 (#3349) 2024-05-24 10:44:55 -07:00
Kaan Kabalak
9985892751 Update default issue message note (#3358) 2024-05-22 23:16:05 -07:00
Ramon de Klein
cfd60bdd91 Upgrade to Yarn 4 and fix vulnerability check (#3353) 2024-05-22 18:19:32 -07:00
Shireesh Anjal
779f2a86e5 Fix empty version in health report download (#3341) 2024-05-17 14:42:39 -06:00
Pedro Juarez
f47c4445bd Return header with error idp logout (#3346) 2024-05-12 09:30:46 -07:00
Kaan Kabalak
1aeb4cc3d5 Fix SUBNET capitalization in issue template (#3345) 2024-05-10 17:47:38 -06:00
Alex
9e0a0205cc Updated react-pdf dependency (#3342) 2024-05-10 09:11:09 -06:00
Harshavardhana
1058efb17a Remove all unnecessary Dockerfiles from repo (#3340) 2024-05-08 21:53:47 -06:00
Anis Eleuch
d0f744ebef svc: Assume access key creation permission to be available by default (#3306)
Allow SVC creation when CreateServiceAccount is denied with a condition

Adding this policy will make the user not able to create a service account anymore:

```
    {
      "Effect": "Deny",
      "Action": [
              "admin:CreateServiceAccount"
      ],
      "Condition": {
              "NumericGreaterThanIfExists": {"svc:DurationSeconds": "1500"}
      }
    },

```

The reason is that policy.IsAllowedActions() is called with conditions from the user login.

Assume svc account creation to be possible for now until we come up with a better fix

Co-authored-by: Anis Eleuch <anis@min.io>
Co-authored-by: Prakash Senthil Vel <23444145+prakashsvmx@users.noreply.github.com>
2024-05-08 09:47:57 -07:00
Cesar N
a8c043cb16 Use redirect URL in share link if env variable set (#3334) 2024-05-08 09:46:41 -07:00
dependabot[bot]
978e02b5dc Bump react-pdf from 7.7.1 to 7.7.3 in /web-app (#3337)
Bumps [react-pdf](https://github.com/wojtekmaj/react-pdf/tree/HEAD/packages/react-pdf) from 7.7.1 to 7.7.3.
- [Release notes](https://github.com/wojtekmaj/react-pdf/releases)
- [Commits](https://github.com/wojtekmaj/react-pdf/commits/v7.7.3/packages/react-pdf)

---
updated-dependencies:
- dependency-name: react-pdf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-08 09:46:13 -07:00
dependabot[bot]
b39dbfff96 Bump pdfjs-dist from 3.11.174 to 4.2.67 in /web-app (#3335)
Bumps [pdfjs-dist](https://github.com/mozilla/pdfjs-dist) from 3.11.174 to 4.2.67.
- [Commits](https://github.com/mozilla/pdfjs-dist/commits)

---
updated-dependencies:
- dependency-name: pdfjs-dist
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-08 09:46:03 -07:00
Alex
bd89cfde79 Release v1.4.0 (#3333) 2024-05-06 17:58:31 -06:00
Anis Eleuch
0bd563b2e5 Fix a leak in WS object browser (#3325)
```
goroutine 7399330769 [chan send, 70126 minutes]:
github.com/minio/console/api.(*wsMinioClient).objectManager.func2.1()
        github.com/minio/console@v0.46.0/api/ws_objects.go:135 +0x6f0
created by github.com/minio/console/api.(*wsMinioClient).objectManager.func2 in goroutine 7354918912
        github.com/minio/console@v0.46.0/api/ws_objects.go:95 +0x45e
```
2024-05-06 15:12:31 -07:00
Alex
22fe915629 Changed default Replicate Existing Objects behavior in MinIO UI (#3271)
Changed default Replicate Existing Objects behavior in UI

- Fixed replicate existing objects configuration saving
- Displayed full error message if error case ocurrs.
- Changed wording for this feature & enabled by default this setting

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-05-06 16:02:27 -06:00
Alex
aa161a5365 Added VersionID support to Metadata Details (#3332)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-05-06 14:38:53 -07:00
kcao
0557514cb4 fix: correct metric endpoint from minio_cluster_drive_free_inodes (#3296)
Fixes minio/console#3295
2024-05-06 03:56:08 -07:00
Alex
298203253c Updated UI dependencies (#3329)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-05-03 17:32:11 -06:00
Cesar N
cbeef2b248 Fix URL safe string decoding for DownloadPublicObject API (#3328)
Co-authored-by: cesnietor <cesar.nieto@min.io>
2024-05-03 15:33:46 -07:00
Harshavardhana
e68a74ba48 fix: passing correct httpClient, do not use DefaultClients (#3319)
most of our deployments use custom certificates, using DefaultClient
makes it virtually impossible to make share URL feature work.

this PR fixes this behavior in the implementation.

Bonus: re-use transports inside console, will add more changes to
take custom transport inputs in subsequent PR.
2024-05-01 09:46:35 -07:00
Ramon de Klein
02a0db1408 Use React hook to better deal with websockets (#3299) 2024-05-01 03:42:49 -07:00
dependabot[bot]
348376c672 Bump ejs from 3.1.9 to 3.1.10 in /web-app (#3324)
Bumps [ejs](https://github.com/mde/ejs) from 3.1.9 to 3.1.10.
- [Release notes](https://github.com/mde/ejs/releases)
- [Commits](https://github.com/mde/ejs/compare/v3.1.9...v3.1.10)

---
updated-dependencies:
- dependency-name: ejs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-01 02:53:56 -07:00
Kaan Kabalak
037b02e268 Make permission tests compatible with minio-js v8 (#3323)
Fixes #3322
2024-05-01 02:45:09 -07:00
Kaan Kabalak
fe534ab4e6 Temporarily fix permission tests failing due to minio-js version bump (#3321)
Fix permission tests failing due to minio-js version bump

Permission tests were failing due to function signature changes
introduced with the latest minio-js release. This is a temporary
measure until a Console PR to update test files is sent.
2024-04-30 14:32:02 -06:00
Cesar N
6625d54d67 Release v1.3.0 (#3313) 2024-04-24 18:15:13 -07:00
Cesar N
ee6d1ed586 Upgrade superagent package to fix vulnerability (#3314) 2024-04-24 17:27:42 -07:00
Cesar N
6de1d88e11 Use url-safe base64 encoding for download-shared-object api (#3305) 2024-04-23 08:36:30 -07:00
jinapurapu
de19b6f17b Make prefix field optional for adding tier (#3301) 2024-04-18 23:51:13 -06:00
jinapurapu
226a90be1d Adds ExpireDeleteMarker status to bucketLifecycleRule UI display (#3302) 2024-04-18 18:36:00 -06:00
Prakash Senthil Vel
6cfb6ff06a add user agent in admin client to display console in audit logs (#3297) 2024-04-17 10:49:15 -06:00
Alex
649c3d74b8 Release v1.2.0 (#3292)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-04-10 13:06:18 -06:00
Alex
662ce3b2f5 Update console dependencies to fix vulnerabilities (#3291)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-04-10 11:52:15 -06:00
dependabot[bot]
0292bc154d Bump express from 4.18.3 to 4.19.2 in /web-app (#3277)
Bumps [express](https://github.com/expressjs/express) from 4.18.3 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.18.3...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex <33497058+bexsoft@users.noreply.github.com>
2024-04-10 11:40:56 -06:00
Cesar N
ceee83f03a Use Console as proxy for share object logic (#3284) 2024-04-10 11:16:17 -06:00
Prakash Senthil Vel
144904f0f6 fix ux for keys permissions (#3280) 2024-04-05 10:14:29 -07:00
Alex
963c8f1221 Added missing permissions validation to rewind button (#3282)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-04-04 23:41:20 -06:00
Shireesh Anjal
6c50c38f83 fix health report upload error (#3275) 2024-04-04 13:50:22 -06:00
Shireesh Anjal
3aac62cc81 Reuse GetClusterRegInfo from mc (#3270) 2024-04-01 09:14:54 -07:00
Cesar N
78a05d39c4 Log error if it exists while serving APIs (#3276)
Co-authored-by: cesnietor <>
2024-03-27 13:06:42 -07:00
dependabot[bot]
79bec3880e Bump webpack-dev-middleware from 5.3.3 to 5.3.4 in /web-app (#3273) 2024-03-24 05:39:34 +01:00
Alex
bdf7bd6309 Changed Bucket Access Policy default value from n/a to private (#3267)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-03-19 18:28:18 -06:00
dependabot[bot]
4ce1ba999b Bump follow-redirects from 1.15.5 to 1.15.6 in /web-app (#3266) 2024-03-14 21:05:39 -06:00
Alex
d01501703b Release v1.1.1 (#3265)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-03-14 16:34:57 -07:00
Cesar N
6a38a09462 Fix folder download (#3264) 2024-03-14 15:07:15 -06:00
Alex
78990e354f Release v1.1.0 (#3261)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-03-12 11:22:55 -06:00
Harshavardhana
3189ebdfef Update all go-deps (#3259) 2024-03-12 01:47:35 -06:00
Shubhendu
39bf627b0a Enable console to set expired-object-all-versions (#3226)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-03-11 14:25:06 -06:00
Alex
a838c763ea Release v1.0.0 (#3252)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-02-29 13:45:03 -08:00
Aditya Manthramurthy
0afea63994 Fix: handling of no inline policy for service acc. (#3221) 2024-02-29 14:51:12 -06:00
Phillip Schichtel
0df9487527 Check the blob size instead of the progress reports (#3249) 2024-02-29 08:33:26 -08:00
Victor Bayas
9274ee72ad Fix URL of inspect object API (#3247) 2024-02-28 20:51:09 -06:00
Prakash Senthil Vel
2b6c3debb4 clean up text preview support which was removed earlier (#3251) 2024-02-28 09:00:41 -08:00
Victor Bayas
8dd6dd4e7f Use native WebSocket API (#3248) 2024-02-27 13:34:06 -08:00
dependabot[bot]
5e64c96497 Bump ip from 1.1.8 to 1.1.9 in /web-app (#3241)
Bumps [ip](https://github.com/indutny/node-ip) from 1.1.8 to 1.1.9.
- [Commits](https://github.com/indutny/node-ip/compare/v1.1.8...v1.1.9)

---
updated-dependencies:
- dependency-name: ip
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex <33497058+bexsoft@users.noreply.github.com>
2024-02-26 13:45:16 -08:00
jinapurapu
54c0b4b8a2 Add bucket replication screen (#3040) 2024-02-26 13:44:55 -08:00
Prakash Senthil Vel
31056e12ba No preview message UI (#3244) 2024-02-26 11:34:21 -06:00
Alex
151c8117a3 Release v0.46.0 (#3238) 2024-02-16 13:58:01 -08:00
Alex
9b5c17c2db Updated failing UI tests in console (#3236)
Updated failing tests in console

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-02-14 17:48:41 -06:00
Alex
23e01b257e Updated mds to v0.18.1 (#3233)
- Updated other project dependencies
- Fixed an issue while pressing enter key in a page that contains a select box
- Fixed an issue while selecting an autocomplete option from an input box

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-02-13 17:53:11 -06:00
jinapurapu
ecc8c7a86e Added latest blog content to help menu (#3223) 2024-02-13 00:28:05 -08:00
Harshavardhana
ee4d7b9b69 upgrade all dependencies for console (#3235)
Signed-off-by: Harshavardhana <harsha@minio.io>
2024-02-12 22:17:21 -08:00
Alex
80c03839a4 Fixed lint issues with files (#3234)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-02-12 21:55:17 -08:00
jinapurapu
f394cb69ce Fixed disabled Create User button if policy has no resource (#3231)
Co-authored-by: Jillian Inapurapu <jillii@Jillians-MBP.attlocal.net>
Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2024-02-12 09:54:32 -08:00
Prakash Senthil Vel
52137ba9e5 Logout state clean up (#3219) 2024-02-09 15:36:56 -06:00
Prakash Senthil Vel
942b8101cc Fix lifecycle rule and edit modal to be consistent to display tier (#3227) 2024-02-07 11:35:25 -06:00
jinapurapu
a0a6b33ecd Add HelpTip to clarify Usage calculation (#3143) 2024-01-30 23:15:11 -06:00
Cesar N
d4c5e1b51c Fail request when error occurs during download (#3214) 2024-01-26 15:06:25 -06:00
jinapurapu
96923aed75 Changed DeleteAccessRule to use swagger api (#3213) 2024-01-26 14:59:34 -06:00
Shubhendu
a04f833e3f Query params replicate-ilm-expiry and disable-ilm-expiry-replication (#3065)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2024-01-26 14:59:09 -06:00
dependabot[bot]
3b52cc9bd4 Bump github.com/lestrrat-go/jwx from 1.2.27 to 1.2.28 (#3215)
Bumps [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) from 1.2.27 to 1.2.28.
- [Release notes](https://github.com/lestrrat-go/jwx/releases)
- [Changelog](https://github.com/lestrrat-go/jwx/blob/v1.2.28/Changes)
- [Commits](https://github.com/lestrrat-go/jwx/compare/v1.2.27...v1.2.28)

---
updated-dependencies:
- dependency-name: github.com/lestrrat-go/jwx
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-26 12:01:41 -06:00
Cesar N
df2e92e451 Use swagger api for Site Replication Status (#3208) 2024-01-24 23:05:27 -06:00
Cesar N
8836fe043b Return proper progress on download error (#3211) 2024-01-23 10:55:41 -06:00
Cesar N
7ce6a58099 Use swagger api for Get API from Subnet (#3207) 2024-01-22 10:42:33 -06:00
Haruaki
57d6aca716 Fix BucketNamingRules button click (#3209) 2024-01-22 10:41:35 -06:00
Cesar N
8d99637455 Use swagger api for Add KMS key in Bucket Encryption (#3205) 2024-01-21 22:16:10 -08:00
Cesar N
abd66780f4 Use swagger api for AirGap Subnet Registration (#3206) 2024-01-19 14:17:23 -06:00
Cesar N
a5175a35ec Use swagger api for import KSM Key (#3204) 2024-01-19 11:07:05 -08:00
Cesar N
d9f945b5df Use swagger api for Add KMS Key (#3202) 2024-01-18 22:41:40 -08:00
Cesar N
0c55e39e8c Use swagger api for Add IDP Configuration (#3201) 2024-01-18 16:03:01 -08:00
Cesar N
b5443952da Use swagger api for IDP configuration details (#3200) 2024-01-18 15:02:11 -08:00
Cesar N
b9f0ccfaba Use swagger api for delete single and multiple Service Accounts (#3199) 2024-01-18 11:55:56 -05:00
Daniel Valdivia
24742325b7 Remove useAPI from DeleteUser and DeleteIDPConfigurationModal (#3191) 2024-01-17 15:37:28 -08:00
Cesar N
c87ebe447f Use swagger api for delete KMS key (#3197) 2024-01-17 15:31:19 -06:00
Cesar N
462cf16db9 Use swagger api for delete Policy (#3198) 2024-01-17 12:06:03 -08:00
Cesar N
edaa4e8754 Use swagger api for delete group (#3196) 2024-01-17 11:49:03 -08:00
Cesar N
76c596c574 Disable KMS Endpoints and Metrics Tabs if using KMS Secret Key (#3193) 2024-01-17 09:05:10 -08:00
Alex
b5554f6dcf Added Dark / Light Mode Status icons (#3194)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-01-16 19:06:58 -06:00
Daniel Valdivia
fc65f1afd1 Add Base URI to Inspect API calls (#3190)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2024-01-16 13:45:27 -08:00
Cesar N
b066b6a920 Kms status endpoints null validation (#3189) 2024-01-12 16:32:37 -06:00
Alex
bc0e63aac8 Release v0.45.0 (#3187)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-01-10 21:48:08 -08:00
Alex
343ff575e6 Removed heal backend (#3188)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-01-10 21:16:08 -08:00
Alex
08c922dca6 Deprecated Heal (Drives) functionality (#3186)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-01-10 22:33:18 -06:00
Alex
4dd6519cc6 Updated Section titles & labels (#3185)
Renamed Subscription to Subnet in menus
Renamed Settings to Configuration
Renamed Diagnostics to Heath

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2024-01-10 22:16:24 -06:00
Prakash Senthil Vel
cdffdae289 Fix life cycle rule edit for transition (#3183) 2024-01-08 08:43:07 -06:00
Shireesh Anjal
27e3b82223 Use subnet package in pkg for license validation (#3156) 2023-12-29 12:12:27 -06:00
Daniel Valdivia
239b31748a Rename portal-ui to web-app (#3178)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-12-29 11:44:01 -06:00
Daniel Valdivia
b465b74326 Release v0.44.0 (#3177)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-12-27 00:11:15 -08:00
Daniel Valdivia
616f262d09 Rename restapi to api (#3176)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-12-26 15:07:30 -06:00
Harshavardhana
8aa0ec17c5 simplify the provider config init, loading and allow reachable IDPs (#3168)
fixes https://github.com/minio/console/issues/3018
2023-12-26 14:38:42 -06:00
Daniel Valdivia
a8c5b53a2c Pkg Subnet Utils Tests (#3173)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-12-26 14:29:11 -06:00
Cesar Celis Hernandez
e96dbd444e Add all possible tests under restapi (#3174) 2023-12-26 14:17:40 -06:00
Prakash Senthil Vel
939e2acb0b fix event dest icons not loading when subpath is configured (#3169)
Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-12-26 14:03:25 -06:00
Daniel Valdivia
a04955dc70 Save all coverage files to play (#3170)
* Save all coverage files to play

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>

* Save them to latest as well

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>

---------

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-12-26 13:52:18 -06:00
Cesar Celis Hernandez
ba04a22492 Adjusting the threshold of the coverage (#3172) 2023-12-26 13:52:03 -06:00
Cesar Celis Hernandez
a281fe129f To include pkg tests in the coverage (#3171)
Execute and include pkg tests in the coverage
2023-12-26 13:34:25 -06:00
Daniel Valdivia
a655cc8d3b Upgrade Go Dependencies (#3167) 2023-12-23 08:26:57 -06:00
Daniel Valdivia
63b584c83d Change Loading Logic for Metrics Page (#3166)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-12-22 10:25:54 -06:00
Alex
7dffd5f079 Release v0.43.1 (#3161) 2023-12-18 17:00:58 -06:00
Cesar N
044e5702df Update Share Object UI to reflect max expiration time (#3098) 2023-12-14 15:28:11 -06:00
Alex
3c3b9546d9 Release v0.43.0 (#3159)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-12-12 21:53:25 -06:00
jinapurapu
5bc0e74b53 Omit detailedMessage from login errors (#3136) 2023-12-12 18:09:56 -06:00
Alex
f0d4dddacd Changed PDF file preview behavior (#3144)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-12-12 14:20:06 -06:00
Prakash Senthil Vel
f4a3f46bcf Fix to prevent extra metadata call when listing at a bucket level (#3158) 2023-12-12 10:56:48 -06:00
Alex
38472e4cd2 Updated Console dependencies (#3157)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-12-11 18:29:07 -06:00
Daniel Valdivia
9db5d1e4f4 Tests for pkg/utils (#3155)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-12-11 09:57:02 -08:00
jinapurapu
4cadaf7d49 Cleaned up Tooltips and HelpTips on AddBucket screen (#3154) 2023-12-11 11:33:28 -06:00
Adrian Najera
748486160f FIX: Use STS env variable to increase the IDP token expiration (#3132)
Share link duration is based on the token expiration,
this increases the IDP token expiration so the share link
is able to last longer, by using an env variable called
MINIO_STS_DURATION
2023-12-08 09:58:46 -08:00
Alex
2c0a0b2bc4 Release v0.42.2 (#3153)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-12-07 15:37:44 -06:00
Daniel Valdivia
7e51d4bebb Don't attempt to show prometheus metrics if URL is empty (#3152)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-12-07 15:16:03 -06:00
Alex
c011e67122 Release v0.42.1 (#3150)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-12-06 19:10:28 -06:00
Alex
394b4c403d Rollback to go 1.19 (#3149)
Rollback go version to go 1.19, This is a requirement of MinIO server

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-12-06 16:55:03 -08:00
Cesar N
74030aa067 Release 0.42.0 (#3148) 2023-12-06 16:04:01 -08:00
Cesar N
07b8c745e6 Remove prints from delete handlers (#3147) 2023-12-06 16:59:10 -06:00
Prakash Senthil Vel
6767bfa2d2 add encoded filename as part of delete api url (#3141) 2023-12-06 14:28:46 -08:00
Prakash Senthil Vel
607d94fef4 add encoded filename as part of upload url (#3140) 2023-12-06 14:14:25 -08:00
Alex
83b060ef94 Updated govuln check to use latest version (#3146)
Updated go vuln check to use latest version

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-12-06 15:13:22 -06:00
dependabot[bot]
cb14cb94ce Bump @adobe/css-tools from 4.3.1 to 4.3.2 in /portal-ui (#3139) 2023-12-06 11:31:55 -06:00
Daniel Valdivia
2b9de49fbe Upgrade to Go 1.21 (#3142)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-12-01 18:23:24 -06:00
Alex
290f273bdf Updated mds version to v0.13.0 (#3138) 2023-11-28 17:11:54 -08:00
Prakash Senthil Vel
7b43779fb0 Fix share option should not be enabled for a prefix (#3135) 2023-11-28 18:45:24 -06:00
Prakash Senthil Vel
924c38faa6 Fix actions on a del marker in object list view (#3134) 2023-11-23 22:32:08 -06:00
Prakash Senthil Vel
e4d5f9610e access keys ui details improvement and edit (#3116) 2023-11-21 22:08:23 -06:00
jinapurapu
04e9cb0ac8 Enable Create Path button on BrowserBreadcrumbs if User can create subPath (#3131) 2023-11-17 13:21:07 -06:00
jinapurapu
da53daff37 Add UI to select number of non-current versions subject to ILM expiry rule (#3088) 2023-11-16 13:34:04 -06:00
Alex
8c26eff2c1 Added matchMedia mock function for Testing purposes (#3130)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-11-15 15:51:55 -06:00
Alex
044c265423 Enabled Dark Mode in Console (#3129)
- Dark mode will be tied to system settings if not set
- Dark mode will be stored in Application storage once set

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-11-15 13:33:05 -06:00
jinapurapu
0053658d5d Added OIDC docs and blog to helpMenu (#3127) 2023-11-15 09:30:39 -06:00
Alex
99cf3b378f Removed MUI dependencies from console (#3126)
- Updated DateTime Selector
- Updated last dependency functions
- Removed mui theming tools

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-11-14 10:22:47 -06:00
jinapurapu
78293eab62 Added new blog and video content to HelpMenu (#3124) 2023-11-13 12:11:55 -06:00
Cesar N
1a84be5782 Ignore server file from swagger-gen make command (#3123) 2023-11-06 14:01:02 -08:00
Alex
178f82b675 Release v0.41.0 (#3121)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-11-02 16:30:50 -07:00
Alex
ec5fbbcd1e Updated Login Error Callback page to mds (#3120)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-11-01 15:21:24 -06:00
Alex
78164054d4 Updated HelpMenu components to use only mds subcomponents (#3119)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-11-01 09:54:14 -06:00
Alex
6d5d11d5b4 Updated common bars (#3118)
- Updated common Loading Bars
- Updated Restart MinIO notification bar

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-11-01 09:53:42 -06:00
nreisingercres
9e3b93d385 Fix days selector to ignore daylight savings (#3117) 2023-10-31 14:30:10 -06:00
jiuker
d77cf93193 update the madmin-go dep (#3115) 2023-10-31 11:03:26 -06:00
Alex
2cca3f3722 Updated Logs Page to use mds components (#3114)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-31 10:12:23 -06:00
Anis Eleuch
36d96a1791 Support resolving of listen addrs to multiple IPv4/IPv6 (#3100)
If you specify --console-address "myaddress:9001" while myaddress can be
resolved to one IPv4 address and another IPv6 address, Console ignores
the IPv6 address. This commit fixes that.

Authored-by: Anis Elleuch <anis@min.io>
2023-10-30 17:47:16 -07:00
Alex
82e34a5df2 Replaced MenuDropdown components with mds variables (#3113)
- Replaced menu dropdown in Files Button
- Input Unit Menu dropdown replacement
- Migrated Download Widget dropdown

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-30 16:46:22 -06:00
Alex
7b83f4b1dc Restored ENV var display support in Console Configuration pages. (#3112)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-30 14:38:33 -06:00
Andreas Auernhammer
7d9910d1ca update docker file to ubi9 base image (#3109)
This commit improves and updates the docker file
to the UBI 9 base image.

Signed-off-by: Andreas Auernhammer <github@aead.dev>
2023-10-30 13:20:43 -06:00
Alex
7a63f6da56 Migrated Object Manager components to mds (#3108) 2023-10-27 06:36:01 -07:00
Alex
0043833f36 Migrated Date Selectors & Chart Tooltips styles (#3107)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-26 22:41:40 -06:00
Alex
3ad3bccadb Autocomplete component replacement (#3104)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-26 11:54:34 -06:00
Alex
39e94c890e Replaced Notification components with mds variants (#3103)
Replaced Notification components for mds variants

- Updated Warning Message components
- Replaced Snackbar component

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-25 11:38:35 -06:00
Alex
701039454a MDS Console improvements (#3102)
- Removed mui badge component
- Updated icons screen
- Migrated Wizard Component
- Improved modals styles
- Updated KMS Status page

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-24 14:09:22 -06:00
Alex
ec77a03d7c Replace missing icons from mui (#3101)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-24 09:28:33 -07:00
Alex
8dbad84a58 Improved error handling in Object Browser (#3097)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-23 10:17:44 -06:00
Cesar N
1767a37162 Add share link exp api (#3095) 2023-10-19 16:03:14 -05:00
Javier Adriel
622c3a067a Add global params for limit and offset (#3096) 2023-10-19 15:38:31 -05:00
Cesar N
4389548b64 Update swagger generated files with latest swagger version (#3094) 2023-10-19 12:49:38 -07:00
Alex
8cb0f1e558 Replaced mui accordion with mds component (#3089)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-17 10:32:23 -05:00
Alex
faafb77c73 Updated mds version to v0.9.6 (#3090)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-16 18:17:05 -05:00
Alex
0ecd1c73c1 Updated styling methods to remove mui and replace it with mds (#3085)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-13 12:02:29 -05:00
Shubhendu
88bf40f9a6 Use the new golang version 1.21.3 (#3087)
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
2023-10-12 11:50:15 -05:00
dependabot[bot]
a025163b34 Bump golang.org/x/net from 0.15.0 to 0.17.0 (#3086) 2023-10-12 11:50:00 -05:00
Alex
07c80462b7 mui Grid component replacement (#3084)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-11 13:59:04 -07:00
Alex
79ac2277d4 Migrated mui Box to use mds component (#3082)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-11 13:58:33 -07:00
Alex
1c27bee9d0 Removed FormSwitchWrapper component (#3081)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-10 12:29:24 -05:00
Alex
56dc58b0b8 Components cleanup (#3079)
Removed old component wrappers and replaced them with their mds equivalent components:

- InputBoxWrapper
- CommentBoxWrapper
- CheckboxWrapper
- PredefinedList

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-09 14:41:23 -05:00
Adrian Najera
4018addd79 Fix: cache clientIP in GetConsoleHTTPClient (#3056) 2023-10-09 14:40:54 -05:00
jinapurapu
429dfb4314 Add HelpTips to Console (#3054) 2023-10-06 15:38:55 -05:00
Alex
1d7bb0bb2b Removed mui support from PasswordSelector component (#3078)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-06 14:09:44 -05:00
Alex
476eb673bb Updated FileSelector and removed old component (#3076)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-06 09:12:13 -07:00
Alex
71681b710c Removed deprecated components and replaced them with mds ones (#3077)
- SectionTitle
- AButton
- ScreenTitle

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-06 09:11:48 -07:00
Alex
fb02a7da06 Updated README file (#3074)
Updated README file

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-05 12:31:06 -05:00
MinIO Bot
5fdc341138 mds-released-v0.9.3 (#3073) 2023-10-04 19:17:16 -05:00
Alex
15de6caf75 Fixed Failing integration test (#3071)
Added a wait time after bucket creation to list the new buckets list
2023-10-04 09:09:55 -07:00
Alex
77bc2d5006 Updated Playwright tests (#3070)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-03 20:09:33 -05:00
Alex
972f5fca9d Release v0.40.0 (#3069) 2023-10-03 12:17:05 -07:00
Alex
083314ee2d Object Browser Refactor (#3066)
- Refactored navigation to be handled only with URL
- Refactored & simplified websocket
- Updated components to use mds
- Fixed an issue with Anonymous access and file selection
- Fixed an issue with anonymous access and download selection click
- Fixed an issue with object details selection on root path from a bucket
- Simplified reducer

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-02 18:02:03 -05:00
Alex
078ce0e546 Updated console dependencies (#3068)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-10-02 15:52:34 -05:00
MinIO Bot
9beca2c226 mds-released-v0.9.2 (#3060) 2023-09-25 11:49:51 -06:00
Prakash Senthil Vel
451f23ae24 Improve change password user experience (#3058) 2023-09-22 13:51:03 -06:00
Alex
300ebfa19f Updated OpenID UX (#3050)
- Display ENV variables set in configuration
- Removed Password empty placeholders
- Added notification to re-enter password when modifying OpenID configuration

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-22 13:50:41 -06:00
Alex
1ce2846c95 AuditLogs page fixes (#3059)
- Added support to endDate
- Converted dates to UTC as required by AuditLogs API

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-22 09:49:36 -06:00
Alex
7fb8c11a9d Added support for Scanner event type (#3055)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-21 13:14:54 -06:00
Prakash Senthil Vel
e7993c2d1b Fix: handle crash in error handling of access keys page (#3051) 2023-09-20 20:45:51 -06:00
Alex
3e93f7ff88 Release v0.39.0 (#3049)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-14 23:43:58 -07:00
Alex
f0580956db Improvements to LDAP Configuration page (#3047)
- Fixed LDAP Enabled / Disabled calculation
- Removed Password Label from main page to avoid confusion
- Display LDAP ENV variables in case of configured

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-14 17:54:59 -06:00
Pedro Juarez
65b0bab26d Load the available CA in logout API (#3044) 2023-09-13 15:26:48 -06:00
Harshavardhana
a559421293 migrate and upgrade all dependencies (#3046) 2023-09-13 13:55:47 -06:00
Cesar N
6ef35c26a4 Remove unused check-version api (#3045) 2023-09-13 13:55:06 -06:00
Alex
8a918324aa Added CONSOLE_PROMETHEUS_AUTH_TOKEN flag support (#3043)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-13 12:02:13 -06:00
Alex
d30c0c8cbb Migrated Metrics pages and components to mds (#3042)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-13 12:01:43 -06:00
Alex
1697c826c0 Fixed an issue while deleting objects with similar prefixes (#3035)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-12 10:05:41 -06:00
Cesar N
b378b8c8ef Fix regression on login path when using redirect url (#3038) 2023-09-11 14:25:34 -07:00
MinIO Bot
2c42d7ff81 mds-released-v0.9.1 (#3041) 2023-09-11 09:58:23 -06:00
Cesar N
e1f36ee54a Upgrade go version in git workflows to 1.21.1 (#3039) 2023-09-07 17:29:22 -06:00
Alex
698f72f828 Migrated Register page components to mds (#3034)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-07 11:48:29 -06:00
jinapurapu
8dd94f5336 Moved EditBucketReplication to screen (#3037) 2023-09-06 17:24:07 -06:00
Alex
1dc21b9a21 Removed TableWrapper (#3032)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-05 11:06:33 -06:00
Alex
248215cc77 Updated Changelog for v0.38.0 (#3031)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-04 11:44:50 -07:00
Alex
a6eee73c11 Release v0.38.0 (#3029)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-02 09:10:10 -07:00
Anis Eleuch
50d6a39312 idp: Use 900 seconds as minimum expiry without returning an error (#3022)
Do not bother the user with an error if the IDP expiry is less than
900 seconds, since the S3 spec sets a minimum of 900 seconds for STS
expiration, use that minimum duration instead of returning an error

Co-authored-by: Anis Elleuch <anis@min.io>
Co-authored-by: Alex <33497058+bexsoft@users.noreply.github.com>
2023-09-02 07:50:45 -07:00
Aditya Manthramurthy
467b6b9bcb Use github.com/minio/pkg/v2 (#3027) 2023-09-01 17:29:07 -06:00
Alex
6e6246797c Renamed Subnet strings to SUBNET (#3026)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-01 15:10:12 -07:00
Alex
f8e4f747f5 Migrated Components loader to mds (#3025)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-09-01 12:06:33 -06:00
Alex
9acd49fcc6 Updated console dependencies (#3024)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-31 09:27:48 -06:00
Alex
636d12d43f Replaced LinearProgress as loader in favor of ProgressBar from mds (#3020)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-31 09:27:29 -06:00
MinIO Bot
5e9383de95 mds-released-v0.9.0 (#3021) 2023-08-30 12:38:11 -06:00
Kaan Kabalak
4863af863e Update minimum Standard plan capacity on License page (#3023) 2023-08-30 11:28:42 -06:00
Martin
b6d4c62edd Fix oauth2Config.Exchange error reporting (#3003) 2023-08-28 15:35:53 -07:00
Alex
bf733f3822 Migrated Heal and Watch pages to mds (#3016)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-25 09:53:02 -06:00
Alex
bbf4027418 Migrated Speedtest components to mds (#3015)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-24 17:08:16 -06:00
Alex
dbffc5fc22 Migrated Site Replication Pages (#3011)
- Improved & Simplified UI elements

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-24 17:07:58 -06:00
Cesar Celis Hernandez
f4a9420002 To properly show error in AddAccessRule.tsx (#3008)
Fixing the shown errors
2023-08-24 06:53:32 -06:00
Alex
657854bd29 Updated generated stylesheet (#3013) 2023-08-23 15:31:22 -06:00
MinIO Bot
cdc9e7d921 mds-released-v0.8.6 (#3012) 2023-08-23 15:21:36 -06:00
Alex
b125121ac8 Migrated available mds components in Tiers Page (#3007)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-21 22:30:04 -06:00
Daniel Valdivia
0c480dd5ec Handle errors for Set Policy for Access keys (#3005)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-08-21 12:00:45 -06:00
MinIO Bot
c07b8dcf73 mds-released-v0.8.4 (#3002)
Co-authored-by: MinIO Bot <minio.bot@minio.io>
2023-08-21 09:25:24 -06:00
Daniel Valdivia
912a4b216f Rename Error to ApiError to avoid ambiguity (#2954)
Rename Error to ApiError to avoide ambiguity and remove redundant status code

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2023-08-16 14:18:08 -07:00
Prakash Senthil Vel
e7fb205c31 show service account status and expiry in ui (#2992) 2023-08-16 11:55:07 -06:00
Alex
a2ba20e12f Release v0.37.0 (#3000) 2023-08-16 10:03:02 -07:00
Alex
f515dd82fe Migrated Trace page to mds (#2996)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-16 10:23:01 -06:00
Alex
61d3193c41 Migrated available mds components in Logs Page (#2998)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-16 09:42:15 -06:00
Harshavardhana
430ae66955 update disk -> drive change in prometheus metrics in minio master (#2999)
refer to https://github.com/minio/minio/pull/17854
2023-08-15 19:49:53 -07:00
MinIO Bot
3abbbc82b2 mds-released-v0.8.3 (#2995) 2023-08-15 10:09:50 -06:00
Alex
854181f63e Disabled input fields and changed Register label in Subscription features (#2994)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-14 17:07:31 -06:00
Kaan Kabalak
df996794ed Remove duplicate ref=con in License page buttons (#2993) 2023-08-14 10:12:10 -06:00
Cesar N
2d94018e3c Release v0.36.0 (#2988) 2023-08-10 11:59:15 -07:00
Alex
72bb9d0ca1 Update Settings Page components (#2986)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-09 18:30:42 -06:00
Javier Adriel
93bd0d65e2 Show LDAP configuration (#2985) 2023-08-09 12:06:17 -06:00
Prakash Senthil Vel
495b0f0068 truncate prefixes above the selected level to make the download layout flat (#2987) 2023-08-09 10:29:41 -07:00
Cesar Celis Hernandez
3275b6a6d8 Removing unneeded password (#2983) 2023-08-04 13:45:41 -06:00
Harshavardhana
fed5aa1599 fix: dateTime usage only available in go1.20 (#2982)
instead use a simpler normalizer for timestamp
to be user friendly without spaces.

For example

```
selected_files_20091110T230000Z.zip
```
2023-08-03 20:21:44 -07:00
Alex
6bc4efbac1 Release v0.35.0 (#2981) 2023-08-03 14:54:29 -07:00
Alex
cc0164a67b Initial Tools Pages Migrations (#2978)
Tools Pages Migrations

- Call Home
- Inspect
- Profile
- Health

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-03 15:26:17 -06:00
Prakash Senthil Vel
b968cc25ad feat: download multiple object selection as zip ignoring any deleted objects selected (#2965) 2023-08-02 18:28:25 -06:00
jinapurapu
d116a35a6d Fix subpath button (#2977)
Added bucketName to permissions check for subpath
2023-08-02 15:26:39 -07:00
Alex
49f856bdd5 Added Exclude Folders & Exclude Prefixes support (#2973)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2023-08-02 13:35:00 -06:00
Cesar Celis Hernandez
0d628f589a Removing white spaces from provided values (#2922) 2023-07-31 22:29:11 -06:00
Cesar N
4387b2149f Update Github jobs to use hardcoded testcafe version (#2972) 2023-07-31 16:11:28 -07:00
1969 changed files with 182613 additions and 225595 deletions

View File

@@ -1,7 +0,0 @@
node_modules/
dist/
target/
console
!console/
portal-ui/node_modules/
.git/

View File

@@ -8,7 +8,8 @@ assignees: ''
---
## NOTE
If this case is urgent, please subscribe to [Subnet](https://min.io/pricing) so that our 24/7 support team may help you faster.
Please subscribe to our [paid subscription plans](https://min.io/pricing) for 24x7 support from our Engineering team.
<!--- Provide a general summary of the issue in the title above -->

View File

@@ -1,166 +0,0 @@
# @format
name: Cross Compile
on:
pull_request:
branches:
- master
paths:
- go.sum
# This ensures that previous jobs for the PR are canceled when the PR is
# updated.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
cross-compile-1:
name: Cross compile
needs:
- lint-job
- ui-assets
- reuse-golang-dependencies
- semgrep-static-code-analysis
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [ 1.20.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
with:
go-version: ${{ matrix.go-version }}
cache: true
id: go
- name: Build on ${{ matrix.os }}
env:
GO111MODULE: on
GOOS: linux
run: |
make crosscompile arg1="'linux/ppc64le linux/mips64'"
cross-compile-2:
name: Cross compile 2
needs:
- lint-job
- ui-assets
- reuse-golang-dependencies
- semgrep-static-code-analysis
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [ 1.20.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
with:
go-version: ${{ matrix.go-version }}
cache: true
id: go
- name: Build on ${{ matrix.os }}
env:
GO111MODULE: on
GOOS: linux
run: |
make crosscompile arg1="'linux/arm64 linux/s390x'"
cross-compile-3:
name: Cross compile 3
needs:
- lint-job
- ui-assets
- reuse-golang-dependencies
- semgrep-static-code-analysis
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [ 1.20.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
with:
go-version: ${{ matrix.go-version }}
cache: true
id: go
- name: Build on ${{ matrix.os }}
env:
GO111MODULE: on
GOOS: linux
run: |
make crosscompile arg1="'darwin/amd64 freebsd/amd64'"
cross-compile-4:
name: Cross compile 4
needs:
- lint-job
- ui-assets
- reuse-golang-dependencies
- semgrep-static-code-analysis
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [ 1.20.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
with:
go-version: ${{ matrix.go-version }}
cache: true
id: go
- name: Build on ${{ matrix.os }}
env:
GO111MODULE: on
GOOS: linux
run: |
make crosscompile arg1="'windows/amd64 linux/arm'"
cross-compile-5:
name: Cross compile 5
needs:
- lint-job
- ui-assets
- reuse-golang-dependencies
- semgrep-static-code-analysis
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [ 1.20.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
with:
go-version: ${{ matrix.go-version }}
cache: true
id: go
- name: Build on ${{ matrix.os }}
env:
GO111MODULE: on
GOOS: linux
run: |
make crosscompile arg1="'linux/386 netbsd/amd64'"

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,10 @@
# @format
name: Vulnerability Check
on:
pull_request:
branches:
- master
push:
branches:
- master
permissions:
contents: read # to fetch code (actions/checkout)
@@ -16,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.20.x
go-version: 1.23.8
check-latest: true
- name: Get official govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@latest
@@ -34,18 +33,21 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.20.x ]
go-version: [ 1.23.x ]
os: [ ubuntu-latest ]
steps:
- name: Check out code
uses: actions/checkout@v3
- uses: actions/setup-node@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@v4
with:
node-version: ${{ env.NVMRC }}
cache: "yarn"
cache-dependency-path: portal-ui/yarn.lock
- name: Checks for known security issues with the installed packages
working-directory: ./portal-ui
working-directory: ./web-app
continue-on-error: false
run: |
yarn audit --groups dependencies
yarn npm audit --recursive --environment production --no-deprecations

13
.gitignore vendored
View File

@@ -1,12 +1,12 @@
# Playwright Data
portal-ui/storage/
portal-ui/playwright/.auth/admin.json
web-app/storage/
web-app/playwright/.auth/admin.json
# Report from Playwright
portal-ui/playwright-report/
web-app/playwright-report/
# Coverage from Playwright
portal-ui/.nyc_output/
web-app/.nyc_output/
# Binaries for programs and plugins
*.exe
@@ -37,7 +37,7 @@ dist/
# Ignore node_modules
portal-ui/node_modules/
web-app/node_modules/
# Ignore tls cert and key
private.key
@@ -48,3 +48,6 @@ public.crt
*.code-workspace
*~
.eslintcache
# Ignore Bin files
bin/

55
.golangci.bck.yml Normal file
View File

@@ -0,0 +1,55 @@
linters-settings:
misspell:
locale: US
testifylint:
disable:
- go-require
staticcheck:
checks:
[
"all",
"-ST1005",
"-ST1000",
"-SA4000",
"-SA9004",
"-SA1019",
"-SA1008",
"-U1000",
"-ST1016",
]
goheader:
values:
regexp:
copyright-holder: Copyright \(c\) (20\d\d\-20\d\d)|2021|({{year}})
template-path: .license.tmpl
linters:
disable-all: true
enable:
- goimports
- misspell
- govet
- revive
- ineffassign
- gosimple
- gomodguard
- gofmt
- unused
- staticcheck
- unconvert
- gocritic
- gofumpt
- durationcheck
issues:
exclude-use-default: false
exclude:
- should have a package comment
# TODO(y4m4): Remove once all exported ident. have comments!
- comment on exported function
- comment on exported type
- should have comment
- use leading k in Go names
- comment on exported const
exclude-dirs:
- api/operations

View File

@@ -1,49 +1,73 @@
linters-settings:
golint:
min-confidence: 0
misspell:
locale: US
goheader:
values:
regexp:
copyright-holder: Copyright \(c\) (20\d\d\-20\d\d)|2021|({{year}})
template-path: .license.tmpl
version: "2"
linters:
disable-all: true
default: none
enable:
- goimports
- misspell
- govet
- revive
- ineffassign
- gosimple
- durationcheck
- gocritic
- gomodguard
- gofmt
- unused
- govet
- ineffassign
- misspell
- revive
- staticcheck
- unconvert
- gocritic
- unused
settings:
goheader:
values:
regexp:
copyright-holder: Copyright \(c\) (20\d\d\-20\d\d)|2021|({{year}})
template-path: .license.tmpl
misspell:
locale: US
staticcheck:
checks:
- all
- -QF1001
- -QF1008
- -QF1010
- -QF1012
- -SA1008
- -SA1019
- -SA4000
- -SA9004
- -ST1000
- -ST1005
- -ST1016
- -ST1019
- -U1000
testifylint:
disable:
- go-require
exclusions:
generated: lax
rules:
- path: (.+)\.go$
text: should have a package comment
- path: (.+)\.go$
text: comment on exported function
- path: (.+)\.go$
text: comment on exported type
- path: (.+)\.go$
text: should have comment
- path: (.+)\.go$
text: use leading k in Go names
- path: (.+)\.go$
text: comment on exported const
paths:
- api/operations
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- gofumpt
- durationcheck
service:
golangci-lint-version: 1.43.0 # use the fixed version to not introduce new linters unexpectedly
issues:
exclude-use-default: false
exclude:
- should have a package comment
# TODO(y4m4): Remove once all exported ident. have comments!
- comment on exported function
- comment on exported type
- should have comment
- use leading k in Go names
- comment on exported const
run:
skip-dirs:
- pkg/clientgen
- pkg/apis/networking.gke.io
- restapi/operations
- goimports
exclusions:
generated: lax
paths:
- api/operations
- third_party$
- builtin$
- examples$

View File

@@ -5,7 +5,7 @@
# Common large paths
node_modules/
portal-ui/node_modules/
web-app/node_modules/
build/
dist/
.idea/

View File

@@ -1,9 +1,408 @@
<!-- @format -->
# Changelog
## Release v0.34.0
## Release v2.0.1
Bug Fix:
- Updated project dependencies for vulnerabilities
Changes:
- Updated Object Browser console logos
- Updated License page information
## Release v2.0.0
Community version is going back to be an object browser only.
Bug Fix:
- Fixed Dependencies vulnerabilities
Deprecations:
- Deprecated support of accounts & policies management, this can be managed by using mc admin commands. Please refer to the [MinIO Console User Management page](https://min.io/docs/minio/kubernetes/upstream/administration/identity-access-management/minio-user-management.html#id1) for more information.
- Deprecated support of bucket management, this can be managed by using mc commands. Please refer to the [MinIO Client](https://min.io/docs/minio/linux/reference/minio-mc.html) for more information.
- Deprecated support of configuration management, this can be managed by using mc admin config commands. Please refer to the [MinIO Client](https://min.io/docs/minio/linux/reference/minio-mc.html) for more information.
## 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:
- Fixed share link encoding
- Fixed Edit Lifecycle Storage Class
- Added Tiers Improvements for Bucket Lifecycle management
Additional Changes:
- Vulnerability updates
- Update Logo logic
## Release v1.5.0
Features:
- Added remove Tier functionality
Bug Fix:
- Fixed ILM rule tags not being shown
- Fixed race condition Object Browser websocket
- Fixed Encryption page crashing on empty response
- Fixed Replication Delete Marker comparisons
Additional Changes:
- Use automatic URI encoding for APIs
- Vulnerability updates
## Release v1.4.0
Features:
- Added VersionID support to metadata details
- Improved Websockets handlers
Bug Fix:
- Fixed vulnerabilities and updated dependencies
- Fixed an issue with Download URL decoding
- Fixed leak in Object Browser Websocket
- Minor UX fixes
## Release v1.3.0
Features:
- Adds ExpireDeleteMarker status to BucketLifecycleRule UI
Bug Fix:
- Fixed vulnerability
- Used URL-safe base64 enconding for Share API
- Made Prefix field optional when Adding Tier
- Added Console user agent in MinIO Admin Client
## Release v1.2.0
Features:
- Updated file share logic to work as Proxy
Bug Fix:
- Updated project dependencies
- Fixed Key Permissions UX
- Added permissions validation to rewind button
- Fixed Health report upload to SUBNET
- Misc Cosmetic fixes
## Release v1.1.1
Bug Fix:
- Fixed folder download issue
## Release v1.1.0
Features:
- Added Set Expired object all versions selector
Bug Fix:
- Updated Go Dependencies
## Release v1.0.0
Features:
- Updated Preview message alert
Bug Fix:
- Updated Websocket API
- Fixed issues with download manager
- Fixed policies issues
## Release v0.46.0
Features:
- Added latest help content to forms
Bug Fix:
- Disabled Create User button in certain policy cases
- Fixed an issue with Logout request
- Upgraded project dependencies
## Release v0.45.0
Deprecated:
- Deprecated Heal / Drives page
Features:
- Updated tines on menus & pages
Bug Fix:
- Upgraded project dependencies
## Release v0.44.0
Bug Fix:
- Upgraded project dependencies
- Fixed events icons not loading in subpaths
## Release v0.43.1
Bug Fix:
- Update Share Object UI to reflect maximum expiration time in UI
## Release v0.43.0
Features:
- Updated PDF preview method
Bug Fix:
- Fixed vulnerabilities
- Prevented non-necessary metadata calls in object browser
## Release v0.42.2
Bug Fix:
- Hidden Prometheus metrics if URL is empty
## Release v0.42.1
Bug Fix:
- Reset go version to 1.19
## Release v0.42.0
Features:
- Introducing Dark Mode
Bug Fix:
- Fixed vulnerabilities
- Changes on Upload and Delete object urls
- Fixed blocking subpath creation if not enough permissions
- Removed share object option at prefix level
- Updated allowed actions for a deleted object
## Release v0.41.0
Features:
- Updated pages to use mds components
- support for resolving IPv4/IPv6
Bug Fix:
- Remove cache for ClientIP
- Fixed override environment variables display in settings page
- Fixed daylight savings time support in share modal
## Release v0.40.0
Features:
- Updated OpenID page
- Added New bucket event types support
Bug Fix:
- Fixed crash in access keys page
- Fixed AuditLog filters issue
- Fixed multiple issues with Object Browser
## Release v0.39.0
Features:
- Migrated metrics page to mds
- Migrated Register page to mds
Bug Fix:
- Fixed LDAP configuration page issues
- Load available certificates in logout
- Updated dependencies & go version
- Fixed delete objects functionality
## Release v0.38.0
Features:
- Added extra information to Service Accounts page
- Updated Tiers, Site Replication, Speedtest, Heal & Watch pages components
Bug Fix:
- Fixed IDP expiry time errors
- Updated project Dependencies
## Release v0.37.0
Features:
- Updated Trace and Logs page components
- Updated Prometheus metrics
Bug Fix:
- Disabled input fields for Subscription features if MinIO is not registered
## Release v0.36.0
Features:
- Updated Settings page components
Bug Fix:
- Show LDAP Enabled value LDAP configuration
- Download multiple objects in same path as they were selected
## Release v0.35.1
Bug Fix:
- Change timestamp format for zip creation
## Release v0.35.0
Features:
- Add Exclude Folders and Exclude Prefixes during bucket creation
- Download multiple selected objects as zip and ignore deleted objects
- Updated Call Home, Inspet, Profile and Health components
Bug Fix:
- Remove extra white spaces for configuration strings
- Allow Create New Path in bucket view when having right permissions
## Release v0.34.0
Features:
- Updated Buckets components
Bug Fix:
@@ -12,9 +411,13 @@ Bug Fix:
- Updated Download Handler
- Fixes issue with rewind
- Avoid 1 hour expiration for IDP credentials
---
## Release v0.33.0
Features:
- Updated OpenID, LDAP components
Bug Fix:
@@ -22,21 +425,27 @@ Bug Fix:
- Fixed security issues
- Fixed navigation issues in Object Browser
- Fixed Dashboard metrics
---
## Release v0.32.0
Features:
- Updated Users and Groups components
- Added placeholder image for Help Menu
Bug Fix:
- Fixed memory leak in WebSocket API for Object Browser
- Fixed memory leak in WebSocket API for Object Browser
---
## Release v0.31.0
*Breaking Changes:*
**Breaking Changes:**
- *Removed support for Standalone Deployments*
- **Removed support for Standalone Deployments**
Features:
@@ -48,7 +457,9 @@ Bug Fix:
- Fixed Download folders issue in Object Browser
- Added missing Notification Events (ILM & REPLICA) in Events Notification Page
- Fixed Security Vulnerability for `semver` dependency
---
## Release v0.30.0
Features:

View File

@@ -4,56 +4,80 @@ This is a REST portal server created using [go-swagger](https://github.com/go-sw
The API handlers are created using a YAML definition located in `swagger.YAML`.
To add new api, the YAML file needs to be updated with all the desired apis using the [Swagger Basic Structure](https://swagger.io/docs/specification/2-0/basic-structure/), this includes paths, parameters, definitions, tags, etc.
To add new api, the YAML file needs to be updated with all the desired apis using
the [Swagger Basic Structure](https://swagger.io/docs/specification/2-0/basic-structure/), this includes paths,
parameters, definitions, tags, etc.
## Generate server from YAML
Once the YAML file is ready we can autogenerate the code needed for the new api by just running:
Validate it:
```
swagger validate ./swagger.yml
```
Update server code:
```
make swagger-gen
```
This will update all the necessary code.
`./restapi/configure_console.go` is a file that contains the handlers to be used by the application, here is the only place where we need to update our code to support the new apis. This file is not affected when running the swagger generator and it is safe to edit.
`./api/configure_console.go` is a file that contains the handlers to be used by the application, here is the only place
where we need to update our code to support the new apis. This file is not affected when running the swagger generator
and it is safe to edit.
## Unit Tests
`./restapi/handlers_test.go` needs to be updated with the proper tests for the new api.
`./api/handlers_test.go` needs to be updated with the proper tests for the new api.
To run tests:
```
go test ./restapi
go test ./api
```
## Commit changes
After verification, commit your changes. This is a [great post](https://chris.beams.io/posts/git-commit/) on how to write useful commit messages
After verification, commit your changes. This is a [great post](https://chris.beams.io/posts/git-commit/) on how to
write useful commit messages
```
$ git commit -am 'Add some feature'
```
### Push to the branch
Push your locally committed changes to the remote origin (your fork)
```
$ git push origin my-new-feature
```
### Create a Pull Request
Pull requests can be created via GitHub. Refer to [this document](https://help.github.com/articles/creating-a-pull-request/) for detailed steps on how to create a pull request. After a Pull Request gets peer reviewed and approved, it will be merged.
Pull requests can be created via GitHub. Refer
to [this document](https://help.github.com/articles/creating-a-pull-request/) for detailed steps on how to create a pull
request. After a Pull Request gets peer reviewed and approved, it will be merged.
## FAQs
### How does ``console`` manages dependencies?
``MinIO`` uses `go mod` to manage its dependencies.
- Run `go get foo/bar` in the source folder to add the dependency to `go.mod` file.
To remove a dependency
- Edit your code and remove the import reference.
- Run `go mod tidy` in the source folder to remove dependency from `go.mod` file.
### What are the coding guidelines for console?
``console`` is fully conformant with Golang style. Refer: [Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) article from Golang project. If you observe offending code, please feel free to send a pull request or ping us on [Slack](https://slack.min.io).
``console`` is fully conformant with Golang style.
Refer: [Effective Go](https://github.com/golang/go/wiki/CodeReviewComments) article from Golang project. If you observe
offending code, please feel free to send a pull request or ping us on [Slack](https://slack.min.io).

11004
CREDITS

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,20 @@
# Developing MinIO Console
The MinIO Console requires the [MinIO Server](https://github.com/minio/minio). For development purposes, you also need to run both the MinIO Console web app and the MinIO Console server.
The MinIO Console requires the [MinIO Server](https://github.com/minio/minio). For development purposes, you also need
to run both the MinIO Console web app and the MinIO Console server.
## Running MinIO Console server
Build the server in the main folder by running:
```
make
```
> Note: If it's the first time running the server, you might need to run `go mod tidy` to ensure you have all modules required.
To start the server run:
> Note: If it's the first time running the server, you might need to run `go mod tidy` to ensure you have all modules
> required.
> To start the server run:
```
CONSOLE_ACCESS_KEY=<your-access-key>
CONSOLE_SECRET_KEY=<your-secret-key>
@@ -19,8 +24,8 @@ CONSOLE_DEV_MODE=on
```
## Running MinIO Console web app
Refer to `/portal-ui` [instructions](/portal-ui/README.md) to run the web app locally.
Refer to `/web-app` [instructions](/web-app/README.md) to run the web app locally.
# Building with MinIO
@@ -72,25 +77,6 @@ Still in the MinIO folder, run
make build
```
# Testing on Kubernetes
If you want to test console on kubernetes, you can perform all the steps from `Building with MinIO`, but change `Step 3`
to the following:
```shell
TAG=miniodev/console:dev make docker
```
This will build a docker container image that can be used to test with your local kubernetes environment.
For example, if you are using kind:
```shell
kind load docker-image miniodev/console:dev
```
and then deploy any `Tenant` that uses this image
# LDAP authentication with Console
## Setup

View File

@@ -1,43 +0,0 @@
ARG NODE_VERSION
FROM node:$NODE_VERSION as uilayer
WORKDIR /app
COPY ./portal-ui/package.json ./
COPY ./portal-ui/yarn.lock ./
RUN yarn install
COPY ./portal-ui .
RUN make build-static
USER node
FROM golang:1.19 as golayer
RUN apt-get update -y && apt-get install -y ca-certificates
ADD go.mod /go/src/github.com/minio/console/go.mod
ADD go.sum /go/src/github.com/minio/console/go.sum
WORKDIR /go/src/github.com/minio/console/
# Get dependencies - will also be cached if we won't change mod/sum
RUN go mod download
ADD . /go/src/github.com/minio/console/
WORKDIR /go/src/github.com/minio/console/
ENV CGO_ENABLED=0
COPY --from=uilayer /app/build /go/src/github.com/minio/console/portal-ui/build
RUN go build --tags=kqueue,operator -ldflags "-w -s" -a -o console ./cmd/console
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
MAINTAINER MinIO Development "dev@min.io"
EXPOSE 9090
COPY --from=golayer /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=golayer /go/src/github.com/minio/console/console .
ENTRYPOINT ["/console"]

View File

@@ -1,14 +0,0 @@
ARG NODE_VERSION
FROM node:$NODE_VERSION as uilayer
WORKDIR /app
COPY ./portal-ui/package.json ./
COPY ./portal-ui/yarn.lock ./
RUN yarn install
COPY ./portal-ui .
RUN yarn install && make build-static
USER node

View File

@@ -1,27 +0,0 @@
FROM --platform=linux/amd64 registry.access.redhat.com/ubi8/ubi-minimal:8.7 as build
RUN microdnf update --nodocs && microdnf install ca-certificates --nodocs
RUN curl -s -q https://raw.githubusercontent.com/minio/kes/master/LICENSE -o LICENSE
RUN curl -s -q https://raw.githubusercontent.com/minio/kes/master/CREDITS -o CREDITS
FROM registry.access.redhat.com/ubi8/ubi-micro:8.7
# On RHEL the certificate bundle is located at:
# - /etc/pki/tls/certs/ca-bundle.crt (RHEL 6)
# - /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem (RHEL 7)
COPY --from=build /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /etc/pki/ca-trust/extracted/pem/
COPY --from=build LICENSE /LICENSE
COPY --from=build CREDITS /CREDITS
LABEL name="MinIO" \
vendor="MinIO Inc <dev@min.io>" \
maintainer="MinIO Inc <dev@min.io>" \
version="${TAG}" \
release="${TAG}" \
summary="A graphical user interface for MinIO" \
description="MinIO object storage is fundamentally different. Designed for performance and the S3 API, it is 100% open-source. MinIO is ideal for large, private cloud environments with stringent security requirements and delivers mission-critical availability across a diverse range of workloads."
EXPOSE 9090
COPY console /console
ENTRYPOINT ["/console"]

133
Makefile
View File

@@ -33,6 +33,10 @@ lint:
@GO111MODULE=on ${GOPATH}/bin/golangci-lint cache clean
@GO111MODULE=on ${GOPATH}/bin/golangci-lint run --timeout=5m --config ./.golangci.yml
lint-fix: getdeps ## runs golangci-lint suite of linters with automatic fixes
@echo "Running $@ check"
@GO111MODULE=on ${GOPATH}/bin/golangci-lint run --timeout=5m --config ./.golangci.yml --fix
install: console
@echo "Installing console binary to '$(GOPATH)/bin/console'"
@mkdir -p $(GOPATH)/bin && cp -f $(PWD)/console $(GOPATH)/bin/console
@@ -48,18 +52,23 @@ apply-gofmt:
clean-swagger:
@echo "cleaning"
@rm -rf models
@rm -rf restapi/operations
@rm -rf api/operations
swagger-console:
@echo "Generating swagger server code from yaml"
@swagger generate server -A console --main-package=management --server-package=restapi --exclude-main -P models.Principal -f ./swagger.yml -r NOTICE
@swagger generate server -A console --main-package=management --server-package=api --exclude-main -P models.Principal -f ./swagger.yml -r NOTICE
@echo "Ensure basic install"
@(cd web-app; yarn; cd ..)
@echo "Generating typescript api"
@npx swagger-typescript-api -p ./swagger.yml -o ./portal-ui/src/api -n consoleApi.ts
@make swagger-typescript-api path="../swagger.yml" output="./src/api" name="consoleApi.ts"
@git restore api/server.go
swagger-typescript-api:
@(cd web-app; yarn swagger-typescript-api -p $(path) -o $(output) -n $(name) --custom-config ../generator.config.js; cd ..)
assets:
@(if [ -f "${NVM_DIR}/nvm.sh" ]; then \. "${NVM_DIR}/nvm.sh" && nvm install && nvm use && npm install -g yarn ; fi &&\
cd portal-ui; yarn install --prefer-offline; make build-static; yarn prettier --write . --loglevel warn; cd ..)
cd web-app; corepack enable; yarn install --prefer-offline; make build-static; yarn prettier --write . --log-level warn; cd ..)
test-integration:
@(docker stop pgsqlcontainer || true)
@@ -77,7 +86,7 @@ test-integration:
@echo "Postgres"
@(docker run --net=mynet123 --ip=173.18.0.4 --name pgsqlcontainer --rm -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres && sleep 5)
@echo "execute test and get coverage for test-integration:"
@(cd integration && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && ./integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/system.out)
@(cd integration && go test -coverpkg=../api -c -tags testrunmain . && mkdir -p coverage && ./integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/system.out)
@(docker stop pgsqlcontainer)
@(docker stop minio)
@(docker stop minio2)
@@ -125,99 +134,39 @@ test-replication:
$(MINIO_VERSION) server /data{1...4} \
--address :9002 \
--console-address :6002)
@(cd replication && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && ./replication.test -test.v -test.run "^Test*" -test.coverprofile=coverage/replication.out)
@(cd replication && go test -coverpkg=../api -c -tags testrunmain . && mkdir -p coverage && ./replication.test -test.v -test.run "^Test*" -test.coverprofile=coverage/replication.out)
@(docker stop minio || true)
@(docker stop minio1 || true)
@(docker stop minio2 || true)
@(docker network rm mynet123 || true)
test-sso-integration:
@echo "create the network in bridge mode to communicate all containers"
@(docker network create my-net)
@echo "run openldap container using MinIO Image: quay.io/minio/openldap:latest"
@(docker run \
-e LDAP_ORGANIZATION="MinIO Inc" \
-e LDAP_DOMAIN="min.io" \
-e LDAP_ADMIN_PASSWORD="admin" \
--network my-net \
-p 389:389 \
-p 636:636 \
--name openldap \
--detach quay.io/minio/openldap:latest)
@echo "Run Dex container using MinIO Image: quay.io/minio/dex:latest"
@(docker run \
-e DEX_ISSUER=http://dex:5556/dex \
-e DEX_CLIENT_REDIRECT_URI=http://127.0.0.1:9090/oauth_callback \
-e DEX_LDAP_SERVER=openldap:389 \
--network my-net \
-p 5556:5556 \
--name dex \
--detach quay.io/minio/dex:latest)
@echo "running minio server"
@(docker run \
-v /data1 -v /data2 -v /data3 -v /data4 \
--network my-net \
-d \
--name minio \
--rm \
-p 9000:9000 \
-p 9001:9001 \
-e MINIO_IDENTITY_OPENID_CLIENT_ID="minio-client-app" \
-e MINIO_IDENTITY_OPENID_CLIENT_SECRET="minio-client-app-secret" \
-e MINIO_IDENTITY_OPENID_CLAIM_NAME=name \
-e MINIO_IDENTITY_OPENID_CONFIG_URL=http://dex:5556/dex/.well-known/openid-configuration \
-e MINIO_IDENTITY_OPENID_REDIRECT_URI=http://127.0.0.1:9090/oauth_callback \
-e MINIO_ROOT_USER=minio \
-e MINIO_ROOT_PASSWORD=minio123 $(MINIO_VERSION) server /data{1...4} --address :9000 --console-address :9001)
@echo "run mc commands to set the policy"
@(docker run --name minio-client --network my-net -dit --entrypoint=/bin/sh minio/mc)
@(docker exec minio-client mc alias set myminio/ http://minio:9000 minio minio123)
@echo "adding policy to Dillon Harper to be able to login:"
@(cd sso-integration && docker cp allaccess.json minio-client:/ && docker exec minio-client mc admin policy create myminio "Dillon Harper" allaccess.json)
@echo "starting bash script"
@(env bash $(PWD)/sso-integration/set-sso.sh)
@echo "add python module"
@(pip3 install bs4)
@echo "Executing the test:"
@(cd sso-integration && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && ./sso-integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/sso-system.out)
test-permissions-1:
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-1/")
@(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-1/")
@(docker stop minio)
test-permissions-2:
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-2/")
@(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-2/")
@(docker stop minio)
test-permissions-3:
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-3/")
@(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-3/")
@(docker stop minio)
test-permissions-4:
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-4/")
@(docker stop minio)
test-permissions-5:
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-5/")
@(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-4/")
@(docker stop minio)
test-permissions-6:
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/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)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-7/")
@(env bash $(PWD)/web-app/tests/scripts/permissions.sh "web-app/tests/permissions-6/")
@(docker stop minio)
test-apply-permissions:
@(env bash $(PWD)/portal-ui/tests/scripts/initialize-env.sh)
@(env bash $(PWD)/web-app/tests/scripts/initialize-env.sh)
test-start-docker-minio:
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
@@ -226,20 +175,50 @@ initialize-permissions: test-start-docker-minio test-apply-permissions
@echo "Done initializing permissions test"
cleanup-permissions:
@(env bash $(PWD)/portal-ui/tests/scripts/cleanup-env.sh)
@(env bash $(PWD)/web-app/tests/scripts/cleanup-env.sh)
@(docker stop minio)
initialize-docker-network:
@(docker network create test-network)
test-start-docker-minio-w-redirect-url: initialize-docker-network
@(docker run \
-e MINIO_BROWSER_REDIRECT_URL='http://localhost:8000/console/subpath/' \
-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})
test-start-docker-nginx-w-subpath:
@(docker run \
--network host \
-d --rm \
--add-host=host.docker.internal:host-gateway \
-v ./web-app/tests/subpath-nginx/nginx.conf:/etc/nginx/nginx.conf \
--name test-nginx nginx)
test-initialize-minio-nginx: test-start-docker-minio-w-redirect-url test-start-docker-nginx-w-subpath
cleanup-minio-nginx:
@(docker stop minio test-nginx & docker network rm test-network)
# https://stackoverflow.com/questions/19200235/golang-tests-in-sub-directory
# Note: go test ./... will run tests on the current folder and all subfolders.
# This is needed because tests can be in the folder or sub-folder(s), let's include them all please!.
test:
@echo "execute test and get coverage"
@(cd restapi && mkdir coverage && GO111MODULE=on go test -test.v -coverprofile=coverage/coverage.out)
@(cd api && mkdir -p coverage && GO111MODULE=on go test ./... -test.v -coverprofile=coverage/coverage.out)
# https://stackoverflow.com/questions/19200235/golang-tests-in-sub-directory
# Note: go test ./... will run tests on the current folder and all subfolders.
# This is since tests in pkg folder are in subfolders and were not executed.
test-pkg:
@echo "execute test and get coverage"
@(cd pkg && mkdir coverage && GO111MODULE=on go test -test.v -coverprofile=coverage/coverage-pkg.out)
@(cd pkg && mkdir -p coverage && GO111MODULE=on go test ./... -test.v -coverprofile=coverage/coverage-pkg.out)
coverage:
@(GO111MODULE=on go test -v -coverprofile=coverage.out github.com/minio/console/restapi/... && go tool cover -html=coverage.out && open coverage.html)
@(GO111MODULE=on go test -v -coverprofile=coverage.out github.com/minio/console/api/... && go tool cover -html=coverage.out && open coverage.html)
clean:
@echo "Cleaning up all the generated files"
@@ -254,4 +233,4 @@ release: swagger-gen
@echo "Generating Release: $(RELEASE)"
@make assets
@git add -u .
@git add portal-ui/build/
@git add web-app/build/

View File

@@ -12,57 +12,20 @@ A graphical user interface for [MinIO](https://github.com/minio/minio)
**Table of Contents**
- [MinIO Console](#minio-console)
- [Install](#install)
- [Binary Releases](#binary-releases)
- [Docker](#docker)
- [Build from source](#build-from-source)
- [Setup](#setup)
- [1. Create a user `console` using `mc`](#1-create-a-user-console-using-mc)
- [2. Create a policy for `console` with admin access to all resources (for testing)](#2-create-a-policy-for-console-with-admin-access-to-all-resources-for-testing)
- [3. Set the policy for the new `console` user](#3-set-the-policy-for-the-new-console-user)
- [Start Console service:](#start-console-service)
- [Start Console service with TLS:](#start-console-service-with-tls)
- [Connect Console to a Minio using TLS and a self-signed certificate](#connect-console-to-a-minio-using-tls-and-a-self-signed-certificate)
- [Install](#install)
- [Build from source](#build-from-source)
- [Setup](#setup)
- [1. Create a user `console` using `mc`](#1-create-a-user-console-using-mc)
- [2. Create a policy for `console` with admin access to all resources (for testing)](#2-create-a-policy-for-console-with-admin-access-to-all-resources-for-testing)
- [3. Set the policy for the new `console` user](#3-set-the-policy-for-the-new-console-user)
- [Start Console service:](#start-console-service)
- [Start Console service with TLS:](#start-console-service-with-tls)
- [Connect Console to a Minio using TLS and a self-signed certificate](#connect-console-to-a-minio-using-tls-and-a-self-signed-certificate)
- [Contribute to console Project](#contribute-to-console-project)
<!-- markdown-toc end -->
## Install
### Binary Releases
| OS | ARCH | Binary |
|:-------:|:-------:|:----------------------------------------------------------------------------------------------------:|
| Linux | amd64 | [linux-amd64](https://github.com/minio/console/releases/latest/download/console-linux-amd64) |
| Linux | arm64 | [linux-arm64](https://github.com/minio/console/releases/latest/download/console-linux-arm64) |
| Linux | ppc64le | [linux-ppc64le](https://github.com/minio/console/releases/latest/download/console-linux-ppc64le) |
| Linux | s390x | [linux-s390x](https://github.com/minio/console/releases/latest/download/console-linux-s390x) |
| Apple | amd64 | [darwin-amd64](https://github.com/minio/console/releases/latest/download/console-darwin-amd64) |
| Windows | amd64 | [windows-amd64](https://github.com/minio/console/releases/latest/download/console-windows-amd64.exe) |
You can also verify the binary with [minisign](https://jedisct1.github.io/minisign/) by downloading the
corresponding [`.minisig`](https://github.com/minio/console/releases/latest) signature file. Then run:
```
minisign -Vm console-<OS>-<ARCH> -P RWTx5Zr1tiHQLwG9keckT0c45M3AGeHD6IvimQHpyRywVWGbP1aVSGav
```
### Docker
Pull the latest release via:
```
docker pull minio/console
```
### Build from source
> You will need a working Go environment. Therefore, please follow [How to install Go](https://golang.org/doc/install).
> Minimum version required is go1.19
```
go install github.com/minio/console/cmd/console@latest
```
MinIO Console is a library that provides a management and browser UI overlay for the MinIO Server.
## Setup
@@ -228,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)

View File

@@ -14,28 +14,22 @@
// 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/>.
import React, { Fragment } from "react";
import { HelpBox, HelpIconFilled, Box } from "mds";
package api
interface IKMSHelpBoxProps {
helpText: string;
contents: string[];
import (
"context"
"github.com/minio/madmin-go/v3"
)
type AdminClientMock struct {
minioAccountInfoMock func(ctx context.Context) (madmin.AccountInfo, error)
}
const KMSHelpBox = ({ helpText, contents }: IKMSHelpBoxProps) => {
return (
<HelpBox
iconComponent={<HelpIconFilled />}
title={helpText}
help={
<Fragment>
{contents.map((content) => (
<Box sx={{ paddingBottom: "20px" }}>{content}</Box>
))}
</Fragment>
}
/>
);
};
func (ac AdminClientMock) kmsStatus(_ context.Context) (madmin.KMSStatus, error) {
return madmin.KMSStatus{Name: "name", DefaultKeyID: "key", Endpoints: map[string]madmin.ItemState{"localhost": madmin.ItemState("online")}}, nil
}
export default KMSHelpBox;
func (ac AdminClientMock) AccountInfo(ctx context.Context) (madmin.AccountInfo, error) {
return ac.minioAccountInfoMock(ctx)
}

View File

@@ -14,11 +14,10 @@
// 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 restapi
package api
import (
"context"
"encoding/base64"
"time"
"github.com/minio/mc/cmd"
@@ -41,7 +40,7 @@ type ObjectsRequest struct {
type WSResponse struct {
RequestID int64 `json:"request_id,omitempty"`
Error string `json:"error,omitempty"`
Error *CodedAPIError `json:"error,omitempty"`
RequestEnd bool `json:"request_end,omitempty"`
Prefix string `json:"prefix,omitempty"`
BucketName string `json:"bucketName,omitempty"`
@@ -60,20 +59,7 @@ type ObjectResponse struct {
func getObjectsOptionsFromReq(request ObjectsRequest) (*objectsListOpts, error) {
pOptions := objectsListOpts{
BucketName: request.BucketName,
Prefix: "",
}
prefix := request.Prefix
if prefix != "" {
encodedPrefix := SanitizeEncodedPrefix(prefix)
decodedPrefix, err := base64.StdEncoding.DecodeString(encodedPrefix)
if err != nil {
LogError("error decoding prefix: %v", err)
return nil, err
}
pOptions.Prefix = string(decodedPrefix)
Prefix: request.Prefix,
}
if request.Mode == "rewind" {

View File

@@ -14,7 +14,7 @@
// 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 restapi
package api
import (
"context"
@@ -97,11 +97,11 @@ func TestWSRewindObjects(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
mcListMock = func(ctx context.Context, opts mc.ListOptions) <-chan *mc.ClientContent {
mcListMock = func(_ context.Context, _ mc.ListOptions) <-chan *mc.ClientContent {
ch := make(chan *mc.ClientContent)
go func() {
defer close(ch)
@@ -206,11 +206,11 @@ func TestWSListObjects(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
minioListObjectsMock = func(ctx context.Context, bucket string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo {
minioListObjectsMock = func(_ context.Context, _ string, _ minio.ListObjectsOptions) <-chan minio.ObjectInfo {
ch := make(chan minio.ObjectInfo)
go func() {
defer close(ch)

190
api/client-admin.go Normal file
View File

@@ -0,0 +1,190 @@
// 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"
"net"
"net/http"
"net/url"
"regexp"
"strings"
"github.com/minio/console/pkg"
"github.com/minio/console/pkg/utils"
"github.com/minio/console/models"
"github.com/minio/madmin-go/v3"
"github.com/minio/minio-go/v7/pkg/credentials"
)
const globalAppName = "MinIO Console"
// MinioAdmin interface with all functions to be implemented
// by mock when testing, it should include all MinioAdmin respective api calls
// that are used within this project.
type MinioAdmin interface {
AccountInfo(ctx context.Context) (madmin.AccountInfo, error)
// KMS
kmsStatus(ctx context.Context) (madmin.KMSStatus, error)
}
// Interface implementation
//
// Define the structure of a minIO Client and define the functions that are actually used
// from minIO api.
type AdminClient struct {
Client *madmin.AdminClient
}
// AccountInfo implements madmin.AccountInfo()
func (ac AdminClient) AccountInfo(ctx context.Context) (madmin.AccountInfo, error) {
return ac.Client.AccountInfo(ctx, madmin.AccountOpts{})
}
func (ac AdminClient) getBucketQuota(ctx context.Context, bucket string) (madmin.BucketQuota, error) {
return ac.Client.GetBucketQuota(ctx, bucket)
}
func (ac AdminClient) kmsStatus(ctx context.Context) (madmin.KMSStatus, error) {
return ac.Client.KMSStatus(ctx)
}
func NewMinioAdminClient(ctx context.Context, sessionClaims *models.Principal) (*madmin.AdminClient, error) {
clientIP := utils.ClientIPFromContext(ctx)
adminClient, err := newAdminFromClaims(sessionClaims, clientIP)
if err != nil {
return nil, err
}
adminClient.SetAppInfo(globalAppName, pkg.Version)
return adminClient, nil
}
// newAdminFromClaims creates a minio admin from Decrypted claims using Assume role credentials
func newAdminFromClaims(claims *models.Principal, clientIP string) (*madmin.AdminClient, error) {
tlsEnabled := getMinIOEndpointIsSecure()
endpoint := getMinIOEndpoint()
adminClient, err := madmin.NewWithOptions(endpoint, &madmin.Options{
Creds: credentials.NewStaticV4(claims.STSAccessKeyID, claims.STSSecretAccessKey, claims.STSSessionToken),
Secure: tlsEnabled,
})
if err != nil {
return nil, err
}
adminClient.SetAppInfo(globalAppName, pkg.Version)
adminClient.SetCustomTransport(PrepareSTSClientTransport(clientIP))
return adminClient, nil
}
// isLocalAddress returns true if the url contains an IPv4/IPv6 hostname
// that points to the local machine - FQDN are not supported
func isLocalIPEndpoint(endpoint string) bool {
u, err := url.Parse(endpoint)
if err != nil {
return false
}
return isLocalIPAddress(u.Hostname())
}
// isLocalAddress returns true if the url contains an IPv4/IPv6 hostname
// that points to the local machine - FQDN are not supported
func isLocalIPAddress(ipAddr string) bool {
if ipAddr == "" {
return false
}
if ipAddr == "localhost" {
return true
}
ip := net.ParseIP(ipAddr)
return ip != nil && ip.IsLoopback()
}
// GetConsoleHTTPClient caches different http clients depending on the target endpoint while taking
// in consideration CA certs stored in ${HOME}/.console/certs/CAs and ${HOME}/.minio/certs/CAs
// If the target endpoint points to a loopback device, skip the TLS verification.
func GetConsoleHTTPClient(clientIP string) *http.Client {
return PrepareConsoleHTTPClient(clientIP)
}
var (
// De-facto standard header keys.
xForwardedFor = http.CanonicalHeaderKey("X-Forwarded-For")
xRealIP = http.CanonicalHeaderKey("X-Real-IP")
)
var (
// RFC7239 defines a new "Forwarded: " header designed to replace the
// existing use of X-Forwarded-* headers.
// e.g. Forwarded: for=192.0.2.60;proto=https;by=203.0.113.43
forwarded = http.CanonicalHeaderKey("Forwarded")
// Allows for a sub-match of the first value after 'for=' to the next
// comma, semi-colon or space. The match is case-insensitive.
forRegex = regexp.MustCompile(`(?i)(?:for=)([^(;|,| )]+)(.*)`)
)
// getSourceIPFromHeaders retrieves the IP from the X-Forwarded-For, X-Real-IP
// and RFC7239 Forwarded headers (in that order)
func getSourceIPFromHeaders(r *http.Request) string {
var addr string
if fwd := r.Header.Get(xForwardedFor); fwd != "" {
// Only grab the first (client) address. Note that '192.168.0.1,
// 10.1.1.1' is a valid key for X-Forwarded-For where addresses after
// the first may represent forwarding proxies earlier in the chain.
s := strings.Index(fwd, ", ")
if s == -1 {
s = len(fwd)
}
addr = fwd[:s]
} else if fwd := r.Header.Get(xRealIP); fwd != "" {
// X-Real-IP should only contain one IP address (the client making the
// request).
addr = fwd
} else if fwd := r.Header.Get(forwarded); fwd != "" {
// match should contain at least two elements if the protocol was
// specified in the Forwarded header. The first element will always be
// the 'for=' capture, which we ignore. In the case of multiple IP
// addresses (for=8.8.8.8, 8.8.4.4, 172.16.1.20 is valid) we only
// extract the first, which should be the client IP.
if match := forRegex.FindStringSubmatch(fwd); len(match) > 1 {
// IPv6 addresses in Forwarded headers are quoted-strings. We strip
// these quotes.
addr = strings.Trim(match[1], `"`)
}
}
return addr
}
// getClientIP retrieves the IP from the request headers
// and falls back to r.RemoteAddr when necessary.
// however returns without bracketing.
func getClientIP(r *http.Request) string {
addr := getSourceIPFromHeaders(r)
if addr == "" {
addr = r.RemoteAddr
}
// Default to remote address if headers not set.
raddr, _, _ := net.SplitHostPort(addr)
if raddr == "" {
return addr
}
return raddr
}

View File

@@ -14,31 +14,28 @@
// 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 restapi
package api
import (
"context"
"errors"
"fmt"
"io"
"net/http"
"path"
"strings"
"time"
"github.com/minio/minio-go/v7/pkg/replication"
"github.com/minio/minio-go/v7/pkg/sse"
xnet "github.com/minio/pkg/net"
xnet "github.com/minio/pkg/v3/net"
"github.com/minio/console/models"
"github.com/minio/console/pkg"
"github.com/minio/console/pkg/auth"
"github.com/minio/console/pkg/auth/ldap"
xjwt "github.com/minio/console/pkg/auth/token"
mc "github.com/minio/mc/cmd"
"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 +71,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
@@ -140,11 +135,6 @@ func (c minioClient) getBucketVersioning(ctx context.Context, bucketName string)
return c.client.GetBucketVersioning(ctx, bucketName)
}
// implements minio.getBucketVersioning(ctx, bucketName)
func (c minioClient) getBucketReplication(ctx context.Context, bucketName string) (replication.Config, error) {
return c.client.GetBucketReplication(ctx, bucketName)
}
// implements minio.listObjects(ctx)
func (c minioClient) listObjects(ctx context.Context, bucket string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo {
return c.client.ListObjects(ctx, bucket, opts)
@@ -209,14 +199,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)
}
@@ -232,7 +214,7 @@ type MCClient interface {
list(ctx context.Context, opts mc.ListOptions) <-chan *mc.ClientContent
get(ctx context.Context, opts mc.GetOptions) (io.ReadCloser, *probe.Error)
shareDownload(ctx context.Context, versionID string, expires time.Duration) (string, *probe.Error)
setVersioning(ctx context.Context, status string) *probe.Error
setVersioning(ctx context.Context, status string, excludePrefix []string, excludeFolders bool) *probe.Error
}
// Interface implementation
@@ -257,16 +239,8 @@ func (c mcClient) watch(ctx context.Context, options mc.WatchOptions) (*mc.Watch
return c.client.Watch(ctx, options)
}
func (c mcClient) setReplication(ctx context.Context, cfg *replication.Config, opts replication.Options) *probe.Error {
return c.client.SetReplication(ctx, cfg, opts)
}
func (c mcClient) deleteAllReplicationRules(ctx context.Context) *probe.Error {
return c.client.RemoveReplication(ctx)
}
func (c mcClient) setVersioning(ctx context.Context, status string) *probe.Error {
return c.client.SetVersion(ctx, status, []string{}, false)
func (c mcClient) setVersioning(ctx context.Context, status string, excludePrefix []string, excludeFolders bool) *probe.Error {
return c.client.SetVersion(ctx, status, excludePrefix, excludeFolders)
}
func (c mcClient) remove(ctx context.Context, isIncomplete, isRemoveBucket, isBypass, forceDelete bool, contentCh <-chan *mc.ClientContent) <-chan mc.RemoveResult {
@@ -278,7 +252,8 @@ func (c mcClient) list(ctx context.Context, opts mc.ListOptions) <-chan *mc.Clie
}
func (c mcClient) get(ctx context.Context, opts mc.GetOptions) (io.ReadCloser, *probe.Error) {
return c.client.Get(ctx, opts)
rd, _, err := c.client.Get(ctx, opts)
return rd, err
}
func (c mcClient) shareDownload(ctx context.Context, versionID string, expires time.Duration) (string, *probe.Error) {
@@ -298,6 +273,7 @@ type ConsoleCredentialsI interface {
type ConsoleCredentials struct {
ConsoleCredentials *credentials.Credentials
AccountAccessKey string
CredContext *credentials.CredContext
}
func (c ConsoleCredentials) GetAccountAccessKey() string {
@@ -306,7 +282,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()
@@ -321,6 +297,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()
}
@@ -329,7 +309,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")
}
@@ -340,7 +320,7 @@ func stsCredentials(minioURL, accessKey, secretKey, location, clientIP string) (
DurationSeconds: int(xjwt.GetConsoleSTSDuration().Seconds()),
}
stsAssumeRole := &credentials.STSAssumeRole{
Client: GetConsoleHTTPClient(minioURL, clientIP),
Client: client,
STSEndpoint: minioURL,
Options: opts,
}
@@ -348,51 +328,10 @@ 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(minioURL, clientIP), minioURL, accessKey, secretKey)
if err != nil {
return nil, err
}
// 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 stsCredentials(minioURL, accessKey, secretKey, location, client)
}
// getConsoleCredentialsFromSession returns the *consoleCredentials.Login associated to the
@@ -413,7 +352,7 @@ func newMinioClient(claims *models.Principal, clientIP string) (*minio.Client, e
minioClient, err := minio.New(endpoint, &minio.Options{
Creds: creds,
Secure: secure,
Transport: GetConsoleHTTPClient(getMinIOServer(), clientIP).Transport,
Transport: GetConsoleHTTPClient(clientIP).Transport,
})
if err != nil {
return nil, err
@@ -425,10 +364,9 @@ func newMinioClient(claims *models.Principal, clientIP string) (*minio.Client, e
// computeObjectURLWithoutEncode returns a MinIO url containing the object filename without encoding
func computeObjectURLWithoutEncode(bucketName, prefix string) (string, error) {
endpoint := getMinIOServer()
u, err := xnet.ParseHTTPURL(endpoint)
u, err := xnet.ParseHTTPURL(getMinIOServer())
if err != nil {
return "", fmt.Errorf("the provided endpoint is invalid")
return "", fmt.Errorf("the provided endpoint: '%s' is invalid", getMinIOServer())
}
var p string
if strings.TrimSpace(bucketName) != "" {
@@ -437,7 +375,7 @@ func computeObjectURLWithoutEncode(bucketName, prefix string) (string, error) {
if strings.TrimSpace(prefix) != "" {
p = pathJoinFinalSlash(p, prefix)
}
return fmt.Sprintf("%s://%s/%s", u.Scheme, u.Host, p), nil
return u.String() + "/" + p, nil
}
// newS3BucketClient creates a new mc S3Client to talk to the server based on a bucket
@@ -478,22 +416,18 @@ func pathJoinFinalSlash(elem ...string) string {
func newS3Config(endpoint, accessKey, secretKey, sessionToken string, clientIP string) *mc.Config {
// We have a valid alias and hostConfig. We populate the/
// consoleCredentials from the match found in the config file.
s3Config := new(mc.Config)
s3Config.AppName = globalAppName
s3Config.AppVersion = pkg.Version
s3Config.Debug = false
s3Config.HostURL = endpoint
s3Config.AccessKey = accessKey
s3Config.SecretKey = secretKey
s3Config.SessionToken = sessionToken
s3Config.Signature = "S3v4"
insecure := isLocalIPEndpoint(endpoint)
s3Config.Insecure = insecure
s3Config.Transport = PrepareSTSClientTransport(insecure, clientIP).Transport
return s3Config
return &mc.Config{
HostURL: endpoint,
AccessKey: accessKey,
SecretKey: secretKey,
SessionToken: sessionToken,
Signature: "S3v4",
AppName: globalAppName,
AppVersion: pkg.Version,
Insecure: isLocalIPEndpoint(endpoint),
Transport: &ConsoleTransport{
ClientIP: clientIP,
Transport: GlobalTransport,
},
}
}

View File

@@ -1,5 +1,5 @@
// This file is part of MinIO Console Server
// Copyright (c) 2021 MinIO, Inc.
// Copyright (c) 2024 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
@@ -14,7 +14,7 @@
// 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 restapi
package api
import "testing"
@@ -76,14 +76,15 @@ func Test_computeObjectURLWithoutEncode(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
got, err := computeObjectURLWithoutEncode(tt.args.bucketName, tt.args.prefix)
if (err != nil) != tt.wantErr {
t.Errorf("computeObjectURLWithoutEncode() errors = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("computeObjectURLWithoutEncode() got = %v, want %v", got, tt.want)
if err == nil {
if got != tt.want {
t.Errorf("computeObjectURLWithoutEncode() got = %v, want %v", got, tt.want)
}
}
})
}

View File

@@ -14,18 +14,21 @@
// 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 restapi
package api
import (
"crypto/tls"
"crypto/x509"
"net"
"net/http"
"strconv"
"strings"
"time"
"github.com/minio/console/pkg/auth/idp/oauth2"
xcerts "github.com/minio/pkg/certs"
"github.com/minio/pkg/env"
xnet "github.com/minio/pkg/net"
xcerts "github.com/minio/pkg/v3/certs"
"github.com/minio/pkg/v3/env"
xnet "github.com/minio/pkg/v3/net"
)
var (
@@ -54,6 +57,31 @@ var (
GlobalPublicCerts []*x509.Certificate
// GlobalTLSCertsManager custom TLS Manager for SNI support
GlobalTLSCertsManager *xcerts.Manager
// GlobalTransport is common transport used for all HTTP calls, this is set via
// MinIO server to be the correct transport, however we still define some defaults
// here just in case.
GlobalTransport = &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 10 * time.Second,
KeepAlive: 15 * time.Second,
}).DialContext,
MaxIdleConns: 1024,
MaxIdleConnsPerHost: 1024,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 10 * time.Second,
DisableCompression: true, // Set to avoid auto-decompression
TLSClientConfig: &tls.Config{
// Can't use SSLv3 because of POODLE and BEAST
// Can't use TLSv1.0 because of POODLE and BEAST using CBC cipher
// Can't use TLSv1.1 because of RC4 cipher usage
MinVersion: tls.VersionTLS12,
// Console runs in the same pod/node as MinIO this is acceptable.
InsecureSkipVerify: true,
RootCAs: GlobalRootCAs,
},
}
)
// MinIOConfig represents application configuration passed in from the MinIO
@@ -70,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, ""))
}
@@ -203,21 +227,11 @@ func GetSecureSTSPreload() bool {
return strings.ToLower(env.Get(ConsoleSecureSTSPreload, "off")) == "on"
}
// If TLSTemporaryRedirect is true, the a 302 will be used while redirecting. Default is false (301).
func GetSecureTLSTemporaryRedirect() bool {
return strings.ToLower(env.Get(ConsoleSecureTLSTemporaryRedirect, "off")) == "on"
}
// STS header is only included when the connection is HTTPS.
func GetSecureForceSTSHeader() bool {
return strings.ToLower(env.Get(ConsoleSecureForceSTSHeader, "off")) == "on"
}
// PublicKey implements HPKP to prevent MITM attacks with forged certificates. Default is "".
func GetSecurePublicKey() string {
return env.Get(ConsoleSecurePublicKey, "")
}
// ReferrerPolicy allows the Referrer-Policy header with the value to be set with a custom value. Default is "".
func GetSecureReferrerPolicy() string {
return env.Get(ConsoleSecureReferrerPolicy, "")
@@ -228,10 +242,6 @@ func GetSecureFeaturePolicy() string {
return env.Get(ConsoleSecureFeaturePolicy, "")
}
func GetSecureExpectCTHeader() string {
return env.Get(ConsoleSecureExpectCTHeader, "")
}
func getLogSearchAPIToken() string {
if v := env.Get(ConsoleLogQueryAuthToken, ""); v != "" {
return v
@@ -239,22 +249,6 @@ func getLogSearchAPIToken() string {
return env.Get(LogSearchQueryAuthToken, "")
}
func getLogSearchURL() string {
return env.Get(ConsoleLogQueryURL, "")
}
func getPrometheusURL() string {
return env.Get(PrometheusURL, "")
}
func getPrometheusJobID() string {
return env.Get(PrometheusJobID, "minio-job")
}
func getPrometheusExtraLabels() string {
return env.Get(PrometheusExtraLabels, "")
}
func getMaxConcurrentUploadsLimit() int64 {
cu, err := strconv.ParseInt(env.Get(ConsoleMaxConcurrentUploads, "10"), 10, 64)
if err != nil {
@@ -280,3 +274,7 @@ func getConsoleDevMode() bool {
func getConsoleAnimatedLogin() bool {
return strings.ToLower(env.Get(ConsoleAnimatedLogin, "on")) == "on"
}
func getConsoleBrowserRedirectURL() string {
return env.Get(ConsoleBrowserRedirectURL, "")
}

View File

@@ -14,7 +14,7 @@
// 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 restapi
package api
import (
"os"
@@ -54,7 +54,7 @@ func TestGetPort(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
os.Setenv(ConsolePort, tt.args.env)
assert.Equalf(t, tt.want, GetPort(), "GetPort()")
os.Unsetenv(ConsolePort)
@@ -87,7 +87,7 @@ func TestGetTLSPort(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
os.Setenv(ConsoleTLSPort, tt.args.env)
assert.Equalf(t, tt.want, GetTLSPort(), "GetTLSPort()")
os.Unsetenv(ConsoleTLSPort)
@@ -120,7 +120,7 @@ func TestGetSecureAllowedHosts(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
os.Setenv(ConsoleSecureAllowedHosts, tt.args.env)
assert.Equalf(t, tt.want, GetSecureAllowedHosts(), "GetSecureAllowedHosts()")
os.Unsetenv(ConsoleSecureAllowedHosts)
@@ -153,7 +153,7 @@ func TestGetSecureHostsProxyHeaders(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
os.Setenv(ConsoleSecureHostsProxyHeaders, tt.args.env)
assert.Equalf(t, tt.want, GetSecureHostsProxyHeaders(), "GetSecureHostsProxyHeaders()")
os.Unsetenv(ConsoleSecureHostsProxyHeaders)
@@ -186,7 +186,7 @@ func TestGetSecureSTSSeconds(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
os.Setenv(ConsoleSecureSTSSeconds, tt.args.env)
assert.Equalf(t, tt.want, GetSecureSTSSeconds(), "GetSecureSTSSeconds()")
os.Unsetenv(ConsoleSecureSTSSeconds)
@@ -219,7 +219,7 @@ func Test_getLogSearchAPIToken(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
os.Setenv(ConsoleLogQueryAuthToken, tt.args.env)
assert.Equalf(t, tt.want, getLogSearchAPIToken(), "getLogSearchAPIToken()")
os.Setenv(ConsoleLogQueryAuthToken, tt.args.env)
@@ -227,72 +227,6 @@ func Test_getLogSearchAPIToken(t *testing.T) {
}
}
func Test_getPrometheusURL(t *testing.T) {
type args struct {
env string
}
tests := []struct {
name string
args args
want string
}{
{
name: "env set",
args: args{
env: "value",
},
want: "value",
},
{
name: "env not set",
args: args{
env: "",
},
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
os.Setenv(PrometheusURL, tt.args.env)
assert.Equalf(t, tt.want, getPrometheusURL(), "getPrometheusURL()")
os.Setenv(PrometheusURL, tt.args.env)
})
}
}
func Test_getPrometheusJobID(t *testing.T) {
type args struct {
env string
}
tests := []struct {
name string
args args
want string
}{
{
name: "env set",
args: args{
env: "value",
},
want: "value",
},
{
name: "env not set",
args: args{
env: "",
},
want: "minio-job",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
os.Setenv(PrometheusJobID, tt.args.env)
assert.Equalf(t, tt.want, getPrometheusJobID(), "getPrometheusJobID()")
os.Setenv(PrometheusJobID, tt.args.env)
})
}
}
func Test_getMaxConcurrentUploadsLimit(t *testing.T) {
type args struct {
env string
@@ -318,7 +252,7 @@ func Test_getMaxConcurrentUploadsLimit(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
os.Setenv(ConsoleMaxConcurrentUploads, tt.args.env)
assert.Equalf(t, tt.want, getMaxConcurrentUploadsLimit(), "getMaxConcurrentUploadsLimit()")
os.Unsetenv(ConsoleMaxConcurrentUploads)
@@ -351,7 +285,7 @@ func Test_getMaxConcurrentDownloadsLimit(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
os.Setenv(ConsoleMaxConcurrentDownloads, tt.args.env)
assert.Equalf(t, tt.want, getMaxConcurrentDownloadsLimit(), "getMaxConcurrentDownloadsLimit()")
os.Unsetenv(ConsoleMaxConcurrentDownloads)
@@ -384,7 +318,7 @@ func Test_getConsoleDevMode(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
os.Setenv(ConsoleDevMode, tt.args.env)
assert.Equalf(t, tt.want, getConsoleDevMode(), "getConsoleDevMode()")
os.Unsetenv(ConsoleDevMode)

View File

@@ -16,7 +16,7 @@
// This file is safe to edit. Once it exists it will not be overwritten
package restapi
package api
import (
"bytes"
@@ -31,26 +31,30 @@ import (
"path"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"sync"
"time"
"github.com/google/uuid"
"github.com/minio/console/pkg/logger"
"github.com/minio/console/pkg/utils"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/klauspost/compress/gzhttp"
portal_ui "github.com/minio/console/portal-ui"
"github.com/minio/pkg/env"
"github.com/minio/pkg/mimedb"
xnet "github.com/minio/pkg/net"
portal_ui "github.com/minio/console/web-app"
"github.com/minio/pkg/v3/env"
"github.com/minio/pkg/v3/mimedb"
xnet "github.com/minio/pkg/v3/net"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
"github.com/minio/console/api/operations"
"github.com/minio/console/models"
"github.com/minio/console/pkg/auth"
"github.com/minio/console/restapi/operations"
"github.com/unrolled/secure"
)
@@ -80,7 +84,7 @@ func configureFlags(api *operations.ConsoleAPI) {
func configureAPI(api *operations.ConsoleAPI) http.Handler {
// Applies when the "x-token" header is set
api.KeyAuth = func(token string, scopes []string) (*models.Principal, error) {
api.KeyAuth = func(token string, _ []string) (*models.Principal, error) {
// we are validating the session token by decrypting the claims inside, if the operation succeed that means the jwt
// was generated and signed by us in the first place
if token == "Anonymous" {
@@ -101,7 +105,7 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler {
CustomStyleOb: claims.CustomStyleOB,
}, nil
}
api.AnonymousAuth = func(s string) (*models.Principal, error) {
api.AnonymousAuth = func(_ string) (*models.Principal, error) {
return &models.Principal{}, nil
}
@@ -111,72 +115,19 @@ func configureAPI(api *operations.ConsoleAPI) http.Handler {
registerLogoutHandlers(api)
// Register bucket handlers
registerBucketsHandlers(api)
// Register all users handlers
registerUsersHandlers(api)
// Register groups handlers
registerGroupsHandlers(api)
// Register policies handlers
registersPoliciesHandler(api)
// Register configurations handlers
registerConfigHandlers(api)
// Register bucket events handlers
registerBucketEventsHandlers(api)
// Register bucket lifecycle handlers
registerBucketsLifecycleHandlers(api)
// Register service handlers
registerServiceHandlers(api)
// Register session handlers
registerSessionHandlers(api)
// Register version handlers
registerVersionHandlers(api)
// Register admin info handlers
registerAdminInfoHandlers(api)
// Register admin arns handlers
registerAdminArnsHandlers(api)
// Register admin notification endpoints handlers
registerAdminNotificationEndpointsHandlers(api)
// Register admin Service Account Handlers
registerServiceAccountsHandlers(api)
// Register admin remote buckets
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
registerObjectsHandlers(api)
// Register Bucket Quota's Handlers
registerBucketQuotaHandlers(api)
// Register Account handlers
registerAccountHandlers(api)
registerReleasesHandlers(api)
// Register Bucket Policy's Handlers
registerPublicObjectsHandlers(api)
api.PreServerShutdown = func() {}
api.ServerShutdown = func() {}
// do an initial subnet plan caching
fetchLicensePlan()
return setupGlobalMiddleware(api.Serve(setupMiddlewares))
}
@@ -194,11 +145,7 @@ func setupMiddlewares(handler http.Handler) http.Handler {
func ContextMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
requestID, err := utils.NewUUID()
if err != nil && err != auth.ErrNoAuthToken {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
requestID := uuid.NewString()
ctx := context.WithValue(r.Context(), utils.ContextRequestID, requestID)
ctx = context.WithValue(ctx, utils.ContextRequestUserAgent, r.UserAgent())
ctx = context.WithValue(ctx, utils.ContextRequestHost, r.Host)
@@ -218,6 +165,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 {
@@ -230,6 +268,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)
@@ -258,10 +298,8 @@ func setupGlobalMiddleware(handler http.Handler) http.Handler {
BrowserXssFilter: GetSecureBrowserXSSFilter(),
ContentSecurityPolicy: GetSecureContentSecurityPolicy(),
ContentSecurityPolicyReportOnly: GetSecureContentSecurityPolicyReportOnly(),
PublicKey: GetSecurePublicKey(),
ReferrerPolicy: GetSecureReferrerPolicy(),
FeaturePolicy: GetSecureFeaturePolicy(),
ExpectCTHeader: GetSecureExpectCTHeader(),
IsDevelopment: false,
}
secureMiddleware := secure.New(secureOptions)
@@ -317,6 +355,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 {
@@ -325,11 +369,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)
}
})
}
@@ -428,13 +468,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))
}
@@ -511,8 +548,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=\"apgl\"/>", newPlan, 1)
indexPageBytes = []byte(indexPageStr)
return indexPageBytes
}

View File

@@ -14,7 +14,7 @@
// 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 restapi
package api
import (
"os"
@@ -70,7 +70,7 @@ func Test_parseSubPath(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
assert.Equalf(t, tt.want, parseSubPath(tt.args.v), "parseSubPath(%v)", tt.args.v)
})
}
@@ -115,7 +115,7 @@ func Test_getSubPath(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
t.Setenv(SubPath, tt.args.envValue)
defer os.Unsetenv(SubPath)
subPathOnce = sync.Once{}

View File

@@ -14,13 +14,12 @@
// 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 restapi
package api
// list of all console environment constants
const (
// Constants for common configuration
ConsoleMinIOServer = "CONSOLE_MINIO_SERVER"
ConsoleSubnetProxy = "CONSOLE_SUBNET_PROXY"
ConsoleMinIORegion = "CONSOLE_MINIO_REGION"
ConsoleHostname = "CONSOLE_HOSTNAME"
ConsolePort = "CONSOLE_PORT"
@@ -40,21 +39,16 @@ const (
ConsoleSecureSTSPreload = "CONSOLE_SECURE_STS_PRELOAD"
ConsoleSecureTLSRedirect = "CONSOLE_SECURE_TLS_REDIRECT"
ConsoleSecureTLSHost = "CONSOLE_SECURE_TLS_HOST"
ConsoleSecureTLSTemporaryRedirect = "CONSOLE_SECURE_TLS_TEMPORARY_REDIRECT"
ConsoleSecureForceSTSHeader = "CONSOLE_SECURE_FORCE_STS_HEADER"
ConsoleSecurePublicKey = "CONSOLE_SECURE_PUBLIC_KEY"
ConsoleSecureReferrerPolicy = "CONSOLE_SECURE_REFERRER_POLICY"
ConsoleSecureFeaturePolicy = "CONSOLE_SECURE_FEATURE_POLICY"
ConsoleSecureExpectCTHeader = "CONSOLE_SECURE_EXPECT_CT_HEADER"
PrometheusURL = "CONSOLE_PROMETHEUS_URL"
PrometheusJobID = "CONSOLE_PROMETHEUS_JOB_ID"
PrometheusExtraLabels = "CONSOLE_PROMETHEUS_EXTRA_LABELS"
ConsoleLogQueryURL = "CONSOLE_LOG_QUERY_URL"
ConsoleLogQueryAuthToken = "CONSOLE_LOG_QUERY_AUTH_TOKEN"
ConsoleMaxConcurrentUploads = "CONSOLE_MAX_CONCURRENT_UPLOADS"
ConsoleMaxConcurrentDownloads = "CONSOLE_MAX_CONCURRENT_DOWNLOADS"
ConsoleDevMode = "CONSOLE_DEV_MODE"
ConsoleAnimatedLogin = "CONSOLE_ANIMATED_LOGIN"
ConsoleBrowserRedirectURL = "CONSOLE_BROWSER_REDIRECT_URL"
LogSearchQueryAuthToken = "LOGSEARCH_QUERY_AUTH_TOKEN"
SlashSeparator = "/"
LocalAddress = "127.0.0.1"

556
api/custom-server.go Normal file
View File

@@ -0,0 +1,556 @@
// 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 (
"context"
"crypto/tls"
"crypto/x509"
"errors"
"fmt"
"log"
"net"
"net/http"
"os"
"os/signal"
"strconv"
"sync"
"sync/atomic"
"syscall"
"time"
"github.com/go-openapi/runtime/flagext"
"github.com/go-openapi/swag"
flags "github.com/jessevdk/go-flags"
"golang.org/x/net/netutil"
"github.com/minio/console/api/operations"
)
const (
schemeHTTP = "http"
schemeHTTPS = "https"
schemeUnix = "unix"
)
var defaultSchemes []string
func init() {
defaultSchemes = []string{
schemeHTTP,
}
}
// NewServer creates a new api console server but does not configure it
func NewServer(api *operations.ConsoleAPI) *Server {
s := new(Server)
s.shutdown = make(chan struct{})
s.api = api
s.interrupt = make(chan os.Signal, 1)
return s
}
// ConfigureAPI configures the API and handlers.
func (s *Server) ConfigureAPI() {
if s.api != nil {
s.handler = configureAPI(s.api)
}
}
// ConfigureFlags configures the additional flags defined by the handlers. Needs to be called before the parser.Parse
func (s *Server) ConfigureFlags() {
if s.api != nil {
configureFlags(s.api)
}
}
// Server for the console API
type Server struct {
EnabledListeners []string `long:"scheme" description:"the listeners to enable, this can be repeated and defaults to the schemes in the swagger spec"`
CleanupTimeout time.Duration `long:"cleanup-timeout" description:"grace period for which to wait before killing idle connections" default:"10s"`
GracefulTimeout time.Duration `long:"graceful-timeout" description:"grace period for which to wait before shutting down the server" default:"15s"`
MaxHeaderSize flagext.ByteSize `long:"max-header-size" description:"controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of the request body." default:"1MiB"`
SocketPath flags.Filename `long:"socket-path" description:"the unix socket to listen on" default:"/var/run/console.sock"`
domainSocketL net.Listener
Host string `long:"host" description:"the IP to listen on" default:"localhost" env:"HOST"`
Port int `long:"port" description:"the port to listen on for insecure connections, defaults to a random value" env:"PORT"`
ListenLimit int `long:"listen-limit" description:"limit the number of outstanding requests"`
KeepAlive time.Duration `long:"keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)" default:"3m"`
ReadTimeout time.Duration `long:"read-timeout" description:"maximum duration before timing out read of the request" default:"30s"`
WriteTimeout time.Duration `long:"write-timeout" description:"maximum duration before timing out write of the response" default:"60s"`
httpServerL []net.Listener
TLSHost string `long:"tls-host" description:"the IP to listen on for tls, when not specified it's the same as --host" env:"TLS_HOST"`
TLSPort int `long:"tls-port" description:"the port to listen on for secure connections, defaults to a random value" env:"TLS_PORT"`
TLSCertificate flags.Filename `long:"tls-certificate" description:"the certificate to use for secure connections" env:"TLS_CERTIFICATE"`
TLSCertificateKey flags.Filename `long:"tls-key" description:"the private key to use for secure connections" env:"TLS_PRIVATE_KEY"`
TLSCACertificate flags.Filename `long:"tls-ca" description:"the certificate authority file to be used with mutual tls auth" env:"TLS_CA_CERTIFICATE"`
TLSListenLimit int `long:"tls-listen-limit" description:"limit the number of outstanding requests"`
TLSKeepAlive time.Duration `long:"tls-keep-alive" description:"sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)"`
TLSReadTimeout time.Duration `long:"tls-read-timeout" description:"maximum duration before timing out read of the request"`
TLSWriteTimeout time.Duration `long:"tls-write-timeout" description:"maximum duration before timing out write of the response"`
httpsServerL []net.Listener
api *operations.ConsoleAPI
handler http.Handler
hasListeners bool
shutdown chan struct{}
shuttingDown int32
interrupted bool
interrupt chan os.Signal
}
// Logf logs message either via defined user logger or via system one if no user logger is defined.
func (s *Server) Logf(f string, args ...interface{}) {
if s.api != nil && s.api.Logger != nil {
s.api.Logger(f, args...)
} else {
log.Printf(f, args...)
}
}
// Fatalf logs message either via defined user logger or via system one if no user logger is defined.
// Exits with non-zero status after printing
func (s *Server) Fatalf(f string, args ...interface{}) {
if s.api != nil && s.api.Logger != nil {
s.api.Logger(f, args...)
os.Exit(1)
}
log.Fatalf(f, args...)
}
// SetAPI configures the server with the specified API. Needs to be called before Serve
func (s *Server) SetAPI(api *operations.ConsoleAPI) {
if api == nil {
s.api = nil
s.handler = nil
return
}
s.api = api
s.handler = configureAPI(api)
}
func (s *Server) hasScheme(scheme string) bool {
schemes := s.EnabledListeners
if len(schemes) == 0 {
schemes = defaultSchemes
}
for _, v := range schemes {
if v == scheme {
return true
}
}
return false
}
// Serve the api
func (s *Server) Serve() (err error) {
if !s.hasListeners {
if err = s.Listen(); err != nil {
return err
}
}
// set default handler, if none is set
if s.handler == nil {
if s.api == nil {
return errors.New("can't create the default handler, as no api is set")
}
s.SetHandler(s.api.Serve(nil))
}
wg := new(sync.WaitGroup)
once := new(sync.Once)
signalNotify(s.interrupt)
go handleInterrupt(once, s)
servers := []*http.Server{}
if s.hasScheme(schemeUnix) {
domainSocket := new(http.Server)
domainSocket.MaxHeaderBytes = int(s.MaxHeaderSize)
domainSocket.Handler = s.handler
if int64(s.CleanupTimeout) > 0 {
domainSocket.IdleTimeout = s.CleanupTimeout
}
configureServer(domainSocket, "unix", string(s.SocketPath))
servers = append(servers, domainSocket)
wg.Add(1)
s.Logf("Serving console at unix://%s", s.SocketPath)
go func(l net.Listener) {
defer wg.Done()
if err := domainSocket.Serve(l); err != nil && err != http.ErrServerClosed {
s.Fatalf("%v", err)
}
s.Logf("Stopped serving console at unix://%s", s.SocketPath)
}(s.domainSocketL)
}
if s.hasScheme(schemeHTTP) {
httpServer := new(http.Server)
httpServer.MaxHeaderBytes = int(s.MaxHeaderSize)
httpServer.ReadTimeout = s.ReadTimeout
httpServer.WriteTimeout = s.WriteTimeout
httpServer.SetKeepAlivesEnabled(int64(s.KeepAlive) > 0)
if s.ListenLimit > 0 {
for i := range s.httpServerL {
s.httpServerL[i] = netutil.LimitListener(s.httpServerL[i], s.ListenLimit)
}
}
if int64(s.CleanupTimeout) > 0 {
httpServer.IdleTimeout = s.CleanupTimeout
}
httpServer.Handler = s.handler
configureServer(httpServer, "http", s.httpServerL[0].Addr().String())
servers = append(servers, httpServer)
s.Logf("Serving console at http://%s", s.httpServerL[0].Addr())
for i := range s.httpServerL {
wg.Add(1)
go func(l net.Listener) {
defer wg.Done()
if err := httpServer.Serve(l); err != nil && err != http.ErrServerClosed {
s.Fatalf("%v", err)
}
s.Logf("Stopped serving console at http://%s", l.Addr())
}(s.httpServerL[i])
}
}
if s.hasScheme(schemeHTTPS) {
httpsServer := new(http.Server)
httpsServer.MaxHeaderBytes = int(s.MaxHeaderSize)
httpsServer.ReadTimeout = s.TLSReadTimeout
httpsServer.WriteTimeout = s.TLSWriteTimeout
httpsServer.SetKeepAlivesEnabled(int64(s.TLSKeepAlive) > 0)
if s.TLSListenLimit > 0 {
for i := range s.httpsServerL {
s.httpsServerL[i] = netutil.LimitListener(s.httpsServerL[i], s.TLSListenLimit)
}
}
if int64(s.CleanupTimeout) > 0 {
httpsServer.IdleTimeout = s.CleanupTimeout
}
httpsServer.Handler = s.handler
// Inspired by https://blog.bracebin.com/achieving-perfect-ssl-labs-score-with-go
httpsServer.TLSConfig = &tls.Config{
// Causes servers to use Go's default ciphersuite preferences,
// which are tuned to avoid attacks. Does nothing on clients.
PreferServerCipherSuites: true,
// Only use curves which have assembly implementations
// https://github.com/golang/go/tree/master/src/crypto/elliptic
CurvePreferences: []tls.CurveID{tls.CurveP256},
// Use modern tls mode https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility
NextProtos: []string{"h2", "http/1.1"},
// https://www.owasp.org/index.php/Transport_Layer_Protection_Cheat_Sheet#Rule_-_Only_Support_Strong_Protocols
MinVersion: tls.VersionTLS12,
// These ciphersuites support Forward Secrecy: https://en.wikipedia.org/wiki/Forward_secrecy
CipherSuites: []uint16{
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,
tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,
},
}
// build standard config from server options
if s.TLSCertificate != "" && s.TLSCertificateKey != "" {
httpsServer.TLSConfig.Certificates = make([]tls.Certificate, 1)
httpsServer.TLSConfig.Certificates[0], err = tls.LoadX509KeyPair(string(s.TLSCertificate), string(s.TLSCertificateKey))
if err != nil {
return err
}
}
if s.TLSCACertificate != "" {
// include specified CA certificate
caCert, caCertErr := os.ReadFile(string(s.TLSCACertificate))
if caCertErr != nil {
return caCertErr
}
caCertPool := x509.NewCertPool()
ok := caCertPool.AppendCertsFromPEM(caCert)
if !ok {
return fmt.Errorf("cannot parse CA certificate")
}
httpsServer.TLSConfig.ClientCAs = caCertPool
httpsServer.TLSConfig.ClientAuth = tls.RequireAndVerifyClientCert
}
// call custom TLS configurator
configureTLS(httpsServer.TLSConfig)
if len(httpsServer.TLSConfig.Certificates) == 0 && httpsServer.TLSConfig.GetCertificate == nil {
// after standard and custom config are passed, this ends up with no certificate
if s.TLSCertificate == "" {
if s.TLSCertificateKey == "" {
s.Fatalf("the required flags `--tls-certificate` and `--tls-key` were not specified")
}
s.Fatalf("the required flag `--tls-certificate` was not specified")
}
if s.TLSCertificateKey == "" {
s.Fatalf("the required flag `--tls-key` was not specified")
}
// this happens with a wrong custom TLS configurator
s.Fatalf("no certificate was configured for TLS")
}
configureServer(httpsServer, "https", s.httpsServerL[0].Addr().String())
servers = append(servers, httpsServer)
s.Logf("Serving console at https://%s", s.httpsServerL[0].Addr())
for i := range s.httpsServerL {
wg.Add(1)
go func(l net.Listener) {
defer wg.Done()
if err := httpsServer.Serve(l); err != nil && err != http.ErrServerClosed {
s.Fatalf("%v", err)
}
s.Logf("Stopped serving console at https://%s", l.Addr())
}(tls.NewListener(s.httpsServerL[i], httpsServer.TLSConfig))
}
}
wg.Add(1)
go s.handleShutdown(wg, &servers)
wg.Wait()
return nil
}
// Listen creates the listeners for the server
func (s *Server) Listen() error {
if s.hasListeners { // already done this
return nil
}
if s.hasScheme(schemeHTTPS) {
// Use http host if https host wasn't defined
if s.TLSHost == "" {
s.TLSHost = s.Host
}
// Use http listen limit if https listen limit wasn't defined
if s.TLSListenLimit == 0 {
s.TLSListenLimit = s.ListenLimit
}
// Use http tcp keep alive if https tcp keep alive wasn't defined
if int64(s.TLSKeepAlive) == 0 {
s.TLSKeepAlive = s.KeepAlive
}
// Use http read timeout if https read timeout wasn't defined
if int64(s.TLSReadTimeout) == 0 {
s.TLSReadTimeout = s.ReadTimeout
}
// Use http write timeout if https write timeout wasn't defined
if int64(s.TLSWriteTimeout) == 0 {
s.TLSWriteTimeout = s.WriteTimeout
}
}
if s.hasScheme(schemeUnix) {
domSockListener, err := net.Listen("unix", string(s.SocketPath))
if err != nil {
return err
}
s.domainSocketL = domSockListener
}
lookup := func(addr string) []net.IP {
ips, err := net.LookupIP(addr)
if err == nil {
return ips
}
return []net.IP{net.ParseIP(addr)}
}
convert := func(ip net.IP) (string, string) {
if ip == nil {
return "", "tcp"
}
proto := "tcp4"
if ip.To4() == nil {
proto = "tcp6"
}
return ip.String(), proto
}
if s.hasScheme(schemeHTTP) {
for _, ip := range lookup(s.Host) {
host, proto := convert(ip)
listener, err := net.Listen(proto, net.JoinHostPort(host, strconv.Itoa(s.Port)))
if err != nil {
return err
}
if s.Host == "" || s.Port == 0 {
h, p, err := swag.SplitHostPort(listener.Addr().String())
if err != nil {
return err
}
s.Host = h
s.Port = p
}
s.httpServerL = append(s.httpServerL, listener)
}
}
if s.hasScheme(schemeHTTPS) {
for _, ip := range lookup(s.TLSHost) {
host, proto := convert(ip)
tlsListener, err := net.Listen(proto, net.JoinHostPort(host, strconv.Itoa(s.TLSPort)))
if err != nil {
return err
}
if s.TLSHost == "" || s.TLSPort == 0 {
sh, sp, err := swag.SplitHostPort(tlsListener.Addr().String())
if err != nil {
return err
}
s.TLSHost = sh
s.TLSPort = sp
}
s.httpsServerL = append(s.httpsServerL, tlsListener)
}
}
s.hasListeners = true
return nil
}
// Shutdown server and clean up resources
func (s *Server) Shutdown() error {
if atomic.CompareAndSwapInt32(&s.shuttingDown, 0, 1) {
close(s.shutdown)
}
return nil
}
func (s *Server) handleShutdown(wg *sync.WaitGroup, serversPtr *[]*http.Server) {
// wg.Done must occur last, after s.api.ServerShutdown()
// (to preserve old behavior)
defer wg.Done()
<-s.shutdown
servers := *serversPtr
ctx, cancel := context.WithTimeout(context.TODO(), s.GracefulTimeout)
defer cancel()
// first execute the pre-shutdown hook
s.api.PreServerShutdown()
shutdownChan := make(chan bool)
for i := range servers {
server := servers[i]
go func() {
var success bool
defer func() {
shutdownChan <- success
}()
if err := server.Shutdown(ctx); err != nil {
// Error from closing listeners, or context timeout:
s.Logf("HTTP server Shutdown: %v", err)
} else {
success = true
}
}()
}
// Wait until all listeners have successfully shut down before calling ServerShutdown
success := true
for range servers {
success = success && <-shutdownChan
}
if success {
s.api.ServerShutdown()
}
}
// GetHandler returns a handler useful for testing
func (s *Server) GetHandler() http.Handler {
return s.handler
}
// SetHandler allows for setting a http handler on this server
func (s *Server) SetHandler(handler http.Handler) {
s.handler = handler
}
// UnixListener returns the domain socket listener
func (s *Server) UnixListener() (net.Listener, error) {
if !s.hasListeners {
if err := s.Listen(); err != nil {
return nil, err
}
}
return s.domainSocketL, nil
}
// HTTPListener returns the http listener
func (s *Server) HTTPListener() ([]net.Listener, error) {
if !s.hasListeners {
if err := s.Listen(); err != nil {
return nil, err
}
}
return s.httpServerL, nil
}
// TLSListener returns the https listener
func (s *Server) TLSListener() ([]net.Listener, error) {
if !s.hasListeners {
if err := s.Listen(); err != nil {
return nil, err
}
}
return s.httpsServerL, nil
}
func handleInterrupt(once *sync.Once, s *Server) {
once.Do(func() {
for range s.interrupt {
if s.interrupted {
s.Logf("Server already shutting down")
continue
}
s.interrupted = true
s.Logf("Shutting down... ")
if err := s.Shutdown(); err != nil {
s.Logf("HTTP server Shutdown: %v", err)
}
}
})
}
func signalNotify(interrupt chan<- os.Signal) {
signal.Notify(interrupt, syscall.SIGINT, syscall.SIGTERM)
}

View File

@@ -16,7 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// Package restapi MinIO Console Server
// Package api MinIO Console Server
//
// Schemes:
// http
@@ -30,9 +30,8 @@
// - multipart/form-data
//
// Produces:
// - application/zip
// - application/octet-stream
// - application/json
//
// swagger:meta
package restapi
package api

3677
api/embedded_spec.go Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -14,22 +14,22 @@
// 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 restapi
package api
import (
"context"
"errors"
"strings"
"github.com/go-openapi/swag"
"github.com/minio/minio-go/v7"
"github.com/minio/console/models"
"github.com/minio/madmin-go/v3"
"github.com/minio/minio-go/v7"
)
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")
@@ -53,6 +52,7 @@ var (
ErrAvoidSelfAccountDelete = errors.New("logged in user cannot be deleted by itself")
ErrAccessDenied = errors.New("access denied")
ErrOauth2Provider = errors.New("unable to contact configured identity provider")
ErrOauth2Login = errors.New("unable to login using configured identity provider")
ErrNonUniqueAccessKey = errors.New("access key already in use")
ErrRemoteTierExists = errors.New("specified remote tier already exists")
ErrRemoteTierNotFound = errors.New("specified remote tier was not found")
@@ -71,18 +71,25 @@ var (
ErrEncryptionConfigNotFound = errors.New("encryption configuration not found")
ErrPolicyNotFound = errors.New("policy does not exist")
ErrLoginNotAllowed = errors.New("login not allowed")
ErrSubnetUploadFail = errors.New("Subnet upload failed")
ErrHealthReportFail = errors.New("failure to generate Health report")
ErrNetworkError = errors.New("unable to login due to network error")
)
type CodedAPIError struct {
Code int
APIError *models.APIError
}
// ErrorWithContext :
func ErrorWithContext(ctx context.Context, err ...interface{}) *models.Error {
errorCode := int32(500)
func ErrorWithContext(ctx context.Context, err ...interface{}) *CodedAPIError {
errorCode := 500
errorMessage := ErrDefault.Error()
var detailedMessage string
var err1 error
var exists bool
if len(err) > 0 {
if err1, exists = err[0].(error); exists {
detailedMessage = err1.Error()
var lastError error
if len(err) > 1 {
if err2, lastExists := err[1].(error); lastExists {
@@ -100,15 +107,27 @@ func ErrorWithContext(ctx context.Context, err ...interface{}) *models.Error {
errorMessage = ErrNotFound.Error()
}
if errors.Is(err1, ErrInvalidLogin) {
detailedMessage = ""
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()
}
// If the last error is ErrInvalidLogin, this is a login failure
if errors.Is(lastError, ErrInvalidLogin) {
detailedMessage = ""
errorCode = 401
errorMessage = err1.Error()
}
if strings.Contains(err1.Error(), ErrLoginNotAllowed.Error()) {
detailedMessage = ""
errorCode = 400
errorMessage = ErrLoginNotAllowed.Error()
}
@@ -141,10 +160,6 @@ func ErrorWithContext(ctx context.Context, err ...interface{}) *models.Error {
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
@@ -202,6 +217,7 @@ func ErrorWithContext(ctx context.Context, err ...interface{}) *models.Error {
errorMessage = ErrAccessDenied.Error()
}
if madmin.ToErrorResponse(err1).Code == "InvalidAccessKeyId" {
errorCode = 401
errorMessage = ErrInvalidSession.Error()
}
@@ -241,6 +257,7 @@ func ErrorWithContext(ctx context.Context, err ...interface{}) *models.Error {
errorCode = 400
errorMessage = "Bucket already exists"
}
LogError("ErrorWithContext:%v", err...)
LogIf(ctx, err1, err...)
}
@@ -251,11 +268,11 @@ func ErrorWithContext(ctx context.Context, err ...interface{}) *models.Error {
}
}
}
return &models.Error{Code: errorCode, Message: swag.String(errorMessage), DetailedMessage: swag.String(err1.Error())}
return &CodedAPIError{Code: errorCode, APIError: &models.APIError{Message: errorMessage, DetailedMessage: detailedMessage}}
}
// Error receives an errors object and parse it against k8sErrors, returns the right errors code paired with a generic errors message
func Error(err ...interface{}) *models.Error {
func Error(err ...interface{}) *CodedAPIError {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
return ErrorWithContext(ctx, err...)

View File

@@ -14,14 +14,13 @@
// 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 restapi
package api
import (
"context"
"fmt"
"testing"
"github.com/go-openapi/swag"
"github.com/minio/console/models"
"github.com/stretchr/testify/assert"
)
@@ -34,7 +33,7 @@ func TestError(t *testing.T) {
type testError struct {
name string
args args
want *models.Error
want *CodedAPIError
}
var tests []testError
@@ -45,37 +44,37 @@ func TestError(t *testing.T) {
}
appErrors := map[string]expectedError{
"ErrDefault": {code: 500, err: ErrDefault},
"ErrInvalidLogin": {code: 401, err: ErrInvalidLogin},
"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},
"ErrAccessDenied": {code: 403, err: ErrAccessDenied},
"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},
"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},
"ErrRemoteTierNotFound": {code: 400, err: ErrRemoteTierNotFound},
"ErrRemoteTierUppercase": {code: 400, err: ErrRemoteTierUppercase},
"ErrRemoteTierBucketNotFound": {code: 400, err: ErrRemoteTierBucketNotFound},
"ErrRemoteInvalidCredentials": {code: 403, err: ErrRemoteInvalidCredentials},
"ErrTooFewNodes": {code: 500, err: ErrTooFewNodes},
"ErrUnableToGetTenantUsage": {code: 500, err: ErrUnableToGetTenantUsage},
"ErrTooManyNodes": {code: 500, err: ErrTooManyNodes},
"ErrTooFewNodes": {code: 500, err: ErrTooFewNodes},
"ErrAccessDenied": {code: 403, err: ErrAccessDenied},
"ErrTooFewAvailableNodes": {code: 500, err: ErrTooFewAvailableNodes},
"ErrFewerThanFourNodes": {code: 500, err: ErrFewerThanFourNodes},
"ErrUnableToGetTenantLogs": {code: 500, err: ErrUnableToGetTenantLogs},
@@ -91,22 +90,41 @@ func TestError(t *testing.T) {
args: args{
err: []interface{}{e.err},
},
want: &models.Error{Code: int32(e.code), Message: swag.String(e.err.Error()), DetailedMessage: swag.String(e.err.Error())},
want: &CodedAPIError{
Code: e.code,
APIError: &models.APIError{Message: e.err.Error(), DetailedMessage: e.err.Error()},
},
})
}
tests = append(tests,
testError{
name: "passing multiple errors but ErrInvalidLogin is last",
args: args{
err: []interface{}{ErrDefault, ErrInvalidLogin},
},
want: &models.Error{Code: int32(401), Message: swag.String(ErrDefault.Error()), DetailedMessage: swag.String(ErrDefault.Error())},
want: &CodedAPIError{
Code: int(401),
APIError: &models.APIError{Message: ErrDefault.Error(), DetailedMessage: ""},
},
})
tests = append(tests,
testError{
name: "login error omits detailedMessage",
args: args{
err: []interface{}{ErrInvalidLogin},
},
want: &CodedAPIError{
Code: int(401),
APIError: &models.APIError{Message: ErrInvalidLogin.Error(), DetailedMessage: ""},
},
})
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
got := Error(tt.args.err...)
assert.Equalf(t, tt.want.Code, got.Code, "Error(%v) Got (%v)", tt.want.Code, got.Code)
assert.Equalf(t, *tt.want.DetailedMessage, *got.DetailedMessage, "Error(%s) Got (%s)", *tt.want.DetailedMessage, *got.DetailedMessage)
assert.Equalf(t, tt.want.APIError.DetailedMessage, got.APIError.DetailedMessage, "Error(%s) Got (%s)", tt.want.APIError.DetailedMessage, got.APIError.DetailedMessage)
})
}
}
@@ -119,7 +137,7 @@ func TestErrorWithContext(t *testing.T) {
tests := []struct {
name string
args args
want *models.Error
want *CodedAPIError
}{
{
name: "default error",
@@ -127,11 +145,13 @@ func TestErrorWithContext(t *testing.T) {
ctx: context.Background(),
err: []interface{}{ErrDefault},
},
want: &models.Error{Code: 500, Message: swag.String(ErrDefault.Error()), DetailedMessage: swag.String(ErrDefault.Error())},
want: &CodedAPIError{
Code: 500, APIError: &models.APIError{Message: ErrDefault.Error(), DetailedMessage: ErrDefault.Error()},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
assert.Equalf(t, tt.want, ErrorWithContext(tt.args.ctx, tt.args.err...), "ErrorWithContext(%v, %v)", tt.args.ctx, tt.args.err)
})
}

View File

@@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package restapi
package api
import (
"context"
@@ -58,7 +58,7 @@ type Context struct {
TLSCertificate, TLSKey, TLSca string
}
// Load loads restapi Context from command line context.
// Load loads api Context from command line context.
func (c *Context) Load(ctx *cli.Context) error {
*c = Context{
Host: ctx.String("host"),

View File

@@ -14,7 +14,7 @@
// 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 restapi
package api
import (
"flag"
@@ -85,7 +85,7 @@ func TestContext_Load(t *testing.T) {
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Run(tt.name, func(_ *testing.T) {
c := &Context{}
fs := flag.NewFlagSet("flags", flag.ContinueOnError)

View File

@@ -86,7 +86,7 @@ type LoginDetailDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewLoginDetailDefault creates LoginDetailDefault with default headers values
@@ -112,13 +112,13 @@ func (o *LoginDetailDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the login detail default response
func (o *LoginDetailDefault) WithPayload(payload *models.Error) *LoginDetailDefault {
func (o *LoginDetailDefault) WithPayload(payload *models.APIError) *LoginDetailDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the login detail default response
func (o *LoginDetailDefault) SetPayload(payload *models.Error) {
func (o *LoginDetailDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -66,7 +66,7 @@ type LoginDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewLoginDefault creates LoginDefault with default headers values
@@ -92,13 +92,13 @@ func (o *LoginDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the login default response
func (o *LoginDefault) WithPayload(payload *models.Error) *LoginDefault {
func (o *LoginDefault) WithPayload(payload *models.APIError) *LoginDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the login default response
func (o *LoginDefault) SetPayload(payload *models.Error) {
func (o *LoginDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -66,7 +66,7 @@ type LogoutDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewLogoutDefault creates LogoutDefault with default headers values
@@ -92,13 +92,13 @@ func (o *LogoutDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the logout default response
func (o *LogoutDefault) WithPayload(payload *models.Error) *LogoutDefault {
func (o *LogoutDefault) WithPayload(payload *models.APIError) *LogoutDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the logout default response
func (o *LogoutDefault) SetPayload(payload *models.Error) {
func (o *LogoutDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -86,7 +86,7 @@ type SessionCheckDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewSessionCheckDefault creates SessionCheckDefault with default headers values
@@ -112,13 +112,13 @@ func (o *SessionCheckDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the session check default response
func (o *SessionCheckDefault) WithPayload(payload *models.Error) *SessionCheckDefault {
func (o *SessionCheckDefault) WithPayload(payload *models.APIError) *SessionCheckDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the session check default response
func (o *SessionCheckDefault) SetPayload(payload *models.Error) {
func (o *SessionCheckDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -86,7 +86,7 @@ type BucketInfoDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewBucketInfoDefault creates BucketInfoDefault with default headers values
@@ -112,13 +112,13 @@ func (o *BucketInfoDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the bucket info default response
func (o *BucketInfoDefault) WithPayload(payload *models.Error) *BucketInfoDefault {
func (o *BucketInfoDefault) WithPayload(payload *models.APIError) *BucketInfoDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the bucket info default response
func (o *BucketInfoDefault) SetPayload(payload *models.Error) {
func (o *BucketInfoDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -86,7 +86,7 @@ type GetBucketQuotaDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewGetBucketQuotaDefault creates GetBucketQuotaDefault with default headers values
@@ -112,13 +112,13 @@ func (o *GetBucketQuotaDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the get bucket quota default response
func (o *GetBucketQuotaDefault) WithPayload(payload *models.Error) *GetBucketQuotaDefault {
func (o *GetBucketQuotaDefault) WithPayload(payload *models.APIError) *GetBucketQuotaDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get bucket quota default response
func (o *GetBucketQuotaDefault) SetPayload(payload *models.Error) {
func (o *GetBucketQuotaDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -86,7 +86,7 @@ type GetBucketRewindDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewGetBucketRewindDefault creates GetBucketRewindDefault with default headers values
@@ -112,13 +112,13 @@ func (o *GetBucketRewindDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the get bucket rewind default response
func (o *GetBucketRewindDefault) WithPayload(payload *models.Error) *GetBucketRewindDefault {
func (o *GetBucketRewindDefault) WithPayload(payload *models.APIError) *GetBucketRewindDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get bucket rewind default response
func (o *GetBucketRewindDefault) SetPayload(payload *models.Error) {
func (o *GetBucketRewindDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -86,7 +86,7 @@ type GetBucketVersioningDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewGetBucketVersioningDefault creates GetBucketVersioningDefault with default headers values
@@ -112,13 +112,13 @@ func (o *GetBucketVersioningDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the get bucket versioning default response
func (o *GetBucketVersioningDefault) WithPayload(payload *models.Error) *GetBucketVersioningDefault {
func (o *GetBucketVersioningDefault) WithPayload(payload *models.APIError) *GetBucketVersioningDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get bucket versioning default response
func (o *GetBucketVersioningDefault) SetPayload(payload *models.Error) {
func (o *GetBucketVersioningDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -30,40 +30,40 @@ import (
"github.com/minio/console/models"
)
// DeleteRemoteBucketHandlerFunc turns a function with the right signature into a delete remote bucket handler
type DeleteRemoteBucketHandlerFunc func(DeleteRemoteBucketParams, *models.Principal) middleware.Responder
// GetMaxShareLinkExpHandlerFunc turns a function with the right signature into a get max share link exp handler
type GetMaxShareLinkExpHandlerFunc func(GetMaxShareLinkExpParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteRemoteBucketHandlerFunc) Handle(params DeleteRemoteBucketParams, principal *models.Principal) middleware.Responder {
func (fn GetMaxShareLinkExpHandlerFunc) Handle(params GetMaxShareLinkExpParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// DeleteRemoteBucketHandler interface for that can handle valid delete remote bucket params
type DeleteRemoteBucketHandler interface {
Handle(DeleteRemoteBucketParams, *models.Principal) middleware.Responder
// GetMaxShareLinkExpHandler interface for that can handle valid get max share link exp params
type GetMaxShareLinkExpHandler interface {
Handle(GetMaxShareLinkExpParams, *models.Principal) middleware.Responder
}
// NewDeleteRemoteBucket creates a new http.Handler for the delete remote bucket operation
func NewDeleteRemoteBucket(ctx *middleware.Context, handler DeleteRemoteBucketHandler) *DeleteRemoteBucket {
return &DeleteRemoteBucket{Context: ctx, Handler: handler}
// NewGetMaxShareLinkExp creates a new http.Handler for the get max share link exp operation
func NewGetMaxShareLinkExp(ctx *middleware.Context, handler GetMaxShareLinkExpHandler) *GetMaxShareLinkExp {
return &GetMaxShareLinkExp{Context: ctx, Handler: handler}
}
/*
DeleteRemoteBucket swagger:route DELETE /remote-buckets/{source-bucket-name}/{arn} Bucket deleteRemoteBucket
GetMaxShareLinkExp swagger:route GET /buckets/max-share-exp Bucket getMaxShareLinkExp
Delete Remote Bucket
Get max expiration time for share link in seconds
*/
type DeleteRemoteBucket struct {
type GetMaxShareLinkExp struct {
Context *middleware.Context
Handler DeleteRemoteBucketHandler
Handler GetMaxShareLinkExpHandler
}
func (o *DeleteRemoteBucket) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
func (o *GetMaxShareLinkExp) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewDeleteRemoteBucketParams()
var Params = NewGetMaxShareLinkExpParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)

View File

@@ -29,19 +29,19 @@ import (
"github.com/go-openapi/runtime/middleware"
)
// NewListRemoteBucketsParams creates a new ListRemoteBucketsParams object
// NewGetMaxShareLinkExpParams creates a new GetMaxShareLinkExpParams object
//
// There are no default values defined in the spec.
func NewListRemoteBucketsParams() ListRemoteBucketsParams {
func NewGetMaxShareLinkExpParams() GetMaxShareLinkExpParams {
return ListRemoteBucketsParams{}
return GetMaxShareLinkExpParams{}
}
// ListRemoteBucketsParams contains all the bound params for the list remote buckets operation
// GetMaxShareLinkExpParams contains all the bound params for the get max share link exp operation
// typically these are obtained from a http.Request
//
// swagger:parameters ListRemoteBuckets
type ListRemoteBucketsParams struct {
// swagger:parameters GetMaxShareLinkExp
type GetMaxShareLinkExpParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
@@ -50,8 +50,8 @@ type ListRemoteBucketsParams struct {
// 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 NewListRemoteBucketsParams() beforehand.
func (o *ListRemoteBucketsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
// To ensure default values, the struct must have been initialized with NewGetMaxShareLinkExpParams() beforehand.
func (o *GetMaxShareLinkExpParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r

View File

@@ -30,41 +30,41 @@ import (
"github.com/minio/console/models"
)
// GetBucketLifecycleOKCode is the HTTP code returned for type GetBucketLifecycleOK
const GetBucketLifecycleOKCode int = 200
// GetMaxShareLinkExpOKCode is the HTTP code returned for type GetMaxShareLinkExpOK
const GetMaxShareLinkExpOKCode int = 200
/*
GetBucketLifecycleOK A successful response.
GetMaxShareLinkExpOK A successful response.
swagger:response getBucketLifecycleOK
swagger:response getMaxShareLinkExpOK
*/
type GetBucketLifecycleOK struct {
type GetMaxShareLinkExpOK struct {
/*
In: Body
*/
Payload *models.BucketLifecycleResponse `json:"body,omitempty"`
Payload *models.MaxShareLinkExpResponse `json:"body,omitempty"`
}
// NewGetBucketLifecycleOK creates GetBucketLifecycleOK with default headers values
func NewGetBucketLifecycleOK() *GetBucketLifecycleOK {
// NewGetMaxShareLinkExpOK creates GetMaxShareLinkExpOK with default headers values
func NewGetMaxShareLinkExpOK() *GetMaxShareLinkExpOK {
return &GetBucketLifecycleOK{}
return &GetMaxShareLinkExpOK{}
}
// WithPayload adds the payload to the get bucket lifecycle o k response
func (o *GetBucketLifecycleOK) WithPayload(payload *models.BucketLifecycleResponse) *GetBucketLifecycleOK {
// WithPayload adds the payload to the get max share link exp o k response
func (o *GetMaxShareLinkExpOK) WithPayload(payload *models.MaxShareLinkExpResponse) *GetMaxShareLinkExpOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get bucket lifecycle o k response
func (o *GetBucketLifecycleOK) SetPayload(payload *models.BucketLifecycleResponse) {
// SetPayload sets the payload to the get max share link exp o k response
func (o *GetMaxShareLinkExpOK) SetPayload(payload *models.MaxShareLinkExpResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetBucketLifecycleOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
func (o *GetMaxShareLinkExpOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
@@ -76,54 +76,54 @@ func (o *GetBucketLifecycleOK) WriteResponse(rw http.ResponseWriter, producer ru
}
/*
GetBucketLifecycleDefault Generic error response.
GetMaxShareLinkExpDefault Generic error response.
swagger:response getBucketLifecycleDefault
swagger:response getMaxShareLinkExpDefault
*/
type GetBucketLifecycleDefault struct {
type GetMaxShareLinkExpDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewGetBucketLifecycleDefault creates GetBucketLifecycleDefault with default headers values
func NewGetBucketLifecycleDefault(code int) *GetBucketLifecycleDefault {
// NewGetMaxShareLinkExpDefault creates GetMaxShareLinkExpDefault with default headers values
func NewGetMaxShareLinkExpDefault(code int) *GetMaxShareLinkExpDefault {
if code <= 0 {
code = 500
}
return &GetBucketLifecycleDefault{
return &GetMaxShareLinkExpDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get bucket lifecycle default response
func (o *GetBucketLifecycleDefault) WithStatusCode(code int) *GetBucketLifecycleDefault {
// WithStatusCode adds the status to the get max share link exp default response
func (o *GetMaxShareLinkExpDefault) WithStatusCode(code int) *GetMaxShareLinkExpDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get bucket lifecycle default response
func (o *GetBucketLifecycleDefault) SetStatusCode(code int) {
// SetStatusCode sets the status to the get max share link exp default response
func (o *GetMaxShareLinkExpDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get bucket lifecycle default response
func (o *GetBucketLifecycleDefault) WithPayload(payload *models.Error) *GetBucketLifecycleDefault {
// WithPayload adds the payload to the get max share link exp default response
func (o *GetMaxShareLinkExpDefault) WithPayload(payload *models.APIError) *GetMaxShareLinkExpDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get bucket lifecycle default response
func (o *GetBucketLifecycleDefault) SetPayload(payload *models.Error) {
// SetPayload sets the payload to the get max share link exp default response
func (o *GetMaxShareLinkExpDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetBucketLifecycleDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
func (o *GetMaxShareLinkExpDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package policy
package bucket
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
@@ -28,15 +28,15 @@ import (
golangswaggerpaths "path"
)
// GetUserPolicyURL generates an URL for the get user policy operation
type GetUserPolicyURL struct {
// GetMaxShareLinkExpURL generates an URL for the get max share link exp operation
type GetMaxShareLinkExpURL 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 *GetUserPolicyURL) WithBasePath(bp string) *GetUserPolicyURL {
func (o *GetMaxShareLinkExpURL) WithBasePath(bp string) *GetMaxShareLinkExpURL {
o.SetBasePath(bp)
return o
}
@@ -44,15 +44,15 @@ func (o *GetUserPolicyURL) WithBasePath(bp string) *GetUserPolicyURL {
// 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 *GetUserPolicyURL) SetBasePath(bp string) {
func (o *GetMaxShareLinkExpURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *GetUserPolicyURL) Build() (*url.URL, error) {
func (o *GetMaxShareLinkExpURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/user/policy"
var _path = "/buckets/max-share-exp"
_basePath := o._basePath
if _basePath == "" {
@@ -64,7 +64,7 @@ func (o *GetUserPolicyURL) Build() (*url.URL, error) {
}
// Must is a helper function to panic when the url builder returns an error
func (o *GetUserPolicyURL) Must(u *url.URL, err error) *url.URL {
func (o *GetMaxShareLinkExpURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
@@ -75,17 +75,17 @@ func (o *GetUserPolicyURL) Must(u *url.URL, err error) *url.URL {
}
// String returns the string representation of the path with query string
func (o *GetUserPolicyURL) String() string {
func (o *GetMaxShareLinkExpURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *GetUserPolicyURL) BuildFull(scheme, host string) (*url.URL, error) {
func (o *GetMaxShareLinkExpURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on GetUserPolicyURL")
return nil, errors.New("scheme is required for a full url on GetMaxShareLinkExpURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on GetUserPolicyURL")
return nil, errors.New("host is required for a full url on GetMaxShareLinkExpURL")
}
base, err := o.Build()
@@ -99,6 +99,6 @@ func (o *GetUserPolicyURL) BuildFull(scheme, host string) (*url.URL, error) {
}
// StringFull returns the string representation of a complete url
func (o *GetUserPolicyURL) StringFull(scheme, host string) string {
func (o *GetMaxShareLinkExpURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -86,7 +86,7 @@ type ListBucketsDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewListBucketsDefault creates ListBucketsDefault with default headers values
@@ -112,13 +112,13 @@ func (o *ListBucketsDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the list buckets default response
func (o *ListBucketsDefault) WithPayload(payload *models.Error) *ListBucketsDefault {
func (o *ListBucketsDefault) WithPayload(payload *models.APIError) *ListBucketsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the list buckets default response
func (o *ListBucketsDefault) SetPayload(payload *models.Error) {
func (o *ListBucketsDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -86,7 +86,7 @@ type MakeBucketDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewMakeBucketDefault creates MakeBucketDefault with default headers values
@@ -112,13 +112,13 @@ func (o *MakeBucketDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the make bucket default response
func (o *MakeBucketDefault) WithPayload(payload *models.Error) *MakeBucketDefault {
func (o *MakeBucketDefault) WithPayload(payload *models.APIError) *MakeBucketDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the make bucket default response
func (o *MakeBucketDefault) SetPayload(payload *models.Error) {
func (o *MakeBucketDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -66,7 +66,7 @@ type SetBucketVersioningDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewSetBucketVersioningDefault creates SetBucketVersioningDefault with default headers values
@@ -92,13 +92,13 @@ func (o *SetBucketVersioningDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the set bucket versioning default response
func (o *SetBucketVersioningDefault) WithPayload(payload *models.Error) *SetBucketVersioningDefault {
func (o *SetBucketVersioningDefault) WithPayload(payload *models.APIError) *SetBucketVersioningDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the set bucket versioning default response
func (o *SetBucketVersioningDefault) SetPayload(payload *models.Error) {
func (o *SetBucketVersioningDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -0,0 +1,676 @@
// 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 operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"net/http"
"strings"
"github.com/go-openapi/errors"
"github.com/go-openapi/loads"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/runtime/security"
"github.com/go-openapi/spec"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/minio/console/api/operations/auth"
"github.com/minio/console/api/operations/bucket"
"github.com/minio/console/api/operations/license"
"github.com/minio/console/api/operations/object"
"github.com/minio/console/api/operations/public"
"github.com/minio/console/api/operations/system"
"github.com/minio/console/models"
)
// NewConsoleAPI creates a new Console instance
func NewConsoleAPI(spec *loads.Document) *ConsoleAPI {
return &ConsoleAPI{
handlers: make(map[string]map[string]http.Handler),
formats: strfmt.Default,
defaultConsumes: "application/json",
defaultProduces: "application/json",
customConsumers: make(map[string]runtime.Consumer),
customProducers: make(map[string]runtime.Producer),
PreServerShutdown: func() {},
ServerShutdown: func() {},
spec: spec,
useSwaggerUI: false,
ServeError: errors.ServeError,
BasicAuthenticator: security.BasicAuth,
APIKeyAuthenticator: security.APIKeyAuth,
BearerAuthenticator: security.BearerAuth,
JSONConsumer: runtime.JSONConsumer(),
MultipartformConsumer: runtime.DiscardConsumer,
BinProducer: runtime.ByteStreamProducer(),
JSONProducer: runtime.JSONProducer(),
SystemAdminInfoHandler: system.AdminInfoHandlerFunc(func(params system.AdminInfoParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation system.AdminInfo has not yet been implemented")
}),
BucketBucketInfoHandler: bucket.BucketInfoHandlerFunc(func(params bucket.BucketInfoParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.BucketInfo has not yet been implemented")
}),
ObjectDeleteMultipleObjectsHandler: object.DeleteMultipleObjectsHandlerFunc(func(params object.DeleteMultipleObjectsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.DeleteMultipleObjects has not yet been implemented")
}),
ObjectDeleteObjectHandler: object.DeleteObjectHandlerFunc(func(params object.DeleteObjectParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.DeleteObject has not yet been implemented")
}),
ObjectDownloadObjectHandler: object.DownloadObjectHandlerFunc(func(params object.DownloadObjectParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.DownloadObject has not yet been implemented")
}),
ObjectDownloadMultipleObjectsHandler: object.DownloadMultipleObjectsHandlerFunc(func(params object.DownloadMultipleObjectsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.DownloadMultipleObjects has not yet been implemented")
}),
PublicDownloadSharedObjectHandler: public.DownloadSharedObjectHandlerFunc(func(params public.DownloadSharedObjectParams) middleware.Responder {
return middleware.NotImplemented("operation public.DownloadSharedObject has not yet been implemented")
}),
BucketGetBucketQuotaHandler: bucket.GetBucketQuotaHandlerFunc(func(params bucket.GetBucketQuotaParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.GetBucketQuota has not yet been implemented")
}),
BucketGetBucketRewindHandler: bucket.GetBucketRewindHandlerFunc(func(params bucket.GetBucketRewindParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.GetBucketRewind has not yet been implemented")
}),
BucketGetBucketVersioningHandler: bucket.GetBucketVersioningHandlerFunc(func(params bucket.GetBucketVersioningParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.GetBucketVersioning has not yet been implemented")
}),
BucketGetMaxShareLinkExpHandler: bucket.GetMaxShareLinkExpHandlerFunc(func(params bucket.GetMaxShareLinkExpParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.GetMaxShareLinkExp has not yet been implemented")
}),
ObjectGetObjectMetadataHandler: object.GetObjectMetadataHandlerFunc(func(params object.GetObjectMetadataParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.GetObjectMetadata has not yet been implemented")
}),
LicenseLicenseAcknowledgeHandler: license.LicenseAcknowledgeHandlerFunc(func(params license.LicenseAcknowledgeParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation license.LicenseAcknowledge has not yet been implemented")
}),
BucketListBucketsHandler: bucket.ListBucketsHandlerFunc(func(params bucket.ListBucketsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.ListBuckets has not yet been implemented")
}),
ObjectListObjectsHandler: object.ListObjectsHandlerFunc(func(params object.ListObjectsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.ListObjects has not yet been implemented")
}),
AuthLoginHandler: auth.LoginHandlerFunc(func(params auth.LoginParams) middleware.Responder {
return middleware.NotImplemented("operation auth.Login has not yet been implemented")
}),
AuthLoginDetailHandler: auth.LoginDetailHandlerFunc(func(params auth.LoginDetailParams) middleware.Responder {
return middleware.NotImplemented("operation auth.LoginDetail has not yet been implemented")
}),
AuthLogoutHandler: auth.LogoutHandlerFunc(func(params auth.LogoutParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation auth.Logout has not yet been implemented")
}),
BucketMakeBucketHandler: bucket.MakeBucketHandlerFunc(func(params bucket.MakeBucketParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.MakeBucket has not yet been implemented")
}),
ObjectPostBucketsBucketNameObjectsUploadHandler: object.PostBucketsBucketNameObjectsUploadHandlerFunc(func(params object.PostBucketsBucketNameObjectsUploadParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.PostBucketsBucketNameObjectsUpload has not yet been implemented")
}),
ObjectPutObjectRestoreHandler: object.PutObjectRestoreHandlerFunc(func(params object.PutObjectRestoreParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.PutObjectRestore has not yet been implemented")
}),
ObjectPutObjectTagsHandler: object.PutObjectTagsHandlerFunc(func(params object.PutObjectTagsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.PutObjectTags has not yet been implemented")
}),
AuthSessionCheckHandler: auth.SessionCheckHandlerFunc(func(params auth.SessionCheckParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation auth.SessionCheck has not yet been implemented")
}),
BucketSetBucketVersioningHandler: bucket.SetBucketVersioningHandlerFunc(func(params bucket.SetBucketVersioningParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation bucket.SetBucketVersioning has not yet been implemented")
}),
ObjectShareObjectHandler: object.ShareObjectHandlerFunc(func(params object.ShareObjectParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation object.ShareObject has not yet been implemented")
}),
// Applies when the "X-Anonymous" header is set
AnonymousAuth: func(token string) (*models.Principal, error) {
return nil, errors.NotImplemented("api key auth (anonymous) X-Anonymous from header param [X-Anonymous] has not yet been implemented")
},
KeyAuth: func(token string, scopes []string) (*models.Principal, error) {
return nil, errors.NotImplemented("oauth2 bearer auth (key) has not yet been implemented")
},
// default authorizer is authorized meaning no requests are blocked
APIAuthorizer: security.Authorized(),
}
}
/*ConsoleAPI the console API */
type ConsoleAPI struct {
spec *loads.Document
context *middleware.Context
handlers map[string]map[string]http.Handler
formats strfmt.Registry
customConsumers map[string]runtime.Consumer
customProducers map[string]runtime.Producer
defaultConsumes string
defaultProduces string
Middleware func(middleware.Builder) http.Handler
useSwaggerUI bool
// BasicAuthenticator generates a runtime.Authenticator from the supplied basic auth function.
// It has a default implementation in the security package, however you can replace it for your particular usage.
BasicAuthenticator func(security.UserPassAuthentication) runtime.Authenticator
// APIKeyAuthenticator generates a runtime.Authenticator from the supplied token auth function.
// It has a default implementation in the security package, however you can replace it for your particular usage.
APIKeyAuthenticator func(string, string, security.TokenAuthentication) runtime.Authenticator
// BearerAuthenticator generates a runtime.Authenticator from the supplied bearer token auth function.
// It has a default implementation in the security package, however you can replace it for your particular usage.
BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator
// JSONConsumer registers a consumer for the following mime types:
// - application/json
JSONConsumer runtime.Consumer
// MultipartformConsumer registers a consumer for the following mime types:
// - multipart/form-data
MultipartformConsumer runtime.Consumer
// BinProducer registers a producer for the following mime types:
// - application/octet-stream
BinProducer runtime.Producer
// JSONProducer registers a producer for the following mime types:
// - application/json
JSONProducer runtime.Producer
// AnonymousAuth registers a function that takes a token and returns a principal
// it performs authentication based on an api key X-Anonymous provided in the header
AnonymousAuth func(string) (*models.Principal, error)
// KeyAuth registers a function that takes an access token and a collection of required scopes and returns a principal
// it performs authentication based on an oauth2 bearer token provided in the request
KeyAuth func(string, []string) (*models.Principal, error)
// APIAuthorizer provides access control (ACL/RBAC/ABAC) by providing access to the request and authenticated principal
APIAuthorizer runtime.Authorizer
// SystemAdminInfoHandler sets the operation handler for the admin info operation
SystemAdminInfoHandler system.AdminInfoHandler
// BucketBucketInfoHandler sets the operation handler for the bucket info operation
BucketBucketInfoHandler bucket.BucketInfoHandler
// ObjectDeleteMultipleObjectsHandler sets the operation handler for the delete multiple objects operation
ObjectDeleteMultipleObjectsHandler object.DeleteMultipleObjectsHandler
// ObjectDeleteObjectHandler sets the operation handler for the delete object operation
ObjectDeleteObjectHandler object.DeleteObjectHandler
// ObjectDownloadObjectHandler sets the operation handler for the download object operation
ObjectDownloadObjectHandler object.DownloadObjectHandler
// ObjectDownloadMultipleObjectsHandler sets the operation handler for the download multiple objects operation
ObjectDownloadMultipleObjectsHandler object.DownloadMultipleObjectsHandler
// PublicDownloadSharedObjectHandler sets the operation handler for the download shared object operation
PublicDownloadSharedObjectHandler public.DownloadSharedObjectHandler
// BucketGetBucketQuotaHandler sets the operation handler for the get bucket quota operation
BucketGetBucketQuotaHandler bucket.GetBucketQuotaHandler
// BucketGetBucketRewindHandler sets the operation handler for the get bucket rewind operation
BucketGetBucketRewindHandler bucket.GetBucketRewindHandler
// BucketGetBucketVersioningHandler sets the operation handler for the get bucket versioning operation
BucketGetBucketVersioningHandler bucket.GetBucketVersioningHandler
// BucketGetMaxShareLinkExpHandler sets the operation handler for the get max share link exp operation
BucketGetMaxShareLinkExpHandler bucket.GetMaxShareLinkExpHandler
// ObjectGetObjectMetadataHandler sets the operation handler for the get object metadata operation
ObjectGetObjectMetadataHandler object.GetObjectMetadataHandler
// LicenseLicenseAcknowledgeHandler sets the operation handler for the license acknowledge operation
LicenseLicenseAcknowledgeHandler license.LicenseAcknowledgeHandler
// BucketListBucketsHandler sets the operation handler for the list buckets operation
BucketListBucketsHandler bucket.ListBucketsHandler
// ObjectListObjectsHandler sets the operation handler for the list objects operation
ObjectListObjectsHandler object.ListObjectsHandler
// AuthLoginHandler sets the operation handler for the login operation
AuthLoginHandler auth.LoginHandler
// AuthLoginDetailHandler sets the operation handler for the login detail operation
AuthLoginDetailHandler auth.LoginDetailHandler
// AuthLogoutHandler sets the operation handler for the logout operation
AuthLogoutHandler auth.LogoutHandler
// BucketMakeBucketHandler sets the operation handler for the make bucket operation
BucketMakeBucketHandler bucket.MakeBucketHandler
// ObjectPostBucketsBucketNameObjectsUploadHandler sets the operation handler for the post buckets bucket name objects upload operation
ObjectPostBucketsBucketNameObjectsUploadHandler object.PostBucketsBucketNameObjectsUploadHandler
// ObjectPutObjectRestoreHandler sets the operation handler for the put object restore operation
ObjectPutObjectRestoreHandler object.PutObjectRestoreHandler
// ObjectPutObjectTagsHandler sets the operation handler for the put object tags operation
ObjectPutObjectTagsHandler object.PutObjectTagsHandler
// AuthSessionCheckHandler sets the operation handler for the session check operation
AuthSessionCheckHandler auth.SessionCheckHandler
// BucketSetBucketVersioningHandler sets the operation handler for the set bucket versioning operation
BucketSetBucketVersioningHandler bucket.SetBucketVersioningHandler
// ObjectShareObjectHandler sets the operation handler for the share object operation
ObjectShareObjectHandler object.ShareObjectHandler
// ServeError is called when an error is received, there is a default handler
// but you can set your own with this
ServeError func(http.ResponseWriter, *http.Request, error)
// PreServerShutdown is called before the HTTP(S) server is shutdown
// This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic
PreServerShutdown func()
// ServerShutdown is called when the HTTP(S) server is shut down and done
// handling all active connections and does not accept connections any more
ServerShutdown func()
// Custom command line argument groups with their descriptions
CommandLineOptionsGroups []swag.CommandLineOptionsGroup
// User defined logger function.
Logger func(string, ...interface{})
}
// UseRedoc for documentation at /docs
func (o *ConsoleAPI) UseRedoc() {
o.useSwaggerUI = false
}
// UseSwaggerUI for documentation at /docs
func (o *ConsoleAPI) UseSwaggerUI() {
o.useSwaggerUI = true
}
// SetDefaultProduces sets the default produces media type
func (o *ConsoleAPI) SetDefaultProduces(mediaType string) {
o.defaultProduces = mediaType
}
// SetDefaultConsumes returns the default consumes media type
func (o *ConsoleAPI) SetDefaultConsumes(mediaType string) {
o.defaultConsumes = mediaType
}
// SetSpec sets a spec that will be served for the clients.
func (o *ConsoleAPI) SetSpec(spec *loads.Document) {
o.spec = spec
}
// DefaultProduces returns the default produces media type
func (o *ConsoleAPI) DefaultProduces() string {
return o.defaultProduces
}
// DefaultConsumes returns the default consumes media type
func (o *ConsoleAPI) DefaultConsumes() string {
return o.defaultConsumes
}
// Formats returns the registered string formats
func (o *ConsoleAPI) Formats() strfmt.Registry {
return o.formats
}
// RegisterFormat registers a custom format validator
func (o *ConsoleAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
o.formats.Add(name, format, validator)
}
// Validate validates the registrations in the ConsoleAPI
func (o *ConsoleAPI) Validate() error {
var unregistered []string
if o.JSONConsumer == nil {
unregistered = append(unregistered, "JSONConsumer")
}
if o.MultipartformConsumer == nil {
unregistered = append(unregistered, "MultipartformConsumer")
}
if o.BinProducer == nil {
unregistered = append(unregistered, "BinProducer")
}
if o.JSONProducer == nil {
unregistered = append(unregistered, "JSONProducer")
}
if o.AnonymousAuth == nil {
unregistered = append(unregistered, "XAnonymousAuth")
}
if o.KeyAuth == nil {
unregistered = append(unregistered, "KeyAuth")
}
if o.SystemAdminInfoHandler == nil {
unregistered = append(unregistered, "system.AdminInfoHandler")
}
if o.BucketBucketInfoHandler == nil {
unregistered = append(unregistered, "bucket.BucketInfoHandler")
}
if o.ObjectDeleteMultipleObjectsHandler == nil {
unregistered = append(unregistered, "object.DeleteMultipleObjectsHandler")
}
if o.ObjectDeleteObjectHandler == nil {
unregistered = append(unregistered, "object.DeleteObjectHandler")
}
if o.ObjectDownloadObjectHandler == nil {
unregistered = append(unregistered, "object.DownloadObjectHandler")
}
if o.ObjectDownloadMultipleObjectsHandler == nil {
unregistered = append(unregistered, "object.DownloadMultipleObjectsHandler")
}
if o.PublicDownloadSharedObjectHandler == nil {
unregistered = append(unregistered, "public.DownloadSharedObjectHandler")
}
if o.BucketGetBucketQuotaHandler == nil {
unregistered = append(unregistered, "bucket.GetBucketQuotaHandler")
}
if o.BucketGetBucketRewindHandler == nil {
unregistered = append(unregistered, "bucket.GetBucketRewindHandler")
}
if o.BucketGetBucketVersioningHandler == nil {
unregistered = append(unregistered, "bucket.GetBucketVersioningHandler")
}
if o.BucketGetMaxShareLinkExpHandler == nil {
unregistered = append(unregistered, "bucket.GetMaxShareLinkExpHandler")
}
if o.ObjectGetObjectMetadataHandler == nil {
unregistered = append(unregistered, "object.GetObjectMetadataHandler")
}
if o.LicenseLicenseAcknowledgeHandler == nil {
unregistered = append(unregistered, "license.LicenseAcknowledgeHandler")
}
if o.BucketListBucketsHandler == nil {
unregistered = append(unregistered, "bucket.ListBucketsHandler")
}
if o.ObjectListObjectsHandler == nil {
unregistered = append(unregistered, "object.ListObjectsHandler")
}
if o.AuthLoginHandler == nil {
unregistered = append(unregistered, "auth.LoginHandler")
}
if o.AuthLoginDetailHandler == nil {
unregistered = append(unregistered, "auth.LoginDetailHandler")
}
if o.AuthLogoutHandler == nil {
unregistered = append(unregistered, "auth.LogoutHandler")
}
if o.BucketMakeBucketHandler == nil {
unregistered = append(unregistered, "bucket.MakeBucketHandler")
}
if o.ObjectPostBucketsBucketNameObjectsUploadHandler == nil {
unregistered = append(unregistered, "object.PostBucketsBucketNameObjectsUploadHandler")
}
if o.ObjectPutObjectRestoreHandler == nil {
unregistered = append(unregistered, "object.PutObjectRestoreHandler")
}
if o.ObjectPutObjectTagsHandler == nil {
unregistered = append(unregistered, "object.PutObjectTagsHandler")
}
if o.AuthSessionCheckHandler == nil {
unregistered = append(unregistered, "auth.SessionCheckHandler")
}
if o.BucketSetBucketVersioningHandler == nil {
unregistered = append(unregistered, "bucket.SetBucketVersioningHandler")
}
if o.ObjectShareObjectHandler == nil {
unregistered = append(unregistered, "object.ShareObjectHandler")
}
if len(unregistered) > 0 {
return fmt.Errorf("missing registration: %s", strings.Join(unregistered, ", "))
}
return nil
}
// ServeErrorFor gets a error handler for a given operation id
func (o *ConsoleAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
return o.ServeError
}
// AuthenticatorsFor gets the authenticators for the specified security schemes
func (o *ConsoleAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {
result := make(map[string]runtime.Authenticator)
for name := range schemes {
switch name {
case "anonymous":
scheme := schemes[name]
result[name] = o.APIKeyAuthenticator(scheme.Name, scheme.In, func(token string) (interface{}, error) {
return o.AnonymousAuth(token)
})
case "key":
result[name] = o.BearerAuthenticator(name, func(token string, scopes []string) (interface{}, error) {
return o.KeyAuth(token, scopes)
})
}
}
return result
}
// Authorizer returns the registered authorizer
func (o *ConsoleAPI) Authorizer() runtime.Authorizer {
return o.APIAuthorizer
}
// ConsumersFor gets the consumers for the specified media types.
// MIME type parameters are ignored here.
func (o *ConsoleAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer {
result := make(map[string]runtime.Consumer, len(mediaTypes))
for _, mt := range mediaTypes {
switch mt {
case "application/json":
result["application/json"] = o.JSONConsumer
case "multipart/form-data":
result["multipart/form-data"] = o.MultipartformConsumer
}
if c, ok := o.customConsumers[mt]; ok {
result[mt] = c
}
}
return result
}
// ProducersFor gets the producers for the specified media types.
// MIME type parameters are ignored here.
func (o *ConsoleAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer {
result := make(map[string]runtime.Producer, len(mediaTypes))
for _, mt := range mediaTypes {
switch mt {
case "application/octet-stream":
result["application/octet-stream"] = o.BinProducer
case "application/json":
result["application/json"] = o.JSONProducer
}
if p, ok := o.customProducers[mt]; ok {
result[mt] = p
}
}
return result
}
// HandlerFor gets a http.Handler for the provided operation method and path
func (o *ConsoleAPI) HandlerFor(method, path string) (http.Handler, bool) {
if o.handlers == nil {
return nil, false
}
um := strings.ToUpper(method)
if _, ok := o.handlers[um]; !ok {
return nil, false
}
if path == "/" {
path = ""
}
h, ok := o.handlers[um][path]
return h, ok
}
// Context returns the middleware context for the console API
func (o *ConsoleAPI) Context() *middleware.Context {
if o.context == nil {
o.context = middleware.NewRoutableContext(o.spec, o, nil)
}
return o.context
}
func (o *ConsoleAPI) initHandlerCache() {
o.Context() // don't care about the result, just that the initialization happened
if o.handlers == nil {
o.handlers = make(map[string]map[string]http.Handler)
}
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/admin/info"] = system.NewAdminInfo(o.context, o.SystemAdminInfoHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/buckets/{name}"] = bucket.NewBucketInfo(o.context, o.BucketBucketInfoHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/buckets/{bucket_name}/delete-objects"] = object.NewDeleteMultipleObjects(o.context, o.ObjectDeleteMultipleObjectsHandler)
if o.handlers["DELETE"] == nil {
o.handlers["DELETE"] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/buckets/{bucket_name}/objects"] = object.NewDeleteObject(o.context, o.ObjectDeleteObjectHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/buckets/{bucket_name}/objects/download"] = object.NewDownloadObject(o.context, o.ObjectDownloadObjectHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/buckets/{bucket_name}/objects/download-multiple"] = object.NewDownloadMultipleObjects(o.context, o.ObjectDownloadMultipleObjectsHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/download-shared-object/{url}"] = public.NewDownloadSharedObject(o.context, o.PublicDownloadSharedObjectHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/buckets/{name}/quota"] = bucket.NewGetBucketQuota(o.context, o.BucketGetBucketQuotaHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/buckets/{bucket_name}/rewind/{date}"] = bucket.NewGetBucketRewind(o.context, o.BucketGetBucketRewindHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/buckets/{bucket_name}/versioning"] = bucket.NewGetBucketVersioning(o.context, o.BucketGetBucketVersioningHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/buckets/max-share-exp"] = bucket.NewGetMaxShareLinkExp(o.context, o.BucketGetMaxShareLinkExpHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/buckets/{bucket_name}/objects/metadata"] = object.NewGetObjectMetadata(o.context, o.ObjectGetObjectMetadataHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/license/acknowledge"] = license.NewLicenseAcknowledge(o.context, o.LicenseLicenseAcknowledgeHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/buckets"] = bucket.NewListBuckets(o.context, o.BucketListBucketsHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/buckets/{bucket_name}/objects"] = object.NewListObjects(o.context, o.ObjectListObjectsHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/login"] = auth.NewLogin(o.context, o.AuthLoginHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/login"] = auth.NewLoginDetail(o.context, o.AuthLoginDetailHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/logout"] = auth.NewLogout(o.context, o.AuthLogoutHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/buckets"] = bucket.NewMakeBucket(o.context, o.BucketMakeBucketHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/buckets/{bucket_name}/objects/upload"] = object.NewPostBucketsBucketNameObjectsUpload(o.context, o.ObjectPostBucketsBucketNameObjectsUploadHandler)
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
}
o.handlers["PUT"]["/buckets/{bucket_name}/objects/restore"] = object.NewPutObjectRestore(o.context, o.ObjectPutObjectRestoreHandler)
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
}
o.handlers["PUT"]["/buckets/{bucket_name}/objects/tags"] = object.NewPutObjectTags(o.context, o.ObjectPutObjectTagsHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/session"] = auth.NewSessionCheck(o.context, o.AuthSessionCheckHandler)
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
}
o.handlers["PUT"]["/buckets/{bucket_name}/versioning"] = bucket.NewSetBucketVersioning(o.context, o.BucketSetBucketVersioningHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/buckets/{bucket_name}/objects/share"] = object.NewShareObject(o.context, o.ObjectShareObjectHandler)
}
// Serve creates a http handler to serve the API over HTTP
// can be used directly in http.ListenAndServe(":8000", api.Serve(nil))
func (o *ConsoleAPI) Serve(builder middleware.Builder) http.Handler {
o.Init()
if o.Middleware != nil {
return o.Middleware(builder)
}
if o.useSwaggerUI {
return o.context.APIHandlerSwaggerUI(builder)
}
return o.context.APIHandler(builder)
}
// Init allows you to just initialize the handler cache, you can then recompose the middleware as you see fit
func (o *ConsoleAPI) Init() {
if len(o.handlers) == 0 {
o.initHandlerCache()
}
}
// RegisterConsumer allows you to add (or override) a consumer for a media type.
func (o *ConsoleAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer) {
o.customConsumers[mediaType] = consumer
}
// RegisterProducer allows you to add (or override) a producer for a media type.
func (o *ConsoleAPI) RegisterProducer(mediaType string, producer runtime.Producer) {
o.customProducers[mediaType] = producer
}
// AddMiddlewareFor adds a http middleware to existing handler
func (o *ConsoleAPI) AddMiddlewareFor(method, path string, builder middleware.Builder) {
um := strings.ToUpper(method)
if path == "/" {
path = ""
}
o.Init()
if h, ok := o.handlers[um][path]; ok {
o.handlers[um][path] = builder(h)
}
}

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package idp
package license
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
@@ -30,40 +30,40 @@ import (
"github.com/minio/console/models"
)
// ListConfigurationsHandlerFunc turns a function with the right signature into a list configurations handler
type ListConfigurationsHandlerFunc func(ListConfigurationsParams, *models.Principal) middleware.Responder
// LicenseAcknowledgeHandlerFunc turns a function with the right signature into a license acknowledge handler
type LicenseAcknowledgeHandlerFunc func(LicenseAcknowledgeParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn ListConfigurationsHandlerFunc) Handle(params ListConfigurationsParams, principal *models.Principal) middleware.Responder {
func (fn LicenseAcknowledgeHandlerFunc) Handle(params LicenseAcknowledgeParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// ListConfigurationsHandler interface for that can handle valid list configurations params
type ListConfigurationsHandler interface {
Handle(ListConfigurationsParams, *models.Principal) middleware.Responder
// LicenseAcknowledgeHandler interface for that can handle valid license acknowledge params
type LicenseAcknowledgeHandler interface {
Handle(LicenseAcknowledgeParams, *models.Principal) middleware.Responder
}
// NewListConfigurations creates a new http.Handler for the list configurations operation
func NewListConfigurations(ctx *middleware.Context, handler ListConfigurationsHandler) *ListConfigurations {
return &ListConfigurations{Context: ctx, Handler: handler}
// NewLicenseAcknowledge creates a new http.Handler for the license acknowledge operation
func NewLicenseAcknowledge(ctx *middleware.Context, handler LicenseAcknowledgeHandler) *LicenseAcknowledge {
return &LicenseAcknowledge{Context: ctx, Handler: handler}
}
/*
ListConfigurations swagger:route GET /idp/{type} idp listConfigurations
LicenseAcknowledge swagger:route GET /license/acknowledge License licenseAcknowledge
List IDP Configurations
Acknowledge the license
*/
type ListConfigurations struct {
type LicenseAcknowledge struct {
Context *middleware.Context
Handler ListConfigurationsHandler
Handler LicenseAcknowledgeHandler
}
func (o *ListConfigurations) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
func (o *LicenseAcknowledge) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewListConfigurationsParams()
var Params = NewLicenseAcknowledgeParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package configuration
package license
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
@@ -29,19 +29,19 @@ import (
"github.com/go-openapi/runtime/middleware"
)
// NewExportConfigParams creates a new ExportConfigParams object
// NewLicenseAcknowledgeParams creates a new LicenseAcknowledgeParams object
//
// There are no default values defined in the spec.
func NewExportConfigParams() ExportConfigParams {
func NewLicenseAcknowledgeParams() LicenseAcknowledgeParams {
return ExportConfigParams{}
return LicenseAcknowledgeParams{}
}
// ExportConfigParams contains all the bound params for the export config operation
// LicenseAcknowledgeParams contains all the bound params for the license acknowledge operation
// typically these are obtained from a http.Request
//
// swagger:parameters ExportConfig
type ExportConfigParams struct {
// swagger:parameters LicenseAcknowledge
type LicenseAcknowledgeParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
@@ -50,8 +50,8 @@ type ExportConfigParams struct {
// 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 NewExportConfigParams() beforehand.
func (o *ExportConfigParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
// To ensure default values, the struct must have been initialized with NewLicenseAcknowledgeParams() beforehand.
func (o *LicenseAcknowledgeParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package object
package license
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
@@ -30,25 +30,25 @@ import (
"github.com/minio/console/models"
)
// PutObjectRetentionOKCode is the HTTP code returned for type PutObjectRetentionOK
const PutObjectRetentionOKCode int = 200
// LicenseAcknowledgeOKCode is the HTTP code returned for type LicenseAcknowledgeOK
const LicenseAcknowledgeOKCode int = 200
/*
PutObjectRetentionOK A successful response.
LicenseAcknowledgeOK A successful response.
swagger:response putObjectRetentionOK
swagger:response licenseAcknowledgeOK
*/
type PutObjectRetentionOK struct {
type LicenseAcknowledgeOK struct {
}
// NewPutObjectRetentionOK creates PutObjectRetentionOK with default headers values
func NewPutObjectRetentionOK() *PutObjectRetentionOK {
// NewLicenseAcknowledgeOK creates LicenseAcknowledgeOK with default headers values
func NewLicenseAcknowledgeOK() *LicenseAcknowledgeOK {
return &PutObjectRetentionOK{}
return &LicenseAcknowledgeOK{}
}
// WriteResponse to the client
func (o *PutObjectRetentionOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
func (o *LicenseAcknowledgeOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
@@ -56,54 +56,54 @@ func (o *PutObjectRetentionOK) WriteResponse(rw http.ResponseWriter, producer ru
}
/*
PutObjectRetentionDefault Generic error response.
LicenseAcknowledgeDefault Generic error response.
swagger:response putObjectRetentionDefault
swagger:response licenseAcknowledgeDefault
*/
type PutObjectRetentionDefault struct {
type LicenseAcknowledgeDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewPutObjectRetentionDefault creates PutObjectRetentionDefault with default headers values
func NewPutObjectRetentionDefault(code int) *PutObjectRetentionDefault {
// NewLicenseAcknowledgeDefault creates LicenseAcknowledgeDefault with default headers values
func NewLicenseAcknowledgeDefault(code int) *LicenseAcknowledgeDefault {
if code <= 0 {
code = 500
}
return &PutObjectRetentionDefault{
return &LicenseAcknowledgeDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the put object retention default response
func (o *PutObjectRetentionDefault) WithStatusCode(code int) *PutObjectRetentionDefault {
// WithStatusCode adds the status to the license acknowledge default response
func (o *LicenseAcknowledgeDefault) WithStatusCode(code int) *LicenseAcknowledgeDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the put object retention default response
func (o *PutObjectRetentionDefault) SetStatusCode(code int) {
// SetStatusCode sets the status to the license acknowledge default response
func (o *LicenseAcknowledgeDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the put object retention default response
func (o *PutObjectRetentionDefault) WithPayload(payload *models.Error) *PutObjectRetentionDefault {
// WithPayload adds the payload to the license acknowledge default response
func (o *LicenseAcknowledgeDefault) WithPayload(payload *models.APIError) *LicenseAcknowledgeDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the put object retention default response
func (o *PutObjectRetentionDefault) SetPayload(payload *models.Error) {
// SetPayload sets the payload to the license acknowledge default response
func (o *LicenseAcknowledgeDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PutObjectRetentionDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
func (o *LicenseAcknowledgeDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package auth
package license
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
@@ -28,15 +28,15 @@ import (
golangswaggerpaths "path"
)
// LoginOauth2AuthURL generates an URL for the login oauth2 auth operation
type LoginOauth2AuthURL struct {
// LicenseAcknowledgeURL generates an URL for the license acknowledge operation
type LicenseAcknowledgeURL 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 *LoginOauth2AuthURL) WithBasePath(bp string) *LoginOauth2AuthURL {
func (o *LicenseAcknowledgeURL) WithBasePath(bp string) *LicenseAcknowledgeURL {
o.SetBasePath(bp)
return o
}
@@ -44,15 +44,15 @@ func (o *LoginOauth2AuthURL) WithBasePath(bp string) *LoginOauth2AuthURL {
// 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 *LoginOauth2AuthURL) SetBasePath(bp string) {
func (o *LicenseAcknowledgeURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *LoginOauth2AuthURL) Build() (*url.URL, error) {
func (o *LicenseAcknowledgeURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/login/oauth2/auth"
var _path = "/license/acknowledge"
_basePath := o._basePath
if _basePath == "" {
@@ -64,7 +64,7 @@ func (o *LoginOauth2AuthURL) Build() (*url.URL, error) {
}
// Must is a helper function to panic when the url builder returns an error
func (o *LoginOauth2AuthURL) Must(u *url.URL, err error) *url.URL {
func (o *LicenseAcknowledgeURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
@@ -75,17 +75,17 @@ func (o *LoginOauth2AuthURL) Must(u *url.URL, err error) *url.URL {
}
// String returns the string representation of the path with query string
func (o *LoginOauth2AuthURL) String() string {
func (o *LicenseAcknowledgeURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *LoginOauth2AuthURL) BuildFull(scheme, host string) (*url.URL, error) {
func (o *LicenseAcknowledgeURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on LoginOauth2AuthURL")
return nil, errors.New("scheme is required for a full url on LicenseAcknowledgeURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on LoginOauth2AuthURL")
return nil, errors.New("host is required for a full url on LicenseAcknowledgeURL")
}
base, err := o.Build()
@@ -99,6 +99,6 @@ func (o *LoginOauth2AuthURL) BuildFull(scheme, host string) (*url.URL, error) {
}
// StringFull returns the string representation of a complete url
func (o *LoginOauth2AuthURL) StringFull(scheme, host string) string {
func (o *LicenseAcknowledgeURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -66,7 +66,7 @@ type DeleteMultipleObjectsDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewDeleteMultipleObjectsDefault creates DeleteMultipleObjectsDefault with default headers values
@@ -92,13 +92,13 @@ func (o *DeleteMultipleObjectsDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the delete multiple objects default response
func (o *DeleteMultipleObjectsDefault) WithPayload(payload *models.Error) *DeleteMultipleObjectsDefault {
func (o *DeleteMultipleObjectsDefault) WithPayload(payload *models.APIError) *DeleteMultipleObjectsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete multiple objects default response
func (o *DeleteMultipleObjectsDefault) SetPayload(payload *models.Error) {
func (o *DeleteMultipleObjectsDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -71,7 +71,7 @@ type DeleteObjectParams struct {
Required: true
In: query
*/
Path string
Prefix string
/*
In: query
*/
@@ -113,8 +113,8 @@ func (o *DeleteObjectParams) BindRequest(r *http.Request, route *middleware.Matc
res = append(res, err)
}
qPath, qhkPath, _ := qs.GetOK("path")
if err := o.bindPath(qPath, qhkPath, route.Formats); err != nil {
qPrefix, qhkPrefix, _ := qs.GetOK("prefix")
if err := o.bindPrefix(qPrefix, qhkPrefix, route.Formats); err != nil {
res = append(res, err)
}
@@ -216,10 +216,10 @@ func (o *DeleteObjectParams) bindNonCurrentVersions(rawData []string, hasKey boo
return nil
}
// bindPath binds and validates parameter Path from query.
func (o *DeleteObjectParams) bindPath(rawData []string, hasKey bool, formats strfmt.Registry) error {
// bindPrefix binds and validates parameter Prefix from query.
func (o *DeleteObjectParams) bindPrefix(rawData []string, hasKey bool, formats strfmt.Registry) error {
if !hasKey {
return errors.Required("path", "query", rawData)
return errors.Required("prefix", "query", rawData)
}
var raw string
if len(rawData) > 0 {
@@ -229,10 +229,10 @@ func (o *DeleteObjectParams) bindPath(rawData []string, hasKey bool, formats str
// Required: true
// AllowEmptyValue: false
if err := validate.RequiredString("path", "query", raw); err != nil {
if err := validate.RequiredString("prefix", "query", raw); err != nil {
return err
}
o.Path = raw
o.Prefix = raw
return nil
}

View File

@@ -66,7 +66,7 @@ type DeleteObjectDefault struct {
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
Payload *models.APIError `json:"body,omitempty"`
}
// NewDeleteObjectDefault creates DeleteObjectDefault with default headers values
@@ -92,13 +92,13 @@ func (o *DeleteObjectDefault) SetStatusCode(code int) {
}
// WithPayload adds the payload to the delete object default response
func (o *DeleteObjectDefault) WithPayload(payload *models.Error) *DeleteObjectDefault {
func (o *DeleteObjectDefault) WithPayload(payload *models.APIError) *DeleteObjectDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete object default response
func (o *DeleteObjectDefault) SetPayload(payload *models.Error) {
func (o *DeleteObjectDefault) SetPayload(payload *models.APIError) {
o.Payload = payload
}

View File

@@ -38,7 +38,7 @@ type DeleteObjectURL struct {
AllVersions *bool
Bypass *bool
NonCurrentVersions *bool
Path string
Prefix string
Recursive *bool
VersionID *string
@@ -107,9 +107,9 @@ func (o *DeleteObjectURL) Build() (*url.URL, error) {
qs.Set("non_current_versions", nonCurrentVersionsQ)
}
pathQ := o.Path
if pathQ != "" {
qs.Set("path", pathQ)
prefixQ := o.Prefix
if prefixQ != "" {
qs.Set("prefix", prefixQ)
}
var recursiveQ string

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package bucket
package object
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
@@ -30,40 +30,40 @@ import (
"github.com/minio/console/models"
)
// DisableBucketEncryptionHandlerFunc turns a function with the right signature into a disable bucket encryption handler
type DisableBucketEncryptionHandlerFunc func(DisableBucketEncryptionParams, *models.Principal) middleware.Responder
// DownloadMultipleObjectsHandlerFunc turns a function with the right signature into a download multiple objects handler
type DownloadMultipleObjectsHandlerFunc func(DownloadMultipleObjectsParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn DisableBucketEncryptionHandlerFunc) Handle(params DisableBucketEncryptionParams, principal *models.Principal) middleware.Responder {
func (fn DownloadMultipleObjectsHandlerFunc) Handle(params DownloadMultipleObjectsParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// DisableBucketEncryptionHandler interface for that can handle valid disable bucket encryption params
type DisableBucketEncryptionHandler interface {
Handle(DisableBucketEncryptionParams, *models.Principal) middleware.Responder
// DownloadMultipleObjectsHandler interface for that can handle valid download multiple objects params
type DownloadMultipleObjectsHandler interface {
Handle(DownloadMultipleObjectsParams, *models.Principal) middleware.Responder
}
// NewDisableBucketEncryption creates a new http.Handler for the disable bucket encryption operation
func NewDisableBucketEncryption(ctx *middleware.Context, handler DisableBucketEncryptionHandler) *DisableBucketEncryption {
return &DisableBucketEncryption{Context: ctx, Handler: handler}
// NewDownloadMultipleObjects creates a new http.Handler for the download multiple objects operation
func NewDownloadMultipleObjects(ctx *middleware.Context, handler DownloadMultipleObjectsHandler) *DownloadMultipleObjects {
return &DownloadMultipleObjects{Context: ctx, Handler: handler}
}
/*
DisableBucketEncryption swagger:route POST /buckets/{bucket_name}/encryption/disable Bucket disableBucketEncryption
DownloadMultipleObjects swagger:route POST /buckets/{bucket_name}/objects/download-multiple Object downloadMultipleObjects
Disable bucket encryption.
Download Multiple Objects
*/
type DisableBucketEncryption struct {
type DownloadMultipleObjects struct {
Context *middleware.Context
Handler DisableBucketEncryptionHandler
Handler DownloadMultipleObjectsHandler
}
func (o *DisableBucketEncryption) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
func (o *DownloadMultipleObjects) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewDisableBucketEncryptionParams()
var Params = NewDownloadMultipleObjectsParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package bucket
package object
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
@@ -30,81 +30,67 @@ import (
"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"
)
// NewPutBucketTagsParams creates a new PutBucketTagsParams object
// NewDownloadMultipleObjectsParams creates a new DownloadMultipleObjectsParams object
//
// There are no default values defined in the spec.
func NewPutBucketTagsParams() PutBucketTagsParams {
func NewDownloadMultipleObjectsParams() DownloadMultipleObjectsParams {
return PutBucketTagsParams{}
return DownloadMultipleObjectsParams{}
}
// PutBucketTagsParams contains all the bound params for the put bucket tags operation
// DownloadMultipleObjectsParams contains all the bound params for the download multiple objects operation
// typically these are obtained from a http.Request
//
// swagger:parameters PutBucketTags
type PutBucketTagsParams struct {
// swagger:parameters DownloadMultipleObjects
type DownloadMultipleObjectsParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
Required: true
In: body
*/
Body *models.PutBucketTagsRequest
/*
Required: true
In: path
*/
BucketName string
/*
Required: true
In: body
*/
ObjectList []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 NewPutBucketTagsParams() beforehand.
func (o *PutBucketTagsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
// To ensure default values, the struct must have been initialized with NewDownloadMultipleObjectsParams() beforehand.
func (o *DownloadMultipleObjectsParams) 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.PutBucketTagsRequest
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 runtime.HasBody(r) {
defer r.Body.Close()
var body []string
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("objectList", "body", ""))
} else {
res = append(res, errors.NewParseError("objectList", "body", "", err))
}
} else {
// no validation required on inline body
o.ObjectList = body
}
} else {
res = append(res, errors.Required("objectList", "body", ""))
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
@@ -112,7 +98,7 @@ func (o *PutBucketTagsParams) BindRequest(r *http.Request, route *middleware.Mat
}
// bindBucketName binds and validates parameter BucketName from path.
func (o *PutBucketTagsParams) bindBucketName(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *DownloadMultipleObjectsParams) bindBucketName(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]

Some files were not shown because too many files have changed in this diff Show More