Compare commits

...

139 Commits

Author SHA1 Message Date
Daniel Valdivia
c741e9ccae Release v0.16.2 (#1945)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-05-03 11:33:42 -07:00
jinapurapu
ab835286b0 Add Service Account Policy restriction improvement (#1921) 2022-05-03 11:03:57 -07:00
Alex
6485718a97 Changed Share modal styles (#1942)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-05-02 22:30:48 -05:00
adfost
00bcb54b67 Describe pod API (#1861) 2022-05-02 18:35:36 -07:00
Alex
fef7863810 Adjusted edit / delete tags modal styles (#1939) 2022-05-02 17:01:34 -07:00
jinapurapu
427b9b4892 Integration test for PolicyNameContainsSpace (#1940) 2022-05-02 17:35:01 -05:00
jinapurapu
34adc5451d Disabled Save button on Add Policy Screen if policy name contains space (#1937) 2022-05-02 15:08:11 -07:00
adfost
224e8d4bba More groups tests (#1923) 2022-05-02 11:25:21 -05:00
Prakash Senthil Vel
07d75e19d5 UX KBar Style (#1935) 2022-05-02 11:04:07 -05:00
Daniel Valdivia
31871f54d4 Update HelpBox for Create Bucket. Add spacing. (#1934) 2022-04-30 12:00:58 -07:00
Alex
6069991405 Improvements for download / upload manager (#1933)
- Changed styles on progress bars & items
- Fixed some issues in error state & handling
- Added cancel capability to objects
- Added visual indicators when new objects are added to pool

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-29 20:54:12 -07:00
Daniel Valdivia
a017c71d20 Release v0.16.1 (#1928)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-29 18:55:43 -07:00
Harshavardhana
4001f14953 keep lookupMap for easy reading for relevant publicKey file (#1930)
Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-29 15:14:04 -07:00
Cesar Celis Hernandez
130413cbef having idp configured via env variable only (#1931) 2022-04-29 14:48:21 -07:00
Lenin Alevski
0622cc658b fix: parseTenantCertificates was ignoring cert-manager secrets (#1929)
Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>

Co-authored-by: Cesar Celis Hernandez <celis.hernandez.cesar@gmail.com>
2022-04-29 11:55:07 -07:00
Alex
663a5b196d Remove of suspended traffic warning in profile page (#1926) 2022-04-29 01:45:42 -05:00
Prakash Senthil Vel
6f676f73a4 UX Prometheus dashboard (#1907) 2022-04-28 19:57:16 -07:00
Daniel Valdivia
26d7001ae1 Remove all un-used CSS classes (#1924)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-28 19:33:46 -05:00
Daniel Valdivia
f79a8e8177 FormLayout Component (#1922)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-28 15:13:20 -07:00
Daniel Valdivia
0e5147bb1d Constraint PageLayout to max 1220px on large resolutions (#1919)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-28 14:34:29 -07:00
Lenin Alevski
566fb27fc1 Error and Audit logger webhooks (#1855)
Similar to MinIO now it's possible to configure webhooks to log all
triggered errors and incomming requests via env variables:

```
CONSOLE_LOGGER_WEBHOOK_ENABLE_<ID>
CONSOLE_LOGGER_WEBHOOK_ENDPOINT_<ID>
CONSOLE_LOGGER_WEBHOOK_AUTH_TOKEN_<ID>
CONSOLE_LOGGER_WEBHOOK_CLIENT_CERT_<ID>
CONSOLE_LOGGER_WEBHOOK_CLIENT_KEY_<ID>
CONSOLE_LOGGER_WEBHOOK_QUEUE_SIZE_<ID>

CONSOLE_AUDIT_WEBHOOK_ENABLE_<ID>
CONSOLE_AUDIT_WEBHOOK_ENDPOINT_<ID>
CONSOLE_AUDIT_WEBHOOK_AUTH_TOKEN_<ID>
CONSOLE_AUDIT_WEBHOOK_CLIENT_CERT_<ID>
CONSOLE_AUDIT_WEBHOOK_QUEUE_SIZE_<ID>
```

Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
2022-04-28 12:55:06 -07:00
Lenin Alevski
8c18829089 Update DNS Rebinding etcd vulnerable dependency (#1918)
Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
2022-04-28 14:21:17 -05:00
adfost
c68c175827 committing new tests (#1879) 2022-04-28 11:52:37 -05:00
dependabot[bot]
415088ae2d Bump ejs from 3.1.6 to 3.1.7 in /portal-ui (#1915)
Bumps [ejs](https://github.com/mde/ejs) from 3.1.6 to 3.1.7.
- [Release notes](https://github.com/mde/ejs/releases)
- [Changelog](https://github.com/mde/ejs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mde/ejs/compare/v3.1.6...v3.1.7)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-28 11:00:34 -05:00
adfost
158926f192 groups_test (#1916) 2022-04-28 08:09:06 -07:00
Lenin Alevski
f026ffffc8 Fix profiling endpoint and adding tests (#1917)
Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
2022-04-27 20:07:32 -07:00
Cesar Celis Hernandez
bd0edea3df Increase coverage threshold (#1914) 2022-04-27 16:49:58 -05:00
Alex
07b4dad4d3 Fixed issues with Quota modal (#1911)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-27 14:08:19 -07:00
Cesar Celis Hernandez
0df796bc03 fixing integration tests to use proxy (#1912) 2022-04-27 12:33:10 -07:00
Daniel Valdivia
cf0212391e Console Swagger Module Reorganization (#1881)
Co-authored-by: Alex <33497058+bexsoft@users.noreply.github.com>
Co-authored-by: Prakash Senthil Vel <23444145+prakashsvmx@users.noreply.github.com>
2022-04-27 11:45:04 -07:00
Alex
cb3a695c25 Removed quota from versioning section & added inside summary page (#1910)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-27 09:36:39 -07:00
Daniel Valdivia
3040d468db Release v0.16.0 (#1904) 2022-04-25 15:41:06 -07:00
jinapurapu
9df300b241 Changed from modal to screen for Add Group link on empty Groups screen (#1905) 2022-04-25 15:51:19 -06:00
jinapurapu
870cef7b65 Added error handling for group already existing (#1902) 2022-04-25 15:42:50 -05:00
Daniel Valdivia
d9843d50cd Fix Subpath parsing (#1900) 2022-04-25 15:23:40 -05:00
Alex
9c64c5732b Removed spaces next to breadcrumbs slashes (#1903)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-25 13:12:26 -07:00
Harshavardhana
275d87f302 config set should always use on/off not true/false (#1899)
fixes https://github.com/minio/minio/issues/14516
2022-04-25 07:47:56 -07:00
Daniel Valdivia
509f4953bb update all dependencies (#1853)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-23 08:45:46 -07:00
Alex
63d1fb2abb Added UI for Domains edit (#1897)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-23 10:31:04 -05:00
Alex
b3afa34535 API for domains update (#1889)
* API for domains update

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-23 02:19:14 -05:00
Daniel Valdivia
8203449d92 Format Add Users/Groups, Fix bug on Add Service Account (#1898)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-22 22:36:41 -07:00
Daniel Valdivia
8a96d8d8a5 Fix spacing on Add tenant forms (#1895)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-22 21:59:18 -07:00
jinapurapu
66df609d4a Moved AddUser from modal to screen (#1869)
Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-22 21:40:20 -07:00
jinapurapu
fda090f7dd Created Add Policy screen (#1896) 2022-04-22 23:21:06 -05:00
jinapurapu
74d4c4a3e6 Create Add Group screen (#1890) 2022-04-22 20:50:31 -07:00
Kaan Kabalak
c6798a69d9 Remove duplicate Inspect page path (#1891) 2022-04-22 20:58:40 -05:00
Daniel Valdivia
5a484550fb New Login (#1894)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-22 20:40:57 -05:00
jinapurapu
b567e4855f Create service account screen (#1886) 2022-04-22 19:49:24 -05:00
Kaan Kabalak
c2303f78df Remove redundant Tools path (#1887) 2022-04-21 23:16:06 -05:00
Alex
bbe494f85c Fixed create path issue when object details is open (#1885)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-21 18:28:15 -05:00
Alex
715dbbb92c Fixed Objects list reload after file upload (#1888) 2022-04-21 16:56:18 -06:00
Cesar Celis Hernandez
c2455e3f06 Fixing Permissions Tests Part 2 (#1884) 2022-04-21 17:31:52 -05:00
Alex
997052a872 Fixed breadcrumbs container overflow in object browser (#1880)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-20 21:38:23 -07:00
Daniel Valdivia
3e13e6db98 Small Styling Adjustments. Lists style. (#1870)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-20 14:41:08 -05:00
Cesar Celis Hernandez
3291b3ca45 Test change password response (#1877) 2022-04-20 13:38:49 -05:00
Daniel Valdivia
74ba1c80a9 Fix the relative login redirects (#1872)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-20 12:57:28 -05:00
Alex
af76280f1d Added console & minio domains selector to add tenant wizard (#1863)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-20 12:29:06 -05:00
Cesar Celis Hernandez
9b7fdfd286 Removing unnecessary error check (#1876) 2022-04-20 11:07:16 -05:00
Daniel Valdivia
cefb95dc74 Revert "Create docker-publish.yml (#1789)" (#1875) 2022-04-20 00:31:18 -07:00
Alex
f15a7ff5f6 Added tenant domains to summary page (#1864)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-19 23:31:53 -05:00
Alex
6c123ce2b5 Prettier update to v2.6.2 (#1873)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-19 23:06:05 -05:00
adfost
d7588eaea1 Add policy test (#1874) 2022-04-19 20:39:19 -07:00
Prakash Senthil Vel
8cd756599f Top Bar UX back icon and link (#1860) 2022-04-19 20:56:40 -05:00
Cesar Celis Hernandez
5b25a6cb53 Recalibrating our coverage threshold (#1871) 2022-04-19 20:19:50 -05:00
Prakash Senthil Vel
82a0b67a26 Disable Bucket replication tab when site replication is enabled in Bucket Summary page (#1858) 2022-04-19 17:50:58 -05:00
Alex
1fa6b0a353 Updated insecure dependencies (#1865)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-19 10:34:01 -07:00
Prakash Senthil Vel
46151a5e55 UX basic dashboard (#1866) 2022-04-19 08:16:26 -07:00
adfost
f36c07aa68 Fixing SSO Operator mode showing CONSOLE (#1808) 2022-04-18 15:47:16 -07:00
Daniel Valdivia
86797cda20 Test for Get Object with Preview (#1848)
* Test for Get Object with Preview

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-18 14:03:06 -05:00
Cesar Celis Hernandez
50bc755b44 Test invalid url in getWatchOptionsFromReq() (#1850) 2022-04-18 07:25:21 -07:00
Daniel Valdivia
f02461097b Release v0.15.14 (#1856)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-18 00:46:13 -07:00
Daniel Valdivia
b36aed8845 Adds support to proxy WS requests on Hop (#1857)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-17 23:16:12 -07:00
Daniel Valdivia
991cc0953e Make Login assets and redirects relative (#1854) 2022-04-16 22:05:53 -07:00
Daniel Valdivia
ef4587b596 Create docker-publish.yml (#1789) 2022-04-14 16:13:45 -07:00
Daniel Valdivia
75e2d1d9ce Release v0.15.13 (#1852)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-14 15:53:15 -07:00
Cesar Celis Hernandez
75fc68cd18 correcting error message to be same as our code (#1851) 2022-04-14 14:55:32 -07:00
Prakash Senthil Vel
ae34d886a9 Add site in a new page (#1845) 2022-04-14 13:19:45 -07:00
Daniel Valdivia
f2c187bf7c Fix early context cancellation when downloading/previewing object (#1846)
* Fix early context cancellation when downloading/previewing object
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-14 09:44:08 -07:00
Daniel Valdivia
243e51fe83 Release v0.15.12 (#1843)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-14 00:49:04 -07:00
Prakash Senthil Vel
d1d3d91fc1 Site replication status (#1834)
Site replication status UI
Site replication status ui-test
Address review comment by Alex
Add functional test for API
Add integration tests for status API
2022-04-14 00:21:43 -07:00
Alex
4541b4de03 Added domains item in create tenant & get tenant requests (#1841) 2022-04-14 00:42:38 -06:00
Alex
291e1fce55 Replaced Usage bar in tenant details to display tiers information (#1836)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-13 22:41:38 -07:00
Alex
bbb4090cd8 Remove of non-used console logs (#1842)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-13 21:51:11 -07:00
Alex
a30d29b437 Added URL support to object view (#1831)
- Added URL support to object view
- Refactored & simplified requests

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-13 23:06:31 -05:00
jinapurapu
e6404be02f Added tooltip to prefix field of Add Access Rule modal (#1839) 2022-04-13 19:07:08 -05:00
Cesar Celis Hernandez
5e10719168 Adding test to cover registerAdminArnsHandlers() (#1835) 2022-04-13 07:13:19 -07:00
Lenin Alevski
68f9019d0e Fix: compress health diagnostics file when download (#1821) 2022-04-12 18:29:19 -07:00
Shireesh Anjal
d8e7d343ba Update madmin-go and mc to latest versions (#1832) 2022-04-12 18:41:11 -05:00
Cesar Celis Hernandez
0e5561032c Adding unittest for user_watch.go (#1833) 2022-04-12 16:28:48 -07:00
Daniel Valdivia
fc490a1ca8 Release v0.15.11 (#1830) 2022-04-11 20:32:10 -07:00
Daniel Valdivia
6e6aab580c Replace aws:username, jwt: and ldap: policy variables in session policies (#1828)
* Replace username variable in session policies

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-11 20:01:49 -07:00
Alex
dc5b1963ae Fixed typo in create tenant screen (#1829)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-11 19:13:37 -07:00
Daniel Valdivia
564cfa2201 Remove ResponseHeaderTimeout from default http transport (#1827)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-11 17:18:22 -07:00
Lenin Alevski
398ab028a4 Removing hardcoded timeouts (#1826)
Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
2022-04-11 16:20:30 -07:00
jinapurapu
1de712c099 Added titleIcon to UserAddServiceAccount modal (#1825) 2022-04-11 14:15:20 -07:00
jinapurapu
2d26eb4a70 Updated Tiers help text for consistency with button (#1824) 2022-04-11 12:54:53 -07:00
Cesar Celis Hernandez
e9cc567977 correcting the testing package (#1819) 2022-04-11 09:56:16 -07:00
Daniel Valdivia
ee82748aeb Release v0.15.10 (#1820)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-09 18:05:04 -07:00
Prakash Senthil Vel
ee3affd140 UI site replication (#1807) 2022-04-09 16:27:25 -07:00
dependabot[bot]
836090a0d5 Bump moment from 2.29.1 to 2.29.2 in /portal-ui (#1817)
Signed-off-by: dependabot[bot] <support@github.com>
2022-04-09 00:38:56 -07:00
Alex
e0e5e42af2 Remove duplicated versioned item in breadcrumbs (#1816) 2022-04-08 22:20:25 -06:00
Alex
49f340b5f8 Fixed assign policies screens (#1815) 2022-04-08 09:38:23 -07:00
Alex
404a10d3c7 Added fixed background color to pie chart (#1812)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-07 21:03:17 -07:00
Daniel Valdivia
62e270e95e Tenant Forms alignment. Components Page. (#1811)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-07 20:06:28 -07:00
Alex
bfbaaf12fb Add Edit pool capability (#1806)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-07 19:24:37 -07:00
Lenin Alevski
0aa9c7b36e Updating operator dependency to latest (#1810)
Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
2022-04-07 19:08:35 -07:00
Lenin Alevski
8540168133 Identity Provider screen for TenantDetails (#1809)
- fixing encryption page styles
- removing extra fields on gemalto configuration
- backend endpoints for tenant identity provider details
- force restart tenant pods when identity provider configuration change
- force restart tenant pods when tls certificates change
- existing tls secrets are not deleted from tenant namespace, just removed from the tenant

Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
2022-04-07 18:40:09 -07:00
Daniel Valdivia
02a35fb8d1 Operator UI Adjustments (#1805)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-06 19:08:24 -07:00
Prakash Senthil Vel
4647671f07 UX Basic Dashboard (#1799) 2022-04-05 22:48:35 -07:00
adfost
f30450c3c1 Adding usage objects and versions to tiers (#1796) 2022-04-05 22:31:09 -07:00
CommanderRoot
731501ba27 refactor: replace deprecated String.prototype.substr() (#1800)
.substr() is deprecated so we replace it with functions which work similarily but aren't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-04-05 17:42:20 -05:00
Daniel Valdivia
62a8bf05bb Release v0.15.9 (#1801)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-05 12:30:58 -07:00
Alex
d8754a2e3e Don't display "NaN B" in tenant capacity (#1802)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>

Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-05 11:16:55 -07:00
Alex
64ffa039b4 Operator improvements (#1798)
Added new design to Tenants page list
Added Pool details initial page

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-04-05 09:27:54 -07:00
Daniel Valdivia
822724a4f1 Fix Add Bucket Lifecycle Rule (#1797)
Fix Add Bucket Lifecycle Rule
Fix Edit ILM Rule
Update Bucket ILM Rules Listing

Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-04-04 19:13:59 -07:00
Prakash Senthil Vel
c18c843d03 UX code mirror button colors (#1792) 2022-04-04 14:18:02 -05:00
jinapurapu
1d362aceaf Added node and type selector UI to Error Logs screen (#1715) 2022-04-04 11:54:03 -07:00
Daniel Valdivia
6f5cb4d1a5 Make Bucket Icon Browse the bucket (#1795) 2022-04-04 10:25:46 -07:00
Harshavardhana
2cefa0860d update for go mod tidy 2022-04-03 13:05:57 -07:00
Cesar Celis Hernandez
ea0c83ea74 Node Labels Test (#1787) 2022-03-31 18:35:25 -06:00
Daniel Valdivia
90f64b685e Release v0.15.8 (#1786) 2022-03-31 17:06:27 -07:00
Daniel Valdivia
62f925d93c Remove Autocapitalizing CSS (#1785)
Remove Autocapitalizing CSS
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-03-31 15:58:40 -07:00
Alex
1985c110b1 Not show objects with the same path (#1784)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-03-31 13:49:55 -07:00
Prakash Senthil Vel
461bc94a0b UX Trace Screen (#1781) 2022-03-31 12:05:10 -07:00
Aditya Manthramurthy
aaa55a1f4a Fix authorization code flow handling (#1767)
Remove checking for unnecessary response types - this has been causing a regression since MinIO release RELEASE.2022-03-03T21-21-16Z
2022-03-31 11:21:32 -07:00
Prakash Senthil Vel
2eecabf5e6 Site replication API (#1773)
Site replication API
tests in CI/CL environment
2022-03-31 10:11:01 -07:00
Lenin Alevski
fba9bd87df TLS Certificate React component (#1780)
Add support to parse multiple blocks on pem certificate
Added react tls certificate component

Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>
2022-03-31 09:56:39 -07:00
Alex
bf461b8b27 Migrated AddPool modal to be a single page (#1782)
Also included extra fields configuration

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-03-31 10:24:21 -06:00
Alex
301c4a83b5 Changed breadcrumbs bar position (#1783)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-03-30 21:27:08 -07:00
Alex
87468571ae Changed Size column width in object browser (#1779)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-03-30 09:30:35 -07:00
Alex
7ad2df3e7f Fixed loader for LinearGraphWidget (#1778)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
2022-03-30 09:14:21 -07:00
Daniel Valdivia
baef7b5ec0 Release v0.15.7 (#1776)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-03-29 14:20:00 -07:00
Prakash Senthil Vel
fa8c59360a Fix sidebar navigation state (#1775)
Fix sidebar navigation state
2022-03-29 09:31:54 -07:00
Lenin Alevski
ceeacd2167 fix: pass original http response code to proxy response (#1772)
Signed-off-by: Lenin Alevski <alevsk.8772@gmail.com>

Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-03-28 17:19:15 -07:00
Cesar Celis Hernandez
70214a6578 List Users With Access to a Given Bucket Integration Test (#1771)
List Users With Access to a Given Bucket Integration Test
Incrementing coverage threshold
2022-03-28 16:12:52 -07:00
adfost
d1a5e5ba57 Adding delete remote bucket functionality (#1762) 2022-03-28 15:36:23 -07:00
jinapurapu
fcd50257ee Updated BasicDashboard UI to expand drives initially if single server (#1768) 2022-03-26 15:25:14 -07:00
Cesar Celis Hernandez
2765fb0c97 Get objects in a bucket for a rewind date Test (#1766)
* Get objects in a bucket for a rewind date Test

* Incrementing the coverage
2022-03-25 11:34:29 -06:00
Cesar Celis Hernandez
d22f345d4a SSO Integration Test (#1742) 2022-03-24 20:11:42 -07:00
1510 changed files with 49746 additions and 14732 deletions

View File

@@ -65,7 +65,7 @@ function main() {
check_tenant_status tenant-lite storage-lite
kubectl -n minio-operator port-forward svc/console 9090 &
kubectl proxy &
}
main "$@"

View File

@@ -16,6 +16,142 @@ concurrency:
jobs:
replication:
name: Site Replication Test
needs:
- lint-job
- no-warnings-and-make-assets
- reuse-golang-dependencies
- vulnerable-dependencies-checks
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.17.x ]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
# To build minio image, we need to clone the repository first
- name: clone https://github.com/minio/minio
uses: actions/checkout@master
with:
# Repository name with owner. For example, actions/checkout
# Default: ${{ github.repository }}
repository: minio/minio
# Relative path under $GITHUB_WORKSPACE to place the repository
# To have two repositories under the same test
path: 'minio_repository'
- uses: actions/cache@v2
name: Go Mod Cache
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ github.run_id }}
- name: Build on ${{ matrix.os }}
run: |
echo "The idea is to build minio image from downloaded repository";
cd $GITHUB_WORKSPACE/minio_repository;
echo "Get git version to build MinIO Image";
VERSION=`git rev-parse HEAD`;
echo $VERSION;
echo "Create minio image";
make docker VERSION=$VERSION;
echo "Jumping back to console repository to run the integration test"
cd $GITHUB_WORKSPACE;
echo "We are going to use the built image on test-integration";
VERSION="minio/minio:$VERSION";
echo $VERSION;
make test-replication MINIO_VERSION=$VERSION;
- uses: actions/cache@v2
id: coverage-cache-replication
name: Coverage Cache Replication
with:
path: |
./replication/coverage/
key: ${{ runner.os }}-replication-coverage-2-${{ github.run_id }}
sso-integration:
name: SSO Integration Test
needs:
- lint-job
- no-warnings-and-make-assets
- reuse-golang-dependencies
- vulnerable-dependencies-checks
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.17.x ]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
# To build minio image, we need to clone the repository first
- name: clone https://github.com/minio/minio
uses: actions/checkout@master
with:
# Repository name with owner. For example, actions/checkout
# Default: ${{ github.repository }}
repository: minio/minio
# Relative path under $GITHUB_WORKSPACE to place the repository
# To have two repositories under the same test
path: 'minio_repository'
- uses: actions/cache@v2
name: Go Mod Cache
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ github.run_id }}
- name: Build on ${{ matrix.os }}
run: |
echo "The idea is to build minio image from downloaded repository";
cd $GITHUB_WORKSPACE/minio_repository;
echo "Get git version to build MinIO Image";
VERSION=`git rev-parse HEAD`;
echo $VERSION;
echo "Create minio image";
make docker VERSION=$VERSION;
echo "Jumping back to console repository to run the integration test"
cd $GITHUB_WORKSPACE;
echo "We are going to use the built image on test-integration";
VERSION="minio/minio:$VERSION";
echo $VERSION;
make test-sso-integration MINIO_VERSION=$VERSION;
- uses: actions/cache@v2
id: coverage-cache-sso
name: Coverage Cache SSO
with:
path: |
./sso-integration/coverage/
key: ${{ runner.os }}-sso-coverage-2-${{ github.run_id }}
c-operator-api-tests:
name: Operator API Tests
@@ -442,6 +578,210 @@ jobs:
make cleanup-permissions
all-permissions-4:
name: Permissions Tests Part 4
needs:
- lint-job
- no-warnings-and-make-assets
- reuse-golang-dependencies
- vulnerable-dependencies-checks
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
matrix:
go-version: [ 1.17.x ]
os: [ ubuntu-latest ]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
name: Yarn Cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
./portal-ui/node_modules/
./portal-ui/build/
key: ${{ runner.os }}-yarn-${{ hashFiles('./portal-ui/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v2
id: assets-cache
name: Assets Cache
with:
path: |
./portal-ui/build/
key: ${{ runner.os }}-assets-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-assets-
- uses: actions/cache@v2
name: Go Mod Cache
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ github.run_id }}
- name: Build Console on ${{ matrix.os }}
env:
GO111MODULE: on
GOOS: linux
run: |
make console
- name: Start Console, front-end app and initialize users/policies
run: |
(./console server) & (make initialize-permissions)
- name: Run TestCafe Tests
timeout-minutes: 5
uses: DevExpress/testcafe-action@latest
with:
args: '"chrome:headless" portal-ui/tests/permissions-4/ --skip-js-errors'
all-permissions-5:
name: Permissions Tests Part 5
needs:
- lint-job
- no-warnings-and-make-assets
- reuse-golang-dependencies
- vulnerable-dependencies-checks
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [ 1.17.x ]
os: [ ubuntu-latest ]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
name: Yarn Cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
./portal-ui/node_modules/
./portal-ui/build/
key: ${{ runner.os }}-yarn-${{ hashFiles('./portal-ui/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v2
id: assets-cache
name: Assets Cache
with:
path: |
./portal-ui/build/
key: ${{ runner.os }}-assets-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-assets-
- uses: actions/cache@v2
name: Go Mod Cache
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ github.run_id }}
- name: Build Console on ${{ matrix.os }}
env:
GO111MODULE: on
GOOS: linux
run: |
make console
- name: Start Console, front-end app and initialize users/policies
run: |
(./console server) & (make initialize-permissions)
- name: Run TestCafe Tests
timeout-minutes: 5
uses: DevExpress/testcafe-action@latest
with:
args: '"chrome:headless" portal-ui/tests/permissions-5/ --skip-js-errors'
all-permissions-6:
name: Permissions Tests Part 6
needs:
- lint-job
- no-warnings-and-make-assets
- reuse-golang-dependencies
- vulnerable-dependencies-checks
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [ 1.17.x ]
os: [ ubuntu-latest ]
steps:
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
id: go
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache
name: Yarn Cache
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
./portal-ui/node_modules/
./portal-ui/build/
key: ${{ runner.os }}-yarn-${{ hashFiles('./portal-ui/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v2
id: assets-cache
name: Assets Cache
with:
path: |
./portal-ui/build/
key: ${{ runner.os }}-assets-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-assets-
- uses: actions/cache@v2
name: Go Mod Cache
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ github.run_id }}
- name: Build Console on ${{ matrix.os }}
env:
GO111MODULE: on
GOOS: linux
run: |
make console
- name: Start Console, front-end app and initialize users/policies
run: |
(./console server) & (make initialize-permissions)
- name: Run TestCafe Tests
timeout-minutes: 5
uses: DevExpress/testcafe-action@latest
with:
args: '"chrome:headless" portal-ui/tests/permissions-6/ --skip-js-errors'
all-operator-tests:
name: Operator UI Tests
@@ -912,6 +1252,8 @@ jobs:
- test-restapi-on-go
- c-operator-api-tests
- test-pkg-on-go
- sso-integration
- replication
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -946,6 +1288,22 @@ jobs:
./integration/coverage/
key: ${{ runner.os }}-coverage-2-${{ github.run_id }}
- uses: actions/cache@v2
id: coverage-cache-sso
name: Coverage Cache SSO
with:
path: |
./sso-integration/coverage/
key: ${{ runner.os }}-sso-coverage-2-${{ github.run_id }}
- uses: actions/cache@v2
id: coverage-cache-replication
name: Coverage Cache Replication
with:
path: |
./replication/coverage/
key: ${{ runner.os }}-replication-coverage-2-${{ github.run_id }}
- uses: actions/cache@v2
id: coverage-cache-operator
name: Coverage Cache Operator
@@ -981,14 +1339,14 @@ jobs:
echo "go build gocoverage.go"
go build gocovmerge.go
echo "put together the outs for final coverage resolution"
./gocovmerge ../integration/coverage/system.out ../restapi/coverage/coverage.out ../pkg/coverage/coverage-pkg.out ../operator-integration/coverage/operator-api.out > all.out
./gocovmerge ../integration/coverage/system.out ../replication/coverage/replication.out ../sso-integration/coverage/sso-system.out ../restapi/coverage/coverage.out ../pkg/coverage/coverage-pkg.out ../operator-integration/coverage/operator-api.out > all.out
echo "grep to obtain the result"
go tool cover -func=all.out | grep total > tmp2
result=`cat tmp2 | awk 'END {print $3}'`
result=${result%\%}
echo "result:"
echo $result
threshold=52.7
threshold=41.2
if (( $(echo "$result >= $threshold" |bc -l) )); then
echo "It is equal or greater than threshold, passed!"
else

1
.gitignore vendored
View File

@@ -19,6 +19,7 @@ vendor/
# Ignore executables
target/
!pkg/logger/target/
console
!console/

View File

@@ -80,10 +80,103 @@ test-integration:
@(docker stop minio)
@(docker network rm mynet123)
test-replication:
@(docker stop minio || true)
@(docker stop minio1 || true)
@(docker stop minio2 || true)
@(docker network rm mynet123 || true)
@(docker network create mynet123)
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 \
--net=mynet123 -d \
--name minio \
--rm \
-p 9000:9000 \
-p 6000:6000 \
-e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= \
-e MINIO_ROOT_USER="minioadmin" \
-e MINIO_ROOT_PASSWORD="minioadmin" \
$(MINIO_VERSION) server /data{1...4} \
--address :9000 \
--console-address :6000)
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 \
--net=mynet123 -d \
--name minio1 \
--rm \
-p 9001:9001 \
-p 6001:6001 \
-e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= \
-e MINIO_ROOT_USER="minioadmin" \
-e MINIO_ROOT_PASSWORD="minioadmin" \
$(MINIO_VERSION) server /data{1...4} \
--address :9001 \
--console-address :6001)
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 \
--net=mynet123 -d \
--name minio2 \
--rm \
-p 9002:9002 \
-p 6002:6002 \
-e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= \
-e MINIO_ROOT_USER="minioadmin" \
-e MINIO_ROOT_PASSWORD="minioadmin" \
$(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)
@(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 "execute latest keycloak container"
@(docker run \
--rm \
--name keycloak-container \
--network my-net \
-p 8080:8080 \
-e KEYCLOAK_USER=admin \
-e KEYCLOAK_PASSWORD=admin jboss/keycloak:latest -b 0.0.0.0 -bprivate 127.0.0.1 &)
@echo "wait 60 sec until keycloak is listenning on port, then go for minio server"
@(sleep 60)
@echo "execute keycloak-config-cli container to configure keycloak for Single Sign On with MinIO"
@(docker run \
--rm \
--network my-net \
--name keycloak-config-cli \
-e KEYCLOAK_URL=http://keycloak-container:8080/auth \
-e KEYCLOAK_USER="admin" \
-e KEYCLOAK_PASSWORD="admin" \
-e KEYCLOAK_AVAILABILITYCHECK_ENABLED=true \
-e KEYCLOAK_AVAILABILITYCHECK_TIMEOUT=120s \
-e IMPORT_FILES_LOCATIONS='/config/realm-export.json' \
-v /home/runner/work/console/console/sso-integration/config:/config \
adorsys/keycloak-config-cli: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_SECRET=0nfJuqIt0iPnRIUJkvetve5l38C6gi9W \
-e MINIO_IDENTITY_OPENID_CONFIG_URL=http://keycloak-container:8080/auth/realms/myrealm/.well-known/openid-configuration \
-e MINIO_IDENTITY_OPENID_CLIENT_ID="account" \
-e MINIO_ROOT_USER=minio \
-e MINIO_ROOT_PASSWORD=minio123 $(MINIO_VERSION) server /data{1...4} --address :9000 --console-address :9001)
@echo "starting bash script"
@(env bash $(PWD)/sso-integration/set-sso.sh)
@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-operator-integration:
@(echo "Start cd operator-integration && go test:")
@(pwd)
@(cd operator-integration && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && ./operator-integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/operator-api.out)
@(cd operator-integration && go test -coverpkg=../operatorapi -c -tags testrunmain . && mkdir -p coverage && ./operator-integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/operator-api.out)
test-operator:
@(env bash $(PWD)/portal-ui/tests/scripts/operator.sh)

View File

@@ -23,6 +23,8 @@ import (
"strings"
"time"
xhttp "github.com/minio/console/pkg/http"
"github.com/minio/console/pkg/utils"
"github.com/minio/pkg/env"
@@ -68,7 +70,7 @@ func GetMinioImage() (*string, error) {
return &image, nil
}
latestMinIOImage, errLatestMinIOImage := utils.GetLatestMinIOImage(
&utils.HTTPClient{
&xhttp.Client{
Client: &http.Client{
Timeout: 5 * time.Second,
},

View File

@@ -20,10 +20,14 @@
package main
import (
"context"
"fmt"
"os"
"strconv"
"time"
"github.com/minio/console/pkg/logger"
"github.com/minio/cli"
"github.com/minio/console/restapi"
)
@@ -36,15 +40,28 @@ var appCmds = []cli.Command{
// StartServer starts the console service
func StartServer(ctx *cli.Context) error {
if os.Getenv("CONSOLE_OPERATOR_MODE") != "" && os.Getenv("CONSOLE_OPERATOR_MODE") == "on" {
return startOperatorServer(ctx)
}
// Load all certificates
if err := loadAllCerts(ctx); err != nil {
// Log this as a warning and continue running console without TLS certificates
restapi.LogError("Unable to load certs: %v", err)
}
xctx := context.Background()
transport := restapi.PrepareSTSClientTransport(false)
if err := logger.InitializeLogger(xctx, transport); err != nil {
fmt.Println("error InitializeLogger", err)
logger.CriticalIf(xctx, err)
}
// custom error configuration
restapi.LogInfo = logger.Info
restapi.LogError = logger.Error
restapi.LogIf = logger.LogIf
if os.Getenv("CONSOLE_OPERATOR_MODE") != "" && os.Getenv("CONSOLE_OPERATOR_MODE") == "on" {
return startOperatorServer(ctx)
}
var rctx restapi.Context
if err := rctx.Load(ctx); err != nil {
restapi.LogError("argument validation failed: %v", err)

View File

@@ -20,9 +20,13 @@
package main
import (
"context"
"fmt"
"strconv"
"time"
"github.com/minio/console/pkg/logger"
"github.com/minio/cli"
"github.com/minio/console/restapi"
)
@@ -39,6 +43,17 @@ func StartServer(ctx *cli.Context) error {
restapi.LogError("Unable to load certs: %v", err)
}
xctx := context.Background()
transport := restapi.PrepareSTSClientTransport(false)
if err := logger.InitializeLogger(xctx, transport); err != nil {
fmt.Println("error InitializeLogger", err)
logger.CriticalIf(xctx, err)
}
// custom error configuration
restapi.LogInfo = logger.Info
restapi.LogError = logger.Error
restapi.LogIf = logger.LogIf
var rctx restapi.Context
if err := rctx.Load(ctx); err != nil {
restapi.LogError("argument validation failed: %v", err)

View File

@@ -2,7 +2,7 @@
// +build operator
// This file is part of MinIO Console Server
// Copyright (c) 2021 MinIO, Inc.
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
@@ -20,6 +20,7 @@
package main
import (
"context"
"fmt"
"io/ioutil"
"path/filepath"
@@ -27,6 +28,8 @@ import (
"syscall"
"time"
"github.com/minio/console/pkg/logger"
"github.com/minio/console/restapi"
"github.com/go-openapi/loads"
@@ -106,7 +109,7 @@ func buildOperatorServer() (*operatorapi.Server, error) {
}
api := operations.NewOperatorAPI(swaggerSpec)
api.Logger = operatorapi.LogInfo
api.Logger = restapi.LogInfo
server := operatorapi.NewServer(api)
parser := flags.NewParser(server, flags.Default)
@@ -147,7 +150,7 @@ func loadOperatorAllCerts(ctx *cli.Context) error {
}
// load the certificates and the CAs
operatorapi.GlobalRootCAs, operatorapi.GlobalPublicCerts, operatorapi.GlobalTLSCertsManager, err = certs.GetAllCertificatesAndCAs()
restapi.GlobalRootCAs, restapi.GlobalPublicCerts, restapi.GlobalTLSCertsManager, err = certs.GetAllCertificatesAndCAs()
if err != nil {
return fmt.Errorf("unable to load certificates at %s: failed with %w", certs.GlobalCertsDir.Get(), err)
}
@@ -159,12 +162,12 @@ func loadOperatorAllCerts(ctx *cli.Context) error {
swaggerServerCACertificate := ctx.String("tls-ca")
// load tls cert and key from swagger server tls-certificate and tls-key flags
if swaggerServerCertificate != "" && swaggerServerCertificateKey != "" {
if err = operatorapi.GlobalTLSCertsManager.AddCertificate(swaggerServerCertificate, swaggerServerCertificateKey); err != nil {
if err = restapi.GlobalTLSCertsManager.AddCertificate(swaggerServerCertificate, swaggerServerCertificateKey); err != nil {
return err
}
x509Certs, err := certs.ParsePublicCertFile(swaggerServerCertificate)
if err == nil {
operatorapi.GlobalPublicCerts = append(operatorapi.GlobalPublicCerts, x509Certs...)
restapi.GlobalPublicCerts = append(restapi.GlobalPublicCerts, x509Certs...)
}
}
@@ -172,7 +175,7 @@ func loadOperatorAllCerts(ctx *cli.Context) error {
if swaggerServerCACertificate != "" {
caCert, caCertErr := ioutil.ReadFile(swaggerServerCACertificate)
if caCertErr == nil {
operatorapi.GlobalRootCAs.AppendCertsFromPEM(caCert)
restapi.GlobalRootCAs.AppendCertsFromPEM(caCert)
}
}
}
@@ -186,20 +189,32 @@ func loadOperatorAllCerts(ctx *cli.Context) error {
// StartServer starts the console service
func startOperatorServer(ctx *cli.Context) error {
if err := loadOperatorAllCerts(ctx); err != nil {
if err := loadAllCerts(ctx); err != nil {
// Log this as a warning and continue running console without TLS certificates
operatorapi.LogError("Unable to load certs: %v", err)
restapi.LogError("Unable to load certs: %v", err)
}
xctx := context.Background()
transport := restapi.PrepareSTSClientTransport(false)
if err := logger.InitializeLogger(xctx, transport); err != nil {
fmt.Println("error InitializeLogger", err)
logger.CriticalIf(xctx, err)
}
// custom error configuration
restapi.LogInfo = logger.Info
restapi.LogError = logger.Error
restapi.LogIf = logger.LogIf
var rctx operatorapi.Context
if err := rctx.Load(ctx); err != nil {
operatorapi.LogError("argument validation failed: %v", err)
restapi.LogError("argument validation failed: %v", err)
return err
}
server, err := buildOperatorServer()
if err != nil {
operatorapi.LogError("Unable to initialize console server: %v", err)
restapi.LogError("Unable to initialize console server: %v", err)
return err
}
@@ -212,7 +227,7 @@ func startOperatorServer(ctx *cli.Context) error {
operatorapi.Port = strconv.Itoa(server.Port)
operatorapi.Hostname = server.Host
if len(operatorapi.GlobalPublicCerts) > 0 {
if len(restapi.GlobalPublicCerts) > 0 {
// If TLS certificates are provided enforce the HTTPS schema, meaning console will redirect
// plain HTTP connections to HTTPS server
server.EnabledListeners = []string{"http", "https"}

55
go.mod
View File

@@ -6,46 +6,48 @@ require (
github.com/blang/semver/v4 v4.0.0
github.com/cheggaaa/pb/v3 v3.0.8
github.com/dustin/go-humanize v1.0.0
github.com/fatih/color v1.13.0
github.com/go-openapi/errors v0.20.2
github.com/go-openapi/loads v0.21.1
github.com/go-openapi/runtime v0.23.1
github.com/go-openapi/spec v0.20.4
github.com/go-openapi/runtime v0.23.3
github.com/go-openapi/spec v0.20.5
github.com/go-openapi/strfmt v0.21.2
github.com/go-openapi/swag v0.21.1
github.com/go-openapi/validate v0.21.0
github.com/golang-jwt/jwt/v4 v4.3.0
github.com/golang-jwt/jwt/v4 v4.4.1
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.5.0
github.com/jessevdk/go-flags v1.5.0
github.com/klauspost/compress v1.14.4
github.com/klauspost/compress v1.15.1
github.com/minio/cli v1.22.0
github.com/minio/kes v0.18.0
github.com/minio/madmin-go v1.3.5
github.com/minio/mc v0.0.0-20220302011226-f13defa54577
github.com/minio/minio-go/v7 v7.0.23
github.com/minio/operator v0.0.0-20220322220228-ae7a32a7c19e
github.com/minio/pkg v1.1.20
github.com/minio/highwayhash v1.0.2
github.com/minio/kes v0.19.2
github.com/minio/madmin-go v1.3.12
github.com/minio/mc v0.0.0-20220419155441-cc4ff3a0cc82
github.com/minio/minio-go/v7 v7.0.24
github.com/minio/operator v0.0.0-20220414212219-ba4c097324b2
github.com/minio/pkg v1.1.21
github.com/minio/selfupdate v0.4.0
github.com/mitchellh/go-homedir v1.1.0
github.com/rs/xid v1.3.0
github.com/rs/xid v1.4.0
github.com/secure-io/sio-go v0.3.1
github.com/stretchr/testify v1.7.0
github.com/stretchr/testify v1.7.1
github.com/tidwall/gjson v1.14.0
github.com/unrolled/secure v1.10.0
golang.org/x/crypto v0.0.0-20220214200702-86341886e292
golang.org/x/net v0.0.0-20220225172249-27dd8689420f
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
golang.org/x/net v0.0.0-20220421235706-1d1ef9303861
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.23.4
k8s.io/apimachinery v0.23.4
k8s.io/client-go v0.23.4
k8s.io/api v0.23.5
k8s.io/apimachinery v0.23.5
k8s.io/client-go v0.23.5
)
require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/briandowns/spinner v1.18.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/charmbracelet/bubbles v0.10.3 // indirect
github.com/charmbracelet/bubbletea v0.20.0 // indirect
@@ -58,7 +60,6 @@ require (
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
github.com/gdamore/tcell/v2 v2.4.1-0.20210905002822-f057f0a857a1 // indirect
@@ -66,7 +67,7 @@ require (
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/analysis v0.21.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/goccy/go-json v0.9.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
@@ -75,7 +76,6 @@ require (
github.com/google/go-cmp v0.5.7 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
@@ -97,8 +97,7 @@ require (
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/minio/argon2 v1.0.0 // indirect
github.com/minio/colorjson v1.0.1 // indirect
github.com/minio/colorjson v1.0.2 // indirect
github.com/minio/filepath v1.0.0 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
@@ -111,7 +110,7 @@ require (
github.com/navidys/tvxwidgets v0.1.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/philhofer/fwd v1.1.1 // indirect
github.com/philhofer/fwd v1.1.2-0.20210722190033-5c56ac6d0bb9 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/xattr v0.4.5 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
@@ -128,7 +127,7 @@ require (
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tinylib/msgp v1.1.6 // indirect
github.com/tinylib/msgp v1.1.7-0.20211026165309-e818a1881b0e // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
@@ -140,7 +139,7 @@ require (
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9 // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect

991
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -55,6 +55,29 @@ func RestartService() (*http.Response, error) {
return response, err
}
func GetNodes() (*http.Response, error) {
/*
Helper function to get nodes
HTTP Verb: GET
URL: /api/v1/nodes
*/
request, err := http.NewRequest(
"GET",
"http://localhost:9090/api/v1/nodes",
nil,
)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
client := &http.Client{
Timeout: 2000 * time.Second, // increased timeout since restart takes time, more than other APIs.
}
response, err := client.Do(request)
return response, err
}
func NotifyPostgres() (*http.Response, error) {
/*
Helper function to add Postgres Notification
@@ -213,3 +236,105 @@ func TestListPoliciesWithBucket(t *testing.T) {
}
}
func ListUsersWithAccessToBucket(bucketName string) (*http.Response, error) {
/*
Helper function to List Users With Access to a Given Bucket
HTTP Verb: GET
URL: /bucket-users/{bucket}
*/
request, err := http.NewRequest(
"GET", "http://localhost:9090/api/v1/bucket-users/"+bucketName, nil)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
client := &http.Client{
Timeout: 2 * time.Second,
}
response, err := client.Do(request)
return response, err
}
func TestListUsersWithAccessToBucket(t *testing.T) {
// Test Variables
bucketName := "testlistuserswithaccesstobucket1"
assert := assert.New(t)
// Test
response, err := ListUsersWithAccessToBucket(bucketName)
assert.Nil(err)
if err != nil {
log.Println(err)
return
}
parsedResponse := inspectHTTPResponse(response)
if response != nil {
assert.Equal(
200,
response.StatusCode,
parsedResponse,
)
}
}
func TestGetNodes(t *testing.T) {
assert := assert.New(t)
getNodesResponse, getNodesError := GetNodes()
assert.Nil(getNodesError)
if getNodesError != nil {
log.Println(getNodesError)
return
}
addObjRsp := inspectHTTPResponse(getNodesResponse)
if getNodesResponse != nil {
assert.Equal(
200,
getNodesResponse.StatusCode,
addObjRsp,
)
}
}
func ArnList() (*http.Response, error) {
/*
Helper function to get arn list
HTTP Verb: GET
URL: /api/v1/admin/arns
*/
request, err := http.NewRequest(
"GET", "http://localhost:9090/api/v1/admin/arns", nil)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
client := &http.Client{
Timeout: 2 * time.Second,
}
response, err := client.Do(request)
return response, err
}
func TestArnList(t *testing.T) {
assert := assert.New(t)
resp, err := ArnList()
assert.Nil(err)
if err != nil {
log.Println(err)
return
}
objRsp := inspectHTTPResponse(resp)
if resp != nil {
assert.Equal(
200,
resp.StatusCode,
objRsp,
)
}
}

View File

@@ -0,0 +1,83 @@
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package integration
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func Test_ConfigAPI(t *testing.T) {
assert := assert.New(t)
type args struct {
api string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Config - Valid",
args: args{
api: "/configs",
},
expectedStatus: 200,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataPolicy := map[string]interface{}{}
requestDataJSON, _ := json.Marshal(requestDataPolicy)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
}
})
}
}

365
integration/groups_test.go Normal file
View File

@@ -0,0 +1,365 @@
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package integration
import (
"bytes"
"encoding/json"
"fmt"
"log"
"net/http"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func Test_AddGroupAPI(t *testing.T) {
assert := assert.New(t)
AddUser("member1", "testtest", []string{}, []string{"consoleAdmin"})
type args struct {
group string
members []string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Create Group - Valid",
args: args{
group: "test",
members: []string{"member1"},
},
expectedStatus: 201,
expectedError: nil,
},
{
name: "Create Group - Invalid",
args: args{
group: "test",
members: []string{},
},
expectedStatus: 400,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataPolicy := map[string]interface{}{}
requestDataPolicy["group"] = tt.args.group
requestDataPolicy["members"] = tt.args.members
requestDataJSON, _ := json.Marshal(requestDataPolicy)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"POST", "http://localhost:9090/api/v1/groups", requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect")
}
})
}
}
func Test_GetGroupAPI(t *testing.T) {
assert := assert.New(t)
AddUser("member2", "testtest", []string{}, []string{"consoleAdmin"})
AddGroup("getgroup1", []string{"member2"})
type args struct {
api string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Get Group - Valid",
args: args{
api: "?name=getgroup1",
},
expectedStatus: 200,
expectedError: nil,
},
{
name: "Get Group - Invalid",
args: args{
api: "?name=askfjalkd",
},
expectedStatus: 500,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataPolicy := map[string]interface{}{}
requestDataJSON, _ := json.Marshal(requestDataPolicy)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"GET", fmt.Sprintf("http://localhost:9090/api/v1/group%s", tt.args.api), requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect")
}
})
}
}
func Test_ListGroupsAPI(t *testing.T) {
assert := assert.New(t)
tests := []struct {
name string
expectedStatus int
expectedError error
}{
{
name: "Get Group - Valid",
expectedStatus: 200,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataPolicy := map[string]interface{}{}
requestDataJSON, _ := json.Marshal(requestDataPolicy)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"GET", "http://localhost:9090/api/v1/groups", requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect")
}
})
}
}
func Test_PutGroupsAPI(t *testing.T) {
assert := assert.New(t)
AddUser("member3", "testtest", []string{}, []string{"consoleAdmin"})
AddGroup("putgroup1", []string{})
type args struct {
api string
members []string
status string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Put Group - Valid",
args: args{
api: "?name=putgroup1",
members: []string{"member3"},
status: "enabled",
},
expectedStatus: 200,
expectedError: nil,
},
{
name: "Put Group - Invalid",
args: args{
api: "?name=gdgfdfgd",
members: []string{"member3"},
status: "enabled",
},
expectedStatus: 500,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataPolicy := map[string]interface{}{}
requestDataPolicy["members"] = tt.args.members
requestDataPolicy["status"] = tt.args.status
requestDataJSON, _ := json.Marshal(requestDataPolicy)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"PUT", fmt.Sprintf("http://localhost:9090/api/v1/group%s", tt.args.api), requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect")
}
})
}
}
func Test_DeleteGroupAPI(t *testing.T) {
assert := assert.New(t)
AddGroup("grouptests1", []string{})
type args struct {
api string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
verb string
}{
{
name: "Delete Group - Valid",
args: args{
api: "?name=grouptests1",
},
verb: "DELETE",
expectedStatus: 204,
expectedError: nil,
},
{
name: "Delete Group - Invalid",
args: args{
api: "?name=grouptests12345",
},
verb: "DELETE",
expectedStatus: 404,
expectedError: nil,
},
{
name: "Access Group After Delete - Invalid",
args: args{
api: "?name=grouptests1",
},
verb: "GET",
expectedStatus: 500,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataPolicy := map[string]interface{}{}
requestDataJSON, _ := json.Marshal(requestDataPolicy)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
tt.verb, fmt.Sprintf("http://localhost:9090/api/v1/group%s", tt.args.api), requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect")
}
})
}
}

View File

@@ -17,7 +17,9 @@
package integration
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
@@ -70,3 +72,66 @@ func TestLoginStrategy(t *testing.T) {
}
}
func TestLogout(t *testing.T) {
assert := assert.New(t)
// image for now:
// minio: 9000
// console: 9090
client := &http.Client{
Timeout: 2 * time.Second,
}
requestData := map[string]string{
"accessKey": "minioadmin",
"secretKey": "minioadmin",
}
requestDataJSON, _ := json.Marshal(requestData)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/login", requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
assert.NotNil(response, "Login response is nil")
assert.Nil(err, "Login errored out")
var loginToken string
for _, cookie := range response.Cookies() {
if cookie.Name == "token" {
loginToken = cookie.Value
break
}
}
if loginToken == "" {
log.Println("authentication token not found in cookies response")
return
}
request, err = http.NewRequest("POST", "http://localhost:9090/api/v1/logout", requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", loginToken))
request.Header.Add("Content-Type", "application/json")
response, err = client.Do(request)
assert.NotNil(response, "Logout response is nil")
assert.Nil(err, "Logout errored out")
assert.Equal(response.StatusCode, 200)
}

198
integration/objects_test.go Normal file
View File

@@ -0,0 +1,198 @@
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package integration
import (
"context"
"encoding/base64"
"fmt"
"log"
"math/rand"
"net/http"
"strings"
"testing"
"time"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/stretchr/testify/assert"
)
func TestObjectGet(t *testing.T) {
// for setup we'll create a bucket and upload a file
endpoint := "localhost:9000"
accessKeyID := "minioadmin"
secretAccessKey := "minioadmin"
// Initialize minio client object.
minioClient, err := minio.New(endpoint, &minio.Options{
Creds: credentials.NewStaticV4(accessKeyID, secretAccessKey, ""),
Secure: false,
})
if err != nil {
log.Fatalln(err)
}
bucketName := fmt.Sprintf("testbucket-%d", rand.Intn(1000-1)+1)
err = minioClient.MakeBucket(context.Background(), bucketName, minio.MakeBucketOptions{Region: "us-east-1", ObjectLocking: true})
if err != nil {
fmt.Println(err)
}
// upload a simple file
fakeFile := "12345678"
fileReader := strings.NewReader(fakeFile)
_, err = minioClient.PutObject(
context.Background(),
bucketName,
"myobject", fileReader, int64(len(fakeFile)), minio.PutObjectOptions{ContentType: "application/octet-stream"})
if err != nil {
fmt.Println(err)
return
}
_, err = minioClient.PutObject(
context.Background(),
bucketName,
"myobject.jpg", fileReader, int64(len(fakeFile)), minio.PutObjectOptions{ContentType: "application/octet-stream"})
if err != nil {
fmt.Println(err)
return
}
assert := assert.New(t)
type args struct {
encodedPrefix string
versionID string
bytesRange string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Preview Object",
args: args{
encodedPrefix: base64.StdEncoding.EncodeToString([]byte("myobject")),
},
expectedStatus: 200,
expectedError: nil,
},
{
name: "Preview image",
args: args{
encodedPrefix: base64.StdEncoding.EncodeToString([]byte("myobject.jpg")),
},
expectedStatus: 200,
expectedError: nil,
},
{
name: "Get Range of bytes",
args: args{
encodedPrefix: base64.StdEncoding.EncodeToString([]byte("myobject.jpg")),
bytesRange: "bytes=1-4",
},
expectedStatus: 206,
expectedError: nil,
},
{
name: "Get Range of bytes empty start",
args: args{
encodedPrefix: base64.StdEncoding.EncodeToString([]byte("myobject.jpg")),
bytesRange: "bytes=-4",
},
expectedStatus: 206,
expectedError: nil,
},
{
name: "Get Invalid Range of bytes",
args: args{
encodedPrefix: base64.StdEncoding.EncodeToString([]byte("myobject.jpg")),
bytesRange: "bytes=9-12",
},
expectedStatus: 400,
expectedError: nil,
},
{
name: "Get Larger Range of bytes empty start",
args: args{
encodedPrefix: base64.StdEncoding.EncodeToString([]byte("myobject.jpg")),
bytesRange: "bytes=-12",
},
expectedStatus: 206,
expectedError: nil,
},
{
name: "Get invalid seek start Range of bytes",
args: args{
encodedPrefix: base64.StdEncoding.EncodeToString([]byte("myobject.jpg")),
bytesRange: "bytes=12-16",
},
expectedStatus: 400,
expectedError: nil,
},
{
name: "Bad Preview Object",
args: args{
encodedPrefix: "garble",
},
expectedStatus: 400,
expectedError: nil,
},
{
name: "Bad Version Preview Object",
args: args{
encodedPrefix: base64.StdEncoding.EncodeToString([]byte("myobject")),
versionID: "garble",
},
expectedStatus: 400,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
destination := fmt.Sprintf("/api/v1/buckets/%s/objects/download?preview=true&prefix=%s&version_id=%s", bucketName, tt.args.encodedPrefix, tt.args.versionID)
finalURL := fmt.Sprintf("http://localhost:9090%s", destination)
request, err := http.NewRequest("GET", finalURL, nil)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
if tt.args.bytesRange != "" {
request.Header.Add("Range", tt.args.bytesRange)
}
response, err := client.Do(request)
assert.NotNil(response, fmt.Sprintf("%s response object is nil", tt.name))
assert.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, fmt.Sprintf("%s returned the wrong status code", tt.name))
}
})
}
}

812
integration/policy_test.go Normal file
View File

@@ -0,0 +1,812 @@
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package integration
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"testing"
"time"
"github.com/go-openapi/swag"
"github.com/stretchr/testify/assert"
)
func AddPolicy(name string, definition string) (*http.Response, error) {
/*
This is an atomic function to add user and can be reused across
different functions.
*/
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataAdd := map[string]interface{}{
"name": name,
"policy": definition,
}
requestDataJSON, _ := json.Marshal(requestDataAdd)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"POST", "http://localhost:9090/api/v1/policies", requestDataBody)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
return response, err
}
func SetPolicy(policies []string, entityName string, entityType string) (*http.Response, error) {
/*
This is an atomic function to add user and can be reused across
different functions.
*/
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataAdd := map[string]interface{}{
"name": policies,
"entityType": entityType,
"entityName": entityName,
}
requestDataJSON, _ := json.Marshal(requestDataAdd)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"PUT", "http://localhost:9090/api/v1/set-policy", requestDataBody)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
return response, err
}
func Test_AddPolicyAPI(t *testing.T) {
assert := assert.New(t)
type args struct {
api string
name string
policy *string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Create Policy - Valid",
args: args{
api: "/policies",
name: "test",
policy: swag.String(`
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}`),
},
expectedStatus: 201,
expectedError: nil,
},
{
name: "Create Policy - Invalid",
args: args{
api: "/policies",
name: "test2",
policy: swag.String(`
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation"
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}`),
},
expectedStatus: 500,
expectedError: nil,
},
{
name: "Create Policy - Space in Name",
args: args{
api: "/policies",
name: "space test",
policy: swag.String(`
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}`),
},
expectedStatus: 400,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataPolicy := map[string]interface{}{}
requestDataPolicy["name"] = tt.args.name
if tt.args.policy != nil {
requestDataPolicy["policy"] = *tt.args.policy
}
requestDataJSON, _ := json.Marshal(requestDataPolicy)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"POST", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
}
})
}
}
func Test_SetPolicyAPI(t *testing.T) {
assert := assert.New(t)
AddUser("policyuser1", "testtest", []string{}, []string{"readwrite"})
AddGroup("testgroup123", []string{})
AddPolicy("setpolicytest", `
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}`)
type args struct {
api string
entityType string
entityName string
policyName []string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Set Policy - Valid",
args: args{
api: "/set-policy",
policyName: []string{"setpolicytest"},
entityType: "user",
entityName: "policyuser1",
},
expectedStatus: 204,
expectedError: nil,
},
{
name: "Set Policy - Invalid",
args: args{
api: "/set-policy",
policyName: []string{"test3"},
entityType: "user",
entityName: "policyuser1",
},
expectedStatus: 500,
expectedError: nil,
},
{
name: "Set Policy Group - Valid",
args: args{
api: "/set-policy",
policyName: []string{"setpolicytest"},
entityType: "group",
entityName: "testgroup123",
},
expectedStatus: 204,
expectedError: nil,
},
{
name: "Set Policy Group - Invalid",
args: args{
api: "/set-policy",
policyName: []string{"test3"},
entityType: "group",
entityName: "testgroup123",
},
expectedStatus: 500,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataPolicy := map[string]interface{}{}
requestDataPolicy["entityName"] = tt.args.entityName
requestDataPolicy["entityType"] = tt.args.entityType
if tt.args.policyName != nil {
requestDataPolicy["name"] = tt.args.policyName
}
requestDataJSON, _ := json.Marshal(requestDataPolicy)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"PUT", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
}
})
}
}
func Test_SetPolicyMultipleAPI(t *testing.T) {
assert := assert.New(t)
AddUser("policyuser2", "testtest", []string{}, []string{"readwrite"})
AddUser("policyuser3", "testtest", []string{}, []string{"readwrite"})
AddGroup("testgroup1234", []string{})
AddPolicy("setpolicytest2", `
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}`)
type args struct {
api string
users []string
groups []string
name []string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Set Policy - Valid",
args: args{
api: "/set-policy-multi",
name: []string{"setpolicytest2"},
users: []string{"policyuser2", "policyuser3"},
},
expectedStatus: 204,
expectedError: nil,
},
{
name: "Set Policy - Invalid",
args: args{
api: "/set-policy-multi",
name: []string{"test3"},
users: []string{"policyuser2", "policyuser3"},
},
expectedStatus: 500,
expectedError: nil,
},
{
name: "Set Policy Group - Valid",
args: args{
api: "/set-policy-multi",
name: []string{"setpolicytest2"},
groups: []string{"testgroup1234"},
},
expectedStatus: 204,
expectedError: nil,
},
{
name: "Set Policy Group - Valid",
args: args{
api: "/set-policy-multi",
name: []string{"setpolicytest23"},
groups: []string{"testgroup1234"},
},
expectedStatus: 500,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
requestDataPolicy := map[string]interface{}{}
requestDataPolicy["name"] = tt.args.name
requestDataPolicy["users"] = tt.args.users
requestDataPolicy["groups"] = tt.args.groups
requestDataJSON, _ := json.Marshal(requestDataPolicy)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"PUT", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), requestDataBody)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
}
})
}
}
func Test_ListPoliciesAPI(t *testing.T) {
assert := assert.New(t)
type args struct {
api string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "List Policies",
args: args{
api: "/policies",
},
expectedStatus: 200,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
request, err := http.NewRequest(
"GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
}
})
}
}
func Test_GetPolicyAPI(t *testing.T) {
assert := assert.New(t)
AddPolicy("getpolicytest", `
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}`)
type args struct {
api string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Get Policies - Invalid",
args: args{
api: "/policy?name=test3",
},
expectedStatus: 500,
expectedError: nil,
},
{
name: "Get Policies - Valid",
args: args{
api: "/policy?name=getpolicytest",
},
expectedStatus: 200,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
request, err := http.NewRequest(
"GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
}
})
}
}
func Test_PolicyListUsersAPI(t *testing.T) {
assert := assert.New(t)
AddUser("policyuser4", "testtest", []string{}, []string{"readwrite"})
AddPolicy("policylistusers", `
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}`)
SetPolicy([]string{"policylistusers"}, "policyuser4", "user")
type args struct {
api string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "List Users for Policy - Valid",
args: args{
api: "/policies/policylistusers/users",
},
expectedStatus: 200,
expectedError: nil,
},
{
name: "List Users for Policy - Invalid",
args: args{
api: "/policies/test2/users",
},
expectedStatus: 404,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
request, err := http.NewRequest(
"GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
bodyBytes, _ := ioutil.ReadAll(response.Body)
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
if response.StatusCode == 200 {
assert.Equal("[\"policyuser4\"]\n", string(bodyBytes))
}
}
})
}
}
func Test_PolicyListGroupsAPI(t *testing.T) {
assert := assert.New(t)
AddGroup("testgroup12345", []string{})
AddPolicy("policylistgroups", `
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}`)
SetPolicy([]string{"policylistgroups"}, "testgroup12345", "group")
type args struct {
api string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "List Users for Policy - Valid",
args: args{
api: "/policies/policylistgroups/groups",
},
expectedStatus: 200,
expectedError: nil,
},
{
name: "List Users for Policy - Invalid",
args: args{
api: "/policies/test3/groups",
},
expectedStatus: 404,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
request, err := http.NewRequest(
"GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
bodyBytes, _ := ioutil.ReadAll(response.Body)
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
if response.StatusCode == 200 {
assert.Equal("[\"testgroup12345\"]\n", string(bodyBytes))
}
}
})
}
}
func Test_DeletePolicyAPI(t *testing.T) {
assert := assert.New(t)
AddPolicy("testdelete", `
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetBucketLocation",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}`)
type args struct {
api string
method string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Delete Policies - Valid",
args: args{
api: "/policy?name=testdelete",
method: "DELETE",
},
expectedStatus: 204,
expectedError: nil,
},
{
name: "Get Policy After Delete - Invalid",
args: args{
api: "/policy?name=testdelete",
method: "GET",
},
expectedStatus: 500,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
request, err := http.NewRequest(
tt.args.method, fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
}
})
}
}

View File

@@ -0,0 +1,121 @@
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package integration
import (
"archive/zip"
"bytes"
"fmt"
"io"
"log"
"net/http"
"strings"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestStartProfiling(t *testing.T) {
testAsser := assert.New(t)
tests := []struct {
name string
}{
{
name: "start/stop profiling",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
files := map[string]bool{
"profile-127.0.0.1:9000-goroutines.txt": false,
"profile-127.0.0.1:9000-goroutines-before.txt": false,
"profile-127.0.0.1:9000-goroutines-before,debug=2.txt": false,
"profile-127.0.0.1:9000-threads-before.pprof": false,
"profile-127.0.0.1:9000-mem.pprof": false,
"profile-127.0.0.1:9000-threads.pprof": false,
"profile-127.0.0.1:9000-cpu.pprof": false,
"profile-127.0.0.1:9000-mem-before.pprof": false,
"profile-127.0.0.1:9000-block.pprof": false,
"profile-127.0.0.1:9000-trace.trace": false,
"profile-127.0.0.1:9000-mutex.pprof": false,
"profile-127.0.0.1:9000-mutex-before.pprof": false,
}
client := &http.Client{
Timeout: 3 * time.Second,
}
destination := "/api/v1/profiling/start"
finalURL := fmt.Sprintf("http://localhost:9090%s", destination)
request, err := http.NewRequest("POST", finalURL, strings.NewReader("{\"type\":\"cpu,mem,block,mutex,trace,threads,goroutines\"}"))
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
testAsser.Equal(201, response.StatusCode)
time.Sleep(5 * time.Second)
destination = "/api/v1/profiling/stop"
finalURL = fmt.Sprintf("http://localhost:9090%s", destination)
request, err = http.NewRequest("POST", finalURL, nil)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err = client.Do(request)
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
testAsser.Equal(200, response.StatusCode)
zipFileBytes, err := io.ReadAll(response.Body)
if err != nil {
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
}
filetype := http.DetectContentType(zipFileBytes)
testAsser.Equal("application/zip", filetype)
zipReader, err := zip.NewReader(bytes.NewReader(zipFileBytes), int64(len(zipFileBytes)))
if err != nil {
testAsser.Nil(err, fmt.Sprintf("%s returned an error: %v", tt.name, err))
}
// Read all the files from zip archive
for _, zipFile := range zipReader.File {
files[zipFile.Name] = true
}
for k, v := range files {
testAsser.Equal(true, v, fmt.Sprintf("%s : compressed file expected to have %v file inside", tt.name, k))
}
})
}
}

55
integration/tiers_test.go Normal file
View File

@@ -0,0 +1,55 @@
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package integration
import (
"fmt"
"log"
"net/http"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func TestTiersList(t *testing.T) {
assert := assert.New(t)
// image for now:
// minio: 9000
// console: 9090
client := &http.Client{
Timeout: 2 * time.Second,
}
request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/admin/tiers", nil)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
assert.NotNil(response, "Tiers List response is nil")
assert.Nil(err, "Tiers List errored out")
assert.Equal(response.StatusCode, 200)
}

View File

@@ -2688,6 +2688,34 @@ func DeletesAllReplicationRulesOnABucket(bucketName string) (*http.Response, err
return response, err
}
func DeleteMultipleReplicationRules(bucketName string, rules []string) (*http.Response, error) {
/*
Helper function to delete multiple replication rules in a bucket
URL: /buckets/{bucket_name}/delete-multiple-replication-rules
HTTP Verb: DELETE
*/
body := map[string]interface{}{
"rules": rules,
}
requestDataJSON, _ := json.Marshal(body)
requestDataBody := bytes.NewReader(requestDataJSON)
request, err := http.NewRequest(
"DELETE",
"http://localhost:9090/api/v1/buckets/"+bucketName+"/delete-selected-replication-rules",
requestDataBody,
)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
client := &http.Client{
Timeout: 2 * time.Second,
}
response, err := client.Do(request)
return response, err
}
func DeleteBucketReplicationRule(bucketName string, ruleID string) (*http.Response, error) {
/*
Helper function to delete a bucket's replication rule
@@ -2716,7 +2744,7 @@ func TestReplication(t *testing.T) {
// Vars
assert := assert.New(t)
originBucket := "testputobjectslegalholdstatus"
destinationBuckets := []string{"testgetbucketquota", "testputbucketquota"} // an array of strings to iterate over
destinationBuckets := []string{"testgetbucketquota", "testputbucketquota", "testlistbucketevents"} // an array of strings to iterate over
// 1. Set replication rules with DIFFERENT PRIORITY <------- NOT SAME BUT DIFFERENT! 1, 2, etc.
for index, destinationBucket := range destinationBuckets {
@@ -2750,7 +2778,7 @@ func TestReplication(t *testing.T) {
}
// 2. Get replication, at this point two rules are expected
// 2. Get replication, at this point four rules are expected
response, err := GetBucketReplication(originBucket)
assert.Nil(err)
if err != nil {
@@ -2771,21 +2799,21 @@ func TestReplication(t *testing.T) {
}
assert.Greater(len(structBucketRepl.Rules), 0, "Number of expected rules is 0")
if len(structBucketRepl.Rules) == 0 {
if len(structBucketRepl.Rules) == 0 || len(structBucketRepl.Rules) < 3 {
return
}
// 4. Verify rules are enabled
for index := 0; index < 2; index++ {
for index := 0; index < 3; index++ {
Status := structBucketRepl.Rules[index].Status
assert.Equal(Status, "Enabled")
}
// 5. Delete 2nd rule only with dedicated end point for single rules:
// 5. Delete 3rd and 4th rules with endpoint for multiple rules:
// /buckets/{bucket_name}/replication/{rule_id}
ruleID := structBucketRepl.Rules[1].ID // To delete 2nd rule in a single way
response, err = DeleteBucketReplicationRule(
ruleIDs := []string{structBucketRepl.Rules[2].ID} // To delete 3rd rule with the multi delete function
response, err = DeleteMultipleReplicationRules(
originBucket,
ruleID,
ruleIDs,
)
assert.Nil(err)
if err != nil {
@@ -2797,7 +2825,24 @@ func TestReplication(t *testing.T) {
assert.Equal(204, response.StatusCode, finalResponse)
}
// 6. Delete remaining Bucket Replication Rule with generic end point:
// 6. Delete 2nd rule only with dedicated end point for single rules:
// /buckets/{bucket_name}/replication/{rule_id}
ruleID := structBucketRepl.Rules[1].ID // To delete 2nd rule in a single way
response, err = DeleteBucketReplicationRule(
originBucket,
ruleID,
)
assert.Nil(err)
if err != nil {
log.Println(err)
return
}
finalResponse = inspectHTTPResponse(response)
if response != nil {
assert.Equal(204, response.StatusCode, finalResponse)
}
// 7. Delete remaining Bucket Replication Rule with generic end point:
// /buckets/{bucket_name}/delete-all-replication-rules
response, err = DeletesAllReplicationRulesOnABucket(
originBucket,
@@ -2812,6 +2857,27 @@ func TestReplication(t *testing.T) {
assert.Equal(204, response.StatusCode, finalResponse)
}
// 8. Get replication, at this point zero rules are expected
response, err = GetBucketReplication(originBucket)
assert.Nil(err)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(200, response.StatusCode, "error invalid status")
}
// 9. Get rule ID and status from response's body
bodyBytes, _ = ioutil.ReadAll(response.Body)
structBucketRepl = models.BucketReplicationResponse{}
err = json.Unmarshal(bodyBytes, &structBucketRepl)
if err != nil {
log.Println(err)
assert.Nil(err)
}
assert.Equal(len(structBucketRepl.Rules), 0, "Delete failed")
}
func GetBucketVersioning(bucketName string) (*http.Response, error) {
@@ -3573,3 +3639,47 @@ func TestAccessRule(t *testing.T) {
}
}
func GetBucketRewind(bucketName string, date string) (*http.Response, error) {
/*
Helper function to get objects in a bucket for a rewind date
HTTP Verb: GET
URL: /buckets/{bucket_name}/rewind/{date}
*/
request, err := http.NewRequest(
"GET",
"http://localhost:9090/api/v1/buckets/"+bucketName+"/rewind/"+date,
nil,
)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
client := &http.Client{
Timeout: 2 * time.Second,
}
response, err := client.Do(request)
return response, err
}
func TestGetBucketRewind(t *testing.T) {
// Variables
assert := assert.New(t)
bucketName := "test-get-bucket-rewind"
date := "2006-01-02T15:04:05Z"
// Test
resp, err := GetBucketRewind(bucketName, date)
assert.Nil(err)
if err != nil {
log.Println(err)
return
}
if resp != nil {
assert.Equal(
200, resp.StatusCode, inspectHTTPResponse(resp))
}
}

View File

@@ -854,3 +854,68 @@ func TestUsersGroupsBulk(t *testing.T) {
}
}
func Test_GetUserPolicyAPI(t *testing.T) {
assert := assert.New(t)
// 1. Create an active user with valid policy
var groups = []string{}
var policies = []string{"readwrite"}
addUserResponse, addUserError := AddUser(
"getpolicyuser", "secretKey", groups, policies)
if addUserError != nil {
log.Println(addUserError)
return
}
if addUserResponse != nil {
fmt.Println("StatusCode:", addUserResponse.StatusCode)
assert.Equal(
201, addUserResponse.StatusCode, "Status Code is incorrect")
}
type args struct {
api string
}
tests := []struct {
name string
args args
expectedStatus int
expectedError error
}{
{
name: "Get User Policies",
args: args{
api: "/user/policy",
},
expectedStatus: 200,
expectedError: nil,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
client := &http.Client{
Timeout: 3 * time.Second,
}
request, err := http.NewRequest(
"GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil)
if err != nil {
log.Println(err)
return
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
response, err := client.Do(request)
if err != nil {
log.Println(err)
return
}
if response != nil {
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
}
})
}
}

View File

@@ -15,7 +15,7 @@ spec:
serviceAccountName: console-sa
containers:
- name: console
image: 'minio/console:v0.15.6'
image: 'minio/console:v0.16.2'
imagePullPolicy: "IfNotPresent"
env:
- name: CONSOLE_OPERATOR_MODE

View File

@@ -32,7 +32,7 @@ spec:
spec:
containers:
- name: console
image: 'minio/console:v0.15.6'
image: 'minio/console:v0.16.2'
imagePullPolicy: "IfNotPresent"
env:
- name: CONSOLE_MINIO_SERVER

View File

@@ -0,0 +1,67 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// BucketReplicationRuleList bucket replication rule list
//
// swagger:model bucketReplicationRuleList
type BucketReplicationRuleList struct {
// rules
Rules []string `json:"rules"`
}
// Validate validates this bucket replication rule list
func (m *BucketReplicationRuleList) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this bucket replication rule list based on context it is used
func (m *BucketReplicationRuleList) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *BucketReplicationRuleList) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *BucketReplicationRuleList) UnmarshalBinary(b []byte) error {
var res BucketReplicationRuleList
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

70
models/condition.go Normal file
View File

@@ -0,0 +1,70 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Condition condition
//
// swagger:model condition
type Condition struct {
// status
Status string `json:"status,omitempty"`
// type
Type string `json:"type,omitempty"`
}
// Validate validates this condition
func (m *Condition) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this condition based on context it is used
func (m *Condition) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *Condition) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Condition) UnmarshalBinary(b []byte) error {
var res Condition
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

70
models/config_map.go Normal file
View File

@@ -0,0 +1,70 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// ConfigMap config map
//
// swagger:model configMap
type ConfigMap struct {
// name
Name string `json:"name,omitempty"`
// optional
Optional bool `json:"optional,omitempty"`
}
// Validate validates this config map
func (m *ConfigMap) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this config map based on context it is used
func (m *ConfigMap) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *ConfigMap) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ConfigMap) UnmarshalBinary(b []byte) error {
var res ConfigMap
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

309
models/container.go Normal file
View File

@@ -0,0 +1,309 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Container container
//
// swagger:model container
type Container struct {
// args
Args []string `json:"args"`
// container ID
ContainerID string `json:"containerID,omitempty"`
// environment variables
EnvironmentVariables []*EnvironmentVariable `json:"environmentVariables"`
// host ports
HostPorts []string `json:"hostPorts"`
// image
Image string `json:"image,omitempty"`
// image ID
ImageID string `json:"imageID,omitempty"`
// last state
LastState *State `json:"lastState,omitempty"`
// mounts
Mounts []*Mount `json:"mounts"`
// name
Name string `json:"name,omitempty"`
// ports
Ports []string `json:"ports"`
// ready
Ready bool `json:"ready,omitempty"`
// restart count
RestartCount int64 `json:"restartCount,omitempty"`
// state
State *State `json:"state,omitempty"`
}
// Validate validates this container
func (m *Container) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateEnvironmentVariables(formats); err != nil {
res = append(res, err)
}
if err := m.validateLastState(formats); err != nil {
res = append(res, err)
}
if err := m.validateMounts(formats); err != nil {
res = append(res, err)
}
if err := m.validateState(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Container) validateEnvironmentVariables(formats strfmt.Registry) error {
if swag.IsZero(m.EnvironmentVariables) { // not required
return nil
}
for i := 0; i < len(m.EnvironmentVariables); i++ {
if swag.IsZero(m.EnvironmentVariables[i]) { // not required
continue
}
if m.EnvironmentVariables[i] != nil {
if err := m.EnvironmentVariables[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Container) validateLastState(formats strfmt.Registry) error {
if swag.IsZero(m.LastState) { // not required
return nil
}
if m.LastState != nil {
if err := m.LastState.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("lastState")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("lastState")
}
return err
}
}
return nil
}
func (m *Container) validateMounts(formats strfmt.Registry) error {
if swag.IsZero(m.Mounts) { // not required
return nil
}
for i := 0; i < len(m.Mounts); i++ {
if swag.IsZero(m.Mounts[i]) { // not required
continue
}
if m.Mounts[i] != nil {
if err := m.Mounts[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("mounts" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("mounts" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Container) validateState(formats strfmt.Registry) error {
if swag.IsZero(m.State) { // not required
return nil
}
if m.State != nil {
if err := m.State.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("state")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("state")
}
return err
}
}
return nil
}
// ContextValidate validate this container based on the context it is used
func (m *Container) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateEnvironmentVariables(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateLastState(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateMounts(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateState(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Container) contextValidateEnvironmentVariables(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.EnvironmentVariables); i++ {
if m.EnvironmentVariables[i] != nil {
if err := m.EnvironmentVariables[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("environmentVariables" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Container) contextValidateLastState(ctx context.Context, formats strfmt.Registry) error {
if m.LastState != nil {
if err := m.LastState.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("lastState")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("lastState")
}
return err
}
}
return nil
}
func (m *Container) contextValidateMounts(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Mounts); i++ {
if m.Mounts[i] != nil {
if err := m.Mounts[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("mounts" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("mounts" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *Container) contextValidateState(ctx context.Context, formats strfmt.Registry) error {
if m.State != nil {
if err := m.State.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("state")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("state")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Container) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Container) UnmarshalBinary(b []byte) error {
var res Container
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -43,6 +43,9 @@ type CreateTenantRequest struct {
// annotations
Annotations map[string]string `json:"annotations,omitempty"`
// domains
Domains *DomainsConfiguration `json:"domains,omitempty"`
// enable console
EnableConsole *bool `json:"enable_console,omitempty"`
@@ -112,6 +115,10 @@ type CreateTenantRequest struct {
func (m *CreateTenantRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDomains(formats); err != nil {
res = append(res, err)
}
if err := m.validateEncryption(formats); err != nil {
res = append(res, err)
}
@@ -154,6 +161,25 @@ func (m *CreateTenantRequest) Validate(formats strfmt.Registry) error {
return nil
}
func (m *CreateTenantRequest) validateDomains(formats strfmt.Registry) error {
if swag.IsZero(m.Domains) { // not required
return nil
}
if m.Domains != nil {
if err := m.Domains.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("domains")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("domains")
}
return err
}
}
return nil
}
func (m *CreateTenantRequest) validateEncryption(formats strfmt.Registry) error {
if swag.IsZero(m.Encryption) { // not required
return nil
@@ -321,6 +347,10 @@ func (m *CreateTenantRequest) validateTLS(formats strfmt.Registry) error {
func (m *CreateTenantRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateDomains(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateEncryption(ctx, formats); err != nil {
res = append(res, err)
}
@@ -355,6 +385,22 @@ func (m *CreateTenantRequest) ContextValidate(ctx context.Context, formats strfm
return nil
}
func (m *CreateTenantRequest) contextValidateDomains(ctx context.Context, formats strfmt.Registry) error {
if m.Domains != nil {
if err := m.Domains.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("domains")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("domains")
}
return err
}
}
return nil
}
func (m *CreateTenantRequest) contextValidateEncryption(ctx context.Context, formats strfmt.Registry) error {
if m.Encryption != nil {

View File

@@ -0,0 +1,517 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// DescribePodWrapper describe pod wrapper
//
// swagger:model describePodWrapper
type DescribePodWrapper struct {
// annotations
Annotations []*Annotation `json:"annotations"`
// conditions
Conditions []*Condition `json:"conditions"`
// containers
Containers []*Container `json:"containers"`
// controller ref
ControllerRef string `json:"controllerRef,omitempty"`
// deletion grace period seconds
DeletionGracePeriodSeconds int64 `json:"deletionGracePeriodSeconds,omitempty"`
// deletion timestamp
DeletionTimestamp string `json:"deletionTimestamp,omitempty"`
// labels
Labels []*Label `json:"labels"`
// message
Message string `json:"message,omitempty"`
// name
Name string `json:"name,omitempty"`
// namespace
Namespace string `json:"namespace,omitempty"`
// node name
NodeName string `json:"nodeName,omitempty"`
// node selector
NodeSelector []*NodeSelector `json:"nodeSelector"`
// phase
Phase string `json:"phase,omitempty"`
// pod IP
PodIP string `json:"podIP,omitempty"`
// priority
Priority int64 `json:"priority,omitempty"`
// priority class name
PriorityClassName string `json:"priorityClassName,omitempty"`
// qos class
QosClass string `json:"qosClass,omitempty"`
// reason
Reason string `json:"reason,omitempty"`
// start time
StartTime string `json:"startTime,omitempty"`
// tolerations
Tolerations []*Toleration `json:"tolerations"`
// volumes
Volumes []*Volume `json:"volumes"`
}
// Validate validates this describe pod wrapper
func (m *DescribePodWrapper) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateAnnotations(formats); err != nil {
res = append(res, err)
}
if err := m.validateConditions(formats); err != nil {
res = append(res, err)
}
if err := m.validateContainers(formats); err != nil {
res = append(res, err)
}
if err := m.validateLabels(formats); err != nil {
res = append(res, err)
}
if err := m.validateNodeSelector(formats); err != nil {
res = append(res, err)
}
if err := m.validateTolerations(formats); err != nil {
res = append(res, err)
}
if err := m.validateVolumes(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *DescribePodWrapper) validateAnnotations(formats strfmt.Registry) error {
if swag.IsZero(m.Annotations) { // not required
return nil
}
for i := 0; i < len(m.Annotations); i++ {
if swag.IsZero(m.Annotations[i]) { // not required
continue
}
if m.Annotations[i] != nil {
if err := m.Annotations[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("annotations" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("annotations" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) validateConditions(formats strfmt.Registry) error {
if swag.IsZero(m.Conditions) { // not required
return nil
}
for i := 0; i < len(m.Conditions); i++ {
if swag.IsZero(m.Conditions[i]) { // not required
continue
}
if m.Conditions[i] != nil {
if err := m.Conditions[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("conditions" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("conditions" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) validateContainers(formats strfmt.Registry) error {
if swag.IsZero(m.Containers) { // not required
return nil
}
for i := 0; i < len(m.Containers); i++ {
if swag.IsZero(m.Containers[i]) { // not required
continue
}
if m.Containers[i] != nil {
if err := m.Containers[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("containers" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("containers" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) validateLabels(formats strfmt.Registry) error {
if swag.IsZero(m.Labels) { // not required
return nil
}
for i := 0; i < len(m.Labels); i++ {
if swag.IsZero(m.Labels[i]) { // not required
continue
}
if m.Labels[i] != nil {
if err := m.Labels[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("labels" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("labels" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) validateNodeSelector(formats strfmt.Registry) error {
if swag.IsZero(m.NodeSelector) { // not required
return nil
}
for i := 0; i < len(m.NodeSelector); i++ {
if swag.IsZero(m.NodeSelector[i]) { // not required
continue
}
if m.NodeSelector[i] != nil {
if err := m.NodeSelector[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("nodeSelector" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("nodeSelector" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) validateTolerations(formats strfmt.Registry) error {
if swag.IsZero(m.Tolerations) { // not required
return nil
}
for i := 0; i < len(m.Tolerations); i++ {
if swag.IsZero(m.Tolerations[i]) { // not required
continue
}
if m.Tolerations[i] != nil {
if err := m.Tolerations[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("tolerations" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("tolerations" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) validateVolumes(formats strfmt.Registry) error {
if swag.IsZero(m.Volumes) { // not required
return nil
}
for i := 0; i < len(m.Volumes); i++ {
if swag.IsZero(m.Volumes[i]) { // not required
continue
}
if m.Volumes[i] != nil {
if err := m.Volumes[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("volumes" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("volumes" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this describe pod wrapper based on the context it is used
func (m *DescribePodWrapper) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateAnnotations(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateConditions(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateContainers(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateLabels(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateNodeSelector(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateTolerations(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateVolumes(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *DescribePodWrapper) contextValidateAnnotations(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Annotations); i++ {
if m.Annotations[i] != nil {
if err := m.Annotations[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("annotations" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("annotations" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) contextValidateConditions(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Conditions); i++ {
if m.Conditions[i] != nil {
if err := m.Conditions[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("conditions" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("conditions" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) contextValidateContainers(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Containers); i++ {
if m.Containers[i] != nil {
if err := m.Containers[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("containers" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("containers" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) contextValidateLabels(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Labels); i++ {
if m.Labels[i] != nil {
if err := m.Labels[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("labels" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("labels" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) contextValidateNodeSelector(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.NodeSelector); i++ {
if m.NodeSelector[i] != nil {
if err := m.NodeSelector[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("nodeSelector" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("nodeSelector" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) contextValidateTolerations(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Tolerations); i++ {
if m.Tolerations[i] != nil {
if err := m.Tolerations[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("tolerations" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("tolerations" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
func (m *DescribePodWrapper) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Volumes); i++ {
if m.Volumes[i] != nil {
if err := m.Volumes[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("volumes" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("volumes" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *DescribePodWrapper) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DescribePodWrapper) UnmarshalBinary(b []byte) error {
var res DescribePodWrapper
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,70 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// DomainsConfiguration domains configuration
//
// swagger:model domainsConfiguration
type DomainsConfiguration struct {
// console
Console string `json:"console,omitempty"`
// minio
Minio []string `json:"minio"`
}
// Validate validates this domains configuration
func (m *DomainsConfiguration) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this domains configuration based on context it is used
func (m *DomainsConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *DomainsConfiguration) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DomainsConfiguration) UnmarshalBinary(b []byte) error {
var res DomainsConfiguration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,70 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// EnvironmentVariable environment variable
//
// swagger:model environmentVariable
type EnvironmentVariable struct {
// key
Key string `json:"key,omitempty"`
// value
Value string `json:"value,omitempty"`
}
// Validate validates this environment variable
func (m *EnvironmentVariable) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this environment variable based on context it is used
func (m *EnvironmentVariable) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *EnvironmentVariable) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *EnvironmentVariable) UnmarshalBinary(b []byte) error {
var res EnvironmentVariable
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -237,7 +237,8 @@ type IdpConfigurationActiveDirectory struct {
GroupSearchFilter string `json:"group_search_filter,omitempty"`
// lookup bind dn
LookupBindDn string `json:"lookup_bind_dn,omitempty"`
// Required: true
LookupBindDn *string `json:"lookup_bind_dn"`
// lookup bind password
LookupBindPassword string `json:"lookup_bind_password,omitempty"`
@@ -269,6 +270,10 @@ type IdpConfigurationActiveDirectory struct {
func (m *IdpConfigurationActiveDirectory) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateLookupBindDn(formats); err != nil {
res = append(res, err)
}
if err := m.validateURL(formats); err != nil {
res = append(res, err)
}
@@ -279,6 +284,15 @@ func (m *IdpConfigurationActiveDirectory) Validate(formats strfmt.Registry) erro
return nil
}
func (m *IdpConfigurationActiveDirectory) validateLookupBindDn(formats strfmt.Registry) error {
if err := validate.Required("active_directory"+"."+"lookup_bind_dn", "body", m.LookupBindDn); err != nil {
return err
}
return nil
}
func (m *IdpConfigurationActiveDirectory) validateURL(formats strfmt.Registry) error {
if err := validate.Required("active_directory"+"."+"url", "body", m.URL); err != nil {

View File

@@ -38,7 +38,7 @@ import (
type LoginDetails struct {
// login strategy
// Enum: [form redirect service-account]
// Enum: [form redirect service-account redirect-service-account]
LoginStrategy string `json:"loginStrategy,omitempty"`
// redirect
@@ -63,7 +63,7 @@ var loginDetailsTypeLoginStrategyPropEnum []interface{}
func init() {
var res []string
if err := json.Unmarshal([]byte(`["form","redirect","service-account"]`), &res); err != nil {
if err := json.Unmarshal([]byte(`["form","redirect","service-account","redirect-service-account"]`), &res); err != nil {
panic(err)
}
for _, v := range res {
@@ -81,6 +81,9 @@ const (
// LoginDetailsLoginStrategyServiceDashAccount captures enum value "service-account"
LoginDetailsLoginStrategyServiceDashAccount string = "service-account"
// LoginDetailsLoginStrategyRedirectDashServiceDashAccount captures enum value "redirect-service-account"
LoginDetailsLoginStrategyRedirectDashServiceDashAccount string = "redirect-service-account"
)
// prop value enum

76
models/mount.go Normal file
View File

@@ -0,0 +1,76 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Mount mount
//
// swagger:model mount
type Mount struct {
// mount path
MountPath string `json:"mountPath,omitempty"`
// name
Name string `json:"name,omitempty"`
// read only
ReadOnly bool `json:"readOnly,omitempty"`
// sub path
SubPath string `json:"subPath,omitempty"`
}
// Validate validates this mount
func (m *Mount) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this mount based on context it is used
func (m *Mount) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *Mount) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Mount) UnmarshalBinary(b []byte) error {
var res Mount
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

73
models/peer_info.go Normal file
View File

@@ -0,0 +1,73 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// PeerInfo peer info
//
// swagger:model peerInfo
type PeerInfo struct {
// deployment ID
DeploymentID string `json:"deploymentID,omitempty"`
// endpoint
Endpoint string `json:"endpoint,omitempty"`
// name
Name string `json:"name,omitempty"`
}
// Validate validates this peer info
func (m *PeerInfo) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this peer info based on context it is used
func (m *PeerInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *PeerInfo) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PeerInfo) UnmarshalBinary(b []byte) error {
var res PeerInfo
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,91 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// PeerInfoRemove peer info remove
//
// swagger:model peerInfoRemove
type PeerInfoRemove struct {
// all
All bool `json:"all,omitempty"`
// sites
// Required: true
Sites []string `json:"sites"`
}
// Validate validates this peer info remove
func (m *PeerInfoRemove) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateSites(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *PeerInfoRemove) validateSites(formats strfmt.Registry) error {
if err := validate.Required("sites", "body", m.Sites); err != nil {
return err
}
return nil
}
// ContextValidate validates this peer info remove based on context it is used
func (m *PeerInfoRemove) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *PeerInfoRemove) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PeerInfoRemove) UnmarshalBinary(b []byte) error {
var res PeerInfoRemove
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

76
models/peer_site.go Normal file
View File

@@ -0,0 +1,76 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// PeerSite peer site
//
// swagger:model peerSite
type PeerSite struct {
// access key
AccessKey string `json:"accessKey,omitempty"`
// endpoint
Endpoint string `json:"endpoint,omitempty"`
// name
Name string `json:"name,omitempty"`
// secret key
SecretKey string `json:"secretKey,omitempty"`
}
// Validate validates this peer site
func (m *PeerSite) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this peer site based on context it is used
func (m *PeerSite) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *PeerSite) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PeerSite) UnmarshalBinary(b []byte) error {
var res PeerSite
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,73 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// PeerSiteEditResponse peer site edit response
//
// swagger:model peerSiteEditResponse
type PeerSiteEditResponse struct {
// error detail
ErrorDetail string `json:"errorDetail,omitempty"`
// status
Status string `json:"status,omitempty"`
// success
Success bool `json:"success,omitempty"`
}
// Validate validates this peer site edit response
func (m *PeerSiteEditResponse) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this peer site edit response based on context it is used
func (m *PeerSiteEditResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *PeerSiteEditResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PeerSiteEditResponse) UnmarshalBinary(b []byte) error {
var res PeerSiteEditResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,70 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// PeerSiteRemoveResponse peer site remove response
//
// swagger:model peerSiteRemoveResponse
type PeerSiteRemoveResponse struct {
// error detail
ErrorDetail string `json:"errorDetail,omitempty"`
// status
Status string `json:"status,omitempty"`
}
// Validate validates this peer site remove response
func (m *PeerSiteRemoveResponse) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this peer site remove response based on context it is used
func (m *PeerSiteRemoveResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *PeerSiteRemoveResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *PeerSiteRemoveResponse) UnmarshalBinary(b []byte) error {
var res PeerSiteRemoveResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

133
models/projected_volume.go Normal file
View File

@@ -0,0 +1,133 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// ProjectedVolume projected volume
//
// swagger:model projectedVolume
type ProjectedVolume struct {
// sources
Sources []*ProjectedVolumeSource `json:"sources"`
}
// Validate validates this projected volume
func (m *ProjectedVolume) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateSources(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ProjectedVolume) validateSources(formats strfmt.Registry) error {
if swag.IsZero(m.Sources) { // not required
return nil
}
for i := 0; i < len(m.Sources); i++ {
if swag.IsZero(m.Sources[i]) { // not required
continue
}
if m.Sources[i] != nil {
if err := m.Sources[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("sources" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("sources" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this projected volume based on the context it is used
func (m *ProjectedVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateSources(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ProjectedVolume) contextValidateSources(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Sources); i++ {
if m.Sources[i] != nil {
if err := m.Sources[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("sources" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("sources" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *ProjectedVolume) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ProjectedVolume) UnmarshalBinary(b []byte) error {
var res ProjectedVolume
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,216 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// ProjectedVolumeSource projected volume source
//
// swagger:model projectedVolumeSource
type ProjectedVolumeSource struct {
// config map
ConfigMap *ConfigMap `json:"configMap,omitempty"`
// downward Api
DownwardAPI bool `json:"downwardApi,omitempty"`
// secret
Secret *Secret `json:"secret,omitempty"`
// service account token
ServiceAccountToken *ServiceAccountToken `json:"serviceAccountToken,omitempty"`
}
// Validate validates this projected volume source
func (m *ProjectedVolumeSource) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateConfigMap(formats); err != nil {
res = append(res, err)
}
if err := m.validateSecret(formats); err != nil {
res = append(res, err)
}
if err := m.validateServiceAccountToken(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ProjectedVolumeSource) validateConfigMap(formats strfmt.Registry) error {
if swag.IsZero(m.ConfigMap) { // not required
return nil
}
if m.ConfigMap != nil {
if err := m.ConfigMap.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("configMap")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("configMap")
}
return err
}
}
return nil
}
func (m *ProjectedVolumeSource) validateSecret(formats strfmt.Registry) error {
if swag.IsZero(m.Secret) { // not required
return nil
}
if m.Secret != nil {
if err := m.Secret.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("secret")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("secret")
}
return err
}
}
return nil
}
func (m *ProjectedVolumeSource) validateServiceAccountToken(formats strfmt.Registry) error {
if swag.IsZero(m.ServiceAccountToken) { // not required
return nil
}
if m.ServiceAccountToken != nil {
if err := m.ServiceAccountToken.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("serviceAccountToken")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("serviceAccountToken")
}
return err
}
}
return nil
}
// ContextValidate validate this projected volume source based on the context it is used
func (m *ProjectedVolumeSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateConfigMap(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateSecret(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateServiceAccountToken(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ProjectedVolumeSource) contextValidateConfigMap(ctx context.Context, formats strfmt.Registry) error {
if m.ConfigMap != nil {
if err := m.ConfigMap.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("configMap")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("configMap")
}
return err
}
}
return nil
}
func (m *ProjectedVolumeSource) contextValidateSecret(ctx context.Context, formats strfmt.Registry) error {
if m.Secret != nil {
if err := m.Secret.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("secret")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("secret")
}
return err
}
}
return nil
}
func (m *ProjectedVolumeSource) contextValidateServiceAccountToken(ctx context.Context, formats strfmt.Registry) error {
if m.ServiceAccountToken != nil {
if err := m.ServiceAccountToken.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("serviceAccountToken")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("serviceAccountToken")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *ProjectedVolumeSource) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ProjectedVolumeSource) UnmarshalBinary(b []byte) error {
var res ProjectedVolumeSource
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

70
models/pvc.go Normal file
View File

@@ -0,0 +1,70 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Pvc pvc
//
// swagger:model pvc
type Pvc struct {
// claim name
ClaimName string `json:"claimName,omitempty"`
// read only
ReadOnly bool `json:"readOnly,omitempty"`
}
// Validate validates this pvc
func (m *Pvc) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this pvc based on context it is used
func (m *Pvc) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *Pvc) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Pvc) UnmarshalBinary(b []byte) error {
var res Pvc
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

70
models/secret.go Normal file
View File

@@ -0,0 +1,70 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Secret secret
//
// swagger:model secret
type Secret struct {
// name
Name string `json:"name,omitempty"`
// optional
Optional bool `json:"optional,omitempty"`
}
// Validate validates this secret
func (m *Secret) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this secret based on context it is used
func (m *Secret) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *Secret) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Secret) UnmarshalBinary(b []byte) error {
var res Secret
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,67 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// ServiceAccountToken service account token
//
// swagger:model serviceAccountToken
type ServiceAccountToken struct {
// expiration seconds
ExpirationSeconds int64 `json:"expirationSeconds,omitempty"`
}
// Validate validates this service account token
func (m *ServiceAccountToken) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this service account token based on context it is used
func (m *ServiceAccountToken) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *ServiceAccountToken) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ServiceAccountToken) UnmarshalBinary(b []byte) error {
var res ServiceAccountToken
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,90 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// SiteReplicationAddRequest site replication add request
//
// swagger:model siteReplicationAddRequest
type SiteReplicationAddRequest []*PeerSite
// Validate validates this site replication add request
func (m SiteReplicationAddRequest) Validate(formats strfmt.Registry) error {
var res []error
for i := 0; i < len(m); i++ {
if swag.IsZero(m[i]) { // not required
continue
}
if m[i] != nil {
if err := m[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName(strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName(strconv.Itoa(i))
}
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// ContextValidate validate this site replication add request based on the context it is used
func (m SiteReplicationAddRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
for i := 0; i < len(m); i++ {
if m[i] != nil {
if err := m[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName(strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName(strconv.Itoa(i))
}
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@@ -0,0 +1,76 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// SiteReplicationAddResponse site replication add response
//
// swagger:model siteReplicationAddResponse
type SiteReplicationAddResponse struct {
// error detail
ErrorDetail string `json:"errorDetail,omitempty"`
// initial sync error message
InitialSyncErrorMessage string `json:"initialSyncErrorMessage,omitempty"`
// status
Status string `json:"status,omitempty"`
// success
Success bool `json:"success,omitempty"`
}
// Validate validates this site replication add response
func (m *SiteReplicationAddResponse) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this site replication add response based on context it is used
func (m *SiteReplicationAddResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *SiteReplicationAddResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SiteReplicationAddResponse) UnmarshalBinary(b []byte) error {
var res SiteReplicationAddResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,142 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// SiteReplicationInfoResponse site replication info response
//
// swagger:model siteReplicationInfoResponse
type SiteReplicationInfoResponse struct {
// enabled
Enabled bool `json:"enabled,omitempty"`
// name
Name string `json:"name,omitempty"`
// service account access key
ServiceAccountAccessKey string `json:"serviceAccountAccessKey,omitempty"`
// sites
Sites []*PeerInfo `json:"sites"`
}
// Validate validates this site replication info response
func (m *SiteReplicationInfoResponse) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateSites(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *SiteReplicationInfoResponse) validateSites(formats strfmt.Registry) error {
if swag.IsZero(m.Sites) { // not required
return nil
}
for i := 0; i < len(m.Sites); i++ {
if swag.IsZero(m.Sites[i]) { // not required
continue
}
if m.Sites[i] != nil {
if err := m.Sites[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("sites" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("sites" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this site replication info response based on the context it is used
func (m *SiteReplicationInfoResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateSites(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *SiteReplicationInfoResponse) contextValidateSites(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Sites); i++ {
if m.Sites[i] != nil {
if err := m.Sites[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("sites" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("sites" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *SiteReplicationInfoResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SiteReplicationInfoResponse) UnmarshalBinary(b []byte) error {
var res SiteReplicationInfoResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,97 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// SiteReplicationStatusResponse site replication status response
//
// swagger:model siteReplicationStatusResponse
type SiteReplicationStatusResponse struct {
// bucket stats
BucketStats interface{} `json:"bucketStats,omitempty"`
// enabled
Enabled bool `json:"enabled,omitempty"`
// group stats
GroupStats interface{} `json:"groupStats,omitempty"`
// max buckets
MaxBuckets int64 `json:"maxBuckets,omitempty"`
// max groups
MaxGroups int64 `json:"maxGroups,omitempty"`
// max policies
MaxPolicies int64 `json:"maxPolicies,omitempty"`
// max users
MaxUsers int64 `json:"maxUsers,omitempty"`
// policy stats
PolicyStats interface{} `json:"policyStats,omitempty"`
// sites
Sites interface{} `json:"sites,omitempty"`
// stats summary
StatsSummary interface{} `json:"statsSummary,omitempty"`
// user stats
UserStats interface{} `json:"userStats,omitempty"`
}
// Validate validates this site replication status response
func (m *SiteReplicationStatusResponse) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this site replication status response based on context it is used
func (m *SiteReplicationStatusResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *SiteReplicationStatusResponse) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *SiteReplicationStatusResponse) UnmarshalBinary(b []byte) error {
var res SiteReplicationStatusResponse
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

85
models/state.go Normal file
View File

@@ -0,0 +1,85 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// State state
//
// swagger:model state
type State struct {
// exit code
ExitCode int64 `json:"exitCode,omitempty"`
// finished
Finished string `json:"finished,omitempty"`
// message
Message string `json:"message,omitempty"`
// reason
Reason string `json:"reason,omitempty"`
// signal
Signal int64 `json:"signal,omitempty"`
// started
Started string `json:"started,omitempty"`
// state
State string `json:"state,omitempty"`
}
// Validate validates this state
func (m *State) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this state based on context it is used
func (m *State) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *State) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *State) UnmarshalBinary(b []byte) error {
var res State
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -45,6 +45,9 @@ type Tenant struct {
// deletion date
DeletionDate string `json:"deletion_date,omitempty"`
// domains
Domains *DomainsConfiguration `json:"domains,omitempty"`
// enable prometheus
EnablePrometheus bool `json:"enable_prometheus,omitempty"`
@@ -95,6 +98,10 @@ type Tenant struct {
func (m *Tenant) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDomains(formats); err != nil {
res = append(res, err)
}
if err := m.validateEndpoints(formats); err != nil {
res = append(res, err)
}
@@ -117,6 +124,25 @@ func (m *Tenant) Validate(formats strfmt.Registry) error {
return nil
}
func (m *Tenant) validateDomains(formats strfmt.Registry) error {
if swag.IsZero(m.Domains) { // not required
return nil
}
if m.Domains != nil {
if err := m.Domains.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("domains")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("domains")
}
return err
}
}
return nil
}
func (m *Tenant) validateEndpoints(formats strfmt.Registry) error {
if swag.IsZero(m.Endpoints) { // not required
return nil
@@ -204,6 +230,10 @@ func (m *Tenant) validateSubnetLicense(formats strfmt.Registry) error {
func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateDomains(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateEndpoints(ctx, formats); err != nil {
res = append(res, err)
}
@@ -226,6 +256,22 @@ func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) e
return nil
}
func (m *Tenant) contextValidateDomains(ctx context.Context, formats strfmt.Registry) error {
if m.Domains != nil {
if err := m.Domains.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("domains")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("domains")
}
return err
}
}
return nil
}
func (m *Tenant) contextValidateEndpoints(ctx context.Context, formats strfmt.Registry) error {
if m.Endpoints != nil {

View File

@@ -24,7 +24,9 @@ package models
import (
"context"
"strconv"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
@@ -55,6 +57,9 @@ type TenantList struct {
// deletion date
DeletionDate string `json:"deletion_date,omitempty"`
// domains
Domains *DomainsConfiguration `json:"domains,omitempty"`
// health status
HealthStatus string `json:"health_status,omitempty"`
@@ -70,6 +75,9 @@ type TenantList struct {
// pool count
PoolCount int64 `json:"pool_count,omitempty"`
// tiers
Tiers []*TenantTierElement `json:"tiers"`
// total size
TotalSize int64 `json:"total_size,omitempty"`
@@ -79,11 +87,118 @@ type TenantList struct {
// Validate validates this tenant list
func (m *TenantList) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDomains(formats); err != nil {
res = append(res, err)
}
if err := m.validateTiers(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// ContextValidate validates this tenant list based on context it is used
func (m *TenantList) validateDomains(formats strfmt.Registry) error {
if swag.IsZero(m.Domains) { // not required
return nil
}
if m.Domains != nil {
if err := m.Domains.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("domains")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("domains")
}
return err
}
}
return nil
}
func (m *TenantList) validateTiers(formats strfmt.Registry) error {
if swag.IsZero(m.Tiers) { // not required
return nil
}
for i := 0; i < len(m.Tiers); i++ {
if swag.IsZero(m.Tiers[i]) { // not required
continue
}
if m.Tiers[i] != nil {
if err := m.Tiers[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("tiers" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("tiers" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// ContextValidate validate this tenant list based on the context it is used
func (m *TenantList) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateDomains(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateTiers(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *TenantList) contextValidateDomains(ctx context.Context, formats strfmt.Registry) error {
if m.Domains != nil {
if err := m.Domains.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("domains")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("domains")
}
return err
}
}
return nil
}
func (m *TenantList) contextValidateTiers(ctx context.Context, formats strfmt.Registry) error {
for i := 0; i < len(m.Tiers); i++ {
if m.Tiers[i] != nil {
if err := m.Tiers[i].ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("tiers" + "." + strconv.Itoa(i))
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("tiers" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}

View File

@@ -0,0 +1,73 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// TenantTierElement tenant tier element
//
// swagger:model tenantTierElement
type TenantTierElement struct {
// name
Name string `json:"name,omitempty"`
// size
Size int64 `json:"size,omitempty"`
// type
Type string `json:"type,omitempty"`
}
// Validate validates this tenant tier element
func (m *TenantTierElement) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this tenant tier element based on context it is used
func (m *TenantTierElement) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *TenantTierElement) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TenantTierElement) UnmarshalBinary(b []byte) error {
var res TenantTierElement
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -49,11 +49,20 @@ type TierAzure struct {
// name
Name string `json:"name,omitempty"`
// objects
Objects string `json:"objects,omitempty"`
// prefix
Prefix string `json:"prefix,omitempty"`
// region
Region string `json:"region,omitempty"`
// usage
Usage string `json:"usage,omitempty"`
// versions
Versions string `json:"versions,omitempty"`
}
// Validate validates this tier azure

View File

@@ -46,11 +46,20 @@ type TierGcs struct {
// name
Name string `json:"name,omitempty"`
// objects
Objects string `json:"objects,omitempty"`
// prefix
Prefix string `json:"prefix,omitempty"`
// region
Region string `json:"region,omitempty"`
// usage
Usage string `json:"usage,omitempty"`
// versions
Versions string `json:"versions,omitempty"`
}
// Validate validates this tier gcs

View File

@@ -46,6 +46,9 @@ type TierS3 struct {
// name
Name string `json:"name,omitempty"`
// objects
Objects string `json:"objects,omitempty"`
// prefix
Prefix string `json:"prefix,omitempty"`
@@ -57,6 +60,12 @@ type TierS3 struct {
// storageclass
Storageclass string `json:"storageclass,omitempty"`
// usage
Usage string `json:"usage,omitempty"`
// versions
Versions string `json:"versions,omitempty"`
}
// Validate validates this tier s3

79
models/toleration.go Normal file
View File

@@ -0,0 +1,79 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Toleration toleration
//
// swagger:model toleration
type Toleration struct {
// effect
Effect string `json:"effect,omitempty"`
// key
Key string `json:"key,omitempty"`
// operator
Operator string `json:"operator,omitempty"`
// toleration seconds
TolerationSeconds int64 `json:"tolerationSeconds,omitempty"`
// value
Value string `json:"value,omitempty"`
}
// Validate validates this toleration
func (m *Toleration) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validates this toleration based on context it is used
func (m *Toleration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *Toleration) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Toleration) UnmarshalBinary(b []byte) error {
var res Toleration
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -0,0 +1,121 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// UpdateDomainsRequest update domains request
//
// swagger:model updateDomainsRequest
type UpdateDomainsRequest struct {
// domains
Domains *DomainsConfiguration `json:"domains,omitempty"`
}
// Validate validates this update domains request
func (m *UpdateDomainsRequest) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateDomains(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *UpdateDomainsRequest) validateDomains(formats strfmt.Registry) error {
if swag.IsZero(m.Domains) { // not required
return nil
}
if m.Domains != nil {
if err := m.Domains.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("domains")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("domains")
}
return err
}
}
return nil
}
// ContextValidate validate this update domains request based on the context it is used
func (m *UpdateDomainsRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateDomains(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *UpdateDomainsRequest) contextValidateDomains(ctx context.Context, formats strfmt.Registry) error {
if m.Domains != nil {
if err := m.Domains.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("domains")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("domains")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *UpdateDomainsRequest) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *UpdateDomainsRequest) UnmarshalBinary(b []byte) error {
var res UpdateDomainsRequest
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

170
models/volume.go Normal file
View File

@@ -0,0 +1,170 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
)
// Volume volume
//
// swagger:model volume
type Volume struct {
// name
Name string `json:"name,omitempty"`
// projected
Projected *ProjectedVolume `json:"projected,omitempty"`
// pvc
Pvc *Pvc `json:"pvc,omitempty"`
}
// Validate validates this volume
func (m *Volume) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateProjected(formats); err != nil {
res = append(res, err)
}
if err := m.validatePvc(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Volume) validateProjected(formats strfmt.Registry) error {
if swag.IsZero(m.Projected) { // not required
return nil
}
if m.Projected != nil {
if err := m.Projected.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("projected")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("projected")
}
return err
}
}
return nil
}
func (m *Volume) validatePvc(formats strfmt.Registry) error {
if swag.IsZero(m.Pvc) { // not required
return nil
}
if m.Pvc != nil {
if err := m.Pvc.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("pvc")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("pvc")
}
return err
}
}
return nil
}
// ContextValidate validate this volume based on the context it is used
func (m *Volume) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateProjected(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidatePvc(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *Volume) contextValidateProjected(ctx context.Context, formats strfmt.Registry) error {
if m.Projected != nil {
if err := m.Projected.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("projected")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("projected")
}
return err
}
}
return nil
}
func (m *Volume) contextValidatePvc(ctx context.Context, formats strfmt.Registry) error {
if m.Pvc != nil {
if err := m.Pvc.ContextValidate(ctx, formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("pvc")
} else if ce, ok := err.(*errors.CompositeError); ok {
return ce.ValidateName("pvc")
}
return err
}
}
return nil
}
// MarshalBinary interface implementation
func (m *Volume) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *Volume) UnmarshalBinary(b []byte) error {
var res Volume
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}

View File

@@ -21,24 +21,37 @@ import (
b64 "encoding/base64"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"os/exec"
"strconv"
"strings"
"testing"
"time"
"github.com/go-openapi/loads"
"github.com/minio/console/models"
"github.com/minio/console/restapi"
"github.com/minio/console/restapi/operations"
"github.com/minio/console/operatorapi"
"github.com/minio/console/operatorapi/operations"
"github.com/stretchr/testify/assert"
)
var token string
func inspectHTTPResponse(httpResponse *http.Response) string {
/*
Helper function to inspect the content of a HTTP response.
*/
b, err := io.ReadAll(httpResponse.Body)
if err != nil {
log.Fatalln(err)
}
return "Http Response: " + string(b)
}
func decodeBase64(value string) string {
/*
Helper function to decode in base64
@@ -74,11 +87,11 @@ func printEndFunc(functionName string) {
fmt.Println("")
}
func initConsoleServer() (*restapi.Server, error) {
func initConsoleServer() (*operatorapi.Server, error) {
//os.Setenv("CONSOLE_MINIO_SERVER", "localhost:9000")
swaggerSpec, err := loads.Embedded(restapi.SwaggerJSON, restapi.FlatSwaggerJSON)
swaggerSpec, err := loads.Embedded(operatorapi.SwaggerJSON, operatorapi.FlatSwaggerJSON)
if err != nil {
return nil, err
}
@@ -88,24 +101,22 @@ func initConsoleServer() (*restapi.Server, error) {
}
// Initialize MinIO loggers
restapi.LogInfo = noLog
restapi.LogError = noLog
operatorapi.LogInfo = noLog
operatorapi.LogError = noLog
api := operations.NewConsoleAPI(swaggerSpec)
api := operations.NewOperatorAPI(swaggerSpec)
api.Logger = noLog
server := restapi.NewServer(api)
server := operatorapi.NewServer(api)
// register all APIs
server.ConfigureAPI()
//restapi.GlobalRootCAs, restapi.GlobalPublicCerts, restapi.GlobalTLSCertsManager = globalRootCAs, globalPublicCerts, globalTLSCerts
consolePort, _ := strconv.Atoi("9090")
server.Host = "0.0.0.0"
server.Port = consolePort
restapi.Port = "9090"
restapi.Hostname = "0.0.0.0"
operatorapi.Port = "9090"
operatorapi.Hostname = "0.0.0.0"
return server, nil
}
@@ -477,3 +488,124 @@ func TestListTenantsByNameSpace(t *testing.T) {
fmt.Println(*TenantName)
assert.Equal("new-tenant", *TenantName, *TenantName)
}
func ListNodeLabels() (*http.Response, error) {
/*
Helper function to list buckets
HTTP Verb: GET
URL: http://localhost:9090/api/v1/nodes/labels
*/
request, err := http.NewRequest(
"GET", "http://localhost:9090/api/v1/nodes/labels", nil)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
client := &http.Client{
Timeout: 2 * time.Second,
}
response, err := client.Do(request)
return response, err
}
func TestListNodeLabels(t *testing.T) {
assert := assert.New(t)
resp, err := ListNodeLabels()
assert.Nil(err)
if err != nil {
log.Println(err)
return
}
finalResponse := inspectHTTPResponse(resp)
if resp != nil {
assert.Equal(
200, resp.StatusCode, finalResponse)
}
// "beta.kubernetes.io/arch" is a label of our nodes and is expected
assert.True(
strings.Contains(finalResponse, "beta.kubernetes.io/arch"),
finalResponse)
}
func GetPodEvents(nameSpace string, tenant string, podName string) (*http.Response, error) {
/*
Helper function to get events for pod
URL: /namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events
HTTP Verb: GET
*/
request, err := http.NewRequest(
"GET", "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/pods/"+podName+"/events", nil)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
client := &http.Client{
Timeout: 2 * time.Second,
}
response, err := client.Do(request)
return response, err
}
func TestGetPodEvents(t *testing.T) {
assert := assert.New(t)
namespace := "tenant-lite"
tenant := "storage-lite"
podName := "storage-lite-pool-0-0"
resp, err := GetPodEvents(namespace, tenant, podName)
assert.Nil(err)
if err != nil {
log.Println(err)
return
}
if resp != nil {
assert.Equal(
200, resp.StatusCode, "Status Code is incorrect")
}
}
func GetPodDescribe(nameSpace string, tenant string, podName string) (*http.Response, error) {
/*
Helper function to get events for pod
URL: /namespaces/{namespace}/tenants/{tenant}/pods/{podName}/events
HTTP Verb: GET
*/
fmt.Println(nameSpace)
fmt.Println(tenant)
fmt.Println(podName)
request, err := http.NewRequest(
"GET", "http://localhost:9090/api/v1/namespaces/"+nameSpace+"/tenants/"+tenant+"/pods/"+podName+"/describe", nil)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
client := &http.Client{
Timeout: 2 * time.Second,
}
response, err := client.Do(request)
return response, err
}
func TestGetPodDescribe(t *testing.T) {
assert := assert.New(t)
namespace := "tenant-lite"
tenant := "storage-lite"
podName := "storage-lite-pool-0-0"
resp, err := GetPodDescribe(namespace, tenant, podName)
assert.Nil(err)
if err != nil {
log.Println(err)
return
}
finalResponse := inspectHTTPResponse(resp)
if resp != nil {
assert.Equal(
200, resp.StatusCode, finalResponse)
}
/*if resp != nil {
assert.Equal(
200, resp.StatusCode, "Status Code is incorrect")
}*/
}

View File

@@ -18,15 +18,14 @@ package auth
import (
"context"
"errors"
errors "github.com/minio/console/restapi"
"github.com/minio/console/cluster"
"github.com/minio/minio-go/v7/pkg/credentials"
operatorClientset "github.com/minio/operator/pkg/client/clientset/versioned"
)
var errInvalidCredentials = errors.New("invalid Login")
// operatorCredentialsProvider is an struct to hold the JWT (service account token)
type operatorCredentialsProvider struct {
serviceAccountJWT string
@@ -76,7 +75,8 @@ func checkServiceAccountTokenValid(ctx context.Context, operatorClient OperatorC
// GetConsoleCredentialsForOperator will validate the provided JWT (service account token) and return it in the form of credentials.Login
func GetConsoleCredentialsForOperator(jwt string) (*credentials.Credentials, error) {
ctx := context.Background()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
opClientClientSet, err := cluster.OperatorClient(jwt)
if err != nil {
return nil, err
@@ -85,7 +85,7 @@ func GetConsoleCredentialsForOperator(jwt string) (*credentials.Credentials, err
client: opClientClientSet,
}
if err = checkServiceAccountTokenValid(ctx, opClient); err != nil {
return nil, errInvalidCredentials
return nil, errors.ErrInvalidLogin
}
return credentials.New(operatorCredentialsProvider{serviceAccountJWT: jwt}), nil
}

View File

@@ -23,7 +23,6 @@ import (
"strings"
"github.com/klauspost/compress/gzhttp"
"github.com/minio/console/restapi"
"github.com/unrolled/secure"
@@ -58,7 +57,7 @@ func configureAPI(api *operations.OperatorAPI) http.Handler {
api.KeyAuth = func(token string, scopes []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
claims, err := auth.SessionTokenAuthenticate(token)
claims, err := auth.ParseClaimsFromToken(token)
if err != nil {
api.Logger("Unable to validate the session token %s: %v", token, err)
return nil, errors.New(401, "incorrect api key auth")
@@ -101,8 +100,8 @@ func configureAPI(api *operations.OperatorAPI) http.Handler {
// The TLS configuration before HTTPS server starts.
func configureTLS(tlsConfig *tls.Config) {
tlsConfig.RootCAs = GlobalRootCAs
tlsConfig.GetCertificate = GlobalTLSCertsManager.GetCertificate
tlsConfig.RootCAs = restapi.GlobalRootCAs
tlsConfig.GetCertificate = restapi.GlobalTLSCertsManager.GetCertificate
}
// As soon as server is initialized but not run yet, this function will be called.
@@ -118,24 +117,6 @@ func setupMiddlewares(handler http.Handler) http.Handler {
return handler
}
func AuthenticationMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
token, err := auth.GetTokenFromRequest(r)
if err != nil && err != auth.ErrNoAuthToken {
http.Error(w, err.Error(), http.StatusUnauthorized)
return
}
// All handlers handle appropriately to return errors
// based on their swagger rules, we do not need to
// additionally return error here, let the next ServeHTTPs
// handle it appropriately.
if token != "" {
r.Header.Add("Authorization", "Bearer "+token)
}
next.ServeHTTP(w, r)
})
}
// proxyMiddleware adds the proxy capability
func proxyMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -150,19 +131,23 @@ func proxyMiddleware(next http.Handler) http.Handler {
// 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, logging and metrics.
func setupGlobalMiddleware(handler http.Handler) http.Handler {
// handle cookie or authorization header for session
next := AuthenticationMiddleware(handler)
// proxy requests
next = proxyMiddleware(next)
next := proxyMiddleware(handler)
// if audit-log is enabled console will log all incoming request
next = restapi.AuditLogMiddleware(next)
// serve static files
next = restapi.FileServerMiddleware(next)
// add information to request context
next = restapi.ContextMiddleware(next)
// handle cookie or authorization header for session
next = restapi.AuthenticationMiddleware(next)
// Secure middleware, this middleware wrap all the previous handlers and add
// HTTP security headers
secureOptions := secure.Options{
AllowedHosts: restapi.GetSecureAllowedHosts(),
AllowedHostsAreRegex: restapi.GetSecureAllowedHostsAreRegex(),
HostsProxyHeaders: restapi.GetSecureHostsProxyHeaders(),
SSLRedirect: restapi.GetTLSRedirect() == "on" && len(GlobalPublicCerts) > 0,
SSLRedirect: restapi.GetTLSRedirect() == "on" && len(restapi.GlobalPublicCerts) > 0,
SSLHost: restapi.GetSecureTLSHost(),
STSSeconds: restapi.GetSecureSTSSeconds(),
STSIncludeSubdomains: restapi.GetSecureSTSIncludeSubdomains(),

File diff suppressed because it is too large Load Diff

View File

@@ -1,219 +0,0 @@
// This file is part of MinIO Console Server
// Copyright (c) 2021 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package operatorapi
import (
"errors"
"runtime"
"strings"
"github.com/go-openapi/swag"
"github.com/minio/console/models"
"github.com/minio/madmin-go"
k8sErrors "k8s.io/apimachinery/pkg/api/errors"
)
var (
// Generic error messages
errorGeneric = errors.New("an error occurred, please try again")
errInvalidCredentials = errors.New("invalid Login")
errorGenericInvalidSession = errors.New("invalid session")
errorGenericUnauthorized = errors.New("unauthorized")
errorGenericForbidden = errors.New("forbidden")
// ErrorGenericNotFound Generic error for not found
ErrorGenericNotFound = errors.New("not found")
// Explicit error messages
errorInvalidErasureCodingValue = errors.New("invalid Erasure Coding Value")
errorUnableToGetTenantUsage = errors.New("unable to get tenant usage")
errorUnableToGetTenantLogs = errors.New("unable to get tenant logs")
errorUnableToUpdateTenantCertificates = errors.New("unable to update tenant certificates")
errorUpdatingEncryptionConfig = errors.New("unable to update encryption configuration")
errorDeletingEncryptionConfig = errors.New("error disabling tenant encryption")
errorEncryptionConfigNotFound = errors.New("encryption configuration not found")
errBucketBodyNotInRequest = errors.New("error bucket body not in request")
errBucketNameNotInRequest = errors.New("error bucket name not in request")
errGroupBodyNotInRequest = errors.New("error group body not in request")
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")
errSSENotConfigured = errors.New("error server side encryption configuration not found")
errBucketLifeCycleNotConfigured = errors.New("error bucket life cycle configuration not found")
errChangePassword = errors.New("error please check your current password")
errInvalidLicense = errors.New("invalid license key")
errLicenseNotFound = errors.New("license not found")
errAvoidSelfAccountDelete = errors.New("logged in user cannot be deleted by itself")
errAccessDenied = errors.New("access denied")
errTooManyNodes = errors.New("cannot request more nodes than what is available in the cluster")
errTooFewNodes = errors.New("there are not enough nodes in the cluster to support this tenant")
errTooFewSchedulableNodes = errors.New("there is not enough schedulable nodes to satisfy this requirement")
errFewerThanFourNodes = errors.New("at least 4 nodes are required for a tenant")
)
// prepareError receives an error object and parse it against k8sErrors, returns the right error code paired with a generic error message
func prepareError(err ...error) *models.Error {
errorCode := int32(500)
errorMessage := errorGeneric.Error()
if len(err) > 0 {
frame := getFrame(2)
fileParts := strings.Split(frame.File, "/")
LogError("original error -> (%s:%d: %v)", fileParts[len(fileParts)-1], frame.Line, err[0])
if k8sErrors.IsUnauthorized(err[0]) {
errorCode = 401
errorMessage = errorGenericUnauthorized.Error()
}
if k8sErrors.IsForbidden(err[0]) {
errorCode = 403
errorMessage = errorGenericForbidden.Error()
}
if k8sErrors.IsNotFound(err[0]) {
errorCode = 404
errorMessage = ErrorGenericNotFound.Error()
}
if err[0] == ErrorGenericNotFound {
errorCode = 404
errorMessage = ErrorGenericNotFound.Error()
}
if errors.Is(err[0], errInvalidCredentials) {
errorCode = 401
errorMessage = errInvalidCredentials.Error()
}
// console invalid erasure coding value
if errors.Is(err[0], errorInvalidErasureCodingValue) {
errorCode = 400
errorMessage = errorInvalidErasureCodingValue.Error()
}
if errors.Is(err[0], errBucketBodyNotInRequest) {
errorCode = 400
errorMessage = errBucketBodyNotInRequest.Error()
}
if errors.Is(err[0], errBucketNameNotInRequest) {
errorCode = 400
errorMessage = errBucketNameNotInRequest.Error()
}
if errors.Is(err[0], errGroupBodyNotInRequest) {
errorCode = 400
errorMessage = errGroupBodyNotInRequest.Error()
}
if errors.Is(err[0], errGroupNameNotInRequest) {
errorCode = 400
errorMessage = errGroupNameNotInRequest.Error()
}
if errors.Is(err[0], errPolicyNameNotInRequest) {
errorCode = 400
errorMessage = errPolicyNameNotInRequest.Error()
}
if errors.Is(err[0], errPolicyBodyNotInRequest) {
errorCode = 400
errorMessage = errPolicyBodyNotInRequest.Error()
}
// console invalid session error
if errors.Is(err[0], errorGenericInvalidSession) {
errorCode = 401
errorMessage = errorGenericInvalidSession.Error()
}
// Bucket life cycle not configured
if errors.Is(err[0], errBucketLifeCycleNotConfigured) {
errorCode = 404
errorMessage = errBucketLifeCycleNotConfigured.Error()
}
// Encryption not configured
if errors.Is(err[0], errSSENotConfigured) {
errorCode = 404
errorMessage = errSSENotConfigured.Error()
}
// account change password
if madmin.ToErrorResponse(err[0]).Code == "SignatureDoesNotMatch" {
errorCode = 403
errorMessage = errChangePassword.Error()
}
if errors.Is(err[0], errLicenseNotFound) {
errorCode = 404
errorMessage = errLicenseNotFound.Error()
}
if errors.Is(err[0], errInvalidLicense) {
errorCode = 404
errorMessage = errInvalidLicense.Error()
}
if errors.Is(err[0], errAvoidSelfAccountDelete) {
errorCode = 403
errorMessage = errAvoidSelfAccountDelete.Error()
}
if madmin.ToErrorResponse(err[0]).Code == "AccessDenied" {
errorCode = 403
errorMessage = errAccessDenied.Error()
}
if madmin.ToErrorResponse(err[0]).Code == "InvalidAccessKeyId" {
errorCode = 401
errorMessage = errorGenericInvalidSession.Error()
}
// console invalid session error
if madmin.ToErrorResponse(err[0]).Code == "XMinioAdminNoSuchUser" {
errorCode = 401
errorMessage = errorGenericInvalidSession.Error()
}
// if we received a second error take that as friendly message but dont override the code
if len(err) > 1 && err[1] != nil {
LogError("friendly error: %v", err[1].Error())
errorMessage = err[1].Error()
}
// if we receive third error we just print that as debugging
if len(err) > 2 && err[2] != nil {
LogError("debugging error: %v", err[2].Error())
}
errRemoteTierExists := errors.New("Specified remote tier already exists") //nolint
if errors.Is(err[0], errRemoteTierExists) {
errorMessage = err[0].Error()
}
if errors.Is(err[0], errTooFewNodes) {
errorCode = 507
errorMessage = errTooFewNodes.Error()
}
if errors.Is(err[0], errTooFewSchedulableNodes) {
errorCode = 507
errorMessage = errTooFewSchedulableNodes.Error()
}
if errors.Is(err[0], errFewerThanFourNodes) {
errorCode = 507
errorMessage = errFewerThanFourNodes.Error()
}
}
return &models.Error{Code: errorCode, Message: swag.String(errorMessage), DetailedMessage: swag.String(err[0].Error())}
}
func getFrame(skipFrames int) runtime.Frame {
// We need the frame at index skipFrames+2, since we never want runtime.Callers and getFrame
targetFrameIndex := skipFrames + 2
// Set size to targetFrameIndex+2 to ensure we have room for one more caller than we need
programCounters := make([]uintptr, targetFrameIndex+2)
n := runtime.Callers(0, programCounters)
frame := runtime.Frame{Function: "unknown"}
if n > 0 {
frames := runtime.CallersFrames(programCounters[:n])
for more, frameIndex := true, 0; more && frameIndex <= targetFrameIndex; frameIndex++ {
var frameCandidate runtime.Frame
frameCandidate, more = frames.Next()
if frameIndex == targetFrameIndex {
frame = frameCandidate
}
}
}
return frame
}

View File

@@ -21,7 +21,6 @@ import (
"fmt"
"math/rand"
"net/http"
"time"
xoauth2 "golang.org/x/oauth2"
@@ -34,44 +33,45 @@ import (
"github.com/minio/console/models"
opauth "github.com/minio/console/operatorapi/auth"
"github.com/minio/console/operatorapi/operations"
"github.com/minio/console/operatorapi/operations/user_api"
authApi "github.com/minio/console/operatorapi/operations/auth"
"github.com/minio/console/pkg/auth"
"github.com/minio/console/pkg/auth/idp/oauth2"
)
func registerLoginHandlers(api *operations.OperatorAPI) {
// GET login strategy
api.UserAPILoginDetailHandler = user_api.LoginDetailHandlerFunc(func(params user_api.LoginDetailParams) middleware.Responder {
loginDetails, err := getLoginDetailsResponse(params.HTTPRequest)
api.AuthLoginDetailHandler = authApi.LoginDetailHandlerFunc(func(params authApi.LoginDetailParams) middleware.Responder {
loginDetails, err := getLoginDetailsResponse(params)
if err != nil {
return user_api.NewLoginDetailDefault(int(err.Code)).WithPayload(err)
return authApi.NewLoginDetailDefault(int(err.Code)).WithPayload(err)
}
return user_api.NewLoginDetailOK().WithPayload(loginDetails)
return authApi.NewLoginDetailOK().WithPayload(loginDetails)
})
// POST login using k8s service account token
api.UserAPILoginOperatorHandler = user_api.LoginOperatorHandlerFunc(func(params user_api.LoginOperatorParams) middleware.Responder {
loginResponse, err := getLoginOperatorResponse(params.Body)
api.AuthLoginOperatorHandler = authApi.LoginOperatorHandlerFunc(func(params authApi.LoginOperatorParams) middleware.Responder {
loginResponse, err := getLoginOperatorResponse(params)
if err != nil {
return user_api.NewLoginOperatorDefault(int(err.Code)).WithPayload(err)
return authApi.NewLoginOperatorDefault(int(err.Code)).WithPayload(err)
}
// Custom response writer to set the session cookies
return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) {
cookie := restapi.NewSessionCookieForConsole(loginResponse.SessionID)
http.SetCookie(w, &cookie)
user_api.NewLoginOperatorNoContent().WriteResponse(w, p)
authApi.NewLoginOperatorNoContent().WriteResponse(w, p)
})
})
// POST login using external IDP
api.UserAPILoginOauth2AuthHandler = user_api.LoginOauth2AuthHandlerFunc(func(params user_api.LoginOauth2AuthParams) middleware.Responder {
loginResponse, err := getLoginOauth2AuthResponse(params.HTTPRequest, params.Body)
api.AuthLoginOauth2AuthHandler = authApi.LoginOauth2AuthHandlerFunc(func(params authApi.LoginOauth2AuthParams) middleware.Responder {
loginResponse, err := getLoginOauth2AuthResponse(params)
if err != nil {
return user_api.NewLoginOauth2AuthDefault(int(err.Code)).WithPayload(err)
return authApi.NewLoginOauth2AuthDefault(int(err.Code)).WithPayload(err)
}
// Custom response writer to set the session cookies
return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) {
cookie := restapi.NewSessionCookieForConsole(loginResponse.SessionID)
http.SetCookie(w, &cookie)
user_api.NewLoginOauth2AuthNoContent().WriteResponse(w, p)
authApi.NewLoginOauth2AuthNoContent().WriteResponse(w, p)
})
})
}
@@ -87,23 +87,28 @@ func login(credentials restapi.ConsoleCredentialsI) (*string, error) {
// if we made it here, the consoleCredentials work, generate a jwt with claims
token, err := auth.NewEncryptedTokenForClient(&tokens, credentials.GetAccountAccessKey(), nil)
if err != nil {
LogError("error authenticating user: %v", err)
return nil, errInvalidCredentials
restapi.LogError("error authenticating user: %v", err)
return nil, restapi.ErrInvalidLogin
}
return &token, nil
}
// getLoginDetailsResponse returns information regarding the Console authentication mechanism.
func getLoginDetailsResponse(r *http.Request) (*models.LoginDetails, *models.Error) {
func getLoginDetailsResponse(params authApi.LoginDetailParams) (*models.LoginDetails, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
r := params.HTTPRequest
loginStrategy := models.LoginDetailsLoginStrategyServiceDashAccount
redirectURL := ""
if oauth2.IsIDPEnabled() {
loginStrategy = models.LoginDetailsLoginStrategyRedirect
loginStrategy = models.LoginDetailsLoginStrategyRedirectDashServiceDashAccount
// initialize new oauth2 client
oauth2Client, err := oauth2.NewOauth2ProviderClient(nil, r, restapi.GetConsoleHTTPClient())
if err != nil {
return nil, prepareError(err)
return nil, restapi.ErrorWithContext(ctx, err)
}
// Validate user against IDP
identityProvider := &auth.IdentityProvider{Client: oauth2Client}
@@ -126,31 +131,35 @@ func verifyUserAgainstIDP(ctx context.Context, provider auth.IdentityProviderI,
return oauth2Token, nil
}
func getLoginOauth2AuthResponse(r *http.Request, lr *models.LoginOauth2AuthRequest) (*models.LoginResponse, *models.Error) {
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
func getLoginOauth2AuthResponse(params authApi.LoginOauth2AuthParams) (*models.LoginResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
r := params.HTTPRequest
lr := params.Body
if oauth2.IsIDPEnabled() {
// initialize new oauth2 client
oauth2Client, err := oauth2.NewOauth2ProviderClient(nil, r, restapi.GetConsoleHTTPClient())
if err != nil {
return nil, prepareError(err)
return nil, restapi.ErrorWithContext(ctx, err)
}
// initialize new identity provider
identityProvider := auth.IdentityProvider{Client: oauth2Client}
// Validate user against IDP
_, err = verifyUserAgainstIDP(ctx, identityProvider, *lr.Code, *lr.State)
if err != nil {
return nil, prepareError(err)
return nil, restapi.ErrorWithContext(ctx, err)
}
// If we pass here that means the IDP correctly authenticate the user with the operator resource
// we proceed to use the service account token configured in the operator-console pod
creds, err := newConsoleCredentials(getK8sSAToken())
if err != nil {
return nil, prepareError(err)
return nil, restapi.ErrorWithContext(ctx, err)
}
token, err := login(restapi.ConsoleCredentials{ConsoleCredentials: creds})
if err != nil {
return nil, prepareError(errInvalidCredentials, nil, err)
return nil, restapi.ErrorWithContext(ctx, restapi.ErrInvalidLogin, nil, err)
}
// serialize output
loginResponse := &models.LoginResponse{
@@ -158,7 +167,7 @@ func getLoginOauth2AuthResponse(r *http.Request, lr *models.LoginOauth2AuthReque
}
return loginResponse, nil
}
return nil, prepareError(errorGeneric)
return nil, restapi.ErrorWithContext(ctx, restapi.ErrDefault)
}
func newConsoleCredentials(secretKey string) (*credentials.Credentials, error) {
@@ -170,17 +179,22 @@ func newConsoleCredentials(secretKey string) (*credentials.Credentials, error) {
}
// getLoginOperatorResponse validate the provided service account token against k8s api
func getLoginOperatorResponse(lmr *models.LoginOperatorRequest) (*models.LoginResponse, *models.Error) {
func getLoginOperatorResponse(params authApi.LoginOperatorParams) (*models.LoginResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
lmr := params.Body
creds, err := newConsoleCredentials(*lmr.Jwt)
if err != nil {
return nil, prepareError(err)
return nil, restapi.ErrorWithContext(ctx, err)
}
consoleCreds := restapi.ConsoleCredentials{ConsoleCredentials: creds}
// Set a random as access key as session identifier
consoleCreds.AccountAccessKey = fmt.Sprintf("%d", rand.Intn(100000-10000)+10000)
token, err := login(consoleCreds)
if err != nil {
return nil, prepareError(errInvalidCredentials, nil, err)
return nil, restapi.ErrorWithContext(ctx, restapi.ErrInvalidLogin, nil, err)
}
// serialize output
loginResponse := &models.LoginResponse{

View File

@@ -23,20 +23,20 @@ import (
"github.com/go-openapi/runtime/middleware"
"github.com/minio/console/models"
"github.com/minio/console/operatorapi/operations"
"github.com/minio/console/operatorapi/operations/user_api"
authApi "github.com/minio/console/operatorapi/operations/auth"
"github.com/minio/console/restapi"
)
func registerLogoutHandlers(api *operations.OperatorAPI) {
// logout from console
api.UserAPILogoutHandler = user_api.LogoutHandlerFunc(func(params user_api.LogoutParams, session *models.Principal) middleware.Responder {
api.AuthLogoutHandler = authApi.LogoutHandlerFunc(func(params authApi.LogoutParams, session *models.Principal) middleware.Responder {
// Custom response writer to expire the session cookies
return middleware.ResponderFunc(func(w http.ResponseWriter, p runtime.Producer) {
expiredCookie := restapi.ExpireSessionCookie()
// this will tell the browser to clear the cookie and invalidate user session
// additionally we are deleting the cookie from the client side
http.SetCookie(w, &expiredCookie)
user_api.NewLogoutOK().WriteResponse(w, p)
authApi.NewLogoutOK().WriteResponse(w, p)
})
})
}

View File

@@ -20,12 +20,13 @@ import (
"context"
"errors"
"github.com/minio/console/operatorapi/operations/operator_api"
xerrors "github.com/minio/console/restapi"
"github.com/go-openapi/runtime/middleware"
"github.com/minio/console/cluster"
"github.com/minio/console/models"
"github.com/minio/console/operatorapi/operations"
"github.com/minio/console/operatorapi/operations/operator_api"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/client-go/kubernetes/typed/core/v1"
@@ -44,12 +45,12 @@ func registerNamespaceHandlers(api *operations.OperatorAPI) {
}
func getNamespaceCreatedResponse(session *models.Principal, params operator_api.CreateNamespaceParams) *models.Error {
ctx := context.Background()
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
clientset, err := cluster.K8sClient(session.STSSessionToken)
if err != nil {
return prepareError(err)
return xerrors.ErrorWithContext(ctx, err)
}
namespace := *params.Body.Name
@@ -57,7 +58,7 @@ func getNamespaceCreatedResponse(session *models.Principal, params operator_api.
errCreation := getNamespaceCreated(ctx, clientset.CoreV1(), namespace)
if errCreation != nil {
return prepareError(errCreation)
return xerrors.ErrorWithContext(ctx, errCreation)
}
return nil

View File

@@ -21,6 +21,8 @@ import (
"errors"
"sort"
xerrors "github.com/minio/console/restapi"
"github.com/minio/minio-go/v7/pkg/set"
"github.com/minio/console/operatorapi/operations/operator_api"
@@ -52,8 +54,8 @@ func registerNodesHandlers(api *operations.OperatorAPI) {
return operator_api.NewListNodeLabelsOK().WithPayload(*resp)
})
api.OperatorAPIGetAllocatableResourcesHandler = operator_api.GetAllocatableResourcesHandlerFunc(func(params operator_api.GetAllocatableResourcesParams, principal *models.Principal) middleware.Responder {
resp, err := getAllocatableResourcesResponse(params.NumNodes, principal)
api.OperatorAPIGetAllocatableResourcesHandler = operator_api.GetAllocatableResourcesHandlerFunc(func(params operator_api.GetAllocatableResourcesParams, session *models.Principal) middleware.Responder {
resp, err := getAllocatableResourcesResponse(session, params)
if err != nil {
return operator_api.NewGetAllocatableResourcesDefault(int(err.Code)).WithPayload(err)
}
@@ -71,7 +73,7 @@ type NodeResourceInfo struct {
func getMaxAllocatableMemory(ctx context.Context, clientset v1.CoreV1Interface, numNodes int32) (*models.MaxAllocatableMemResponse, error) {
// can't request less than 4 nodes
if numNodes < 4 {
return nil, errFewerThanFourNodes
return nil, xerrors.ErrFewerThanFourNodes
}
// get all nodes from cluster
@@ -97,15 +99,15 @@ func getMaxAllocatableMemory(ctx context.Context, clientset v1.CoreV1Interface,
}
// requesting more nodes than schedulable and less than total number of workers
if int(numNodes) > schedulableNodes && int(numNodes) < nonMasterNodes {
return nil, errTooManyNodes
return nil, xerrors.ErrTooManyNodes
}
if nonMasterNodes < int(numNodes) {
return nil, errTooFewNodes
return nil, xerrors.ErrTooFewNodes
}
// not enough schedulable nodes
if schedulableNodes < int(numNodes) {
return nil, errTooFewSchedulableNodes
return nil, xerrors.ErrTooFewAvailableNodes
}
availableMemSizes := []int64{}
@@ -177,12 +179,12 @@ func min(x, y int64) int64 {
func getMaxAllocatableMemoryResponse(ctx context.Context, session *models.Principal, numNodes int32) (*models.MaxAllocatableMemResponse, *models.Error) {
client, err := cluster.K8sClient(session.STSSessionToken)
if err != nil {
return nil, prepareError(err)
return nil, xerrors.ErrorWithContext(ctx, err)
}
clusterResources, err := getMaxAllocatableMemory(ctx, client.CoreV1(), numNodes)
if err != nil {
return nil, prepareError(err)
return nil, xerrors.ErrorWithContext(ctx, err)
}
return clusterResources, nil
}
@@ -217,12 +219,12 @@ func getNodeLabels(ctx context.Context, clientset v1.CoreV1Interface) (*models.N
func getNodeLabelsResponse(ctx context.Context, session *models.Principal) (*models.NodeLabels, *models.Error) {
client, err := cluster.K8sClient(session.STSSessionToken)
if err != nil {
return nil, prepareError(err)
return nil, xerrors.ErrorWithContext(ctx, err)
}
clusterResources, err := getNodeLabels(ctx, client.CoreV1())
if err != nil {
return nil, prepareError(err)
return nil, xerrors.ErrorWithContext(ctx, err)
}
return clusterResources, nil
}
@@ -357,16 +359,16 @@ OUTER:
// Get allocatable resources response
func getAllocatableResourcesResponse(numNodes int32, session *models.Principal) (*models.AllocatableResourcesResponse, *models.Error) {
ctx := context.Background()
func getAllocatableResourcesResponse(session *models.Principal, params operator_api.GetAllocatableResourcesParams) (*models.AllocatableResourcesResponse, *models.Error) {
ctx, cancel := context.WithCancel(params.HTTPRequest.Context())
defer cancel()
client, err := cluster.K8sClient(session.STSSessionToken)
if err != nil {
return nil, prepareError(err)
return nil, xerrors.ErrorWithContext(ctx, err)
}
clusterResources, err := getAllocatableResources(ctx, client.CoreV1(), numNodes)
clusterResources, err := getAllocatableResources(ctx, client.CoreV1(), params.NumNodes)
if err != nil {
return nil, prepareError(err)
return nil, xerrors.ErrorWithContext(ctx, err)
}
return clusterResources, nil
}

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
@@ -46,7 +46,7 @@ func NewLoginDetail(ctx *middleware.Context, handler LoginDetailHandler) *LoginD
return &LoginDetail{Context: ctx, Handler: handler}
}
/* LoginDetail swagger:route GET /login UserAPI loginDetail
/* LoginDetail swagger:route GET /login Auth loginDetail
Returns login strategy, form or sso.

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
@@ -46,7 +46,7 @@ func NewLoginOauth2Auth(ctx *middleware.Context, handler LoginOauth2AuthHandler)
return &LoginOauth2Auth{Context: ctx, Handler: handler}
}
/* LoginOauth2Auth swagger:route POST /login/oauth2/auth UserAPI loginOauth2Auth
/* LoginOauth2Auth swagger:route POST /login/oauth2/auth Auth loginOauth2Auth
Identity Provider oauth2 callback endpoint.

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
@@ -46,7 +46,7 @@ func NewLoginOperator(ctx *middleware.Context, handler LoginOperatorHandler) *Lo
return &LoginOperator{Context: ctx, Handler: handler}
}
/* LoginOperator swagger:route POST /login/operator UserAPI loginOperator
/* LoginOperator swagger:route POST /login/operator Auth loginOperator
Login to Operator Console.

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
@@ -48,7 +48,7 @@ func NewLogout(ctx *middleware.Context, handler LogoutHandler) *Logout {
return &Logout{Context: ctx, Handler: handler}
}
/* Logout swagger:route POST /logout UserAPI logout
/* Logout swagger:route POST /logout Auth logout
Logout from Operator.

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
@@ -48,7 +48,7 @@ func NewSessionCheck(ctx *middleware.Context, handler SessionCheckHandler) *Sess
return &SessionCheck{Context: ctx, Handler: handler}
}
/* SessionCheck swagger:route GET /session UserAPI sessionCheck
/* SessionCheck swagger:route GET /session Auth sessionCheck
Endpoint to check if your session is still valid

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

View File

@@ -17,7 +17,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package user_api
package auth
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command

View File

@@ -37,6 +37,7 @@ import (
"github.com/go-openapi/swag"
"github.com/minio/console/models"
"github.com/minio/console/operatorapi/operations/auth"
"github.com/minio/console/operatorapi/operations/operator_api"
"github.com/minio/console/operatorapi/operations/user_api"
)
@@ -81,6 +82,9 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
OperatorAPIDeleteTenantHandler: operator_api.DeleteTenantHandlerFunc(func(params operator_api.DeleteTenantParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.DeleteTenant has not yet been implemented")
}),
OperatorAPIDescribePodHandler: operator_api.DescribePodHandlerFunc(func(params operator_api.DescribePodParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.DescribePod has not yet been implemented")
}),
OperatorAPIDisableTenantLoggingHandler: operator_api.DisableTenantLoggingHandlerFunc(func(params operator_api.DisableTenantLoggingParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.DisableTenantLogging has not yet been implemented")
}),
@@ -141,23 +145,23 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
OperatorAPIListTenantsHandler: operator_api.ListTenantsHandlerFunc(func(params operator_api.ListTenantsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.ListTenants has not yet been implemented")
}),
UserAPILoginDetailHandler: user_api.LoginDetailHandlerFunc(func(params user_api.LoginDetailParams) middleware.Responder {
return middleware.NotImplemented("operation user_api.LoginDetail 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")
}),
UserAPILoginOauth2AuthHandler: user_api.LoginOauth2AuthHandlerFunc(func(params user_api.LoginOauth2AuthParams) middleware.Responder {
return middleware.NotImplemented("operation user_api.LoginOauth2Auth has not yet been implemented")
AuthLoginOauth2AuthHandler: auth.LoginOauth2AuthHandlerFunc(func(params auth.LoginOauth2AuthParams) middleware.Responder {
return middleware.NotImplemented("operation auth.LoginOauth2Auth has not yet been implemented")
}),
UserAPILoginOperatorHandler: user_api.LoginOperatorHandlerFunc(func(params user_api.LoginOperatorParams) middleware.Responder {
return middleware.NotImplemented("operation user_api.LoginOperator has not yet been implemented")
AuthLoginOperatorHandler: auth.LoginOperatorHandlerFunc(func(params auth.LoginOperatorParams) middleware.Responder {
return middleware.NotImplemented("operation auth.LoginOperator has not yet been implemented")
}),
UserAPILogoutHandler: user_api.LogoutHandlerFunc(func(params user_api.LogoutParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation user_api.Logout 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")
}),
OperatorAPIPutTenantYAMLHandler: operator_api.PutTenantYAMLHandlerFunc(func(params operator_api.PutTenantYAMLParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.PutTenantYAML has not yet been implemented")
}),
UserAPISessionCheckHandler: user_api.SessionCheckHandlerFunc(func(params user_api.SessionCheckParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation user_api.SessionCheck 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")
}),
OperatorAPISetTenantLogsHandler: operator_api.SetTenantLogsHandlerFunc(func(params operator_api.SetTenantLogsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.SetTenantLogs has not yet been implemented")
@@ -189,6 +193,9 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
OperatorAPITenantEncryptionInfoHandler: operator_api.TenantEncryptionInfoHandlerFunc(func(params operator_api.TenantEncryptionInfoParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.TenantEncryptionInfo has not yet been implemented")
}),
OperatorAPITenantIdentityProviderHandler: operator_api.TenantIdentityProviderHandlerFunc(func(params operator_api.TenantIdentityProviderParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.TenantIdentityProvider has not yet been implemented")
}),
OperatorAPITenantSecurityHandler: operator_api.TenantSecurityHandlerFunc(func(params operator_api.TenantSecurityParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.TenantSecurity has not yet been implemented")
}),
@@ -204,6 +211,12 @@ func NewOperatorAPI(spec *loads.Document) *OperatorAPI {
OperatorAPIUpdateTenantHandler: operator_api.UpdateTenantHandlerFunc(func(params operator_api.UpdateTenantParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.UpdateTenant has not yet been implemented")
}),
OperatorAPIUpdateTenantDomainsHandler: operator_api.UpdateTenantDomainsHandlerFunc(func(params operator_api.UpdateTenantDomainsParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.UpdateTenantDomains has not yet been implemented")
}),
OperatorAPIUpdateTenantIdentityProviderHandler: operator_api.UpdateTenantIdentityProviderHandlerFunc(func(params operator_api.UpdateTenantIdentityProviderParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.UpdateTenantIdentityProvider has not yet been implemented")
}),
OperatorAPIUpdateTenantSecurityHandler: operator_api.UpdateTenantSecurityHandlerFunc(func(params operator_api.UpdateTenantSecurityParams, principal *models.Principal) middleware.Responder {
return middleware.NotImplemented("operation operator_api.UpdateTenantSecurity has not yet been implemented")
}),
@@ -268,6 +281,8 @@ type OperatorAPI struct {
OperatorAPIDeletePodHandler operator_api.DeletePodHandler
// OperatorAPIDeleteTenantHandler sets the operation handler for the delete tenant operation
OperatorAPIDeleteTenantHandler operator_api.DeleteTenantHandler
// OperatorAPIDescribePodHandler sets the operation handler for the describe pod operation
OperatorAPIDescribePodHandler operator_api.DescribePodHandler
// OperatorAPIDisableTenantLoggingHandler sets the operation handler for the disable tenant logging operation
OperatorAPIDisableTenantLoggingHandler operator_api.DisableTenantLoggingHandler
// OperatorAPIEnableTenantLoggingHandler sets the operation handler for the enable tenant logging operation
@@ -308,18 +323,18 @@ type OperatorAPI struct {
OperatorAPIListPVCsForTenantHandler operator_api.ListPVCsForTenantHandler
// OperatorAPIListTenantsHandler sets the operation handler for the list tenants operation
OperatorAPIListTenantsHandler operator_api.ListTenantsHandler
// UserAPILoginDetailHandler sets the operation handler for the login detail operation
UserAPILoginDetailHandler user_api.LoginDetailHandler
// UserAPILoginOauth2AuthHandler sets the operation handler for the login oauth2 auth operation
UserAPILoginOauth2AuthHandler user_api.LoginOauth2AuthHandler
// UserAPILoginOperatorHandler sets the operation handler for the login operator operation
UserAPILoginOperatorHandler user_api.LoginOperatorHandler
// UserAPILogoutHandler sets the operation handler for the logout operation
UserAPILogoutHandler user_api.LogoutHandler
// AuthLoginDetailHandler sets the operation handler for the login detail operation
AuthLoginDetailHandler auth.LoginDetailHandler
// AuthLoginOauth2AuthHandler sets the operation handler for the login oauth2 auth operation
AuthLoginOauth2AuthHandler auth.LoginOauth2AuthHandler
// AuthLoginOperatorHandler sets the operation handler for the login operator operation
AuthLoginOperatorHandler auth.LoginOperatorHandler
// AuthLogoutHandler sets the operation handler for the logout operation
AuthLogoutHandler auth.LogoutHandler
// OperatorAPIPutTenantYAMLHandler sets the operation handler for the put tenant y a m l operation
OperatorAPIPutTenantYAMLHandler operator_api.PutTenantYAMLHandler
// UserAPISessionCheckHandler sets the operation handler for the session check operation
UserAPISessionCheckHandler user_api.SessionCheckHandler
// AuthSessionCheckHandler sets the operation handler for the session check operation
AuthSessionCheckHandler auth.SessionCheckHandler
// OperatorAPISetTenantLogsHandler sets the operation handler for the set tenant logs operation
OperatorAPISetTenantLogsHandler operator_api.SetTenantLogsHandler
// OperatorAPISetTenantMonitoringHandler sets the operation handler for the set tenant monitoring operation
@@ -340,6 +355,8 @@ type OperatorAPI struct {
OperatorAPITenantDetailsHandler operator_api.TenantDetailsHandler
// OperatorAPITenantEncryptionInfoHandler sets the operation handler for the tenant encryption info operation
OperatorAPITenantEncryptionInfoHandler operator_api.TenantEncryptionInfoHandler
// OperatorAPITenantIdentityProviderHandler sets the operation handler for the tenant identity provider operation
OperatorAPITenantIdentityProviderHandler operator_api.TenantIdentityProviderHandler
// OperatorAPITenantSecurityHandler sets the operation handler for the tenant security operation
OperatorAPITenantSecurityHandler operator_api.TenantSecurityHandler
// OperatorAPITenantUpdateCertificateHandler sets the operation handler for the tenant update certificate operation
@@ -350,6 +367,10 @@ type OperatorAPI struct {
OperatorAPITenantUpdatePoolsHandler operator_api.TenantUpdatePoolsHandler
// OperatorAPIUpdateTenantHandler sets the operation handler for the update tenant operation
OperatorAPIUpdateTenantHandler operator_api.UpdateTenantHandler
// OperatorAPIUpdateTenantDomainsHandler sets the operation handler for the update tenant domains operation
OperatorAPIUpdateTenantDomainsHandler operator_api.UpdateTenantDomainsHandler
// OperatorAPIUpdateTenantIdentityProviderHandler sets the operation handler for the update tenant identity provider operation
OperatorAPIUpdateTenantIdentityProviderHandler operator_api.UpdateTenantIdentityProviderHandler
// OperatorAPIUpdateTenantSecurityHandler sets the operation handler for the update tenant security operation
OperatorAPIUpdateTenantSecurityHandler operator_api.UpdateTenantSecurityHandler
@@ -451,6 +472,9 @@ func (o *OperatorAPI) Validate() error {
if o.OperatorAPIDeleteTenantHandler == nil {
unregistered = append(unregistered, "operator_api.DeleteTenantHandler")
}
if o.OperatorAPIDescribePodHandler == nil {
unregistered = append(unregistered, "operator_api.DescribePodHandler")
}
if o.OperatorAPIDisableTenantLoggingHandler == nil {
unregistered = append(unregistered, "operator_api.DisableTenantLoggingHandler")
}
@@ -511,23 +535,23 @@ func (o *OperatorAPI) Validate() error {
if o.OperatorAPIListTenantsHandler == nil {
unregistered = append(unregistered, "operator_api.ListTenantsHandler")
}
if o.UserAPILoginDetailHandler == nil {
unregistered = append(unregistered, "user_api.LoginDetailHandler")
if o.AuthLoginDetailHandler == nil {
unregistered = append(unregistered, "auth.LoginDetailHandler")
}
if o.UserAPILoginOauth2AuthHandler == nil {
unregistered = append(unregistered, "user_api.LoginOauth2AuthHandler")
if o.AuthLoginOauth2AuthHandler == nil {
unregistered = append(unregistered, "auth.LoginOauth2AuthHandler")
}
if o.UserAPILoginOperatorHandler == nil {
unregistered = append(unregistered, "user_api.LoginOperatorHandler")
if o.AuthLoginOperatorHandler == nil {
unregistered = append(unregistered, "auth.LoginOperatorHandler")
}
if o.UserAPILogoutHandler == nil {
unregistered = append(unregistered, "user_api.LogoutHandler")
if o.AuthLogoutHandler == nil {
unregistered = append(unregistered, "auth.LogoutHandler")
}
if o.OperatorAPIPutTenantYAMLHandler == nil {
unregistered = append(unregistered, "operator_api.PutTenantYAMLHandler")
}
if o.UserAPISessionCheckHandler == nil {
unregistered = append(unregistered, "user_api.SessionCheckHandler")
if o.AuthSessionCheckHandler == nil {
unregistered = append(unregistered, "auth.SessionCheckHandler")
}
if o.OperatorAPISetTenantLogsHandler == nil {
unregistered = append(unregistered, "operator_api.SetTenantLogsHandler")
@@ -559,6 +583,9 @@ func (o *OperatorAPI) Validate() error {
if o.OperatorAPITenantEncryptionInfoHandler == nil {
unregistered = append(unregistered, "operator_api.TenantEncryptionInfoHandler")
}
if o.OperatorAPITenantIdentityProviderHandler == nil {
unregistered = append(unregistered, "operator_api.TenantIdentityProviderHandler")
}
if o.OperatorAPITenantSecurityHandler == nil {
unregistered = append(unregistered, "operator_api.TenantSecurityHandler")
}
@@ -574,6 +601,12 @@ func (o *OperatorAPI) Validate() error {
if o.OperatorAPIUpdateTenantHandler == nil {
unregistered = append(unregistered, "operator_api.UpdateTenantHandler")
}
if o.OperatorAPIUpdateTenantDomainsHandler == nil {
unregistered = append(unregistered, "operator_api.UpdateTenantDomainsHandler")
}
if o.OperatorAPIUpdateTenantIdentityProviderHandler == nil {
unregistered = append(unregistered, "operator_api.UpdateTenantIdentityProviderHandler")
}
if o.OperatorAPIUpdateTenantSecurityHandler == nil {
unregistered = append(unregistered, "operator_api.UpdateTenantSecurityHandler")
}
@@ -699,6 +732,10 @@ func (o *OperatorAPI) initHandlerCache() {
o.handlers["DELETE"] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/namespaces/{namespace}/tenants/{tenant}"] = operator_api.NewDeleteTenant(o.context, o.OperatorAPIDeleteTenantHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/describe"] = operator_api.NewDescribePod(o.context, o.OperatorAPIDescribePodHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
@@ -782,19 +819,19 @@ func (o *OperatorAPI) initHandlerCache() {
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/login"] = user_api.NewLoginDetail(o.context, o.UserAPILoginDetailHandler)
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"]["/login/oauth2/auth"] = user_api.NewLoginOauth2Auth(o.context, o.UserAPILoginOauth2AuthHandler)
o.handlers["POST"]["/login/oauth2/auth"] = auth.NewLoginOauth2Auth(o.context, o.AuthLoginOauth2AuthHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/login/operator"] = user_api.NewLoginOperator(o.context, o.UserAPILoginOperatorHandler)
o.handlers["POST"]["/login/operator"] = auth.NewLoginOperator(o.context, o.AuthLoginOperatorHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/logout"] = user_api.NewLogout(o.context, o.UserAPILogoutHandler)
o.handlers["POST"]["/logout"] = auth.NewLogout(o.context, o.AuthLogoutHandler)
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
}
@@ -802,7 +839,7 @@ func (o *OperatorAPI) initHandlerCache() {
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/session"] = user_api.NewSessionCheck(o.context, o.UserAPISessionCheckHandler)
o.handlers["GET"]["/session"] = auth.NewSessionCheck(o.context, o.AuthSessionCheckHandler)
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
}
@@ -846,6 +883,10 @@ func (o *OperatorAPI) initHandlerCache() {
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/identity-provider"] = operator_api.NewTenantIdentityProvider(o.context, o.OperatorAPITenantIdentityProviderHandler)
if o.handlers["GET"] == nil {
o.handlers["GET"] = make(map[string]http.Handler)
}
o.handlers["GET"]["/namespaces/{namespace}/tenants/{tenant}/security"] = operator_api.NewTenantSecurity(o.context, o.OperatorAPITenantSecurityHandler)
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
@@ -863,6 +904,14 @@ func (o *OperatorAPI) initHandlerCache() {
o.handlers["PUT"] = make(map[string]http.Handler)
}
o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}"] = operator_api.NewUpdateTenant(o.context, o.OperatorAPIUpdateTenantHandler)
if o.handlers["PUT"] == nil {
o.handlers["PUT"] = make(map[string]http.Handler)
}
o.handlers["PUT"]["/namespaces/{namespace}/tenants/{tenant}/domains"] = operator_api.NewUpdateTenantDomains(o.context, o.OperatorAPIUpdateTenantDomainsHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}
o.handlers["POST"]["/namespaces/{namespace}/tenants/{tenant}/identity-provider"] = operator_api.NewUpdateTenantIdentityProvider(o.context, o.OperatorAPIUpdateTenantIdentityProviderHandler)
if o.handlers["POST"] == nil {
o.handlers["POST"] = make(map[string]http.Handler)
}

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/minio/console/models"
)
// DescribePodHandlerFunc turns a function with the right signature into a describe pod handler
type DescribePodHandlerFunc func(DescribePodParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn DescribePodHandlerFunc) Handle(params DescribePodParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// DescribePodHandler interface for that can handle valid describe pod params
type DescribePodHandler interface {
Handle(DescribePodParams, *models.Principal) middleware.Responder
}
// NewDescribePod creates a new http.Handler for the describe pod operation
func NewDescribePod(ctx *middleware.Context, handler DescribePodHandler) *DescribePod {
return &DescribePod{Context: ctx, Handler: handler}
}
/* DescribePod swagger:route GET /namespaces/{namespace}/tenants/{tenant}/pods/{podName}/describe OperatorAPI describePod
Describe Pod
*/
type DescribePod struct {
Context *middleware.Context
Handler DescribePodHandler
}
func (o *DescribePod) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewDescribePodParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@@ -0,0 +1,136 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
)
// NewDescribePodParams creates a new DescribePodParams object
//
// There are no default values defined in the spec.
func NewDescribePodParams() DescribePodParams {
return DescribePodParams{}
}
// DescribePodParams contains all the bound params for the describe pod operation
// typically these are obtained from a http.Request
//
// swagger:parameters DescribePod
type DescribePodParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
Required: true
In: path
*/
Namespace string
/*
Required: true
In: path
*/
PodName string
/*
Required: true
In: path
*/
Tenant 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 NewDescribePodParams() beforehand.
func (o *DescribePodParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace")
if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil {
res = append(res, err)
}
rPodName, rhkPodName, _ := route.Params.GetOK("podName")
if err := o.bindPodName(rPodName, rhkPodName, route.Formats); err != nil {
res = append(res, err)
}
rTenant, rhkTenant, _ := route.Params.GetOK("tenant")
if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindNamespace binds and validates parameter Namespace from path.
func (o *DescribePodParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.Namespace = raw
return nil
}
// bindPodName binds and validates parameter PodName from path.
func (o *DescribePodParams) bindPodName(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.PodName = raw
return nil
}
// bindTenant binds and validates parameter Tenant from path.
func (o *DescribePodParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.Tenant = raw
return nil
}

View File

@@ -0,0 +1,133 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/minio/console/models"
)
// DescribePodOKCode is the HTTP code returned for type DescribePodOK
const DescribePodOKCode int = 200
/*DescribePodOK A successful response.
swagger:response describePodOK
*/
type DescribePodOK struct {
/*
In: Body
*/
Payload *models.DescribePodWrapper `json:"body,omitempty"`
}
// NewDescribePodOK creates DescribePodOK with default headers values
func NewDescribePodOK() *DescribePodOK {
return &DescribePodOK{}
}
// WithPayload adds the payload to the describe pod o k response
func (o *DescribePodOK) WithPayload(payload *models.DescribePodWrapper) *DescribePodOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the describe pod o k response
func (o *DescribePodOK) SetPayload(payload *models.DescribePodWrapper) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DescribePodOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*DescribePodDefault Generic error response.
swagger:response describePodDefault
*/
type DescribePodDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewDescribePodDefault creates DescribePodDefault with default headers values
func NewDescribePodDefault(code int) *DescribePodDefault {
if code <= 0 {
code = 500
}
return &DescribePodDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the describe pod default response
func (o *DescribePodDefault) WithStatusCode(code int) *DescribePodDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the describe pod default response
func (o *DescribePodDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the describe pod default response
func (o *DescribePodDefault) WithPayload(payload *models.Error) *DescribePodDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the describe pod default response
func (o *DescribePodDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DescribePodDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@@ -0,0 +1,132 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
"strings"
)
// DescribePodURL generates an URL for the describe pod operation
type DescribePodURL struct {
Namespace string
PodName string
Tenant string
_basePath string
// avoid unkeyed usage
_ struct{}
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *DescribePodURL) WithBasePath(bp string) *DescribePodURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *DescribePodURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *DescribePodURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/namespaces/{namespace}/tenants/{tenant}/pods/{podName}/describe"
namespace := o.Namespace
if namespace != "" {
_path = strings.Replace(_path, "{namespace}", namespace, -1)
} else {
return nil, errors.New("namespace is required on DescribePodURL")
}
podName := o.PodName
if podName != "" {
_path = strings.Replace(_path, "{podName}", podName, -1)
} else {
return nil, errors.New("podName is required on DescribePodURL")
}
tenant := o.Tenant
if tenant != "" {
_path = strings.Replace(_path, "{tenant}", tenant, -1)
} else {
return nil, errors.New("tenant is required on DescribePodURL")
}
_basePath := o._basePath
if _basePath == "" {
_basePath = "/api/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *DescribePodURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *DescribePodURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *DescribePodURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on DescribePodURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on DescribePodURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *DescribePodURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/minio/console/models"
)
// TenantIdentityProviderHandlerFunc turns a function with the right signature into a tenant identity provider handler
type TenantIdentityProviderHandlerFunc func(TenantIdentityProviderParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn TenantIdentityProviderHandlerFunc) Handle(params TenantIdentityProviderParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// TenantIdentityProviderHandler interface for that can handle valid tenant identity provider params
type TenantIdentityProviderHandler interface {
Handle(TenantIdentityProviderParams, *models.Principal) middleware.Responder
}
// NewTenantIdentityProvider creates a new http.Handler for the tenant identity provider operation
func NewTenantIdentityProvider(ctx *middleware.Context, handler TenantIdentityProviderHandler) *TenantIdentityProvider {
return &TenantIdentityProvider{Context: ctx, Handler: handler}
}
/* TenantIdentityProvider swagger:route GET /namespaces/{namespace}/tenants/{tenant}/identity-provider OperatorAPI tenantIdentityProvider
Tenant Identity Provider
*/
type TenantIdentityProvider struct {
Context *middleware.Context
Handler TenantIdentityProviderHandler
}
func (o *TenantIdentityProvider) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewTenantIdentityProviderParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@@ -0,0 +1,112 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
)
// NewTenantIdentityProviderParams creates a new TenantIdentityProviderParams object
//
// There are no default values defined in the spec.
func NewTenantIdentityProviderParams() TenantIdentityProviderParams {
return TenantIdentityProviderParams{}
}
// TenantIdentityProviderParams contains all the bound params for the tenant identity provider operation
// typically these are obtained from a http.Request
//
// swagger:parameters TenantIdentityProvider
type TenantIdentityProviderParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
Required: true
In: path
*/
Namespace string
/*
Required: true
In: path
*/
Tenant 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 NewTenantIdentityProviderParams() beforehand.
func (o *TenantIdentityProviderParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace")
if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil {
res = append(res, err)
}
rTenant, rhkTenant, _ := route.Params.GetOK("tenant")
if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindNamespace binds and validates parameter Namespace from path.
func (o *TenantIdentityProviderParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.Namespace = raw
return nil
}
// bindTenant binds and validates parameter Tenant from path.
func (o *TenantIdentityProviderParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.Tenant = raw
return nil
}

View File

@@ -0,0 +1,133 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/minio/console/models"
)
// TenantIdentityProviderOKCode is the HTTP code returned for type TenantIdentityProviderOK
const TenantIdentityProviderOKCode int = 200
/*TenantIdentityProviderOK A successful response.
swagger:response tenantIdentityProviderOK
*/
type TenantIdentityProviderOK struct {
/*
In: Body
*/
Payload *models.IdpConfiguration `json:"body,omitempty"`
}
// NewTenantIdentityProviderOK creates TenantIdentityProviderOK with default headers values
func NewTenantIdentityProviderOK() *TenantIdentityProviderOK {
return &TenantIdentityProviderOK{}
}
// WithPayload adds the payload to the tenant identity provider o k response
func (o *TenantIdentityProviderOK) WithPayload(payload *models.IdpConfiguration) *TenantIdentityProviderOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the tenant identity provider o k response
func (o *TenantIdentityProviderOK) SetPayload(payload *models.IdpConfiguration) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TenantIdentityProviderOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(200)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}
/*TenantIdentityProviderDefault Generic error response.
swagger:response tenantIdentityProviderDefault
*/
type TenantIdentityProviderDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewTenantIdentityProviderDefault creates TenantIdentityProviderDefault with default headers values
func NewTenantIdentityProviderDefault(code int) *TenantIdentityProviderDefault {
if code <= 0 {
code = 500
}
return &TenantIdentityProviderDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the tenant identity provider default response
func (o *TenantIdentityProviderDefault) WithStatusCode(code int) *TenantIdentityProviderDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the tenant identity provider default response
func (o *TenantIdentityProviderDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the tenant identity provider default response
func (o *TenantIdentityProviderDefault) WithPayload(payload *models.Error) *TenantIdentityProviderDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the tenant identity provider default response
func (o *TenantIdentityProviderDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *TenantIdentityProviderDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@@ -0,0 +1,124 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
"strings"
)
// TenantIdentityProviderURL generates an URL for the tenant identity provider operation
type TenantIdentityProviderURL struct {
Namespace string
Tenant string
_basePath string
// avoid unkeyed usage
_ struct{}
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *TenantIdentityProviderURL) WithBasePath(bp string) *TenantIdentityProviderURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *TenantIdentityProviderURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *TenantIdentityProviderURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/namespaces/{namespace}/tenants/{tenant}/identity-provider"
namespace := o.Namespace
if namespace != "" {
_path = strings.Replace(_path, "{namespace}", namespace, -1)
} else {
return nil, errors.New("namespace is required on TenantIdentityProviderURL")
}
tenant := o.Tenant
if tenant != "" {
_path = strings.Replace(_path, "{tenant}", tenant, -1)
} else {
return nil, errors.New("tenant is required on TenantIdentityProviderURL")
}
_basePath := o._basePath
if _basePath == "" {
_basePath = "/api/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *TenantIdentityProviderURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *TenantIdentityProviderURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *TenantIdentityProviderURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on TenantIdentityProviderURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on TenantIdentityProviderURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *TenantIdentityProviderURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/minio/console/models"
)
// UpdateTenantDomainsHandlerFunc turns a function with the right signature into a update tenant domains handler
type UpdateTenantDomainsHandlerFunc func(UpdateTenantDomainsParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn UpdateTenantDomainsHandlerFunc) Handle(params UpdateTenantDomainsParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// UpdateTenantDomainsHandler interface for that can handle valid update tenant domains params
type UpdateTenantDomainsHandler interface {
Handle(UpdateTenantDomainsParams, *models.Principal) middleware.Responder
}
// NewUpdateTenantDomains creates a new http.Handler for the update tenant domains operation
func NewUpdateTenantDomains(ctx *middleware.Context, handler UpdateTenantDomainsHandler) *UpdateTenantDomains {
return &UpdateTenantDomains{Context: ctx, Handler: handler}
}
/* UpdateTenantDomains swagger:route PUT /namespaces/{namespace}/tenants/{tenant}/domains OperatorAPI updateTenantDomains
Update Domains for a Tenant
*/
type UpdateTenantDomains struct {
Context *middleware.Context
Handler UpdateTenantDomainsHandler
}
func (o *UpdateTenantDomains) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewUpdateTenantDomainsParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

View File

@@ -0,0 +1,151 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"io"
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/validate"
"github.com/minio/console/models"
)
// NewUpdateTenantDomainsParams creates a new UpdateTenantDomainsParams object
//
// There are no default values defined in the spec.
func NewUpdateTenantDomainsParams() UpdateTenantDomainsParams {
return UpdateTenantDomainsParams{}
}
// UpdateTenantDomainsParams contains all the bound params for the update tenant domains operation
// typically these are obtained from a http.Request
//
// swagger:parameters UpdateTenantDomains
type UpdateTenantDomainsParams struct {
// HTTP Request Object
HTTPRequest *http.Request `json:"-"`
/*
Required: true
In: body
*/
Body *models.UpdateDomainsRequest
/*
Required: true
In: path
*/
Namespace string
/*
Required: true
In: path
*/
Tenant 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 NewUpdateTenantDomainsParams() beforehand.
func (o *UpdateTenantDomainsParams) 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.UpdateDomainsRequest
if err := route.Consumer.Consume(r.Body, &body); err != nil {
if err == io.EOF {
res = append(res, errors.Required("body", "body", ""))
} else {
res = append(res, errors.NewParseError("body", "body", "", err))
}
} else {
// validate body object
if err := body.Validate(route.Formats); err != nil {
res = append(res, err)
}
ctx := validate.WithOperationRequest(context.Background())
if err := body.ContextValidate(ctx, route.Formats); err != nil {
res = append(res, err)
}
if len(res) == 0 {
o.Body = &body
}
}
} else {
res = append(res, errors.Required("body", "body", ""))
}
rNamespace, rhkNamespace, _ := route.Params.GetOK("namespace")
if err := o.bindNamespace(rNamespace, rhkNamespace, route.Formats); err != nil {
res = append(res, err)
}
rTenant, rhkTenant, _ := route.Params.GetOK("tenant")
if err := o.bindTenant(rTenant, rhkTenant, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// bindNamespace binds and validates parameter Namespace from path.
func (o *UpdateTenantDomainsParams) bindNamespace(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.Namespace = raw
return nil
}
// bindTenant binds and validates parameter Tenant from path.
func (o *UpdateTenantDomainsParams) bindTenant(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// Parameter is provided by construction from the route
o.Tenant = raw
return nil
}

View File

@@ -0,0 +1,113 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"net/http"
"github.com/go-openapi/runtime"
"github.com/minio/console/models"
)
// UpdateTenantDomainsNoContentCode is the HTTP code returned for type UpdateTenantDomainsNoContent
const UpdateTenantDomainsNoContentCode int = 204
/*UpdateTenantDomainsNoContent A successful response.
swagger:response updateTenantDomainsNoContent
*/
type UpdateTenantDomainsNoContent struct {
}
// NewUpdateTenantDomainsNoContent creates UpdateTenantDomainsNoContent with default headers values
func NewUpdateTenantDomainsNoContent() *UpdateTenantDomainsNoContent {
return &UpdateTenantDomainsNoContent{}
}
// WriteResponse to the client
func (o *UpdateTenantDomainsNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
rw.WriteHeader(204)
}
/*UpdateTenantDomainsDefault Generic error response.
swagger:response updateTenantDomainsDefault
*/
type UpdateTenantDomainsDefault struct {
_statusCode int
/*
In: Body
*/
Payload *models.Error `json:"body,omitempty"`
}
// NewUpdateTenantDomainsDefault creates UpdateTenantDomainsDefault with default headers values
func NewUpdateTenantDomainsDefault(code int) *UpdateTenantDomainsDefault {
if code <= 0 {
code = 500
}
return &UpdateTenantDomainsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the update tenant domains default response
func (o *UpdateTenantDomainsDefault) WithStatusCode(code int) *UpdateTenantDomainsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the update tenant domains default response
func (o *UpdateTenantDomainsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the update tenant domains default response
func (o *UpdateTenantDomainsDefault) WithPayload(payload *models.Error) *UpdateTenantDomainsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the update tenant domains default response
func (o *UpdateTenantDomainsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *UpdateTenantDomainsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if o.Payload != nil {
payload := o.Payload
if err := producer.Produce(rw, payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}
}

View File

@@ -0,0 +1,124 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"errors"
"net/url"
golangswaggerpaths "path"
"strings"
)
// UpdateTenantDomainsURL generates an URL for the update tenant domains operation
type UpdateTenantDomainsURL struct {
Namespace string
Tenant string
_basePath string
// avoid unkeyed usage
_ struct{}
}
// WithBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *UpdateTenantDomainsURL) WithBasePath(bp string) *UpdateTenantDomainsURL {
o.SetBasePath(bp)
return o
}
// SetBasePath sets the base path for this url builder, only required when it's different from the
// base path specified in the swagger spec.
// When the value of the base path is an empty string
func (o *UpdateTenantDomainsURL) SetBasePath(bp string) {
o._basePath = bp
}
// Build a url path and query string
func (o *UpdateTenantDomainsURL) Build() (*url.URL, error) {
var _result url.URL
var _path = "/namespaces/{namespace}/tenants/{tenant}/domains"
namespace := o.Namespace
if namespace != "" {
_path = strings.Replace(_path, "{namespace}", namespace, -1)
} else {
return nil, errors.New("namespace is required on UpdateTenantDomainsURL")
}
tenant := o.Tenant
if tenant != "" {
_path = strings.Replace(_path, "{tenant}", tenant, -1)
} else {
return nil, errors.New("tenant is required on UpdateTenantDomainsURL")
}
_basePath := o._basePath
if _basePath == "" {
_basePath = "/api/v1"
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
return &_result, nil
}
// Must is a helper function to panic when the url builder returns an error
func (o *UpdateTenantDomainsURL) Must(u *url.URL, err error) *url.URL {
if err != nil {
panic(err)
}
if u == nil {
panic("url can't be nil")
}
return u
}
// String returns the string representation of the path with query string
func (o *UpdateTenantDomainsURL) String() string {
return o.Must(o.Build()).String()
}
// BuildFull builds a full url with scheme, host, path and query string
func (o *UpdateTenantDomainsURL) BuildFull(scheme, host string) (*url.URL, error) {
if scheme == "" {
return nil, errors.New("scheme is required for a full url on UpdateTenantDomainsURL")
}
if host == "" {
return nil, errors.New("host is required for a full url on UpdateTenantDomainsURL")
}
base, err := o.Build()
if err != nil {
return nil, err
}
base.Scheme = scheme
base.Host = host
return base, nil
}
// StringFull returns the string representation of a complete url
func (o *UpdateTenantDomainsURL) StringFull(scheme, host string) string {
return o.Must(o.BuildFull(scheme, host)).String()
}

View File

@@ -0,0 +1,88 @@
// Code generated by go-swagger; DO NOT EDIT.
// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
package operator_api
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the generate command
import (
"net/http"
"github.com/go-openapi/runtime/middleware"
"github.com/minio/console/models"
)
// UpdateTenantIdentityProviderHandlerFunc turns a function with the right signature into a update tenant identity provider handler
type UpdateTenantIdentityProviderHandlerFunc func(UpdateTenantIdentityProviderParams, *models.Principal) middleware.Responder
// Handle executing the request and returning a response
func (fn UpdateTenantIdentityProviderHandlerFunc) Handle(params UpdateTenantIdentityProviderParams, principal *models.Principal) middleware.Responder {
return fn(params, principal)
}
// UpdateTenantIdentityProviderHandler interface for that can handle valid update tenant identity provider params
type UpdateTenantIdentityProviderHandler interface {
Handle(UpdateTenantIdentityProviderParams, *models.Principal) middleware.Responder
}
// NewUpdateTenantIdentityProvider creates a new http.Handler for the update tenant identity provider operation
func NewUpdateTenantIdentityProvider(ctx *middleware.Context, handler UpdateTenantIdentityProviderHandler) *UpdateTenantIdentityProvider {
return &UpdateTenantIdentityProvider{Context: ctx, Handler: handler}
}
/* UpdateTenantIdentityProvider swagger:route POST /namespaces/{namespace}/tenants/{tenant}/identity-provider OperatorAPI updateTenantIdentityProvider
Update Tenant Identity Provider
*/
type UpdateTenantIdentityProvider struct {
Context *middleware.Context
Handler UpdateTenantIdentityProviderHandler
}
func (o *UpdateTenantIdentityProvider) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, rCtx, _ := o.Context.RouteInfo(r)
if rCtx != nil {
*r = *rCtx
}
var Params = NewUpdateTenantIdentityProviderParams()
uprinc, aCtx, err := o.Context.Authorize(r, route)
if err != nil {
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
if aCtx != nil {
*r = *aCtx
}
var principal *models.Principal
if uprinc != nil {
principal = uprinc.(*models.Principal) // this is really a models.Principal, I promise
}
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
o.Context.Respond(rw, r, route.Produces, route, err)
return
}
res := o.Handler.Handle(Params, principal) // actually handle the request
o.Context.Respond(rw, r, route.Produces, route, res)
}

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