Compare commits
1263 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7dffd5f079 | ||
|
|
044e5702df | ||
|
|
3c3b9546d9 | ||
|
|
5bc0e74b53 | ||
|
|
f0d4dddacd | ||
|
|
f4a3f46bcf | ||
|
|
38472e4cd2 | ||
|
|
9db5d1e4f4 | ||
|
|
4cadaf7d49 | ||
|
|
748486160f | ||
|
|
2c0a0b2bc4 | ||
|
|
7e51d4bebb | ||
|
|
c011e67122 | ||
|
|
394b4c403d | ||
|
|
74030aa067 | ||
|
|
07b8c745e6 | ||
|
|
6767bfa2d2 | ||
|
|
607d94fef4 | ||
|
|
83b060ef94 | ||
|
|
cb14cb94ce | ||
|
|
2b9de49fbe | ||
|
|
290f273bdf | ||
|
|
7b43779fb0 | ||
|
|
924c38faa6 | ||
|
|
e4d5f9610e | ||
|
|
04e9cb0ac8 | ||
|
|
da53daff37 | ||
|
|
8c26eff2c1 | ||
|
|
044c265423 | ||
|
|
0053658d5d | ||
|
|
99cf3b378f | ||
|
|
78293eab62 | ||
|
|
1a84be5782 | ||
|
|
178f82b675 | ||
|
|
ec5fbbcd1e | ||
|
|
78164054d4 | ||
|
|
6d5d11d5b4 | ||
|
|
9e3b93d385 | ||
|
|
d77cf93193 | ||
|
|
2cca3f3722 | ||
|
|
36d96a1791 | ||
|
|
82e34a5df2 | ||
|
|
7b83f4b1dc | ||
|
|
7d9910d1ca | ||
|
|
7a63f6da56 | ||
|
|
0043833f36 | ||
|
|
3ad3bccadb | ||
|
|
39e94c890e | ||
|
|
701039454a | ||
|
|
ec77a03d7c | ||
|
|
8dbad84a58 | ||
|
|
1767a37162 | ||
|
|
622c3a067a | ||
|
|
4389548b64 | ||
|
|
8cb0f1e558 | ||
|
|
faafb77c73 | ||
|
|
0ecd1c73c1 | ||
|
|
88bf40f9a6 | ||
|
|
a025163b34 | ||
|
|
07c80462b7 | ||
|
|
79ac2277d4 | ||
|
|
1c27bee9d0 | ||
|
|
56dc58b0b8 | ||
|
|
4018addd79 | ||
|
|
429dfb4314 | ||
|
|
1d7bb0bb2b | ||
|
|
476eb673bb | ||
|
|
71681b710c | ||
|
|
fb02a7da06 | ||
|
|
5fdc341138 | ||
|
|
15de6caf75 | ||
|
|
77bc2d5006 | ||
|
|
972f5fca9d | ||
|
|
083314ee2d | ||
|
|
078ce0e546 | ||
|
|
9beca2c226 | ||
|
|
451f23ae24 | ||
|
|
300ebfa19f | ||
|
|
1ce2846c95 | ||
|
|
7fb8c11a9d | ||
|
|
e7993c2d1b | ||
|
|
3e93f7ff88 | ||
|
|
f0580956db | ||
|
|
65b0bab26d | ||
|
|
a559421293 | ||
|
|
6ef35c26a4 | ||
|
|
8a918324aa | ||
|
|
d30c0c8cbb | ||
|
|
1697c826c0 | ||
|
|
b378b8c8ef | ||
|
|
2c42d7ff81 | ||
|
|
e1f36ee54a | ||
|
|
698f72f828 | ||
|
|
8dd94f5336 | ||
|
|
1dc21b9a21 | ||
|
|
248215cc77 | ||
|
|
a6eee73c11 | ||
|
|
50d6a39312 | ||
|
|
467b6b9bcb | ||
|
|
6e6246797c | ||
|
|
f8e4f747f5 | ||
|
|
9acd49fcc6 | ||
|
|
636d12d43f | ||
|
|
5e9383de95 | ||
|
|
4863af863e | ||
|
|
b6d4c62edd | ||
|
|
bf733f3822 | ||
|
|
bbf4027418 | ||
|
|
dbffc5fc22 | ||
|
|
f4a9420002 | ||
|
|
657854bd29 | ||
|
|
cdc9e7d921 | ||
|
|
b125121ac8 | ||
|
|
0c480dd5ec | ||
|
|
c07b8dcf73 | ||
|
|
912a4b216f | ||
|
|
e7fb205c31 | ||
|
|
a2ba20e12f | ||
|
|
f515dd82fe | ||
|
|
61d3193c41 | ||
|
|
430ae66955 | ||
|
|
3abbbc82b2 | ||
|
|
854181f63e | ||
|
|
df996794ed | ||
|
|
2d94018e3c | ||
|
|
72bb9d0ca1 | ||
|
|
93bd0d65e2 | ||
|
|
495b0f0068 | ||
|
|
3275b6a6d8 | ||
|
|
fed5aa1599 | ||
|
|
6bc4efbac1 | ||
|
|
cc0164a67b | ||
|
|
b968cc25ad | ||
|
|
d116a35a6d | ||
|
|
49f856bdd5 | ||
|
|
0d628f589a | ||
|
|
4387b2149f | ||
|
|
8cc602434e | ||
|
|
6411dc9504 | ||
|
|
32c34b0a11 | ||
|
|
6e8f5e0fc2 | ||
|
|
3ce377dbd1 | ||
|
|
ad502b9f18 | ||
|
|
fde186a5a3 | ||
|
|
0823f623c8 | ||
|
|
6cec113304 | ||
|
|
cd42d77a46 | ||
|
|
35907beaca | ||
|
|
a062a59288 | ||
|
|
842c2decd0 | ||
|
|
d1069ed359 | ||
|
|
6d81a1b1f8 | ||
|
|
b2fe478dae | ||
|
|
02ed6a6e8b | ||
|
|
1b271ab467 | ||
|
|
bacb5f8901 | ||
|
|
ae7371da95 | ||
|
|
60f5eb603b | ||
|
|
420ed00f55 | ||
|
|
b975871e9d | ||
|
|
803ffe2960 | ||
|
|
c96c95924c | ||
|
|
f02786001c | ||
|
|
542b7192c3 | ||
|
|
b31aa10b52 | ||
|
|
1eba59954d | ||
|
|
b71d9f05c5 | ||
|
|
fc5e94d55f | ||
|
|
3875fb3eaa | ||
|
|
b3d4132fe6 | ||
|
|
21f20bb9ea | ||
|
|
df937467a0 | ||
|
|
d1ae271111 | ||
|
|
e7fb3e0e45 | ||
|
|
b7b0271ec7 | ||
|
|
9935b839b7 | ||
|
|
0e11098c31 | ||
|
|
c55e0a069b | ||
|
|
c3da876b04 | ||
|
|
643a9c6c7c | ||
|
|
0c3a94172d | ||
|
|
527eb16700 | ||
|
|
e3aec3f094 | ||
|
|
eac2734df4 | ||
|
|
a411e7c977 | ||
|
|
28c4abe2d0 | ||
|
|
a9ef6ebf5f | ||
|
|
c12415c12d | ||
|
|
1f481e690b | ||
|
|
58aad859e1 | ||
|
|
b9ebfe09ee | ||
|
|
864cf7af99 | ||
|
|
b76f460979 | ||
|
|
cbd2c4682d | ||
|
|
d49bdf7d49 | ||
|
|
559a7278a0 | ||
|
|
4a172fae97 | ||
|
|
fc4263e2f9 | ||
|
|
c1b9b4c81b | ||
|
|
aa9b73522e | ||
|
|
0904f83627 | ||
|
|
253053cc23 | ||
|
|
08a3ff65c7 | ||
|
|
ee8fac8be8 | ||
|
|
9fa49b40b3 | ||
|
|
de13119e02 | ||
|
|
bf9acd7691 | ||
|
|
a5066fecc8 | ||
|
|
6432681440 | ||
|
|
b3b6df9d82 | ||
|
|
fe7be4ef62 | ||
|
|
b4603547f6 | ||
|
|
b33b9315ea | ||
|
|
6ae03fa028 | ||
|
|
e1bb1e0472 | ||
|
|
411670e4f5 | ||
|
|
1c55932f84 | ||
|
|
5a77054d6b | ||
|
|
84c5fd58f9 | ||
|
|
98979911ee | ||
|
|
c0cf7358c7 | ||
|
|
9053e64dff | ||
|
|
57bfe97d08 | ||
|
|
028570279c | ||
|
|
bda1cd1f25 | ||
|
|
7a9b775b09 | ||
|
|
17e791afb9 | ||
|
|
920fc7d937 | ||
|
|
6e314a2fa5 | ||
|
|
dc90db6591 | ||
|
|
beed4895c1 | ||
|
|
629dd669c4 | ||
|
|
fc9319e55b | ||
|
|
58b64a5739 | ||
|
|
d93537261e | ||
|
|
22ec87d00e | ||
|
|
b87b4156e7 | ||
|
|
93f010b880 | ||
|
|
c5d4cdf1bc | ||
|
|
c117601e53 | ||
|
|
f78f838ed9 | ||
|
|
1583b69fb7 | ||
|
|
cde6d1b0e0 | ||
|
|
be60569a14 | ||
|
|
51226a74d0 | ||
|
|
e983473a54 | ||
|
|
211ab3fd9d | ||
|
|
90c8ea7f09 | ||
|
|
fb5193d896 | ||
|
|
f7a7f01d7d | ||
|
|
2c84a52937 | ||
|
|
6020590b2f | ||
|
|
1477def4fe | ||
|
|
8882f1da0e | ||
|
|
056d487f1c | ||
|
|
b8083215b3 | ||
|
|
61c864e748 | ||
|
|
0e0f5030da | ||
|
|
0dacc4d49e | ||
|
|
4d783c5e42 | ||
|
|
75b3a6bea4 | ||
|
|
29507cda7e | ||
|
|
81e0c82fee | ||
|
|
7519fad6dd | ||
|
|
248a59ee8c | ||
|
|
cefb6d3c95 | ||
|
|
543076eaac | ||
|
|
cbf1ddeb4c | ||
|
|
3746adcc13 | ||
|
|
854b984850 | ||
|
|
62fa0e2043 | ||
|
|
4f5b1b0aa7 | ||
|
|
0e362c2106 | ||
|
|
6ac5be32b2 | ||
|
|
6966183bc8 | ||
|
|
60d70e3668 | ||
|
|
5e65f2aced | ||
|
|
1e345364cf | ||
|
|
502a6c462f | ||
|
|
ceafdb9cb4 | ||
|
|
a6d8f6beaa | ||
|
|
fa1f84bd0a | ||
|
|
72a1e5eefb | ||
|
|
f20fa0b1c8 | ||
|
|
07b7af59b6 | ||
|
|
c9ac525358 | ||
|
|
8b1b2b1e2d | ||
|
|
ad0591ec17 | ||
|
|
59c47d98dd | ||
|
|
cb38a545ce | ||
|
|
dd356b6ea9 | ||
|
|
c1d39a910f | ||
|
|
eb3913ba48 | ||
|
|
f7efbc66f7 | ||
|
|
f368d9936a | ||
|
|
5cb4e6f651 | ||
|
|
f7f7b087c4 | ||
|
|
4cceee8936 | ||
|
|
5262c02a28 | ||
|
|
fd81529ddc | ||
|
|
383341ad61 | ||
|
|
66d0182825 | ||
|
|
1fc9a40273 | ||
|
|
1953a98968 | ||
|
|
3b5979d783 | ||
|
|
9aa1f43df7 | ||
|
|
bf89f09238 | ||
|
|
b8e14ee269 | ||
|
|
c700ee491e | ||
|
|
65575751ff | ||
|
|
cc28f88325 | ||
|
|
dd913decc6 | ||
|
|
372852ee86 | ||
|
|
154974c24e | ||
|
|
844041fc32 | ||
|
|
c23aff45c8 | ||
|
|
1b4eacb587 | ||
|
|
f21434a971 | ||
|
|
6c0e7baa87 | ||
|
|
09fe3af6b7 | ||
|
|
50a6c61d0d | ||
|
|
53b5fba532 | ||
|
|
a73b710313 | ||
|
|
404b1ef92e | ||
|
|
c3b7af9c89 | ||
|
|
13d04b15de | ||
|
|
88fdd3a456 | ||
|
|
de4ff1c1f0 | ||
|
|
a6637f18c8 | ||
|
|
d4031ee7b5 | ||
|
|
7bf2b9601f | ||
|
|
6fbb4b568b | ||
|
|
7a14f0c012 | ||
|
|
e8f27228a2 | ||
|
|
8346fe4bd6 | ||
|
|
d1b8d7240e | ||
|
|
274b16a1a6 | ||
|
|
b0d8c332e5 | ||
|
|
ba1888b6c4 | ||
|
|
c0e47bafa4 | ||
|
|
894f6ce131 | ||
|
|
f0b39a6b6b | ||
|
|
24fdf3487b | ||
|
|
900b8d9f06 | ||
|
|
58b45b8ebc | ||
|
|
606a69b92c | ||
|
|
2c8b96c511 | ||
|
|
38e6af1d09 | ||
|
|
32a289d563 | ||
|
|
8d4d6eace0 | ||
|
|
f337a8dce7 | ||
|
|
fba06cf651 | ||
|
|
fecf484eda | ||
|
|
34907856c5 | ||
|
|
4a2915a62b | ||
|
|
8d51fe60f4 | ||
|
|
e96632a6b2 | ||
|
|
5ba7abaa79 | ||
|
|
451238d48b | ||
|
|
8df91922ad | ||
|
|
34d62837fd | ||
|
|
ed281bbe4a | ||
|
|
b218cbf503 | ||
|
|
c141b6d65e | ||
|
|
aacec617a8 | ||
|
|
ed19f3e1ad | ||
|
|
1374cf047e | ||
|
|
3a0e4c4f8c | ||
|
|
b34b05f059 | ||
|
|
579e8e05b7 | ||
|
|
a0463f405d | ||
|
|
ec344654db | ||
|
|
4aab5bc68f | ||
|
|
4c37afb446 | ||
|
|
86115afc6b | ||
|
|
87399d1064 | ||
|
|
a01b855d2f | ||
|
|
be39cb5af3 | ||
|
|
6930fd198c | ||
|
|
62e822df4e | ||
|
|
6466687a27 | ||
|
|
ccaaa21f16 | ||
|
|
0595ec166d | ||
|
|
72d1698242 | ||
|
|
9321e00d0a | ||
|
|
b03a49e4e1 | ||
|
|
aa9f6f02ca | ||
|
|
6a88d26054 | ||
|
|
37db97dba9 | ||
|
|
0ccce2b2bc | ||
|
|
58813eb4e0 | ||
|
|
5992edb3ba | ||
|
|
808e0ce3d5 | ||
|
|
534f3ec627 | ||
|
|
9d37c9f743 | ||
|
|
1bad4c3da6 | ||
|
|
9edb579156 | ||
|
|
d1aee5d431 | ||
|
|
dc8d4b4ca1 | ||
|
|
35ab508109 | ||
|
|
e01030820c | ||
|
|
fab041b364 | ||
|
|
e5da67d1bc | ||
|
|
bbc61930f9 | ||
|
|
40c789e7cb | ||
|
|
6084212bf6 | ||
|
|
944b56751d | ||
|
|
c9e53542e0 | ||
|
|
7001067baa | ||
|
|
aece2251cf | ||
|
|
756f0048f0 | ||
|
|
1cb2fca7a5 | ||
|
|
287af260b7 | ||
|
|
9fd76362dc | ||
|
|
733517fa76 | ||
|
|
d8b3d0715f | ||
|
|
1d951b28aa | ||
|
|
65ab6870e6 | ||
|
|
255e3d14d0 | ||
|
|
25e486ef18 | ||
|
|
92123bd243 | ||
|
|
6d5026d17e | ||
|
|
1e6ca131d9 | ||
|
|
21c6a441aa | ||
|
|
e23c110057 | ||
|
|
de16b73ce8 | ||
|
|
f269d67ec6 | ||
|
|
7f3490974b | ||
|
|
a42eef376d | ||
|
|
bbf115dc71 | ||
|
|
77bcdcfb08 | ||
|
|
d713dc4933 | ||
|
|
0c9a6bf76b | ||
|
|
4c4094420b | ||
|
|
96e55ca79b | ||
|
|
c61c5024d0 | ||
|
|
f61d0a68d5 | ||
|
|
f917f7d167 | ||
|
|
35541ef323 | ||
|
|
1f60d4a808 | ||
|
|
adc199b315 | ||
|
|
f557c4c550 | ||
|
|
0c4a73ff10 | ||
|
|
203e019e82 | ||
|
|
4d2a39bad2 | ||
|
|
db4fae3603 | ||
|
|
871789a236 | ||
|
|
ba6fb53594 | ||
|
|
5d74b21bc4 | ||
|
|
006490c753 | ||
|
|
1614af0128 | ||
|
|
27fd91ed37 | ||
|
|
7df0560104 | ||
|
|
2368199e03 | ||
|
|
bee98e1ba0 | ||
|
|
8abbbb4625 | ||
|
|
ef182fe75e | ||
|
|
613e93fdc6 | ||
|
|
a5e3c89a54 | ||
|
|
7f55b71495 | ||
|
|
d95d59e454 | ||
|
|
08ea069ed4 | ||
|
|
e7a41b4cd9 | ||
|
|
262a601d21 | ||
|
|
00af6b5179 | ||
|
|
5800d01406 | ||
|
|
c803451920 | ||
|
|
95bdc70d1d | ||
|
|
5d10197334 | ||
|
|
e7da6cd651 | ||
|
|
0f35369292 | ||
|
|
579845dfb1 | ||
|
|
6ad5c16d3a | ||
|
|
24176b5c7d | ||
|
|
0b3b5979ba | ||
|
|
dbec9fbb4a | ||
|
|
7cd0bc7cac | ||
|
|
c12a931dbf | ||
|
|
f8af10dd26 | ||
|
|
4c47b9c3e6 | ||
|
|
44f2fc67a3 | ||
|
|
ec1ba16ef7 | ||
|
|
7a5724591a | ||
|
|
9f433bc359 | ||
|
|
1d45a174ac | ||
|
|
80cee32031 | ||
|
|
437cfd0b8e | ||
|
|
dc4dae6ddb | ||
|
|
2f578010a0 | ||
|
|
e7ec3fe61f | ||
|
|
7b389fc323 | ||
|
|
86361b630e | ||
|
|
c57df87bc3 | ||
|
|
cbbf3c5a53 | ||
|
|
8a9fbb461c | ||
|
|
55b25cb003 | ||
|
|
c929a71649 | ||
|
|
8af1bcd35c | ||
|
|
ae2587dcad | ||
|
|
cac8445aa1 | ||
|
|
7eb98035e5 | ||
|
|
7c75c87a0c | ||
|
|
404efd2523 | ||
|
|
fc7d60e7ec | ||
|
|
fbf3afd6fb | ||
|
|
3f8f277841 | ||
|
|
2ff44df636 | ||
|
|
83a612981e | ||
|
|
0ae1ace8fe | ||
|
|
a2745c687e | ||
|
|
e5e053a2ad | ||
|
|
a5f89bb6d7 | ||
|
|
a53b569d0a | ||
|
|
bcbebda39b | ||
|
|
a296850d58 | ||
|
|
b609a4ee74 | ||
|
|
5409a5eaa0 | ||
|
|
6959bc5b02 | ||
|
|
134700b432 | ||
|
|
483d25c3f3 | ||
|
|
dab4eb7664 | ||
|
|
139e90830f | ||
|
|
2e8ad9281d | ||
|
|
6b6cfd10f1 | ||
|
|
5f07d45846 | ||
|
|
2dd92fd940 | ||
|
|
40f64709a6 | ||
|
|
c31b311b4e | ||
|
|
c316532fe9 | ||
|
|
a65d6ba8f1 | ||
|
|
11f5d6aa0d | ||
|
|
9532aa9500 | ||
|
|
ec3deed38e | ||
|
|
38015b4913 | ||
|
|
e5508b5c5d | ||
|
|
9587e4105f | ||
|
|
d2d735c5c0 | ||
|
|
915c10b4b8 | ||
|
|
671530f5b4 | ||
|
|
0c778f57d3 | ||
|
|
43db7729c4 | ||
|
|
48b467a683 | ||
|
|
59b7406dd7 | ||
|
|
9e7a40abc8 | ||
|
|
189331f465 | ||
|
|
e6a2364209 | ||
|
|
2b17aa598f | ||
|
|
f10fdf4610 | ||
|
|
4156fe0666 | ||
|
|
89bef6027c | ||
|
|
333ca0a827 | ||
|
|
de82a056e6 | ||
|
|
a01b1ffe8c | ||
|
|
61718a5915 | ||
|
|
2fed3572b2 | ||
|
|
af9e4fc150 | ||
|
|
f8475af5a6 | ||
|
|
413870e995 | ||
|
|
cdd6f272ed | ||
|
|
5eddd0cd8d | ||
|
|
5cf2b736e1 | ||
|
|
55330960e9 | ||
|
|
a3b88567cc | ||
|
|
73a687376a | ||
|
|
de4c08c2ff | ||
|
|
9396df2e20 | ||
|
|
4143f50004 | ||
|
|
d1511c5eb0 | ||
|
|
c4c6d48abf | ||
|
|
43c5f9094a | ||
|
|
51ab9c59ae | ||
|
|
fc95ab8658 | ||
|
|
bebe860903 | ||
|
|
df4679ea55 | ||
|
|
2263eada70 | ||
|
|
368c9ee3d7 | ||
|
|
3513a01711 | ||
|
|
0af36a5757 | ||
|
|
fdd5a94074 | ||
|
|
17ad2cfd14 | ||
|
|
67f509e2bb | ||
|
|
6102094c9e | ||
|
|
d84062b1b2 | ||
|
|
a878440485 | ||
|
|
cd6e61e93b | ||
|
|
a77b56b522 | ||
|
|
6ed5084691 | ||
|
|
4ac6ecb558 | ||
|
|
41671b4f25 | ||
|
|
024ab1212b | ||
|
|
77f62e11ef | ||
|
|
0960835cd9 | ||
|
|
3746dd47f8 | ||
|
|
ce255c5181 | ||
|
|
7728cc734a | ||
|
|
cc581c6a9e | ||
|
|
f7b142e74a | ||
|
|
1108cee626 | ||
|
|
94fdba5990 | ||
|
|
524258a9ea | ||
|
|
c0cf7a6d6a | ||
|
|
f9916d1cd6 | ||
|
|
52512c0ccc | ||
|
|
989f041658 | ||
|
|
2f81b750a3 | ||
|
|
035a5b88c2 | ||
|
|
7702149962 | ||
|
|
f3e24d62ca | ||
|
|
d663b9f346 | ||
|
|
ae147358b1 | ||
|
|
20bc53119e | ||
|
|
3a3a4b2fea | ||
|
|
497437729b | ||
|
|
1c37fcf398 | ||
|
|
67af66fc55 | ||
|
|
288c843a17 | ||
|
|
9357c2db0e | ||
|
|
139771f4d4 | ||
|
|
b7783aaa1c | ||
|
|
9821beb1de | ||
|
|
d279f722f8 | ||
|
|
9539a8e18a | ||
|
|
f11b9bff17 | ||
|
|
06c282dd9a | ||
|
|
3e9fb853d9 | ||
|
|
cd21ad2085 | ||
|
|
729100ae16 | ||
|
|
bcd29a4232 | ||
|
|
380a9d7faa | ||
|
|
9cd0033504 | ||
|
|
483fe77a35 | ||
|
|
1742303ad7 | ||
|
|
292fb3920f | ||
|
|
9ed8f11b22 | ||
|
|
860d8c6b78 | ||
|
|
99965805a6 | ||
|
|
7036d1328e | ||
|
|
697910c7b2 | ||
|
|
64dc605843 | ||
|
|
75fa88e6e2 | ||
|
|
2857b8c586 | ||
|
|
b1788c29db | ||
|
|
2e1401f013 | ||
|
|
1e1c11b13c | ||
|
|
25c1c854b1 | ||
|
|
5be2cc1965 | ||
|
|
4aa3f40792 | ||
|
|
3f41a82fd3 | ||
|
|
1b641b4222 | ||
|
|
85aabebbb4 | ||
|
|
919232261d | ||
|
|
ddd25a20eb | ||
|
|
84b8f9d6fa | ||
|
|
46af0ff74c | ||
|
|
b3651ed0a3 | ||
|
|
78c4fa393a | ||
|
|
84c4159062 | ||
|
|
ac2888fc4e | ||
|
|
c311847dcf | ||
|
|
cb6cda7265 | ||
|
|
16fd5470db | ||
|
|
ea0cac2a92 | ||
|
|
33b041ef34 | ||
|
|
b692ea693f | ||
|
|
fd39e50c08 | ||
|
|
ad4b9c050a | ||
|
|
1deb6371ed | ||
|
|
3b11556f4b | ||
|
|
25f719b0e2 | ||
|
|
231b63f1b0 | ||
|
|
e73370cc8c | ||
|
|
5d25dd4c06 | ||
|
|
51a8bacc18 | ||
|
|
db07f546a4 | ||
|
|
255cf0bc85 | ||
|
|
733e0b18e2 | ||
|
|
8d90e03992 | ||
|
|
1a1fae9ce3 | ||
|
|
f26786c904 | ||
|
|
e0b6bf5aa6 | ||
|
|
9655fc4490 | ||
|
|
417ea4d481 | ||
|
|
5a59f8e3f4 | ||
|
|
48340d0010 | ||
|
|
251de9fe8a | ||
|
|
c501df927b | ||
|
|
cdb1659506 | ||
|
|
558afe36ad | ||
|
|
712d3870eb | ||
|
|
c71f084531 | ||
|
|
1c58a543b6 | ||
|
|
8e857dc563 | ||
|
|
78d4d4c89e | ||
|
|
aea749d82f | ||
|
|
ce3293b4e2 | ||
|
|
0c12fbdd23 | ||
|
|
118cf97e1d | ||
|
|
abb668633b | ||
|
|
dd2fffd3dc | ||
|
|
64b13e9dc9 | ||
|
|
58d7f1e8ae | ||
|
|
45e4a94416 | ||
|
|
cce054bbe8 | ||
|
|
cf0e326b82 | ||
|
|
e48958f5a0 | ||
|
|
63e2793272 | ||
|
|
532e64b802 | ||
|
|
64b3e965c6 | ||
|
|
9371c027f3 | ||
|
|
a8bc58a420 | ||
|
|
10c56a91da | ||
|
|
403972de39 | ||
|
|
1c0632473a | ||
|
|
ff93109b57 | ||
|
|
b518810106 | ||
|
|
b4d2d65c5c | ||
|
|
beeb188d7e | ||
|
|
2830022ede | ||
|
|
ba4103e03f | ||
|
|
f3d6638384 | ||
|
|
2ad42d660b | ||
|
|
618a00d775 | ||
|
|
d0b65ce297 | ||
|
|
41f640077b | ||
|
|
bfa05616b1 | ||
|
|
f792d7a476 | ||
|
|
9b13cfdbe9 | ||
|
|
02c274e117 | ||
|
|
8993b40730 | ||
|
|
1311b171f9 | ||
|
|
7ecc1022b2 | ||
|
|
a5c14790b3 | ||
|
|
e5f7a03585 | ||
|
|
a024a13f25 | ||
|
|
4d876d0ce8 | ||
|
|
b02c37bf33 | ||
|
|
1d17f11d2f | ||
|
|
1dd9f7f363 | ||
|
|
618d95b76e | ||
|
|
e416abe19b | ||
|
|
296f58f43d | ||
|
|
0b5e3d5a10 | ||
|
|
5d591b18d9 | ||
|
|
e68bc08fed | ||
|
|
df38c84075 | ||
|
|
c509e5db70 | ||
|
|
5a8e029005 | ||
|
|
e3d96b5bb3 | ||
|
|
51afc337ff | ||
|
|
617d41584e | ||
|
|
7a8e2caa50 | ||
|
|
fed58ec29a | ||
|
|
427a7516a3 | ||
|
|
969feb8efa | ||
|
|
d09d6e1e99 | ||
|
|
2d80638090 | ||
|
|
2918d39ab7 | ||
|
|
fb2eb0ebf7 | ||
|
|
e7a36a1ff1 | ||
|
|
41e1b4a5d5 | ||
|
|
6e205fa8ae | ||
|
|
5b3f6ad76e | ||
|
|
8396c3023e | ||
|
|
161d56db36 | ||
|
|
a49a4e5513 | ||
|
|
9741462e7b | ||
|
|
73f09e1af6 | ||
|
|
d41f6e57d2 | ||
|
|
93d041e55b | ||
|
|
94e419e09c | ||
|
|
6c5f6934e7 | ||
|
|
41155b3f97 | ||
|
|
e41c80449d | ||
|
|
6f7a46e528 | ||
|
|
ba48e0c5b8 | ||
|
|
3da636170f | ||
|
|
7687a9e588 | ||
|
|
692dc1a29e | ||
|
|
bb55f9f331 | ||
|
|
dec7b138e9 | ||
|
|
d3b1be80eb | ||
|
|
0339925d15 | ||
|
|
d956ec65a2 | ||
|
|
b02e649405 | ||
|
|
68e98be376 | ||
|
|
c9d174df09 | ||
|
|
80391b867c | ||
|
|
45715293ea | ||
|
|
dd4963e3aa | ||
|
|
c7c7fe194c | ||
|
|
35fdaf1ddd | ||
|
|
2aa5081889 | ||
|
|
9c5d4aaf11 | ||
|
|
04adf25e65 | ||
|
|
8f77261872 | ||
|
|
8b7505c466 | ||
|
|
b420ef3c1f | ||
|
|
e235863b94 | ||
|
|
6b7948b6cd | ||
|
|
87c373b08c | ||
|
|
9844269c1a | ||
|
|
6866b84da8 | ||
|
|
5b19fb3d96 | ||
|
|
fce2a148b8 | ||
|
|
69e1d653ce | ||
|
|
9b88dd6348 | ||
|
|
85c0e5eca2 | ||
|
|
17684f37d9 | ||
|
|
175b87c355 | ||
|
|
5fff9ebfd4 | ||
|
|
795497a60d | ||
|
|
48119acc72 | ||
|
|
ddb23ea1c8 | ||
|
|
6ec7ec3c25 | ||
|
|
39d3690ac0 | ||
|
|
41e0fce068 | ||
|
|
d876bebf28 | ||
|
|
7cb04ce62b | ||
|
|
326d709bf9 | ||
|
|
40dcc9eb33 | ||
|
|
b8f024aa39 | ||
|
|
fbed90224f | ||
|
|
64fe3a1dae | ||
|
|
a160b92529 | ||
|
|
dc3e7f5888 | ||
|
|
30d23d8555 | ||
|
|
42deb992e6 | ||
|
|
6e31a42886 | ||
|
|
f6cab5a65b | ||
|
|
448a80af4a | ||
|
|
6e4b8884e6 | ||
|
|
076e44e39a | ||
|
|
1d23bf3d04 | ||
|
|
85b7f8c5d7 | ||
|
|
e4bf6ffd18 | ||
|
|
1532cc0e70 | ||
|
|
bd63817e37 | ||
|
|
e8ccfeafe1 | ||
|
|
6c892f095d | ||
|
|
e192623c22 | ||
|
|
c20e9adaeb | ||
|
|
fdb6d210d6 | ||
|
|
3473a10159 | ||
|
|
2d8551f0d0 | ||
|
|
38c74bdfa7 | ||
|
|
117da114dc | ||
|
|
d1f67ea7ac | ||
|
|
6f6846ee2a | ||
|
|
6409d36df0 | ||
|
|
10f8aed021 | ||
|
|
5ee9213ad0 | ||
|
|
6be7527424 | ||
|
|
9edeafb0ec | ||
|
|
09b0ea9a30 | ||
|
|
f409049a51 | ||
|
|
94b4725e24 | ||
|
|
2922a35fd2 | ||
|
|
d417874608 | ||
|
|
bc4abe100e | ||
|
|
393f0cd2f4 | ||
|
|
0c822ffa98 | ||
|
|
624d9d9c4a | ||
|
|
0d7fc0904e | ||
|
|
e5cc4a3d3a | ||
|
|
f51763fc88 | ||
|
|
22390a6781 | ||
|
|
3854372f4d | ||
|
|
6d22aa9955 | ||
|
|
9d052703ad | ||
|
|
3bfdbb5ec7 | ||
|
|
9103ea9d70 | ||
|
|
4c99b0d1d9 | ||
|
|
16474cbd81 | ||
|
|
f0c123932d | ||
|
|
0cdff7dc0e | ||
|
|
3c659a29ae | ||
|
|
42beef408c | ||
|
|
c43d84f14b | ||
|
|
394a728b98 | ||
|
|
c741e9ccae | ||
|
|
ab835286b0 | ||
|
|
6485718a97 | ||
|
|
00bcb54b67 | ||
|
|
fef7863810 | ||
|
|
427b9b4892 | ||
|
|
34adc5451d | ||
|
|
224e8d4bba | ||
|
|
07d75e19d5 | ||
|
|
31871f54d4 | ||
|
|
6069991405 | ||
|
|
a017c71d20 | ||
|
|
4001f14953 | ||
|
|
130413cbef | ||
|
|
0622cc658b | ||
|
|
663a5b196d | ||
|
|
6f676f73a4 | ||
|
|
26d7001ae1 | ||
|
|
f79a8e8177 | ||
|
|
0e5147bb1d | ||
|
|
566fb27fc1 | ||
|
|
8c18829089 | ||
|
|
c68c175827 | ||
|
|
415088ae2d | ||
|
|
158926f192 | ||
|
|
f026ffffc8 | ||
|
|
bd0edea3df | ||
|
|
07b4dad4d3 | ||
|
|
0df796bc03 | ||
|
|
cf0212391e | ||
|
|
cb3a695c25 | ||
|
|
3040d468db | ||
|
|
9df300b241 | ||
|
|
870cef7b65 | ||
|
|
d9843d50cd | ||
|
|
9c64c5732b | ||
|
|
275d87f302 | ||
|
|
509f4953bb | ||
|
|
63d1fb2abb | ||
|
|
b3afa34535 | ||
|
|
8203449d92 | ||
|
|
8a96d8d8a5 | ||
|
|
66df609d4a | ||
|
|
fda090f7dd | ||
|
|
74d4c4a3e6 | ||
|
|
c6798a69d9 | ||
|
|
5a484550fb | ||
|
|
b567e4855f | ||
|
|
c2303f78df | ||
|
|
bbe494f85c | ||
|
|
715dbbb92c | ||
|
|
c2455e3f06 | ||
|
|
997052a872 | ||
|
|
3e13e6db98 | ||
|
|
3291b3ca45 | ||
|
|
74ba1c80a9 | ||
|
|
af76280f1d | ||
|
|
9b7fdfd286 | ||
|
|
cefb95dc74 | ||
|
|
f15a7ff5f6 | ||
|
|
6c123ce2b5 | ||
|
|
d7588eaea1 | ||
|
|
8cd756599f | ||
|
|
5b25a6cb53 | ||
|
|
82a0b67a26 | ||
|
|
1fa6b0a353 | ||
|
|
46151a5e55 | ||
|
|
f36c07aa68 | ||
|
|
86797cda20 | ||
|
|
50bc755b44 | ||
|
|
f02461097b | ||
|
|
b36aed8845 | ||
|
|
991cc0953e | ||
|
|
ef4587b596 | ||
|
|
75e2d1d9ce | ||
|
|
75fc68cd18 | ||
|
|
ae34d886a9 | ||
|
|
f2c187bf7c | ||
|
|
243e51fe83 | ||
|
|
d1d3d91fc1 | ||
|
|
4541b4de03 | ||
|
|
291e1fce55 | ||
|
|
bbb4090cd8 | ||
|
|
a30d29b437 | ||
|
|
e6404be02f | ||
|
|
5e10719168 | ||
|
|
68f9019d0e | ||
|
|
d8e7d343ba | ||
|
|
0e5561032c | ||
|
|
fc490a1ca8 | ||
|
|
6e6aab580c | ||
|
|
dc5b1963ae | ||
|
|
564cfa2201 | ||
|
|
398ab028a4 | ||
|
|
1de712c099 | ||
|
|
2d26eb4a70 | ||
|
|
e9cc567977 | ||
|
|
ee82748aeb | ||
|
|
ee3affd140 | ||
|
|
836090a0d5 | ||
|
|
e0e5e42af2 | ||
|
|
49f340b5f8 | ||
|
|
404a10d3c7 | ||
|
|
62e270e95e | ||
|
|
bfbaaf12fb | ||
|
|
0aa9c7b36e | ||
|
|
8540168133 | ||
|
|
02a35fb8d1 | ||
|
|
4647671f07 | ||
|
|
f30450c3c1 | ||
|
|
731501ba27 | ||
|
|
62a8bf05bb | ||
|
|
d8754a2e3e | ||
|
|
64ffa039b4 | ||
|
|
822724a4f1 | ||
|
|
c18c843d03 | ||
|
|
1d362aceaf | ||
|
|
6f5cb4d1a5 | ||
|
|
2cefa0860d | ||
|
|
ea0c83ea74 | ||
|
|
90f64b685e | ||
|
|
62f925d93c | ||
|
|
1985c110b1 | ||
|
|
461bc94a0b | ||
|
|
aaa55a1f4a | ||
|
|
2eecabf5e6 | ||
|
|
fba9bd87df | ||
|
|
bf461b8b27 | ||
|
|
301c4a83b5 | ||
|
|
87468571ae | ||
|
|
7ad2df3e7f | ||
|
|
baef7b5ec0 | ||
|
|
fa8c59360a | ||
|
|
ceeacd2167 | ||
|
|
70214a6578 | ||
|
|
d1a5e5ba57 | ||
|
|
fcd50257ee | ||
|
|
2765fb0c97 | ||
|
|
d22f345d4a | ||
|
|
b658301725 | ||
|
|
1417375d99 | ||
|
|
676420a2b3 | ||
|
|
ffa9436276 | ||
|
|
f6d92d50e4 | ||
|
|
bc1cb820d1 | ||
|
|
8772c158c6 | ||
|
|
d673473d5e | ||
|
|
bb22a1d62a | ||
|
|
f582d83afc | ||
|
|
b12fa5edfd | ||
|
|
65eee7c1d0 | ||
|
|
de4cf3b554 | ||
|
|
cca04dca1c | ||
|
|
bef3897d0a | ||
|
|
842c3dee5f | ||
|
|
d1d39df71e | ||
|
|
2321343d5e | ||
|
|
ce4d9310aa | ||
|
|
58c53cbe0a | ||
|
|
144979b372 | ||
|
|
e29fa04051 | ||
|
|
5ab5232474 | ||
|
|
d7fef8d89e | ||
|
|
3a09361899 | ||
|
|
6ca17a3f9c | ||
|
|
6d40ff7e1b | ||
|
|
0b29eee9ed | ||
|
|
c7fdfdd035 | ||
|
|
d7626e187c | ||
|
|
39453de8fb | ||
|
|
0c38e93b83 | ||
|
|
bf8db812b8 | ||
|
|
0e35da8370 | ||
|
|
b11fa26162 | ||
|
|
e3836538fc | ||
|
|
9301e3b7de | ||
|
|
cf5e5a14b5 | ||
|
|
7f4546e879 | ||
|
|
1a92c59e3f | ||
|
|
ade9731773 | ||
|
|
cc43b3c743 | ||
|
|
b29f6a1640 | ||
|
|
62b8258989 | ||
|
|
75bc568e4b | ||
|
|
b0119a55df | ||
|
|
78983ce76f | ||
|
|
e060e1d97e | ||
|
|
82bdc228b2 | ||
|
|
1fa8311af7 | ||
|
|
93243f2c77 | ||
|
|
3b423826fd | ||
|
|
e44a7c94c6 | ||
|
|
63c0d260ca | ||
|
|
607ca5742b | ||
|
|
86a3072fa9 | ||
|
|
94c60e1837 | ||
|
|
5e4ad55bbd | ||
|
|
e01d8bc10e | ||
|
|
74605adbee | ||
|
|
c6bd1a28d3 | ||
|
|
b4ea4e7499 | ||
|
|
414db326bb | ||
|
|
3186c1a0d0 | ||
|
|
17c70d6c07 | ||
|
|
57ad200288 | ||
|
|
842c11f414 | ||
|
|
d20be7f836 | ||
|
|
8008f226a8 | ||
|
|
fbfc1557c7 | ||
|
|
dcf6a521a6 | ||
|
|
25562bd55b | ||
|
|
bff35bb13a | ||
|
|
b481b35419 | ||
|
|
d96b2e5bd5 | ||
|
|
8e21039ef1 | ||
|
|
5e42f96eaf | ||
|
|
7bc65031c4 | ||
|
|
fd09a4c815 | ||
|
|
5977e9e82f | ||
|
|
f5edca5a31 | ||
|
|
433868ddf5 | ||
|
|
7c26d583a6 | ||
|
|
9c63bad6ee | ||
|
|
4d4a159d24 | ||
|
|
4cb48b86aa | ||
|
|
2c548be5af | ||
|
|
bfaea09c0b | ||
|
|
06bfe52e7a | ||
|
|
0de9ff38f4 | ||
|
|
768181cf8b | ||
|
|
eb3881fc74 | ||
|
|
2c55722e30 | ||
|
|
26d5972ab5 | ||
|
|
20ba19affc | ||
|
|
c86f57862d | ||
|
|
f92f3e3382 | ||
|
|
cd72c535d0 | ||
|
|
439bc1a2a7 | ||
|
|
fb99cf3805 | ||
|
|
a0bf2b49db | ||
|
|
57e995fc71 | ||
|
|
36134f481e | ||
|
|
632c66539e | ||
|
|
645f98284d | ||
|
|
19dd7aad89 | ||
|
|
d82bd31bf1 | ||
|
|
4fa2f16e9a | ||
|
|
208afdfc3a | ||
|
|
69a3ee6c1a | ||
|
|
96d59fb7cc | ||
|
|
3395d1c853 | ||
|
|
e52fb7d8b5 | ||
|
|
be326c37d0 | ||
|
|
1251232e30 | ||
|
|
fa2a212607 | ||
|
|
af3b0cd5f3 | ||
|
|
86fa54d64a | ||
|
|
576abdeec4 | ||
|
|
04da7ec364 | ||
|
|
815648fe32 | ||
|
|
5af76176cd | ||
|
|
b1ed8307dd | ||
|
|
b8122ec2bd | ||
|
|
2b196b89e9 | ||
|
|
5f1c830f47 | ||
|
|
83fc075bc9 | ||
|
|
8dc000c13b | ||
|
|
b130c89297 | ||
|
|
4bc90588fb | ||
|
|
006b3c7da8 | ||
|
|
1f97f39864 | ||
|
|
c15d75e619 | ||
|
|
844162a7ab | ||
|
|
56c4311a6b | ||
|
|
28dcd19dd9 | ||
|
|
78e4e3fd08 | ||
|
|
1cdc719405 | ||
|
|
3cc218b97e | ||
|
|
1f6e2e7f43 | ||
|
|
9f521bbfb4 | ||
|
|
9c19c639dd | ||
|
|
e3a47d980c | ||
|
|
10539929e1 | ||
|
|
3606870565 | ||
|
|
3307d6f282 | ||
|
|
5dc8d1808c | ||
|
|
8d7cddc20a | ||
|
|
35f9743a10 | ||
|
|
f8c397e231 | ||
|
|
24cf6a3ada | ||
|
|
031ee35a00 | ||
|
|
4507ceb36d | ||
|
|
f6116c1624 | ||
|
|
081df4b535 | ||
|
|
e580af8205 | ||
|
|
226e8eeef2 | ||
|
|
00c4ba430d | ||
|
|
951d3bf6dc | ||
|
|
3ae8e14156 | ||
|
|
f170a6ad36 | ||
|
|
25ff4982a0 | ||
|
|
0ac6ceca3f | ||
|
|
81714bbbed | ||
|
|
5b2715ccc0 | ||
|
|
ab411577a2 | ||
|
|
dce96ecc4b | ||
|
|
a232d73cb1 | ||
|
|
c986baf2ae | ||
|
|
df55d5dcde | ||
|
|
ed5cf89776 | ||
|
|
fa3f2283cf | ||
|
|
2988de4025 | ||
|
|
c6f2ddfd7e | ||
|
|
6a7f042d6c | ||
|
|
5fd82ca6e9 | ||
|
|
829404b33c | ||
|
|
610ec0bed4 | ||
|
|
822f063be3 | ||
|
|
32a3094386 | ||
|
|
07ef32bee3 | ||
|
|
df17d31721 | ||
|
|
302c0dd8f1 | ||
|
|
3d70427e2b | ||
|
|
c29ac61ff4 | ||
|
|
c8fdadde39 | ||
|
|
2ffc28a834 | ||
|
|
75b3082172 | ||
|
|
7e8441264f | ||
|
|
b077f2ec22 | ||
|
|
3262b8fd8f | ||
|
|
090b7e5e26 | ||
|
|
7f05c0bf06 | ||
|
|
fbb6c81986 | ||
|
|
9e843f4ba0 | ||
|
|
4e14ec2742 | ||
|
|
69ccf4872e | ||
|
|
1c31aff147 | ||
|
|
608a5c3787 | ||
|
|
297c980a8d | ||
|
|
4091b11f99 | ||
|
|
4718380bd2 | ||
|
|
52ea19809e | ||
|
|
281bd78104 | ||
|
|
d84e744d05 | ||
|
|
1b5bcad3d8 | ||
|
|
bfc4b138ff | ||
|
|
5a0ec11199 | ||
|
|
c52ba1f859 | ||
|
|
d62235ee58 | ||
|
|
e5d2752436 | ||
|
|
cffaee84bb | ||
|
|
96b1d4fe85 | ||
|
|
02acb76ac9 | ||
|
|
038f542895 | ||
|
|
983e175bc9 | ||
|
|
71ac8d7001 | ||
|
|
5258ac3d1a | ||
|
|
27d1627c8f | ||
|
|
780cf7240b | ||
|
|
ce989e39ab | ||
|
|
63d3c7207d | ||
|
|
eb924ec842 | ||
|
|
f826453284 | ||
|
|
1e00111b00 | ||
|
|
06e1592b54 | ||
|
|
41e0c1e39b | ||
|
|
31f63a387e | ||
|
|
4a1ccf19a0 | ||
|
|
d8b387434b | ||
|
|
2e9a42320c | ||
|
|
1d92f90cbe | ||
|
|
df728fc8e6 | ||
|
|
834e3fb996 | ||
|
|
0b7d4a2c35 | ||
|
|
e13626e92b | ||
|
|
0286010053 | ||
|
|
382e315668 | ||
|
|
5f5c00adb5 | ||
|
|
e093efa931 | ||
|
|
c129eae6a7 | ||
|
|
5b6e5786ea | ||
|
|
8a8471e49a | ||
|
|
719866a574 | ||
|
|
95ebc3bedf |
48
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
48
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: community, triage
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## NOTE
|
||||
If this case is urgent, please subscribe to [Subnet](https://min.io/pricing) so that our 24/7 support team may help you faster.
|
||||
|
||||
<!--- Provide a general summary of the issue in the title above -->
|
||||
|
||||
## Expected Behavior
|
||||
<!--- If you're describing a bug, tell us what should happen -->
|
||||
<!--- If you're suggesting a change/improvement, tell us how it should work -->
|
||||
|
||||
## Current Behavior
|
||||
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
||||
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
||||
|
||||
## Possible Solution
|
||||
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||
<!--- or ideas how to implement the addition or change -->
|
||||
|
||||
## Steps to Reproduce (for bugs)
|
||||
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
||||
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
4.
|
||||
|
||||
## Context
|
||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||
|
||||
## Regression
|
||||
<!-- Is this issue a regression? (Yes / No) -->
|
||||
<!-- If Yes, optionally please include the MinIO version or commit id or PR# that caused this regression, if you have these details. -->
|
||||
|
||||
## Your Environment
|
||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||
* MinIO version used (`minio --version`):
|
||||
* Server setup and configuration:
|
||||
* Operating System and version (`uname -a`):
|
||||
34
.github/workflows/compiles.yml
vendored
34
.github/workflows/compiles.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Compiles on Go ${{ matrix.go-version }} and ${{ matrix.os }}
|
||||
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
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make console
|
||||
166
.github/workflows/cross-compile.yaml
vendored
Normal file
166
.github/workflows/cross-compile.yaml
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
# @format
|
||||
|
||||
name: Cross Compile
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- go.sum
|
||||
|
||||
# This ensures that previous jobs for the PR are canceled when the PR is
|
||||
# updated.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
cross-compile-1:
|
||||
name: Cross compile
|
||||
needs:
|
||||
- lint-job
|
||||
- ui-assets
|
||||
- reuse-golang-dependencies
|
||||
- semgrep-static-code-analysis
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.21.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make crosscompile arg1="'linux/ppc64le linux/mips64'"
|
||||
|
||||
cross-compile-2:
|
||||
name: Cross compile 2
|
||||
needs:
|
||||
- lint-job
|
||||
- ui-assets
|
||||
- reuse-golang-dependencies
|
||||
- semgrep-static-code-analysis
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.21.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make crosscompile arg1="'linux/arm64 linux/s390x'"
|
||||
|
||||
cross-compile-3:
|
||||
name: Cross compile 3
|
||||
needs:
|
||||
- lint-job
|
||||
- ui-assets
|
||||
- reuse-golang-dependencies
|
||||
- semgrep-static-code-analysis
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.21.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make crosscompile arg1="'darwin/amd64 freebsd/amd64'"
|
||||
|
||||
cross-compile-4:
|
||||
name: Cross compile 4
|
||||
needs:
|
||||
- lint-job
|
||||
- ui-assets
|
||||
- reuse-golang-dependencies
|
||||
- semgrep-static-code-analysis
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.21.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make crosscompile arg1="'windows/amd64 linux/arm'"
|
||||
|
||||
cross-compile-5:
|
||||
name: Cross compile 5
|
||||
needs:
|
||||
- lint-job
|
||||
- ui-assets
|
||||
- reuse-golang-dependencies
|
||||
- semgrep-static-code-analysis
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.21.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
id: go
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make crosscompile arg1="'linux/386 netbsd/amd64'"
|
||||
34
.github/workflows/crosscompile-1.yml
vendored
34
.github/workflows/crosscompile-1.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Cross compile
|
||||
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
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make crosscompile arg1="'linux/ppc64le linux/mips64'"
|
||||
34
.github/workflows/crosscompile-2.yml
vendored
34
.github/workflows/crosscompile-2.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Cross compile
|
||||
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
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make crosscompile arg1="'linux/arm64 linux/s390x'"
|
||||
34
.github/workflows/crosscompile-3.yml
vendored
34
.github/workflows/crosscompile-3.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Cross compile
|
||||
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
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make crosscompile arg1="'darwin/amd64 freebsd/amd64'"
|
||||
34
.github/workflows/crosscompile-4.yml
vendored
34
.github/workflows/crosscompile-4.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Cross compile
|
||||
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
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make crosscompile arg1="'windows/amd64 linux/arm'"
|
||||
34
.github/workflows/crosscompile-5.yml
vendored
34
.github/workflows/crosscompile-5.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Cross compile
|
||||
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
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make crosscompile arg1="'linux/386 netbsd/amd64'"
|
||||
34
.github/workflows/go-test-pkg.yml
vendored
34
.github/workflows/go-test-pkg.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Test Pkg on Go ${{ matrix.go-version }} and ${{ matrix.os }}
|
||||
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
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make test-pkg
|
||||
34
.github/workflows/go.yml
vendored
34
.github/workflows/go.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Test Restapi on Go ${{ matrix.go-version }} and ${{ matrix.os }}
|
||||
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
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make test
|
||||
63
.github/workflows/integration.yml
vendored
63
.github/workflows/integration.yml
vendored
@@ -1,63 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
# This ensures that previous jobs for the PR are canceled when the PR is
|
||||
# updated.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
minio-test:
|
||||
name: Integration Tests with Latest Distributed MinIO
|
||||
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'
|
||||
|
||||
- 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-integration MINIO_VERSION=$VERSION;
|
||||
18
.github/workflows/issues.yaml
vendored
Normal file
18
.github/workflows/issues.yaml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# @format
|
||||
|
||||
name: Issue Workflow
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
|
||||
jobs:
|
||||
add-to-project:
|
||||
name: Add issue to project
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/add-to-project@v0.5.0
|
||||
with:
|
||||
project-url: https://github.com/orgs/miniohq/projects/2
|
||||
github-token: ${{ secrets.BOT_PAT }}
|
||||
1322
.github/workflows/jobs.yaml
vendored
Normal file
1322
.github/workflows/jobs.yaml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
34
.github/workflows/lint.yml
vendored
34
.github/workflows/lint.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: Go
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Checking Lint
|
||||
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
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make verifiers
|
||||
70
.github/workflows/permissions.yml
vendored
70
.github/workflows/permissions.yml
vendored
@@ -1,70 +0,0 @@
|
||||
name: "UI"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
permissions:
|
||||
name: Permissions Tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.17.x ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
id: go
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '17'
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Make assets
|
||||
run: |
|
||||
make assets
|
||||
- name: Build Console on ${{ matrix.os }}
|
||||
env:
|
||||
GO111MODULE: on
|
||||
GOOS: linux
|
||||
run: |
|
||||
make console
|
||||
|
||||
- name: Start Console, front-end app and initialize users/policies
|
||||
run: |
|
||||
(./console server) & (make initialize-permissions)
|
||||
|
||||
- name: Run TestCafe Tests
|
||||
uses: DevExpress/testcafe-action@latest
|
||||
with:
|
||||
args: '"chrome:headless" portal-ui/tests/permissions/ --skip-js-errors '
|
||||
|
||||
- name: Clean up users & policies
|
||||
run: |
|
||||
make cleanup-permissions
|
||||
17
.github/workflows/react-no-warnings.yml
vendored
17
.github/workflows/react-no-warnings.yml
vendored
@@ -1,17 +0,0 @@
|
||||
name: "React Code Has No Warnings"
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install modules
|
||||
working-directory: ./portal-ui
|
||||
run: yarn
|
||||
- name: Check for Warnings in build output
|
||||
working-directory: ./portal-ui
|
||||
continue-on-error: false
|
||||
run: |
|
||||
chmod +x check-warnings.sh && ./check-warnings.sh
|
||||
15
.github/workflows/react.yml
vendored
15
.github/workflows/react.yml
vendored
@@ -1,15 +0,0 @@
|
||||
name: "React Tests"
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install modules
|
||||
working-directory: ./portal-ui
|
||||
run: yarn
|
||||
- name: Run tests
|
||||
working-directory: ./portal-ui
|
||||
run: yarn test
|
||||
53
.github/workflows/vulncheck.yaml
vendored
Normal file
53
.github/workflows/vulncheck.yaml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# @format
|
||||
|
||||
name: Vulnerability Check
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
vulncheck:
|
||||
name: Analysis
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: 1.21.5
|
||||
check-latest: true
|
||||
- name: Get official govulncheck
|
||||
run: go install golang.org/x/vuln/cmd/govulncheck@latest
|
||||
shell: bash
|
||||
- name: Run govulncheck
|
||||
run: govulncheck ./...
|
||||
shell: bash
|
||||
|
||||
react-code-known-vulnerabilities:
|
||||
name: "React Code Has No Known Vulnerable Deps"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [ 1.21.5 ]
|
||||
os: [ ubuntu-latest ]
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NVMRC }}
|
||||
cache: "yarn"
|
||||
cache-dependency-path: portal-ui/yarn.lock
|
||||
- name: Checks for known security issues with the installed packages
|
||||
working-directory: ./portal-ui
|
||||
continue-on-error: false
|
||||
run: |
|
||||
yarn audit --groups dependencies
|
||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -1,3 +1,13 @@
|
||||
# Playwright Data
|
||||
portal-ui/storage/
|
||||
portal-ui/playwright/.auth/admin.json
|
||||
|
||||
# Report from Playwright
|
||||
portal-ui/playwright-report/
|
||||
|
||||
# Coverage from Playwright
|
||||
portal-ui/.nyc_output/
|
||||
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
@@ -19,6 +29,7 @@ vendor/
|
||||
|
||||
# Ignore executables
|
||||
target/
|
||||
!pkg/logger/target/
|
||||
console
|
||||
!console/
|
||||
|
||||
|
||||
@@ -5,28 +5,29 @@ linters-settings:
|
||||
misspell:
|
||||
locale: US
|
||||
|
||||
goheader:
|
||||
values:
|
||||
regexp:
|
||||
copyright-holder: Copyright \(c\) (20\d\d\-20\d\d)|2021|({{year}})
|
||||
template-path: .license.tmpl
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
- typecheck
|
||||
- goimports
|
||||
- misspell
|
||||
- govet
|
||||
- revive
|
||||
- ineffassign
|
||||
- gosimple
|
||||
- deadcode
|
||||
- unparam
|
||||
- gomodguard
|
||||
- gofmt
|
||||
- unused
|
||||
- structcheck
|
||||
- goheader
|
||||
|
||||
linters-settings:
|
||||
goheader:
|
||||
values:
|
||||
regexp:
|
||||
copyright-holder: Copyright \(c\) (20\d\d\-20\d\d)|2021|({{year}})
|
||||
template-path: .license.tmpl
|
||||
- staticcheck
|
||||
- unconvert
|
||||
- gocritic
|
||||
- gofumpt
|
||||
- durationcheck
|
||||
|
||||
service:
|
||||
golangci-lint-version: 1.43.0 # use the fixed version to not introduce new linters unexpectedly
|
||||
@@ -34,14 +35,15 @@ service:
|
||||
issues:
|
||||
exclude-use-default: false
|
||||
exclude:
|
||||
- should have a package comment
|
||||
# TODO(y4m4): Remove once all exported ident. have comments!
|
||||
- comment on exported function
|
||||
- comment on exported type
|
||||
- should have comment
|
||||
- use leading k in Go names
|
||||
- comment on exported const
|
||||
- should have a package comment
|
||||
# TODO(y4m4): Remove once all exported ident. have comments!
|
||||
- comment on exported function
|
||||
- comment on exported type
|
||||
- should have comment
|
||||
- use leading k in Go names
|
||||
- comment on exported const
|
||||
run:
|
||||
skip-dirs:
|
||||
- pkg/clientgen
|
||||
- pkg/apis/networking.gke.io
|
||||
- restapi/operations
|
||||
|
||||
195
.goreleaser.yml
195
.goreleaser.yml
@@ -1,195 +0,0 @@
|
||||
# This is an example goreleaser.yaml file with some sane defaults.
|
||||
# Make sure to check the documentation at http://goreleaser.com
|
||||
project_name: console
|
||||
|
||||
release:
|
||||
name_template: "Release version {{.Tag}}"
|
||||
github:
|
||||
owner: minio
|
||||
name: console
|
||||
extra_files:
|
||||
- glob: "*.minisig"
|
||||
|
||||
before:
|
||||
hooks:
|
||||
# you may remove this if you don't use vgo
|
||||
- go mod tidy
|
||||
|
||||
builds:
|
||||
-
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
- windows
|
||||
goarch:
|
||||
- amd64
|
||||
- ppc64le
|
||||
- s390x
|
||||
- arm64
|
||||
ignore:
|
||||
- goos: darwin
|
||||
goarch: arm
|
||||
- goos: windows
|
||||
goarch: arm64
|
||||
- goos: windows
|
||||
goarch: arm
|
||||
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
|
||||
main: ./cmd/console/
|
||||
|
||||
flags:
|
||||
- -trimpath
|
||||
- --tags=kqueue,operator
|
||||
|
||||
ldflags:
|
||||
- -s -w -X github.com/minio/console/pkg.ReleaseTag={{.Tag}} -X github.com/minio/console/pkg.CommitID={{.FullCommit}} -X github.com/minio/console/pkg.Version={{.Version}} -X github.com/minio/console/pkg.ShortCommitID={{.ShortCommit}} -X github.com/minio/console/pkg.ReleaseTime={{.Date}}
|
||||
|
||||
archives:
|
||||
-
|
||||
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
|
||||
format: binary
|
||||
replacements:
|
||||
arm: arm
|
||||
|
||||
signs:
|
||||
-
|
||||
signature: "${artifact}.minisig"
|
||||
cmd: "sh"
|
||||
args:
|
||||
- '-c'
|
||||
- 'minisign -s /media/${USER}/minio/minisign.key -Sm ${artifact} < /media/${USER}/minio/minisign-passphrase'
|
||||
artifacts: all
|
||||
|
||||
snapshot:
|
||||
name_template: v0.0.0@{{.ShortCommit}}
|
||||
|
||||
changelog:
|
||||
sort: asc
|
||||
|
||||
nfpms:
|
||||
-
|
||||
vendor: MinIO, Inc.
|
||||
homepage: https://github.com/minio/console
|
||||
maintainer: MinIO Development <dev@min.io>
|
||||
description: MinIO Console Server
|
||||
license: GNU Affero General Public License v3.0
|
||||
formats:
|
||||
- deb
|
||||
- rpm
|
||||
contents:
|
||||
# Basic file that applies to all packagers
|
||||
- src: systemd/console.service
|
||||
dst: /etc/systemd/system/minio-console.service
|
||||
|
||||
dockers:
|
||||
- image_templates:
|
||||
- "minio/console:{{ .Tag }}-amd64"
|
||||
use: buildx
|
||||
goarch: amd64
|
||||
dockerfile: Dockerfile.release
|
||||
extra_files:
|
||||
- LICENSE
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/amd64"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "minio/console:{{ .Tag }}-ppc64le"
|
||||
use: buildx
|
||||
goarch: ppc64le
|
||||
dockerfile: Dockerfile.release
|
||||
extra_files:
|
||||
- LICENSE
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/ppc64le"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "minio/console:{{ .Tag }}-s390x"
|
||||
use: buildx
|
||||
goarch: s390x
|
||||
dockerfile: Dockerfile.release
|
||||
extra_files:
|
||||
- LICENSE
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/s390x"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "minio/console:{{ .Tag }}-arm64"
|
||||
use: buildx
|
||||
goarch: arm64
|
||||
goos: linux
|
||||
dockerfile: Dockerfile.release
|
||||
extra_files:
|
||||
- LICENSE
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/arm64"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "quay.io/minio/console:{{ .Tag }}-amd64"
|
||||
use: buildx
|
||||
goarch: amd64
|
||||
dockerfile: Dockerfile.release
|
||||
extra_files:
|
||||
- LICENSE
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/amd64"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "quay.io/minio/console:{{ .Tag }}-ppc64le"
|
||||
use: buildx
|
||||
goarch: ppc64le
|
||||
dockerfile: Dockerfile.release
|
||||
extra_files:
|
||||
- LICENSE
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/ppc64le"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "quay.io/minio/console:{{ .Tag }}-s390x"
|
||||
use: buildx
|
||||
goarch: s390x
|
||||
dockerfile: Dockerfile.release
|
||||
extra_files:
|
||||
- LICENSE
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/s390x"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
- image_templates:
|
||||
- "quay.io/minio/console:{{ .Tag }}-arm64"
|
||||
use: buildx
|
||||
goarch: arm64
|
||||
goos: linux
|
||||
dockerfile: Dockerfile.release
|
||||
extra_files:
|
||||
- LICENSE
|
||||
- CREDITS
|
||||
build_flag_templates:
|
||||
- "--platform=linux/arm64"
|
||||
- "--build-arg=TAG={{ .Tag }}"
|
||||
docker_manifests:
|
||||
- name_template: minio/console:{{ .Tag }}
|
||||
image_templates:
|
||||
- minio/console:{{ .Tag }}-amd64
|
||||
- minio/console:{{ .Tag }}-arm64
|
||||
- minio/console:{{ .Tag }}-ppc64le
|
||||
- minio/console:{{ .Tag }}-s390x
|
||||
- name_template: quay.io/minio/console:{{ .Tag }}
|
||||
image_templates:
|
||||
- quay.io/minio/console:{{ .Tag }}-amd64
|
||||
- quay.io/minio/console:{{ .Tag }}-arm64
|
||||
- quay.io/minio/console:{{ .Tag }}-ppc64le
|
||||
- quay.io/minio/console:{{ .Tag }}-s390x
|
||||
- name_template: minio/console:latest
|
||||
image_templates:
|
||||
- minio/console:{{ .Tag }}-amd64
|
||||
- minio/console:{{ .Tag }}-arm64
|
||||
- minio/console:{{ .Tag }}-ppc64le
|
||||
- minio/console:{{ .Tag }}-s390x
|
||||
35
.semgrepignore
Normal file
35
.semgrepignore
Normal file
@@ -0,0 +1,35 @@
|
||||
# Ignore git items
|
||||
.gitignore
|
||||
.git/
|
||||
:include .gitignore
|
||||
|
||||
# Common large paths
|
||||
node_modules/
|
||||
portal-ui/node_modules/
|
||||
build/
|
||||
dist/
|
||||
.idea/
|
||||
vendor/
|
||||
.env/
|
||||
.venv/
|
||||
.tox/
|
||||
*.min.js
|
||||
|
||||
# Common test paths
|
||||
test/
|
||||
tests/
|
||||
*_test.go
|
||||
|
||||
# Semgrep rules folder
|
||||
.semgrep
|
||||
|
||||
# Semgrep-action log folder
|
||||
.semgrep_logs/
|
||||
|
||||
# Ignore VsCode files
|
||||
.vscode/
|
||||
*.code-workspace
|
||||
*~
|
||||
.eslintcache
|
||||
|
||||
consoleApi.ts
|
||||
215
CHANGELOG.md
Normal file
215
CHANGELOG.md
Normal file
@@ -0,0 +1,215 @@
|
||||
<!-- @format -->
|
||||
|
||||
# Changelog
|
||||
|
||||
## Release v0.43.1
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Update Share Object UI to reflect maximum expiration time in UI
|
||||
|
||||
## Release v0.43.0
|
||||
|
||||
Features:
|
||||
|
||||
- Updated PDF preview method
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed vulnerabilities
|
||||
- Prevented non-necessary metadata calls in object browser
|
||||
|
||||
## Release v0.42.2
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Hidden Prometheus metrics if URL is empty
|
||||
|
||||
## Release v0.42.1
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Reset go version to 1.19
|
||||
|
||||
## Release v0.42.0
|
||||
|
||||
Features:
|
||||
|
||||
- Introducing Dark Mode
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed vulnerabilities
|
||||
- Changes on Upload and Delete object urls
|
||||
- Fixed blocking subpath creation if not enough permissions
|
||||
- Removed share object option at prefix level
|
||||
- Updated allowed actions for a deleted object
|
||||
|
||||
## Release v0.41.0
|
||||
|
||||
Features:
|
||||
|
||||
- Updated pages to use mds components
|
||||
- support for resolving IPv4/IPv6
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Remove cache for ClientIP
|
||||
- Fixed override environment variables display in settings page
|
||||
- Fixed daylight savings time support in share modal
|
||||
|
||||
## Release v0.40.0
|
||||
|
||||
Features:
|
||||
|
||||
- Updated OpenID page
|
||||
- Added New bucket event types support
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed crash in access keys page
|
||||
- Fixed AuditLog filters issue
|
||||
- Fixed multiple issues with Object Browser
|
||||
|
||||
## Release v0.39.0
|
||||
|
||||
Features:
|
||||
|
||||
- Migrated metrics page to mds
|
||||
- Migrated Register page to mds
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed LDAP configuration page issues
|
||||
- Load available certificates in logout
|
||||
- Updated dependencies & go version
|
||||
- Fixed delete objects functionality
|
||||
|
||||
## Release v0.38.0
|
||||
|
||||
Features:
|
||||
|
||||
- Added extra information to Service Accounts page
|
||||
- Updated Tiers, Site Replication, Speedtest, Heal & Watch pages components
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed IDP expiry time errors
|
||||
- Updated project Dependencies
|
||||
|
||||
## Release v0.37.0
|
||||
|
||||
Features:
|
||||
|
||||
- Updated Trace and Logs page components
|
||||
- Updated Prometheus metrics
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Disabled input fields for Subscription features if MinIO is not registered
|
||||
|
||||
## Release v0.36.0
|
||||
|
||||
Features:
|
||||
|
||||
- Updated Settings page components
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Show LDAP Enabled value LDAP configuration
|
||||
- Download multiple objects in same path as they were selected
|
||||
|
||||
## Release v0.35.1
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Change timestamp format for zip creation
|
||||
|
||||
## Release v0.35.0
|
||||
|
||||
Features:
|
||||
|
||||
- Add Exclude Folders and Exclude Prefixes during bucket creation
|
||||
- Download multiple selected objects as zip and ignore deleted objects
|
||||
- Updated Call Home, Inspet, Profile and Health components
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Remove extra white spaces for configuration strings
|
||||
- Allow Create New Path in bucket view when having right permissions
|
||||
|
||||
## Release v0.34.0
|
||||
|
||||
Features:
|
||||
|
||||
- Updated Buckets components
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed SUBNET Health report upload
|
||||
- Updated Download Handler
|
||||
- Fixes issue with rewind
|
||||
- Avoid 1 hour expiration for IDP credentials
|
||||
|
||||
---
|
||||
|
||||
## Release v0.33.0
|
||||
|
||||
Features:
|
||||
|
||||
- Updated OpenID, LDAP components
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed security issues
|
||||
- Fixed navigation issues in Object Browser
|
||||
- Fixed Dashboard metrics
|
||||
|
||||
---
|
||||
|
||||
## Release v0.32.0
|
||||
|
||||
Features:
|
||||
|
||||
- Updated Users and Groups components
|
||||
- Added placeholder image for Help Menu
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed memory leak in WebSocket API for Object Browser
|
||||
|
||||
---
|
||||
|
||||
## Release v0.31.0
|
||||
|
||||
**Breaking Changes:**
|
||||
|
||||
- **Removed support for Standalone Deployments**
|
||||
|
||||
Features:
|
||||
|
||||
- Updated way files are displayed in uploading component
|
||||
- Updated Audit Logs and Policies components
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Fixed Download folders issue in Object Browser
|
||||
- Added missing Notification Events (ILM & REPLICA) in Events Notification Page
|
||||
- Fixed Security Vulnerability for `semver` dependency
|
||||
|
||||
---
|
||||
|
||||
## Release v0.30.0
|
||||
|
||||
Features:
|
||||
|
||||
- Added MinIO Console Help Menu
|
||||
- Updated UI Menu components
|
||||
|
||||
Bug Fix:
|
||||
|
||||
- Disable the Upload button on Object Browser if the user is not allowed
|
||||
- Fixed security vulnerability for `lestrrat-go/jwx` and `fast-xml-parser`
|
||||
- Fixed bug on sub-paths for Object Browser
|
||||
- Reduce the number of calls to `/session` API endpoint to improve performance
|
||||
- Rolled back the previous change for the Share File feature to no longer ask for Service Account access keys
|
||||
103
DEVELOPMENT.md
103
DEVELOPMENT.md
@@ -1,3 +1,96 @@
|
||||
# Developing MinIO Console
|
||||
|
||||
The MinIO Console requires the [MinIO Server](https://github.com/minio/minio). For development purposes, you also need to run both the MinIO Console web app and the MinIO Console server.
|
||||
|
||||
## Running MinIO Console server
|
||||
|
||||
Build the server in the main folder by running:
|
||||
```
|
||||
make
|
||||
```
|
||||
> Note: If it's the first time running the server, you might need to run `go mod tidy` to ensure you have all modules required.
|
||||
To start the server run:
|
||||
```
|
||||
CONSOLE_ACCESS_KEY=<your-access-key>
|
||||
CONSOLE_SECRET_KEY=<your-secret-key>
|
||||
CONSOLE_MINIO_SERVER=<minio-server-endpoint>
|
||||
CONSOLE_DEV_MODE=on
|
||||
./console server
|
||||
```
|
||||
|
||||
## Running MinIO Console web app
|
||||
Refer to `/portal-ui` [instructions](/portal-ui/README.md) to run the web app locally.
|
||||
|
||||
|
||||
# Building with MinIO
|
||||
|
||||
To test console in its shipping format, you need to build it from the MinIO repository, the following step will guide
|
||||
you to do that.
|
||||
|
||||
### 0. Building with UI Changes
|
||||
|
||||
If you are performing changes in the UI components of console and want to test inside the MinIO binary, you need to
|
||||
build assets first.
|
||||
|
||||
In the console folder run
|
||||
|
||||
```shell
|
||||
make assets
|
||||
```
|
||||
|
||||
This will regenerate all the static assets that will be served by MinIO.
|
||||
|
||||
### 1. Clone the `MinIO` repository
|
||||
|
||||
In the parent folder of where you cloned this `console` repository, clone the MinIO Repository
|
||||
|
||||
```shell
|
||||
git clone https://github.com/minio/minio.git
|
||||
```
|
||||
|
||||
### 2. Update `go.mod` to use your local version
|
||||
|
||||
In the MinIO repository open `go.mod` and after the first `require()` directive add a `replace()` directive
|
||||
|
||||
```
|
||||
...
|
||||
)
|
||||
|
||||
replace (
|
||||
github.com/minio/console => "../console"
|
||||
)
|
||||
|
||||
require (
|
||||
...
|
||||
```
|
||||
|
||||
### 3. Build `MinIO`
|
||||
|
||||
Still in the MinIO folder, run
|
||||
|
||||
```shell
|
||||
make build
|
||||
```
|
||||
|
||||
# Testing on Kubernetes
|
||||
|
||||
If you want to test console on kubernetes, you can perform all the steps from `Building with MinIO`, but change `Step 3`
|
||||
to the following:
|
||||
|
||||
```shell
|
||||
TAG=miniodev/console:dev make docker
|
||||
```
|
||||
|
||||
This will build a docker container image that can be used to test with your local kubernetes environment.
|
||||
|
||||
For example, if you are using kind:
|
||||
|
||||
```shell
|
||||
kind load docker-image miniodev/console:dev
|
||||
```
|
||||
|
||||
and then deploy any `Tenant` that uses this image
|
||||
|
||||
# LDAP authentication with Console
|
||||
|
||||
## Setup
|
||||
@@ -15,7 +108,8 @@ $ docker cp console/docs/ldap/billy.ldif my-openldap-container:/container/servic
|
||||
$ docker exec my-openldap-container ldapadd -x -D "cn=admin,dc=example,dc=org" -w admin -f /container/service/slapd/assets/test/billy.ldif -H ldap://localhost
|
||||
```
|
||||
|
||||
Query the ldap server to check the user billy was created correctly and got assigned to the consoleAdmin group, you should get a list
|
||||
Query the ldap server to check the user billy was created correctly and got assigned to the consoleAdmin group, you
|
||||
should get a list
|
||||
containing ldap users and groups.
|
||||
|
||||
```
|
||||
@@ -30,7 +124,7 @@ $ docker exec my-openldap-container ldapsearch -x -H ldap://localhost -b uid=bil
|
||||
|
||||
### Change the password for user billy
|
||||
|
||||
Set the new password for `billy` to `minio123` and enter `admin` as the default `LDAP Password`
|
||||
Set the new password for `billy` to `minio123` and enter `admin` as the default `LDAP Password`
|
||||
|
||||
```
|
||||
$ docker exec -it my-openldap-container /bin/bash
|
||||
@@ -41,6 +135,7 @@ Enter LDAP Password:
|
||||
```
|
||||
|
||||
### Add the consoleAdmin policy to user billy on MinIO
|
||||
|
||||
```
|
||||
$ cat > consoleAdmin.json << EOF
|
||||
{
|
||||
@@ -66,8 +161,8 @@ $ cat > consoleAdmin.json << EOF
|
||||
]
|
||||
}
|
||||
EOF
|
||||
$ mc admin policy add myminio consoleAdmin consoleAdmin.json
|
||||
$ mc admin policy set myminio consoleAdmin user="uid=billy,dc=example,dc=org"
|
||||
$ mc admin policy create myminio consoleAdmin consoleAdmin.json
|
||||
$ mc admin policy attach myminio consoleAdmin --user="uid=billy,dc=example,dc=org"
|
||||
```
|
||||
|
||||
## Run MinIO
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM node:14 as uilayer
|
||||
ARG NODE_VERSION
|
||||
FROM node:$NODE_VERSION as uilayer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -12,7 +13,7 @@ RUN make build-static
|
||||
|
||||
USER node
|
||||
|
||||
FROM golang:1.16 as golayer
|
||||
FROM golang:1.19 as golayer
|
||||
|
||||
RUN apt-get update -y && apt-get install -y ca-certificates
|
||||
|
||||
@@ -29,9 +30,9 @@ WORKDIR /go/src/github.com/minio/console/
|
||||
ENV CGO_ENABLED=0
|
||||
|
||||
COPY --from=uilayer /app/build /go/src/github.com/minio/console/portal-ui/build
|
||||
RUN go build -ldflags "-w -s" -a -o console ./cmd/console
|
||||
RUN go build --tags=kqueue,operator -ldflags "-w -s" -a -o console ./cmd/console
|
||||
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
|
||||
MAINTAINER MinIO Development "dev@min.io"
|
||||
EXPOSE 9090
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
FROM node:14 as uilayer
|
||||
ARG NODE_VERSION
|
||||
FROM node:$NODE_VERSION as uilayer
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4
|
||||
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.2 as build
|
||||
|
||||
RUN microdnf update --nodocs && microdnf install ca-certificates --nodocs
|
||||
|
||||
FROM registry.access.redhat.com/ubi9/ubi-micro:9.2
|
||||
|
||||
ARG TAG
|
||||
|
||||
COPY CREDITS /licenses/CREDITS
|
||||
COPY LICENSE /licenses/LICENSE
|
||||
|
||||
LABEL name="MinIO" \
|
||||
vendor="MinIO Inc <dev@min.io>" \
|
||||
maintainer="MinIO Inc <dev@min.io>" \
|
||||
@@ -13,11 +14,14 @@ LABEL name="MinIO" \
|
||||
summary="A graphical user interface for MinIO" \
|
||||
description="MinIO object storage is fundamentally different. Designed for performance and the S3 API, it is 100% open-source. MinIO is ideal for large, private cloud environments with stringent security requirements and delivers mission-critical availability across a diverse range of workloads."
|
||||
|
||||
RUN \
|
||||
microdnf update --nodocs && \
|
||||
microdnf install ca-certificates --nodocs
|
||||
|
||||
EXPOSE 9090
|
||||
# On RHEL the certificate bundle is located at:
|
||||
# - /etc/pki/tls/certs/ca-bundle.crt (RHEL 6)
|
||||
# - /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem (RHEL 7)
|
||||
COPY --from=build /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /etc/pki/ca-trust/extracted/pem/
|
||||
COPY LICENSE /LICENSE
|
||||
COPY CREDITS /CREDITS
|
||||
COPY console /console
|
||||
|
||||
EXPOSE 9090
|
||||
|
||||
ENTRYPOINT ["/console"]
|
||||
|
||||
228
Makefile
228
Makefile
@@ -5,31 +5,25 @@ BUILD_VERSION:=$(shell git describe --exact-match --tags $(git log -n1 --pretty=
|
||||
BUILD_TIME:=$(shell date 2>/dev/null)
|
||||
TAG ?= "minio/console:$(BUILD_VERSION)-dev"
|
||||
MINIO_VERSION ?= "quay.io/minio/minio:latest"
|
||||
TARGET_BUCKET ?= "target"
|
||||
NODE_VERSION := $(shell cat .nvmrc)
|
||||
|
||||
default: console
|
||||
|
||||
.PHONY: console
|
||||
console:
|
||||
@echo "Building Console binary to './console'"
|
||||
@(GO111MODULE=on CGO_ENABLED=0 go build -trimpath --tags=kqueue,operator --ldflags "-s -w" -o console ./cmd/console)
|
||||
|
||||
k8sdev:
|
||||
@docker build -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' .
|
||||
@kind load docker-image $(TAG)
|
||||
@echo "Done, now restart your console deployment"
|
||||
@(GO111MODULE=on CGO_ENABLED=0 go build -trimpath --tags=kqueue --ldflags "-s -w" -o console ./cmd/console)
|
||||
|
||||
getdeps:
|
||||
@mkdir -p ${GOPATH}/bin
|
||||
@which golangci-lint 1>/dev/null || (echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.43.0)
|
||||
@echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin
|
||||
|
||||
verifiers: getdeps fmt lint
|
||||
|
||||
fmt:
|
||||
@echo "Running $@ check"
|
||||
@GO111MODULE=on gofmt -d restapi/
|
||||
@GO111MODULE=on gofmt -d pkg/
|
||||
@GO111MODULE=on gofmt -d cmd/
|
||||
@GO111MODULE=on gofmt -d cluster/
|
||||
@(env bash $(PWD)/verify-gofmt.sh)
|
||||
|
||||
crosscompile:
|
||||
@(env bash $(PWD)/cross-compile.sh $(arg1))
|
||||
@@ -44,43 +38,190 @@ install: console
|
||||
@mkdir -p $(GOPATH)/bin && cp -f $(PWD)/console $(GOPATH)/bin/console
|
||||
@echo "Installation successful. To learn more, try \"console --help\"."
|
||||
|
||||
swagger-gen: clean-swagger swagger-console swagger-operator
|
||||
swagger-gen: clean-swagger swagger-console apply-gofmt
|
||||
@echo "Done Generating swagger server code from yaml"
|
||||
|
||||
apply-gofmt:
|
||||
@echo "Applying gofmt to all generated an existing files"
|
||||
@GO111MODULE=on gofmt -w .
|
||||
|
||||
clean-swagger:
|
||||
@echo "cleaning"
|
||||
@rm -rf models
|
||||
@rm -rf restapi/operations
|
||||
@rm -rf operatorapi/operations
|
||||
|
||||
swagger-console:
|
||||
@echo "Generating swagger server code from yaml"
|
||||
@swagger generate server -A console --main-package=management --server-package=restapi --exclude-main -P models.Principal -f ./swagger-console.yml -r NOTICE
|
||||
@swagger generate server -A console --main-package=management --server-package=restapi --exclude-main -P models.Principal -f ./swagger.yml -r NOTICE
|
||||
@echo "Generating typescript api"
|
||||
@npx swagger-typescript-api -p ./swagger.yml -o ./portal-ui/src/api -n consoleApi.ts
|
||||
@git restore restapi/server.go
|
||||
|
||||
swagger-operator:
|
||||
@echo "Generating swagger server code from yaml"
|
||||
@swagger generate server -A operator --main-package=operator --server-package=operatorapi --exclude-main -P models.Principal -f ./swagger-operator.yml -r NOTICE
|
||||
|
||||
assets:
|
||||
@(cd portal-ui; yarn install; make build-static; yarn prettier --write . --loglevel warn; cd ..)
|
||||
@(if [ -f "${NVM_DIR}/nvm.sh" ]; then \. "${NVM_DIR}/nvm.sh" && nvm install && nvm use && npm install -g yarn ; fi &&\
|
||||
cd portal-ui; yarn install --prefer-offline; make build-static; yarn prettier --write . --loglevel warn; cd ..)
|
||||
|
||||
test-integration:
|
||||
@(docker stop pgsqlcontainer || true)
|
||||
@(docker stop minio || true)
|
||||
@(docker stop minio2 || true)
|
||||
@(docker network rm mynet123 || true)
|
||||
@echo "create docker network to communicate containers MinIO & PostgreSQL"
|
||||
@(docker network create --subnet=173.18.0.0/29 mynet123)
|
||||
@echo "docker run with MinIO Version below:"
|
||||
@echo $(MINIO_VERSION)
|
||||
@(docker run -d --name minio --rm -p 9000:9000 $(MINIO_VERSION) server /data{1...4} && sleep 5)
|
||||
@(GO111MODULE=on go test -race -v github.com/minio/console/integration/...)
|
||||
@echo "MinIO 1"
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 --net=mynet123 -d --name minio --rm -p 9000:9000 -p 9091:9091 -e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= $(MINIO_VERSION) server /data{1...4} --console-address ':9091' && sleep 5)
|
||||
@echo "MinIO 2"
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 --net=mynet123 -d --name minio2 --rm -p 9001:9001 -p 9092:9092 -e MINIO_KMS_SECRET_KEY=my-minio-key:OSMM+vkKUTCvQs9YL/CVMIMt43HFhkUpqJxTmGl6rYw= $(MINIO_VERSION) server /data{1...4} --address ':9001' --console-address ':9092' && sleep 5)
|
||||
@echo "Postgres"
|
||||
@(docker run --net=mynet123 --ip=173.18.0.4 --name pgsqlcontainer --rm -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres && sleep 5)
|
||||
@echo "execute test and get coverage for test-integration:"
|
||||
@(cd integration && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && ./integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/system.out)
|
||||
@(docker stop pgsqlcontainer)
|
||||
@(docker stop minio)
|
||||
@(docker stop minio2)
|
||||
@(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 "run openldap container using MinIO Image: quay.io/minio/openldap:latest"
|
||||
@(docker run \
|
||||
-e LDAP_ORGANIZATION="MinIO Inc" \
|
||||
-e LDAP_DOMAIN="min.io" \
|
||||
-e LDAP_ADMIN_PASSWORD="admin" \
|
||||
--network my-net \
|
||||
-p 389:389 \
|
||||
-p 636:636 \
|
||||
--name openldap \
|
||||
--detach quay.io/minio/openldap:latest)
|
||||
@echo "Run Dex container using MinIO Image: quay.io/minio/dex:latest"
|
||||
@(docker run \
|
||||
-e DEX_ISSUER=http://dex:5556/dex \
|
||||
-e DEX_CLIENT_REDIRECT_URI=http://127.0.0.1:9090/oauth_callback \
|
||||
-e DEX_LDAP_SERVER=openldap:389 \
|
||||
--network my-net \
|
||||
-p 5556:5556 \
|
||||
--name dex \
|
||||
--detach quay.io/minio/dex:latest)
|
||||
@echo "running minio server"
|
||||
@(docker run \
|
||||
-v /data1 -v /data2 -v /data3 -v /data4 \
|
||||
--network my-net \
|
||||
-d \
|
||||
--name minio \
|
||||
--rm \
|
||||
-p 9000:9000 \
|
||||
-p 9001:9001 \
|
||||
-e MINIO_IDENTITY_OPENID_CLIENT_ID="minio-client-app" \
|
||||
-e MINIO_IDENTITY_OPENID_CLIENT_SECRET="minio-client-app-secret" \
|
||||
-e MINIO_IDENTITY_OPENID_CLAIM_NAME=name \
|
||||
-e MINIO_IDENTITY_OPENID_CONFIG_URL=http://dex:5556/dex/.well-known/openid-configuration \
|
||||
-e MINIO_IDENTITY_OPENID_REDIRECT_URI=http://127.0.0.1:9090/oauth_callback \
|
||||
-e MINIO_ROOT_USER=minio \
|
||||
-e MINIO_ROOT_PASSWORD=minio123 $(MINIO_VERSION) server /data{1...4} --address :9000 --console-address :9001)
|
||||
@echo "run mc commands to set the policy"
|
||||
@(docker run --name minio-client --network my-net -dit --entrypoint=/bin/sh minio/mc)
|
||||
@(docker exec minio-client mc alias set myminio/ http://minio:9000 minio minio123)
|
||||
@echo "adding policy to Dillon Harper to be able to login:"
|
||||
@(cd sso-integration && docker cp allaccess.json minio-client:/ && docker exec minio-client mc admin policy create myminio "Dillon Harper" allaccess.json)
|
||||
@echo "starting bash script"
|
||||
@(env bash $(PWD)/sso-integration/set-sso.sh)
|
||||
@echo "add python module"
|
||||
@(pip3 install bs4)
|
||||
@echo "Executing the test:"
|
||||
@(cd sso-integration && go test -coverpkg=../restapi -c -tags testrunmain . && mkdir -p coverage && ./sso-integration.test -test.v -test.run "^Test*" -test.coverprofile=coverage/sso-system.out)
|
||||
|
||||
test-permissions-1:
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-1/")
|
||||
@(docker stop minio)
|
||||
|
||||
test-permissions:
|
||||
@(docker run -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh)
|
||||
test-permissions-2:
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-2/")
|
||||
@(docker stop minio)
|
||||
|
||||
test-permissions-3:
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-3/")
|
||||
@(docker stop minio)
|
||||
|
||||
test-permissions-4:
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-4/")
|
||||
@(docker stop minio)
|
||||
|
||||
test-permissions-5:
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-5/")
|
||||
@(docker stop minio)
|
||||
|
||||
test-permissions-6:
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-6/")
|
||||
@(docker stop minio)
|
||||
|
||||
test-permissions-7:
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/permissions.sh "portal-ui/tests/permissions-7/")
|
||||
@(docker stop minio)
|
||||
|
||||
test-apply-permissions:
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/initialize-env.sh)
|
||||
|
||||
test-start-docker-minio:
|
||||
@(docker run -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
@(docker run -v /data1 -v /data2 -v /data3 -v /data4 -d --name minio --rm -p 9000:9000 quay.io/minio/minio:latest server /data{1...4})
|
||||
|
||||
initialize-permissions: test-start-docker-minio test-apply-permissions
|
||||
@echo "Done initializing permissions test"
|
||||
@@ -89,11 +230,38 @@ cleanup-permissions:
|
||||
@(env bash $(PWD)/portal-ui/tests/scripts/cleanup-env.sh)
|
||||
@(docker stop minio)
|
||||
|
||||
initialize-docker-network:
|
||||
@(docker network create test-network)
|
||||
|
||||
test-start-docker-minio-w-redirect-url: initialize-docker-network
|
||||
@(docker run \
|
||||
-e MINIO_BROWSER_REDIRECT_URL='http://localhost:8000/console/subpath/' \
|
||||
-e MINIO_SERVER_URL='http://localhost:9000' \
|
||||
-v /data1 -v /data2 -v /data3 -v /data4 \
|
||||
-d --network host --name minio --rm\
|
||||
quay.io/minio/minio:latest server /data{1...4})
|
||||
|
||||
test-start-docker-nginx-w-subpath:
|
||||
@(docker run \
|
||||
--network host \
|
||||
-d --rm \
|
||||
--add-host=host.docker.internal:host-gateway \
|
||||
-v ./portal-ui/tests/subpath-nginx/nginx.conf:/etc/nginx/nginx.conf \
|
||||
--name test-nginx nginx)
|
||||
|
||||
test-initialize-minio-nginx: test-start-docker-minio-w-redirect-url test-start-docker-nginx-w-subpath
|
||||
|
||||
cleanup-minio-nginx:
|
||||
@(docker stop minio test-nginx & docker network rm test-network)
|
||||
|
||||
test:
|
||||
@(GO111MODULE=on go test -race -v github.com/minio/console/restapi/...)
|
||||
@echo "execute test and get coverage"
|
||||
@(cd restapi && mkdir coverage && GO111MODULE=on go test -test.v -coverprofile=coverage/coverage.out)
|
||||
|
||||
|
||||
test-pkg:
|
||||
@(GO111MODULE=on go test -race -v github.com/minio/console/pkg/...)
|
||||
@echo "execute test and get coverage"
|
||||
@(cd pkg && mkdir coverage && GO111MODULE=on go test -test.v -coverprofile=coverage/coverage-pkg.out)
|
||||
|
||||
coverage:
|
||||
@(GO111MODULE=on go test -v -coverprofile=coverage.out github.com/minio/console/restapi/... && go tool cover -html=coverage.out && open coverage.html)
|
||||
@@ -105,4 +273,10 @@ clean:
|
||||
@rm -vf console
|
||||
|
||||
docker:
|
||||
@docker buildx build --output=type=docker --platform linux/amd64 -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' .
|
||||
@docker buildx build --output=type=docker --platform linux/amd64 -t $(TAG) --build-arg build_version=$(BUILD_VERSION) --build-arg build_time='$(BUILD_TIME)' --build-arg NODE_VERSION='$(NODE_VERSION)' .
|
||||
|
||||
release: swagger-gen
|
||||
@echo "Generating Release: $(RELEASE)"
|
||||
@make assets
|
||||
@git add -u .
|
||||
@git add portal-ui/build/
|
||||
|
||||
2
NOTICE
2
NOTICE
@@ -1,5 +1,5 @@
|
||||
This file is part of MinIO Console Server
|
||||
Copyright (c) 2021 MinIO, Inc.
|
||||
Copyright (c) 2023 MinIO, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
136
README.md
136
README.md
@@ -4,57 +4,38 @@
|
||||
|
||||
A graphical user interface for [MinIO](https://github.com/minio/minio)
|
||||
|
||||
| Dashboard | Creating a bucket |
|
||||
| ------------- | ------------- |
|
||||
|  |  |
|
||||
| Object Browser | Dashboard | Creating a bucket |
|
||||
|------------------------------------|-------------------------------|-------------------------------|
|
||||
|  |  |  |
|
||||
|
||||
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
|
||||
**Table of Contents**
|
||||
|
||||
- [MinIO Console](#minio-console)
|
||||
- [Install](#install)
|
||||
- [Binary Releases](#binary-releases)
|
||||
- [Docker](#docker)
|
||||
- [Build from source](#build-from-source)
|
||||
- [Setup](#setup)
|
||||
- [1. Create a user `console` using `mc`](#1-create-a-user-console-using-mc)
|
||||
- [2. Create a policy for `console` with admin access to all resources (for testing)](#2-create-a-policy-for-console-with-admin-access-to-all-resources-for-testing)
|
||||
- [3. Set the policy for the new `console` user](#3-set-the-policy-for-the-new-console-user)
|
||||
- [Start Console service:](#start-console-service)
|
||||
- [Start Console service with TLS:](#start-console-service-with-tls)
|
||||
- [Connect Console to a Minio using TLS and a self-signed certificate](#connect-console-to-a-minio-using-tls-and-a-self-signed-certificate)
|
||||
- [Install](#install)
|
||||
- [Build from source](#build-from-source)
|
||||
- [Setup](#setup)
|
||||
- [1. Create a user `console` using `mc`](#1-create-a-user-console-using-mc)
|
||||
- [2. Create a policy for `console` with admin access to all resources (for testing)](#2-create-a-policy-for-console-with-admin-access-to-all-resources-for-testing)
|
||||
- [3. Set the policy for the new `console` user](#3-set-the-policy-for-the-new-console-user)
|
||||
- [Start Console service:](#start-console-service)
|
||||
- [Start Console service with TLS:](#start-console-service-with-tls)
|
||||
- [Connect Console to a Minio using TLS and a self-signed certificate](#connect-console-to-a-minio-using-tls-and-a-self-signed-certificate)
|
||||
- [Contribute to console Project](#contribute-to-console-project)
|
||||
|
||||
<!-- markdown-toc end -->
|
||||
|
||||
## Install
|
||||
|
||||
### Binary Releases
|
||||
MinIO Console is a library that provides a management and browser UI overlay for the MinIO Server.
|
||||
The standalone binary installation path has been removed.
|
||||
|
||||
| OS | ARCH | Binary |
|
||||
|:-------:|:-------:|:----------------------------------------------------------------------------------------------------:|
|
||||
| Linux | amd64 | [linux-amd64](https://github.com/minio/console/releases/latest/download/console-linux-amd64) |
|
||||
| Linux | arm64 | [linux-arm64](https://github.com/minio/console/releases/latest/download/console-linux-arm64) |
|
||||
| Linux | ppc64le | [linux-ppc64le](https://github.com/minio/console/releases/latest/download/console-linux-ppc64le) |
|
||||
| Linux | s390x | [linux-s390x](https://github.com/minio/console/releases/latest/download/console-linux-s390x) |
|
||||
| Apple | amd64 | [darwin-amd64](https://github.com/minio/console/releases/latest/download/console-darwin-amd64) |
|
||||
| Windows | amd64 | [windows-amd64](https://github.com/minio/console/releases/latest/download/console-windows-amd64.exe) |
|
||||
|
||||
You can also verify the binary with [minisign](https://jedisct1.github.io/minisign/) by downloading the corresponding [`.minisig`](https://github.com/minio/console/releases/latest) signature file. Then run:
|
||||
```
|
||||
minisign -Vm console-<OS>-<ARCH> -P RWTx5Zr1tiHQLwG9keckT0c45M3AGeHD6IvimQHpyRywVWGbP1aVSGav
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
Pull the latest release via:
|
||||
```
|
||||
docker pull minio/console
|
||||
```
|
||||
In case a Console standalone binary is needed, it can be generated by building this package from source as follows:
|
||||
|
||||
### Build from source
|
||||
|
||||
> You will need a working Go environment. Therefore, please follow [How to install Go](https://golang.org/doc/install).
|
||||
> Minimum version required is go1.17
|
||||
> Minimum version required is go1.19
|
||||
|
||||
```
|
||||
go install github.com/minio/console/cmd/console@latest
|
||||
@@ -103,60 +84,64 @@ EOF
|
||||
```
|
||||
|
||||
```sh
|
||||
mc admin policy add myminio/ consoleAdmin admin.json
|
||||
mc admin policy create myminio/ consoleAdmin admin.json
|
||||
```
|
||||
|
||||
### 3. Set the policy for the new `console` user
|
||||
|
||||
```sh
|
||||
mc admin policy set myminio consoleAdmin user=console
|
||||
mc admin policy attach myminio consoleAdmin --user=console
|
||||
```
|
||||
|
||||
> NOTE: Additionally, you can create policies to limit the privileges for other `console` users, for example, if you want the user to only have access to dashboard, buckets, notifications and watch page, the policy should look like this:
|
||||
> NOTE: Additionally, you can create policies to limit the privileges for other `console` users, for example, if you
|
||||
> want the user to only have access to dashboard, buckets, notifications and watch page, the policy should look like
|
||||
> this:
|
||||
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [{
|
||||
"Action": [
|
||||
"admin:ServerInfo"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Sid": ""
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"s3:ListenBucketNotification",
|
||||
"s3:PutBucketNotification",
|
||||
"s3:GetBucketNotification",
|
||||
"s3:ListMultipartUploadParts",
|
||||
"s3:ListBucketMultipartUploads",
|
||||
"s3:ListBucket",
|
||||
"s3:HeadBucket",
|
||||
"s3:GetObject",
|
||||
"s3:GetBucketLocation",
|
||||
"s3:AbortMultipartUpload",
|
||||
"s3:CreateBucket",
|
||||
"s3:PutObject",
|
||||
"s3:DeleteObject",
|
||||
"s3:DeleteBucket",
|
||||
"s3:PutBucketPolicy",
|
||||
"s3:DeleteBucketPolicy",
|
||||
"s3:GetBucketPolicy"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"arn:aws:s3:::*"
|
||||
],
|
||||
"Sid": ""
|
||||
}
|
||||
]
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Action": [
|
||||
"admin:ServerInfo"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Sid": ""
|
||||
},
|
||||
{
|
||||
"Action": [
|
||||
"s3:ListenBucketNotification",
|
||||
"s3:PutBucketNotification",
|
||||
"s3:GetBucketNotification",
|
||||
"s3:ListMultipartUploadParts",
|
||||
"s3:ListBucketMultipartUploads",
|
||||
"s3:ListBucket",
|
||||
"s3:HeadBucket",
|
||||
"s3:GetObject",
|
||||
"s3:GetBucketLocation",
|
||||
"s3:AbortMultipartUpload",
|
||||
"s3:CreateBucket",
|
||||
"s3:PutObject",
|
||||
"s3:DeleteObject",
|
||||
"s3:DeleteBucket",
|
||||
"s3:PutBucketPolicy",
|
||||
"s3:DeleteBucketPolicy",
|
||||
"s3:GetBucketPolicy"
|
||||
],
|
||||
"Effect": "Allow",
|
||||
"Resource": [
|
||||
"arn:aws:s3:::*"
|
||||
],
|
||||
"Sid": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Start Console service:
|
||||
|
||||
Before running console service, following environment settings must be supplied
|
||||
|
||||
```sh
|
||||
# Salt to encrypt JWT payload
|
||||
export CONSOLE_PBKDF_PASSPHRASE=SECRET
|
||||
@@ -169,6 +154,7 @@ export CONSOLE_MINIO_SERVER=http://localhost:9000
|
||||
```
|
||||
|
||||
Now start the console service.
|
||||
|
||||
```
|
||||
./console server
|
||||
2021-01-19 02:36:08.893735 I | 2021/01/19 02:36:08 server.go:129: Serving console at http://localhost:9090
|
||||
@@ -189,6 +175,7 @@ Copy your `public.crt` and `private.key` to `~/.console/certs`, then:
|
||||
For advanced users, `console` has support for multiple certificates to service clients through multiple domains.
|
||||
|
||||
Following tree structure is expected for supporting multiple domains:
|
||||
|
||||
```sh
|
||||
certs/
|
||||
│
|
||||
@@ -219,4 +206,5 @@ export CONSOLE_MINIO_SERVER=https://localhost:9000
|
||||
You can verify that the apis work by doing the request on `localhost:9090/api/v1/...`
|
||||
|
||||
# Contribute to console Project
|
||||
|
||||
Please follow console [Contributor's Guide](https://github.com/minio/console/blob/master/CONTRIBUTING.md)
|
||||
|
||||
@@ -18,9 +18,10 @@ you need access credentials for a successful exploit).
|
||||
|
||||
If you have not received a reply to your email within 48 hours or you have not heard from the security team
|
||||
for the past five days please contact the security team directly:
|
||||
- Primary security coordinator: lenin@min.io
|
||||
- Secondary coordinator: security@min.io
|
||||
- If you receive no response: dev@min.io
|
||||
|
||||
- Primary security coordinator: daniel@min.io
|
||||
- Secondary coordinator: security@min.io
|
||||
- If you receive no response: dev@min.io
|
||||
|
||||
### Disclosure Process
|
||||
|
||||
|
||||
@@ -1,71 +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 cluster
|
||||
|
||||
import (
|
||||
direct "github.com/minio/direct-csi/pkg/clientset"
|
||||
operator "github.com/minio/operator/pkg/client/clientset/versioned"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/rest"
|
||||
certutil "k8s.io/client-go/util/cert"
|
||||
)
|
||||
|
||||
// getTLSClientConfig will return the right TLS configuration for the K8S client based on the configured TLS certificate
|
||||
func getTLSClientConfig() rest.TLSClientConfig {
|
||||
var defaultRootCAFile = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
|
||||
var customRootCAFile = getK8sAPIServerTLSRootCA()
|
||||
tlsClientConfig := rest.TLSClientConfig{}
|
||||
// if console is running inside k8s by default he will have access to the CA Cert from the k8s local authority
|
||||
if _, err := certutil.NewPool(defaultRootCAFile); err == nil {
|
||||
tlsClientConfig.CAFile = defaultRootCAFile
|
||||
}
|
||||
// if the user explicitly define a custom CA certificate, instead, we will use that
|
||||
if customRootCAFile != "" {
|
||||
if _, err := certutil.NewPool(customRootCAFile); err == nil {
|
||||
tlsClientConfig.CAFile = customRootCAFile
|
||||
}
|
||||
}
|
||||
return tlsClientConfig
|
||||
}
|
||||
|
||||
// This operation will run only once at console startup
|
||||
var tlsClientConfig = getTLSClientConfig()
|
||||
|
||||
func GetK8sConfig(token string) *rest.Config {
|
||||
config := &rest.Config{
|
||||
Host: GetK8sAPIServer(),
|
||||
TLSClientConfig: tlsClientConfig,
|
||||
APIPath: "/",
|
||||
BearerToken: token,
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
||||
// OperatorClient returns an operator client using GetK8sConfig for its config
|
||||
func OperatorClient(token string) (*operator.Clientset, error) {
|
||||
return operator.NewForConfig(GetK8sConfig(token))
|
||||
}
|
||||
|
||||
// K8sClient returns kubernetes client using GetK8sConfig for its config
|
||||
func K8sClient(token string) (*kubernetes.Clientset, error) {
|
||||
return kubernetes.NewForConfig(GetK8sConfig(token))
|
||||
}
|
||||
|
||||
// DirectCSIClient returns Direct CSI client using GetK8sConfig for its config
|
||||
func DirectCSIClient(token string) (*direct.Clientset, error) {
|
||||
return direct.NewForConfig(GetK8sConfig(token))
|
||||
}
|
||||
@@ -1,121 +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 cluster
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/minio/pkg/env"
|
||||
)
|
||||
|
||||
var (
|
||||
errCantDetermineMinIOImage = errors.New("can't determine MinIO Image")
|
||||
)
|
||||
|
||||
func GetK8sAPIServer() string {
|
||||
// if console is running inside a k8s pod KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT will contain the k8s api server apiServerAddress
|
||||
// if console is not running inside k8s by default will look for the k8s api server on localhost:8001 (kubectl proxy)
|
||||
// NOTE: using kubectl proxy is for local development only, since every request send to localhost:8001 will bypass service account authentication
|
||||
// more info here: https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#directly-accessing-the-rest-api
|
||||
// you can override this using CONSOLE_K8S_API_SERVER, ie use the k8s cluster from `kubectl config view`
|
||||
host, port := env.Get("KUBERNETES_SERVICE_HOST", ""), env.Get("KUBERNETES_SERVICE_PORT", "")
|
||||
apiServerAddress := "http://localhost:8001"
|
||||
if host != "" && port != "" {
|
||||
apiServerAddress = "https://" + net.JoinHostPort(host, port)
|
||||
}
|
||||
return env.Get(ConsoleK8sAPIServer, apiServerAddress)
|
||||
}
|
||||
|
||||
// If CONSOLE_K8S_API_SERVER_TLS_ROOT_CA is true console will load the certificate into the
|
||||
// http.client rootCAs pool, this is useful for testing an k8s ApiServer or when working with self-signed certificates
|
||||
func getK8sAPIServerTLSRootCA() string {
|
||||
return strings.TrimSpace(env.Get(ConsoleK8SAPIServerTLSRootCA, ""))
|
||||
}
|
||||
|
||||
// GetNsFromFile assumes console is running inside a k8s pod and extract the current namespace from the
|
||||
// /var/run/secrets/kubernetes.io/serviceaccount/namespace file
|
||||
func GetNsFromFile() string {
|
||||
dat, err := ioutil.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/namespace")
|
||||
if err != nil {
|
||||
return "default"
|
||||
}
|
||||
return string(dat)
|
||||
}
|
||||
|
||||
// Namespace will run only once at console startup
|
||||
var Namespace = GetNsFromFile()
|
||||
|
||||
// getLatestMinIOImage returns the latest docker image for MinIO if found on the internet
|
||||
func getLatestMinIOImage(client HTTPClientI) (*string, error) {
|
||||
resp, err := client.Get("https://dl.min.io/server/minio/release/linux-amd64/")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var re = regexp.MustCompile(`(?m)\.\/minio\.(RELEASE.*?Z)"`)
|
||||
// look for a single match
|
||||
matches := re.FindAllStringSubmatch(string(body), 1)
|
||||
for i := range matches {
|
||||
release := matches[i][1]
|
||||
dockerImage := fmt.Sprintf("minio/minio:%s", release)
|
||||
return &dockerImage, nil
|
||||
}
|
||||
return nil, errCantDetermineMinIOImage
|
||||
}
|
||||
|
||||
var latestMinIOImage, errLatestMinIOImage = getLatestMinIOImage(
|
||||
&HTTPClient{
|
||||
Client: &http.Client{
|
||||
Timeout: 15 * time.Second,
|
||||
},
|
||||
})
|
||||
|
||||
// GetMinioImage returns the image URL to be used when deploying a MinIO instance, if there is
|
||||
// a preferred image to be used (configured via ENVIRONMENT VARIABLES) GetMinioImage will return that
|
||||
// if not, GetMinioImage will try to obtain the image URL for the latest version of MinIO and return that
|
||||
func GetMinioImage() (*string, error) {
|
||||
image := strings.TrimSpace(env.Get(ConsoleMinioImage, ""))
|
||||
// if there is a preferred image configured by the user we'll always return that
|
||||
if image != "" {
|
||||
return &image, nil
|
||||
}
|
||||
if errLatestMinIOImage != nil {
|
||||
return nil, errLatestMinIOImage
|
||||
}
|
||||
return latestMinIOImage, nil
|
||||
}
|
||||
|
||||
// GetLatestMinioImage returns the latest image URL on minio repository
|
||||
func GetLatestMinioImage(client HTTPClientI) (*string, error) {
|
||||
latestMinIOImage, err := getLatestMinIOImage(client)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return latestMinIOImage, nil
|
||||
}
|
||||
@@ -1,24 +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 cluster
|
||||
|
||||
const (
|
||||
ConsoleK8sAPIServer = "CONSOLE_K8S_API_SERVER"
|
||||
ConsoleK8SAPIServerTLSRootCA = "CONSOLE_K8S_API_SERVER_TLS_ROOT_CA"
|
||||
ConsoleMinioImage = "CONSOLE_MINIO_IMAGE"
|
||||
ConsoleMCImage = "CONSOLE_MC_IMAGE"
|
||||
)
|
||||
@@ -1,53 +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 cluster
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// HTTPClientI interface with all functions to be implemented
|
||||
// by mock when testing, it should include all HttpClient respective api calls
|
||||
// that are used within this project.
|
||||
type HTTPClientI interface {
|
||||
Get(url string) (resp *http.Response, err error)
|
||||
Post(url, contentType string, body io.Reader) (resp *http.Response, err error)
|
||||
Do(req *http.Request) (*http.Response, error)
|
||||
}
|
||||
|
||||
// HTTPClient Interface implementation
|
||||
//
|
||||
// Define the structure of a http client and define the functions that are actually used
|
||||
type HTTPClient struct {
|
||||
Client *http.Client
|
||||
}
|
||||
|
||||
// Get implements http.Client.Get()
|
||||
func (c *HTTPClient) Get(url string) (resp *http.Response, err error) {
|
||||
return c.Client.Get(url)
|
||||
}
|
||||
|
||||
// Post implements http.Client.Post()
|
||||
func (c *HTTPClient) Post(url, contentType string, body io.Reader) (resp *http.Response, err error) {
|
||||
return c.Client.Post(url, contentType, body)
|
||||
}
|
||||
|
||||
// Do implement http.Client.Do()
|
||||
func (c *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
||||
return c.Client.Do(req)
|
||||
}
|
||||
@@ -1,6 +1,3 @@
|
||||
//go:build operator
|
||||
// +build operator
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
@@ -20,10 +17,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/minio/console/pkg/logger"
|
||||
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/console/restapi"
|
||||
)
|
||||
@@ -31,20 +31,27 @@ import (
|
||||
var appCmds = []cli.Command{
|
||||
serverCmd,
|
||||
updateCmd,
|
||||
operatorCmd,
|
||||
}
|
||||
|
||||
// StartServer starts the console service
|
||||
func StartServer(ctx *cli.Context) error {
|
||||
if os.Getenv("CONSOLE_OPERATOR_MODE") != "" && os.Getenv("CONSOLE_OPERATOR_MODE") == "on" {
|
||||
return startOperatorServer(ctx)
|
||||
}
|
||||
|
||||
if err := loadAllCerts(ctx); err != nil {
|
||||
// Log this as a warning and continue running console without TLS certificates
|
||||
restapi.LogError("Unable to load certs: %v", err)
|
||||
}
|
||||
|
||||
xctx := context.Background()
|
||||
|
||||
transport := restapi.PrepareSTSClientTransport(false, restapi.LocalAddress)
|
||||
if err := logger.InitializeLogger(xctx, transport.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)
|
||||
|
||||
@@ -1,77 +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/>.
|
||||
|
||||
//go:build !operator
|
||||
// +build !operator
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/console/restapi"
|
||||
)
|
||||
|
||||
var appCmds = []cli.Command{
|
||||
serverCmd,
|
||||
updateCmd,
|
||||
}
|
||||
|
||||
// StartServer starts the console service
|
||||
func StartServer(ctx *cli.Context) error {
|
||||
if err := loadAllCerts(ctx); err != nil {
|
||||
// Log this as a warning and continue running console without TLS certificates
|
||||
restapi.LogError("Unable to load certs: %v", err)
|
||||
}
|
||||
|
||||
var rctx restapi.Context
|
||||
if err := rctx.Load(ctx); err != nil {
|
||||
restapi.LogError("argument validation failed: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server, err := buildServer()
|
||||
if err != nil {
|
||||
restapi.LogError("Unable to initialize console server: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server.Host = rctx.Host
|
||||
server.Port = rctx.HTTPPort
|
||||
// set conservative timesout for uploads
|
||||
server.ReadTimeout = 1 * time.Hour
|
||||
// no timeouts for response for downloads
|
||||
server.WriteTimeout = 0
|
||||
restapi.Port = strconv.Itoa(server.Port)
|
||||
restapi.Hostname = server.Host
|
||||
|
||||
if len(restapi.GlobalPublicCerts) > 0 {
|
||||
// If TLS certificates are provided enforce the HTTPS schema, meaning console will redirect
|
||||
// plain HTTP connections to HTTPS server
|
||||
server.EnabledListeners = []string{"http", "https"}
|
||||
server.TLSPort = rctx.HTTPSPort
|
||||
// Need to store tls-port, tls-host un config variables so secure.middleware can read from there
|
||||
restapi.TLSPort = strconv.Itoa(server.TLSPort)
|
||||
restapi.Hostname = rctx.Host
|
||||
restapi.TLSRedirect = rctx.TLSRedirect
|
||||
}
|
||||
|
||||
defer server.Shutdown()
|
||||
|
||||
return server.Serve()
|
||||
}
|
||||
@@ -25,29 +25,29 @@ import (
|
||||
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/console/pkg"
|
||||
"github.com/minio/pkg/console"
|
||||
"github.com/minio/pkg/trie"
|
||||
"github.com/minio/pkg/words"
|
||||
"github.com/minio/pkg/v2/console"
|
||||
"github.com/minio/pkg/v2/trie"
|
||||
"github.com/minio/pkg/v2/words"
|
||||
)
|
||||
|
||||
// Help template for Console.
|
||||
var consoleHelpTemplate = `NAME:
|
||||
{{.Name}} - {{.Usage}}
|
||||
{{.Name}} - {{.Usage}}
|
||||
|
||||
DESCRIPTION:
|
||||
{{.Description}}
|
||||
{{.Description}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} {{if .VisibleFlags}}[FLAGS] {{end}}COMMAND{{if .VisibleFlags}}{{end}} [ARGS...]
|
||||
{{.HelpName}} {{if .VisibleFlags}}[FLAGS] {{end}}COMMAND{{if .VisibleFlags}}{{end}} [ARGS...]
|
||||
|
||||
COMMANDS:
|
||||
{{range .VisibleCommands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
|
||||
{{end}}{{if .VisibleFlags}}
|
||||
{{range .VisibleCommands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
|
||||
{{end}}{{if .VisibleFlags}}
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}{{end}}
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}{{end}}
|
||||
VERSION:
|
||||
{{.Version}}
|
||||
{{.Version}}
|
||||
`
|
||||
|
||||
func newApp(name string) *cli.App {
|
||||
|
||||
@@ -1,229 +0,0 @@
|
||||
//go:build operator
|
||||
// +build operator
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/minio/console/restapi"
|
||||
|
||||
"github.com/go-openapi/loads"
|
||||
"github.com/jessevdk/go-flags"
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/console/operatorapi"
|
||||
"github.com/minio/console/operatorapi/operations"
|
||||
"github.com/minio/console/pkg/certs"
|
||||
)
|
||||
|
||||
// starts the server
|
||||
var operatorCmd = cli.Command{
|
||||
Name: "operator",
|
||||
Aliases: []string{"opr"},
|
||||
Usage: "Start MinIO Operator UI server",
|
||||
Action: startOperatorServer,
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "host",
|
||||
Value: restapi.GetHostname(),
|
||||
Usage: "bind to a specific HOST, HOST can be an IP or hostname",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "port",
|
||||
Value: restapi.GetPort(),
|
||||
Usage: "bind to specific HTTP port",
|
||||
},
|
||||
// This is kept here for backward compatibility,
|
||||
// hostname's do not have HTTP or HTTPs
|
||||
// hostnames are opaque so using --host
|
||||
// works for both HTTP and HTTPS setup.
|
||||
cli.StringFlag{
|
||||
Name: "tls-host",
|
||||
Value: restapi.GetHostname(),
|
||||
Hidden: true,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "certs-dir",
|
||||
Value: certs.GlobalCertsCADir.Get(),
|
||||
Usage: "path to certs directory",
|
||||
},
|
||||
cli.IntFlag{
|
||||
Name: "tls-port",
|
||||
Value: restapi.GetTLSPort(),
|
||||
Usage: "bind to specific HTTPS port",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tls-redirect",
|
||||
Value: restapi.GetTLSRedirect(),
|
||||
Usage: "toggle HTTP->HTTPS redirect",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tls-certificate",
|
||||
Value: "",
|
||||
Usage: "path to TLS public certificate",
|
||||
Hidden: true,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tls-key",
|
||||
Value: "",
|
||||
Usage: "path to TLS private key",
|
||||
Hidden: true,
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tls-ca",
|
||||
Value: "",
|
||||
Usage: "path to TLS Certificate Authority",
|
||||
Hidden: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func buildOperatorServer() (*operatorapi.Server, error) {
|
||||
swaggerSpec, err := loads.Embedded(operatorapi.SwaggerJSON, operatorapi.FlatSwaggerJSON)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
api := operations.NewOperatorAPI(swaggerSpec)
|
||||
api.Logger = operatorapi.LogInfo
|
||||
server := operatorapi.NewServer(api)
|
||||
|
||||
parser := flags.NewParser(server, flags.Default)
|
||||
parser.ShortDescription = "MinIO Console Server"
|
||||
parser.LongDescription = swaggerSpec.Spec().Info.Description
|
||||
|
||||
server.ConfigureFlags()
|
||||
|
||||
// register all APIs
|
||||
server.ConfigureAPI()
|
||||
|
||||
for _, optsGroup := range api.CommandLineOptionsGroups {
|
||||
_, err := parser.AddGroup(optsGroup.ShortDescription, optsGroup.LongDescription, optsGroup.Options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if _, err := parser.Parse(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return server, nil
|
||||
}
|
||||
|
||||
func loadOperatorAllCerts(ctx *cli.Context) error {
|
||||
var err error
|
||||
// Set all certs and CAs directories path
|
||||
certs.GlobalCertsDir, _, err = certs.NewConfigDirFromCtx(ctx, "certs-dir", certs.DefaultCertsDir.Get)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
certs.GlobalCertsCADir = &certs.ConfigDir{Path: filepath.Join(certs.GlobalCertsDir.Get(), certs.CertsCADir)}
|
||||
// check if certs and CAs directories exists or can be created
|
||||
if err = certs.MkdirAllIgnorePerm(certs.GlobalCertsCADir.Get()); err != nil {
|
||||
return fmt.Errorf("unable to create certs CA directory at %s: failed with %w", certs.GlobalCertsCADir.Get(), err)
|
||||
}
|
||||
|
||||
// load the certificates and the CAs
|
||||
operatorapi.GlobalRootCAs, operatorapi.GlobalPublicCerts, operatorapi.GlobalTLSCertsManager, err = certs.GetAllCertificatesAndCAs()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to load certificates at %s: failed with %w", certs.GlobalCertsDir.Get(), err)
|
||||
}
|
||||
|
||||
{
|
||||
// TLS flags from swagger server, used to support VMware vsphere operator version.
|
||||
swaggerServerCertificate := ctx.String("tls-certificate")
|
||||
swaggerServerCertificateKey := ctx.String("tls-key")
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
x509Certs, err := certs.ParsePublicCertFile(swaggerServerCertificate)
|
||||
if err == nil {
|
||||
operatorapi.GlobalPublicCerts = append(operatorapi.GlobalPublicCerts, x509Certs...)
|
||||
}
|
||||
}
|
||||
|
||||
// load ca cert from swagger server tls-ca flag
|
||||
if swaggerServerCACertificate != "" {
|
||||
caCert, caCertErr := ioutil.ReadFile(swaggerServerCACertificate)
|
||||
if caCertErr == nil {
|
||||
operatorapi.GlobalRootCAs.AppendCertsFromPEM(caCert)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if restapi.GlobalTLSCertsManager != nil {
|
||||
restapi.GlobalTLSCertsManager.ReloadOnSignal(syscall.SIGHUP)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// StartServer starts the console service
|
||||
func startOperatorServer(ctx *cli.Context) error {
|
||||
if err := loadOperatorAllCerts(ctx); err != nil {
|
||||
// Log this as a warning and continue running console without TLS certificates
|
||||
operatorapi.LogError("Unable to load certs: %v", err)
|
||||
}
|
||||
|
||||
var rctx operatorapi.Context
|
||||
if err := rctx.Load(ctx); err != nil {
|
||||
operatorapi.LogError("argument validation failed: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server, err := buildOperatorServer()
|
||||
if err != nil {
|
||||
operatorapi.LogError("Unable to initialize console server: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
server.Host = rctx.Host
|
||||
server.Port = rctx.HTTPPort
|
||||
// set conservative timesout for uploads
|
||||
server.ReadTimeout = 1 * time.Hour
|
||||
// no timeouts for response for downloads
|
||||
server.WriteTimeout = 0
|
||||
operatorapi.Port = strconv.Itoa(server.Port)
|
||||
operatorapi.Hostname = server.Host
|
||||
|
||||
if len(operatorapi.GlobalPublicCerts) > 0 {
|
||||
// If TLS certificates are provided enforce the HTTPS schema, meaning console will redirect
|
||||
// plain HTTP connections to HTTPS server
|
||||
server.EnabledListeners = []string{"http", "https"}
|
||||
server.TLSPort = rctx.HTTPSPort
|
||||
// Need to store tls-port, tls-host un config variables so secure.middleware can read from there
|
||||
operatorapi.TLSPort = strconv.Itoa(server.TLSPort)
|
||||
operatorapi.Hostname = rctx.Host
|
||||
operatorapi.TLSRedirect = rctx.TLSRedirect
|
||||
}
|
||||
|
||||
defer server.Shutdown()
|
||||
|
||||
return server.Serve()
|
||||
}
|
||||
@@ -18,7 +18,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
|
||||
@@ -163,7 +163,7 @@ func loadAllCerts(ctx *cli.Context) error {
|
||||
|
||||
// load ca cert from swagger server tls-ca flag
|
||||
if swaggerServerCACertificate != "" {
|
||||
caCert, caCertErr := ioutil.ReadFile(swaggerServerCACertificate)
|
||||
caCert, caCertErr := os.ReadFile(swaggerServerCACertificate)
|
||||
if caCertErr == nil {
|
||||
restapi.GlobalRootCAs.AppendCertsFromPEM(caCert)
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ var updateCmd = cli.Command{
|
||||
Action: updateInplace,
|
||||
}
|
||||
|
||||
func updateInplace(ctx *cli.Context) error {
|
||||
func updateInplace(_ *cli.Context) error {
|
||||
transport := getUpdateTransport(30 * time.Second)
|
||||
rel, err := getLatestRelease(transport)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
# Running Console in Operator mode
|
||||
|
||||
`Console` will authenticate against `Kubernetes`using bearer tokens via HTTP `Authorization` header. The user will provide this token once
|
||||
in the login form, Console will validate it against Kubernetes (list apis) and if valid will generate and return a new Console sessions
|
||||
with encrypted claims (the user Service account token will be inside the session encrypted token
|
||||
|
||||
# Kubernetes
|
||||
|
||||
The provided `JWT token` corresponds to the `Kubernetes service account` that `Console` will use to run tasks on behalf of the
|
||||
user, ie: list, create, edit, delete tenants, storage class, etc.
|
||||
|
||||
|
||||
# Development
|
||||
|
||||
If console is running inside a k8s pod `KUBERNETES_SERVICE_HOST` and `KUBERNETES_SERVICE_PORT` will contain the k8s api server apiServerAddress
|
||||
if console is not running inside k8s by default will look for the k8s api server on `localhost:8001` (kubectl proxy)
|
||||
|
||||
If you are running console in your local environment and wish to make request to `Kubernetes` you can set `CONSOLE_K8S_API_SERVER`, if
|
||||
the environment variable is not present by default `Console` will use `"http://localhost:8001"`, additionally you will need to set the
|
||||
`CONSOLE_OPERATOR_MODE=on` variable to make Console display the Operator UI.
|
||||
|
||||
NOTE: using `kubectl` proxy is for local development only, since every request send to localhost:8001 will bypass service account authentication
|
||||
more info here: https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#directly-accessing-the-rest-api
|
||||
you can override this using `CONSOLE_K8S_API_SERVER`, ie use the k8s cluster from `kubectl config view`
|
||||
|
||||
## Extract the Service account token and use it with Console
|
||||
|
||||
For local development you can use the jwt associated to the `console-sa` service account, you can get the token running
|
||||
the following command in your terminal:
|
||||
|
||||
```
|
||||
kubectl get secret $(kubectl get serviceaccount console-sa -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}" | base64 --decode
|
||||
```
|
||||
|
||||
Then run the Console server
|
||||
|
||||
```
|
||||
CONSOLE_OPERATOR_MODE=on ./console server
|
||||
```
|
||||
290
go.mod
290
go.mod
@@ -1,155 +1,159 @@
|
||||
module github.com/minio/console
|
||||
|
||||
go 1.17
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/blang/semver/v4 v4.0.0
|
||||
github.com/cheggaaa/pb/v3 v3.0.6
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/go-openapi/errors v0.20.1
|
||||
github.com/go-openapi/loads v0.21.0
|
||||
github.com/go-openapi/runtime v0.21.0
|
||||
github.com/go-openapi/spec v0.20.4
|
||||
github.com/go-openapi/strfmt v0.21.1
|
||||
github.com/go-openapi/swag v0.19.15
|
||||
github.com/go-openapi/validate v0.20.3
|
||||
github.com/golang-jwt/jwt/v4 v4.1.0
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/jessevdk/go-flags v1.4.0
|
||||
github.com/klauspost/compress v1.13.6
|
||||
github.com/minio/cli v1.22.0
|
||||
github.com/minio/direct-csi v1.3.5-0.20210601185811-f7776f7961bf
|
||||
github.com/minio/kes v0.11.0
|
||||
github.com/minio/madmin-go v1.1.23
|
||||
github.com/minio/mc v0.0.0-20211207230606-23a05f5a17f2
|
||||
github.com/minio/minio-go/v7 v7.0.21
|
||||
github.com/minio/operator v0.0.0-20220110040724-a5d59a342b7f
|
||||
github.com/minio/pkg v1.1.14
|
||||
github.com/minio/selfupdate v0.4.0
|
||||
github.com/cheggaaa/pb/v3 v3.1.4
|
||||
github.com/dustin/go-humanize v1.0.1
|
||||
github.com/fatih/color v1.15.0
|
||||
github.com/go-openapi/errors v0.20.4
|
||||
github.com/go-openapi/loads v0.21.2
|
||||
github.com/go-openapi/runtime v0.26.0
|
||||
github.com/go-openapi/spec v0.20.9
|
||||
github.com/go-openapi/strfmt v0.21.7
|
||||
github.com/go-openapi/swag v0.22.4
|
||||
github.com/go-openapi/validate v0.22.1
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0
|
||||
github.com/google/uuid v1.3.1
|
||||
github.com/jessevdk/go-flags v1.5.0
|
||||
github.com/klauspost/compress v1.16.7
|
||||
github.com/minio/cli v1.24.2
|
||||
github.com/minio/highwayhash v1.0.2
|
||||
github.com/minio/kes v0.22.3
|
||||
github.com/minio/madmin-go/v3 v3.0.29
|
||||
github.com/minio/mc v0.0.0-20231030184332-9f2fb2b6a9f8
|
||||
github.com/minio/minio-go/v7 v7.0.64-0.20230920204636-e783c9ba11b3
|
||||
github.com/minio/selfupdate v0.6.0
|
||||
github.com/minio/websocket v1.6.0
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/rs/xid v1.3.0
|
||||
github.com/rs/xid v1.5.0
|
||||
github.com/secure-io/sio-go v0.3.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/tidwall/gjson v1.10.2
|
||||
github.com/unrolled/secure v1.0.9
|
||||
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2
|
||||
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
k8s.io/api v0.21.1
|
||||
k8s.io/apimachinery v0.21.1
|
||||
k8s.io/client-go v0.21.1
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/tidwall/gjson v1.16.0
|
||||
github.com/unrolled/secure v1.13.0
|
||||
golang.org/x/crypto v0.16.0
|
||||
golang.org/x/net v0.17.0
|
||||
golang.org/x/oauth2 v0.12.0
|
||||
// Added to include security fix for
|
||||
// https://github.com/golang/go/issues/56152
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||
github.com/StackExchange/wmi v1.2.1 // indirect
|
||||
github.com/VividCortex/ewma v1.1.1 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/briandowns/spinner v1.16.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/cheggaaa/pb v1.0.29 // indirect
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0 // indirect
|
||||
github.com/docker/go-units v0.4.0 // indirect
|
||||
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
|
||||
github.com/evanphx/json-patch v4.9.0+incompatible // indirect
|
||||
github.com/fatih/color v1.13.0 // indirect
|
||||
github.com/fatih/structs v1.1.0 // indirect
|
||||
github.com/go-logr/logr v0.4.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/go-openapi/analysis v0.20.1 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.19.6 // indirect
|
||||
github.com/go-stack/stack v1.8.0 // indirect
|
||||
github.com/goccy/go-json v0.7.9 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/google/go-cmp v0.5.5 // indirect
|
||||
github.com/google/gofuzz v1.1.0 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/googleapis/gnostic v0.5.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/golang-lru v0.5.4 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
|
||||
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
|
||||
github.com/lestrrat-go/blackmagic v1.0.0 // indirect
|
||||
github.com/lestrrat-go/httpcc v1.0.0 // indirect
|
||||
github.com/lestrrat-go/iter v1.0.1 // indirect
|
||||
github.com/lestrrat-go/jwx v1.2.7 // indirect
|
||||
github.com/lestrrat-go/option v1.0.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.6 // indirect
|
||||
github.com/mattn/go-colorable v0.1.10 // indirect
|
||||
github.com/mattn/go-ieproxy v0.0.1 // indirect
|
||||
github.com/mattn/go-isatty v0.0.14 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.13 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
|
||||
github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4 // indirect
|
||||
github.com/minio/argon2 v1.0.0 // indirect
|
||||
github.com/minio/colorjson v1.0.1 // 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
|
||||
github.com/mitchellh/mapstructure v1.4.1 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/nxadm/tail v1.4.8 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/philhofer/fwd v1.1.1 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pkg/profile v1.6.0 // indirect
|
||||
github.com/pkg/xattr v0.4.3 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/posener/complete v1.2.3 // indirect
|
||||
github.com/prometheus/client_golang v1.11.0 // indirect
|
||||
github.com/prometheus/client_model v0.2.0 // indirect
|
||||
github.com/prometheus/common v0.31.1 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/rjeczalik/notify v0.9.2 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.21.8 // indirect
|
||||
github.com/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/tklauser/go-sysconf v0.3.9 // indirect
|
||||
github.com/tklauser/numcpus v0.3.0 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.0 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.0 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.0 // indirect
|
||||
go.mongodb.org/mongo-driver v1.7.5 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/multierr v1.7.0 // indirect
|
||||
go.uber.org/zap v1.19.1 // indirect
|
||||
golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 // indirect
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
|
||||
google.golang.org/appengine v1.6.6 // indirect
|
||||
google.golang.org/genproto v0.0.0-20210928142010-c7af6a1a74c9 // indirect
|
||||
google.golang.org/grpc v1.41.0 // indirect
|
||||
google.golang.org/protobuf v1.27.1 // indirect
|
||||
gopkg.in/h2non/filetype.v1 v1.0.5 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.63.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
k8s.io/klog/v2 v2.8.0 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 // indirect
|
||||
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
|
||||
maze.io/x/duration v0.0.0-20160924141736-faac084b6075 // indirect
|
||||
sigs.k8s.io/controller-runtime v0.8.0 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.1.0 // indirect
|
||||
sigs.k8s.io/yaml v1.2.0 // indirect
|
||||
github.com/mattn/go-ieproxy v0.0.11
|
||||
github.com/minio/pkg/v2 v2.0.2
|
||||
)
|
||||
|
||||
replace google.golang.org/grpc => google.golang.org/grpc v1.29.1
|
||||
require (
|
||||
aead.dev/mem v0.2.0 // indirect
|
||||
aead.dev/minisign v0.2.0 // indirect
|
||||
github.com/VividCortex/ewma v1.2.0 // indirect
|
||||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/charmbracelet/bubbles v0.16.1 // indirect
|
||||
github.com/charmbracelet/bubbletea v0.24.2 // indirect
|
||||
github.com/charmbracelet/lipgloss v0.8.0 // indirect
|
||||
github.com/cheggaaa/pb v1.0.29 // indirect
|
||||
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
|
||||
github.com/coreos/go-semver v0.3.1 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
github.com/fatih/structs v1.1.0 // indirect
|
||||
github.com/gdamore/encoding v1.0.0 // indirect
|
||||
github.com/gdamore/tcell/v2 v2.6.0 // indirect
|
||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||
github.com/go-openapi/analysis v0.21.4 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.20.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jedib0t/go-pretty/v6 v6.4.7 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/juju/ratelimit v1.0.2 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
|
||||
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
|
||||
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
|
||||
github.com/lestrrat-go/httpcc v1.0.1 // indirect
|
||||
github.com/lestrrat-go/iter v1.0.2 // indirect
|
||||
github.com/lestrrat-go/jwx v1.2.27 // indirect
|
||||
github.com/lestrrat-go/option v1.0.1 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20230326075908-cb1d2100619a // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mattn/go-localereader v0.0.1 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/minio/colorjson v1.0.6 // 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.1 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/montanaflynn/stats v0.7.1 // indirect
|
||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
||||
github.com/muesli/cancelreader v0.2.2 // indirect
|
||||
github.com/muesli/reflow v0.3.0 // indirect
|
||||
github.com/muesli/termenv v0.15.2 // indirect
|
||||
github.com/navidys/tvxwidgets v0.3.0 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/philhofer/fwd v1.1.2 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pkg/xattr v0.4.9 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/posener/complete v1.2.3 // indirect
|
||||
github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b // indirect
|
||||
github.com/prometheus/client_golang v1.16.0 // indirect
|
||||
github.com/prometheus/client_model v0.4.0 // indirect
|
||||
github.com/prometheus/common v0.44.0 // indirect
|
||||
github.com/prometheus/procfs v0.11.1 // indirect
|
||||
github.com/prometheus/prom2json v1.3.3 // indirect
|
||||
github.com/rivo/tview v0.0.0-20230909130259-ba6a2a345459 // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/rjeczalik/notify v0.9.3 // indirect
|
||||
github.com/safchain/ethtool v0.3.0 // indirect
|
||||
github.com/shirou/gopsutil/v3 v3.23.8 // indirect
|
||||
github.com/shoenig/go-m1cpu v0.1.6 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/tinylib/msgp v1.1.8 // indirect
|
||||
github.com/tklauser/go-sysconf v0.3.12 // indirect
|
||||
github.com/tklauser/numcpus v0.6.1 // indirect
|
||||
github.com/vbauerster/mpb/v8 v8.6.2 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.3 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
|
||||
go.mongodb.org/mongo-driver v1.12.1 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.25.0 // indirect
|
||||
golang.org/x/sync v0.3.0 // indirect
|
||||
golang.org/x/sys v0.15.0 // indirect
|
||||
golang.org/x/term v0.15.0 // indirect
|
||||
google.golang.org/appengine v1.6.8 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20230913181813-007df8e322eb // indirect
|
||||
google.golang.org/grpc v1.58.3 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/h2non/filetype.v1 v1.0.5 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
BIN
images/pic1.png
BIN
images/pic1.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.9 MiB |
BIN
images/pic2.png
BIN
images/pic2.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.9 MiB |
BIN
images/pic3.png
Normal file
BIN
images/pic3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
216
integration/access_rules_test.go
Normal file
216
integration/access_rules_test.go
Normal file
@@ -0,0 +1,216 @@
|
||||
// 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_AddAccessRuleAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
AddBucket("testaccessruleadd", false, nil, nil, nil)
|
||||
|
||||
type args struct {
|
||||
bucket string
|
||||
prefix string
|
||||
access string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Create Access Rule - Valid",
|
||||
args: args{
|
||||
bucket: "testaccessruleadd",
|
||||
prefix: "/test/",
|
||||
access: "readonly",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Add Access Rule - Invalid",
|
||||
args: args{
|
||||
bucket: "testaccessruleadd",
|
||||
prefix: "/test/",
|
||||
access: "readonl",
|
||||
},
|
||||
expectedStatus: 500,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Add Access Rule - Invalid Bucket",
|
||||
args: args{
|
||||
bucket: "fakebucket",
|
||||
prefix: "/test/",
|
||||
access: "readonl",
|
||||
},
|
||||
expectedStatus: 404,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
requestDataPolicy := map[string]interface{}{}
|
||||
requestDataPolicy["prefix"] = tt.args.prefix
|
||||
requestDataPolicy["access"] = tt.args.access
|
||||
|
||||
requestDataJSON, _ := json.Marshal(requestDataPolicy)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT", fmt.Sprintf("http://localhost:9090/api/v1/bucket/%s/access-rules", tt.args.bucket), requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetAccessRulesAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
AddBucket("testaccessruleget", false, nil, nil, nil)
|
||||
|
||||
type args struct {
|
||||
bucket string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Get Access Rule - Valid",
|
||||
args: args{
|
||||
bucket: "testaccessruleget",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
request, err := http.NewRequest(
|
||||
"GET", fmt.Sprintf("http://localhost:9090/api/v1/bucket/%s/access-rules", tt.args.bucket), nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(tt.expectedStatus, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func Test_DeleteAccessRuleAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
AddBucket("testaccessruledelete", false, nil, nil, nil)
|
||||
|
||||
type args struct {
|
||||
prefix string
|
||||
access string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Delete Access Rule - Valid",
|
||||
args: args{
|
||||
prefix: "/test/",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
requestDataPolicy := map[string]interface{}{}
|
||||
requestDataPolicy["prefix"] = tt.args.prefix
|
||||
requestDataPolicy["access"] = tt.args.access
|
||||
|
||||
requestDataJSON, _ := json.Marshal(requestDataPolicy)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"DELETE", "http://localhost:9090/api/v1/bucket/testaccessruledelete/access-rules", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
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")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
407
integration/admin_api_integration_test.go
Normal file
407
integration/admin_api_integration_test.go
Normal file
@@ -0,0 +1,407 @@
|
||||
// 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/>.
|
||||
|
||||
// These tests are for AdminAPI Tag based on swagger-console.yml
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func RestartService() (*http.Response, error) {
|
||||
/*
|
||||
Helper function to restart service
|
||||
HTTP Verb: POST
|
||||
URL: /api/v1/service/restart
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/service/restart",
|
||||
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 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
|
||||
HTTP Verb: PUT
|
||||
URL: api/v1/configs/notify_postgres
|
||||
Body:
|
||||
{
|
||||
"key_values":[
|
||||
{
|
||||
"key":"connection_string",
|
||||
"value":"user=postgres password=password host=localhost dbname=postgres port=5432 sslmode=disable"
|
||||
},
|
||||
{
|
||||
"key":"table",
|
||||
"value":"accountsssss"
|
||||
},
|
||||
{
|
||||
"key":"format",
|
||||
"value":"namespace"
|
||||
},
|
||||
{
|
||||
"key":"queue_limit",
|
||||
"value":"10000"
|
||||
},
|
||||
{
|
||||
"key":"comment",
|
||||
"value":"comment"
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
Body := models.SetConfigRequest{
|
||||
KeyValues: []*models.ConfigurationKV{
|
||||
{
|
||||
Key: "connection_string",
|
||||
Value: "user=postgres password=password host=173.18.0.4 dbname=postgres port=5432 sslmode=disable",
|
||||
},
|
||||
{
|
||||
Key: "table",
|
||||
Value: "accountsssss",
|
||||
},
|
||||
{
|
||||
Key: "format",
|
||||
Value: "namespace",
|
||||
},
|
||||
{
|
||||
Key: "queue_limit",
|
||||
Value: "10000",
|
||||
},
|
||||
{
|
||||
Key: "comment",
|
||||
Value: "comment",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
requestDataJSON, _ := json.Marshal(Body)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT",
|
||||
"http://localhost:9090/api/v1/configs/notify_postgres",
|
||||
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 TestNotifyPostgres(t *testing.T) {
|
||||
// Variables
|
||||
asserter := assert.New(t)
|
||||
|
||||
// Test
|
||||
response, err := NotifyPostgres()
|
||||
finalResponse := inspectHTTPResponse(response)
|
||||
asserter.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
asserter.Fail(finalResponse)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
asserter.Equal(200, response.StatusCode, finalResponse)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRestartService(t *testing.T) {
|
||||
asserter := assert.New(t)
|
||||
restartResponse, restartError := RestartService()
|
||||
asserter.Nil(restartError)
|
||||
if restartError != nil {
|
||||
log.Println(restartError)
|
||||
return
|
||||
}
|
||||
addObjRsp := inspectHTTPResponse(restartResponse)
|
||||
if restartResponse != nil {
|
||||
asserter.Equal(
|
||||
204,
|
||||
restartResponse.StatusCode,
|
||||
addObjRsp,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func ListPoliciesWithBucket(bucketName string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to List Policies With Given Bucket
|
||||
HTTP Verb: GET
|
||||
URL: /bucket-policy/{bucket}
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"GET", "http://localhost:9090/api/v1/bucket-policy/"+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 TestListPoliciesWithBucket(t *testing.T) {
|
||||
// Test Variables
|
||||
bucketName := "testlistpolicieswithbucket"
|
||||
asserter := assert.New(t)
|
||||
|
||||
// Test
|
||||
response, err := ListPoliciesWithBucket(bucketName)
|
||||
asserter.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
parsedResponse := inspectHTTPResponse(response)
|
||||
if response != nil {
|
||||
asserter.Equal(
|
||||
200,
|
||||
response.StatusCode,
|
||||
parsedResponse,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
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"
|
||||
asserter := assert.New(t)
|
||||
|
||||
// Test
|
||||
response, err := ListUsersWithAccessToBucket(bucketName)
|
||||
asserter.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
parsedResponse := inspectHTTPResponse(response)
|
||||
if response != nil {
|
||||
asserter.Equal(
|
||||
200,
|
||||
response.StatusCode,
|
||||
parsedResponse,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetNodes(t *testing.T) {
|
||||
asserter := assert.New(t)
|
||||
getNodesResponse, getNodesError := GetNodes()
|
||||
asserter.Nil(getNodesError)
|
||||
if getNodesError != nil {
|
||||
log.Println(getNodesError)
|
||||
return
|
||||
}
|
||||
addObjRsp := inspectHTTPResponse(getNodesResponse)
|
||||
if getNodesResponse != nil {
|
||||
asserter.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) {
|
||||
asserter := assert.New(t)
|
||||
resp, err := ArnList()
|
||||
asserter.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
objRsp := inspectHTTPResponse(resp)
|
||||
if resp != nil {
|
||||
asserter.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
objRsp,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func ExportConfig() (*http.Response, error) {
|
||||
request, err := http.NewRequest(
|
||||
"GET", "http://localhost:9090/api/v1/configs/export", nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func ImportConfig() (*http.Response, error) {
|
||||
body := &bytes.Buffer{}
|
||||
writer := multipart.NewWriter(body)
|
||||
formFile, _ := writer.CreateFormFile("file", "sample-import-config.txt")
|
||||
fileDir, _ := os.Getwd()
|
||||
fileName := "sample-import-config.txt"
|
||||
filePath := path.Join(fileDir, fileName)
|
||||
file, _ := os.Open(filePath)
|
||||
io.Copy(formFile, file)
|
||||
writer.Close()
|
||||
request, err := http.NewRequest(
|
||||
"POST", "http://localhost:9090/api/v1/configs/import",
|
||||
bytes.NewReader(body.Bytes()),
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Set("Content-Type", writer.FormDataContentType())
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
|
||||
rsp, _ := client.Do(request)
|
||||
if rsp.StatusCode != http.StatusOK {
|
||||
log.Printf("Request failed with response code: %d", rsp.StatusCode)
|
||||
}
|
||||
return rsp, err
|
||||
}
|
||||
|
||||
func TestExportConfig(t *testing.T) {
|
||||
asserter := assert.New(t)
|
||||
resp, err := ExportConfig()
|
||||
asserter.Nil(err)
|
||||
objRsp := inspectHTTPResponse(resp)
|
||||
if resp != nil {
|
||||
asserter.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
objRsp,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestImportConfig(t *testing.T) {
|
||||
asserter := assert.New(t)
|
||||
resp, err := ImportConfig()
|
||||
asserter.Nil(err)
|
||||
objRsp := inspectHTTPResponse(resp)
|
||||
if resp != nil {
|
||||
asserter.Equal(
|
||||
200,
|
||||
resp.StatusCode,
|
||||
objRsp,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -18,29 +18,32 @@ package integration
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
b64 "encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/loads"
|
||||
"github.com/minio/console/restapi"
|
||||
"github.com/minio/console/restapi/operations"
|
||||
|
||||
"github.com/minio/console/models"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
var token string
|
||||
|
||||
func encodeBase64(fileName string) string {
|
||||
/*
|
||||
Helper function to encode in base64 the file name so we can get the path
|
||||
*/
|
||||
path := b64.StdEncoding.EncodeToString([]byte(fileName))
|
||||
return path
|
||||
}
|
||||
|
||||
func inspectHTTPResponse(httpResponse *http.Response) string {
|
||||
/*
|
||||
Helper function to inspect the content of a HTTP response.
|
||||
@@ -52,16 +55,8 @@ func inspectHTTPResponse(httpResponse *http.Response) string {
|
||||
return "Http Response: " + string(b)
|
||||
}
|
||||
|
||||
func printMessage(message string) {
|
||||
/*
|
||||
Helper function to print HTTP response.
|
||||
*/
|
||||
fmt.Println(message)
|
||||
}
|
||||
|
||||
func initConsoleServer() (*restapi.Server, error) {
|
||||
|
||||
//os.Setenv("CONSOLE_MINIO_SERVER", "localhost:9000")
|
||||
// os.Setenv("CONSOLE_MINIO_SERVER", "localhost:9000")
|
||||
|
||||
swaggerSpec, err := loads.Embedded(restapi.SwaggerJSON, restapi.FlatSwaggerJSON)
|
||||
if err != nil {
|
||||
@@ -83,7 +78,7 @@ func initConsoleServer() (*restapi.Server, error) {
|
||||
// register all APIs
|
||||
server.ConfigureAPI()
|
||||
|
||||
//restapi.GlobalRootCAs, restapi.GlobalPublicCerts, restapi.GlobalTLSCertsManager = globalRootCAs, globalPublicCerts, globalTLSCerts
|
||||
// restapi.GlobalRootCAs, restapi.GlobalPublicCerts, restapi.GlobalTLSCertsManager = globalRootCAs, globalPublicCerts, globalTLSCerts
|
||||
|
||||
consolePort, _ := strconv.Atoi("9090")
|
||||
|
||||
@@ -96,7 +91,6 @@ func initConsoleServer() (*restapi.Server, error) {
|
||||
}
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
|
||||
// start console server
|
||||
go func() {
|
||||
fmt.Println("start server")
|
||||
@@ -107,7 +101,6 @@ func TestMain(m *testing.M) {
|
||||
return
|
||||
}
|
||||
srv.Serve()
|
||||
|
||||
}()
|
||||
|
||||
fmt.Println("sleeping")
|
||||
@@ -136,7 +129,6 @@ func TestMain(m *testing.M) {
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
response, err := client.Do(request)
|
||||
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
@@ -166,7 +158,7 @@ func TestMain(m *testing.M) {
|
||||
|
||||
requestDataBody = bytes.NewReader(requestDataJSON)
|
||||
|
||||
// get list of buckets
|
||||
// delete bucket
|
||||
request, err = http.NewRequest("DELETE", "http://localhost:9090/api/v1/buckets/test1", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
@@ -188,689 +180,3 @@ func TestMain(m *testing.M) {
|
||||
|
||||
os.Exit(code)
|
||||
}
|
||||
|
||||
func AddBucket(name string, locking bool, versioning bool, quota map[string]interface{}, retention map[string]interface{}) (*http.Response, error) {
|
||||
/*
|
||||
This is an atomic function that we can re-use to create a bucket on any
|
||||
desired test.
|
||||
*/
|
||||
// Needed Parameters for API Call
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"name": name,
|
||||
"locking": locking,
|
||||
"versioning": versioning,
|
||||
"quota": quota,
|
||||
"retention": retention,
|
||||
}
|
||||
|
||||
// Creating the Call by adding the URL and Headers
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest("POST", "http://localhost:9090/api/v1/buckets", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
// Performing the call
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func ListBuckets() (*http.Response, error) {
|
||||
/*
|
||||
Helper function to list buckets
|
||||
HTTP Verb: GET
|
||||
{{baseUrl}}/buckets?sort_by=proident velit&offset=-5480083&limit=-5480083
|
||||
*/
|
||||
request, err := http.NewRequest(
|
||||
"GET", "http://localhost:9090/api/v1/buckets", nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func BucketInfo(name string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to test Bucket Info End Point
|
||||
GET: {{baseUrl}}/buckets/:name
|
||||
*/
|
||||
bucketInformationRequest, bucketInformationError := http.NewRequest(
|
||||
"GET", "http://localhost:9090/api/v1/buckets/"+name, nil)
|
||||
if bucketInformationError != nil {
|
||||
log.Println(bucketInformationError)
|
||||
}
|
||||
bucketInformationRequest.Header.Add("Cookie",
|
||||
fmt.Sprintf("token=%s", token))
|
||||
bucketInformationRequest.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(bucketInformationRequest)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func PutBucketsTags(bucketName string, tags map[string]string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to put bucket's tags.
|
||||
PUT: {{baseUrl}}/buckets/:bucket_name/tags
|
||||
{
|
||||
"tags": {}
|
||||
}
|
||||
*/
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"tags": tags,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest("PUT",
|
||||
"http://localhost:9090/api/v1/buckets/"+bucketName+"/tags",
|
||||
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 SetBucketRetention(bucketName string, mode string, unit string, validity int) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to set bucket's retention
|
||||
PUT: {{baseUrl}}/buckets/:bucket_name/retention
|
||||
{
|
||||
"mode":"compliance",
|
||||
"unit":"years",
|
||||
"validity":2
|
||||
}
|
||||
*/
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"mode": mode,
|
||||
"unit": unit,
|
||||
"validity": validity,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest("PUT",
|
||||
"http://localhost:9090/api/v1/buckets/"+bucketName+"/retention",
|
||||
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 GetBucketRetention(bucketName string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to get the bucket's retention
|
||||
*/
|
||||
request, err := http.NewRequest("GET",
|
||||
"http://localhost:9090/api/v1/buckets/"+bucketName+"/retention",
|
||||
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 TestAddBucket(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
response, err := AddBucket("test1", false, false, nil, nil)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
if response != nil {
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAddBucketLocking(t *testing.T) {
|
||||
/*
|
||||
This function is to test that locking can't be activated if versioning
|
||||
is not enabled.
|
||||
Then, locking will be activated because versioning is activated as well.
|
||||
*/
|
||||
assert := assert.New(t)
|
||||
|
||||
/*
|
||||
This is invalid, versioning has to be true for locking to be true, but
|
||||
test will see and make sure this is not allowed and that we get proper
|
||||
error for this scenario.
|
||||
*/
|
||||
response, err := AddBucket("test1", true, false, nil, nil)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
if response != nil {
|
||||
assert.Equal(400, response.StatusCode, "400 is expected for this test")
|
||||
}
|
||||
|
||||
msg := "TestAddBucketLocking(): Valid scenario versioning true locking true"
|
||||
fmt.Println(msg)
|
||||
|
||||
/*
|
||||
This is valid, versioning is true, then locking can be true as well.
|
||||
*/
|
||||
response, err = AddBucket("thujun", true, true, nil, nil)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
// Verification part, bucket should be created with versioning enabled and
|
||||
// locking enabled, we expect 201 when created.
|
||||
if response != nil {
|
||||
assert.Equal(201, response.StatusCode, "201 is expected for this test")
|
||||
}
|
||||
|
||||
defer response.Body.Close()
|
||||
|
||||
/*
|
||||
To convert an HTTP response body to a string in Go, so you can read the
|
||||
error from the API in case the bucket is invalid for some reason
|
||||
*/
|
||||
b, err := io.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
fmt.Println(string(b))
|
||||
|
||||
}
|
||||
|
||||
func TestGetBucket(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
|
||||
response, err := AddBucket("test3", false, false, nil, nil)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
// get bucket
|
||||
request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/buckets/test3", 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.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
if response != nil {
|
||||
assert.Equal(200, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetBucketTags(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
|
||||
// put bucket
|
||||
response, err := AddBucket("test4", false, false, nil, nil)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
requestDataTags := map[string]interface{}{
|
||||
"tags": map[string]interface{}{
|
||||
"test": "TAG",
|
||||
},
|
||||
}
|
||||
|
||||
requestTagsJSON, _ := json.Marshal(requestDataTags)
|
||||
|
||||
requestTagsBody := bytes.NewBuffer(requestTagsJSON)
|
||||
|
||||
request, err := http.NewRequest(http.MethodPut, "http://localhost:9090/api/v1/buckets/test4/tags", requestTagsBody)
|
||||
request.Close = true
|
||||
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.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
// get bucket
|
||||
request, err = http.NewRequest("GET", "http://localhost:9090/api/v1/buckets/test4", nil)
|
||||
request.Close = true
|
||||
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.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
bodyBytes, _ := ioutil.ReadAll(response.Body)
|
||||
|
||||
bucket := models.Bucket{}
|
||||
err = json.Unmarshal(bodyBytes, &bucket)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
assert.Equal("TAG", bucket.Details.Tags["test"], "Failed to add tag")
|
||||
}
|
||||
|
||||
func TestBucketVersioning(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
|
||||
request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/session", nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
|
||||
response, err := client.Do(request)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
var distributedSystem bool
|
||||
|
||||
if response != nil {
|
||||
|
||||
bodyBytes, _ := ioutil.ReadAll(response.Body)
|
||||
|
||||
sessionResponse := models.SessionResponse{}
|
||||
err = json.Unmarshal(bodyBytes, &sessionResponse)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
distributedSystem = sessionResponse.DistributedMode
|
||||
|
||||
}
|
||||
|
||||
requestDataVersioning := map[string]interface{}{
|
||||
"name": "test2",
|
||||
"versioning": true,
|
||||
"locking": false,
|
||||
}
|
||||
|
||||
requestDataJSON, _ := json.Marshal(requestDataVersioning)
|
||||
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
|
||||
response, err = AddBucket("test2", true, false, nil, nil)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println("Versioned bucket creation test status:", response.Status)
|
||||
if distributedSystem {
|
||||
assert.Equal(201, response.StatusCode, "Versioning test Status Code is incorrect - bucket failed to create")
|
||||
} else {
|
||||
assert.NotEqual(201, response.StatusCode, "Versioning test Status Code is incorrect - versioned bucket created on non-distributed system")
|
||||
}
|
||||
|
||||
request, error := http.NewRequest("DELETE", "http://localhost:9090/api/v1/buckets/test2", requestDataBody)
|
||||
if error != nil {
|
||||
log.Println(error)
|
||||
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 {
|
||||
fmt.Println("DELETE StatusCode:", response.StatusCode)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestBucketsGet(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
|
||||
// get list of buckets
|
||||
request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/buckets", nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
|
||||
response, err := client.Do(request)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
if response != nil {
|
||||
assert.Equal(200, response.StatusCode, "Status Code is incorrect")
|
||||
bodyBytes, _ := ioutil.ReadAll(response.Body)
|
||||
|
||||
listBuckets := models.ListBucketsResponse{}
|
||||
err = json.Unmarshal(bodyBytes, &listBuckets)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
assert.Nil(err)
|
||||
}
|
||||
|
||||
assert.Greater(len(listBuckets.Buckets), 0, "No bucket was returned")
|
||||
assert.Greater(listBuckets.Total, int64(0), "Total buckets is 0")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestListBuckets(t *testing.T) {
|
||||
/*
|
||||
Test the list of buckets without query parameters.
|
||||
*/
|
||||
assert := assert.New(t)
|
||||
|
||||
// 1. Create buckets
|
||||
var numberOfBuckets = 3
|
||||
for i := 1; i <= numberOfBuckets; i++ {
|
||||
response, err := AddBucket(
|
||||
"testlistbuckets"+strconv.Itoa(i), false, false, nil, nil)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
assert.Fail("Error creating the buckets")
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
b, err := io.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
assert.Equal(201, response.StatusCode,
|
||||
"Status Code is incorrect: "+string(b)+
|
||||
" Bucket name: TestListBuckets"+strconv.Itoa(i))
|
||||
}
|
||||
}
|
||||
|
||||
// 2. List buckets
|
||||
listBucketsResponse, listBucketsError := ListBuckets()
|
||||
assert.Nil(listBucketsError)
|
||||
if listBucketsError != nil {
|
||||
log.Println(listBucketsError)
|
||||
assert.Fail("Error listing the buckets")
|
||||
return
|
||||
}
|
||||
|
||||
// 3. Verify list of buckets
|
||||
b, err := io.ReadAll(listBucketsResponse.Body)
|
||||
if listBucketsResponse != nil {
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
assert.Equal(200, listBucketsResponse.StatusCode,
|
||||
"Status Code is incorrect: "+string(b))
|
||||
}
|
||||
for i := 1; i <= numberOfBuckets; i++ {
|
||||
assert.True(strings.Contains(string(b),
|
||||
"testlistbuckets"+strconv.Itoa(i)))
|
||||
}
|
||||
}
|
||||
|
||||
func TestBucketInformationSuccessfulResponse(t *testing.T) {
|
||||
/*
|
||||
Test Bucket Info End Point with a Successful Response.
|
||||
*/
|
||||
|
||||
// 1. Create the bucket
|
||||
assert := assert.New(t)
|
||||
response, err := AddBucket("bucketinformation1", false, false, nil, nil)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(201, response.StatusCode, inspectHTTPResponse(response))
|
||||
}
|
||||
|
||||
// 2. Add a tag to the bucket
|
||||
tags := make(map[string]string)
|
||||
tags["tag1"] = "tag1"
|
||||
putBucketTagResponse, putBucketTagError := PutBucketsTags(
|
||||
"bucketinformation1", tags)
|
||||
if putBucketTagError != nil {
|
||||
log.Println(putBucketTagError)
|
||||
assert.Fail("Error creating the bucket")
|
||||
return
|
||||
}
|
||||
if putBucketTagResponse != nil {
|
||||
assert.Equal(
|
||||
200, putBucketTagResponse.StatusCode,
|
||||
inspectHTTPResponse(putBucketTagResponse))
|
||||
}
|
||||
|
||||
// 3. Get the information
|
||||
bucketInfoResponse, bucketInfoError := BucketInfo("bucketinformation1")
|
||||
if bucketInfoError != nil {
|
||||
log.Println(bucketInfoError)
|
||||
assert.Fail("Error getting the bucket information")
|
||||
return
|
||||
}
|
||||
debugResponse := inspectHTTPResponse(bucketInfoResponse) // call it once
|
||||
if bucketInfoResponse != nil {
|
||||
assert.Equal(200, bucketInfoResponse.StatusCode,
|
||||
debugResponse)
|
||||
}
|
||||
printMessage(debugResponse)
|
||||
|
||||
// 4. Verify the information
|
||||
assert.True(
|
||||
strings.Contains(debugResponse, "bucketinformation1"),
|
||||
inspectHTTPResponse(bucketInfoResponse))
|
||||
assert.True(
|
||||
strings.Contains(debugResponse, "tag1"),
|
||||
inspectHTTPResponse(bucketInfoResponse))
|
||||
}
|
||||
|
||||
func TestBucketInformationGenericErrorResponse(t *testing.T) {
|
||||
/*
|
||||
Test Bucket Info End Point with a Generic Error Response.
|
||||
*/
|
||||
// 1. Create the bucket
|
||||
assert := assert.New(t)
|
||||
response, err := AddBucket("bucketinformation2", false, false, nil, nil)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
assert.Fail("Error creating the bucket")
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(201, response.StatusCode, inspectHTTPResponse(response))
|
||||
}
|
||||
|
||||
// 2. Add a tag to the bucket
|
||||
tags := make(map[string]string)
|
||||
tags["tag2"] = "tag2"
|
||||
putBucketTagResponse, putBucketTagError := PutBucketsTags(
|
||||
"bucketinformation2", tags)
|
||||
if putBucketTagError != nil {
|
||||
log.Println(putBucketTagError)
|
||||
assert.Fail("Error creating the bucket")
|
||||
return
|
||||
}
|
||||
if putBucketTagResponse != nil {
|
||||
assert.Equal(
|
||||
200, putBucketTagResponse.StatusCode,
|
||||
inspectHTTPResponse(putBucketTagResponse))
|
||||
}
|
||||
|
||||
// 3. Get the information
|
||||
bucketInfoResponse, bucketInfoError := BucketInfo("bucketinformation3")
|
||||
if bucketInfoError != nil {
|
||||
log.Println(bucketInfoError)
|
||||
assert.Fail("Error getting the bucket information")
|
||||
return
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(bucketInfoResponse)
|
||||
if bucketInfoResponse != nil {
|
||||
assert.Equal(200, bucketInfoResponse.StatusCode)
|
||||
}
|
||||
|
||||
// 4. Verify the information
|
||||
// Since bucketinformation3 hasn't been created, then it is expected that
|
||||
// tag2 is not part of the response, this is why assert.False is used.
|
||||
assert.False(strings.Contains(finalResponse, "tag2"), finalResponse)
|
||||
}
|
||||
|
||||
func TestBucketRetention(t *testing.T) {
|
||||
/*
|
||||
To test bucket retention feature
|
||||
*/
|
||||
// 1. Create the bucket with 2 years validity retention
|
||||
assert := assert.New(t)
|
||||
/*
|
||||
{
|
||||
"name":"setbucketretention1",
|
||||
"versioning":true,
|
||||
"locking":true,
|
||||
"retention":
|
||||
{
|
||||
"mode":"compliance",
|
||||
"unit":"years",
|
||||
"validity":2
|
||||
}
|
||||
}
|
||||
*/
|
||||
retention := make(map[string]interface{})
|
||||
retention["mode"] = "compliance"
|
||||
retention["unit"] = "years"
|
||||
retention["validity"] = 2
|
||||
response, err := AddBucket("setbucketretention1", true, true, nil, retention)
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
assert.Fail("Error creating the bucket")
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(201, response.StatusCode, inspectHTTPResponse(response))
|
||||
}
|
||||
|
||||
// 2. Set the bucket's retention from 2 years to 3 years
|
||||
setBucketRetentionResponse, setBucketRetentionError := SetBucketRetention(
|
||||
"setbucketretention1",
|
||||
"compliance",
|
||||
"years",
|
||||
3,
|
||||
)
|
||||
assert.Nil(setBucketRetentionError)
|
||||
if setBucketRetentionError != nil {
|
||||
log.Println(setBucketRetentionError)
|
||||
assert.Fail("Error creating the bucket")
|
||||
return
|
||||
}
|
||||
if setBucketRetentionResponse != nil {
|
||||
assert.Equal(200, setBucketRetentionResponse.StatusCode,
|
||||
inspectHTTPResponse(setBucketRetentionResponse))
|
||||
}
|
||||
|
||||
// 3. Verify the bucket's retention was properly set.
|
||||
getBucketRetentionResponse, getBucketRetentionError := GetBucketRetention(
|
||||
"setbucketretention1",
|
||||
)
|
||||
assert.Nil(getBucketRetentionError)
|
||||
if getBucketRetentionError != nil {
|
||||
log.Println(getBucketRetentionError)
|
||||
assert.Fail("Error creating the bucket")
|
||||
return
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(getBucketRetentionResponse)
|
||||
if getBucketRetentionResponse != nil {
|
||||
assert.Equal(
|
||||
200,
|
||||
getBucketRetentionResponse.StatusCode,
|
||||
finalResponse,
|
||||
)
|
||||
}
|
||||
expected := "Http Response: {\"mode\":\"compliance\",\"unit\":\"years\",\"validity\":3}\n"
|
||||
assert.Equal(expected, finalResponse, finalResponse)
|
||||
}
|
||||
|
||||
250
integration/config_test.go
Normal file
250
integration/config_test.go
Normal file
@@ -0,0 +1,250 @@
|
||||
// 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)
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Config - Valid",
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
request, err := http.NewRequest("GET", "http://localhost:9090/api/v1/configs", 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_GetConfigAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
type args struct {
|
||||
name string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Get Config - Valid",
|
||||
args: args{
|
||||
name: "storage_class",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Get Config - Invalid",
|
||||
args: args{
|
||||
name: "asdf",
|
||||
},
|
||||
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/configs/%s", tt.args.name), 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_SetConfigAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
type args struct {
|
||||
name string
|
||||
keyValues []map[string]interface{}
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Set Config - Valid",
|
||||
args: args{
|
||||
name: "region",
|
||||
keyValues: []map[string]interface{}{{"key": "name", "value": "testServer"}, {"key": "region", "value": "us-west-1"}},
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Set Config - Invalid",
|
||||
args: args{
|
||||
name: "regiontest",
|
||||
keyValues: []map[string]interface{}{{"key": "name", "value": "testServer"}, {"key": "region", "value": "us-west-1"}},
|
||||
},
|
||||
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["key_values"] = tt.args.keyValues
|
||||
|
||||
requestDataJSON, _ := json.Marshal(requestDataPolicy)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT", fmt.Sprintf("http://localhost:9090/api/v1/configs/%s", tt.args.name), 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_ResetConfigAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
type args struct {
|
||||
name string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Reset Config - Valid",
|
||||
args: args{
|
||||
name: "region",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Reset Config - Invalid",
|
||||
args: args{
|
||||
name: "regiontest",
|
||||
},
|
||||
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(
|
||||
"POST", fmt.Sprintf("http://localhost:9090/api/v1/configs/%s/reset", tt.args.name), 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")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
351
integration/groups_test.go
Normal file
351
integration/groups_test.go
Normal file
@@ -0,0 +1,351 @@
|
||||
// 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/base64"
|
||||
"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: base64.StdEncoding.EncodeToString([]byte("getgroup1")),
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Get Group - Invalid",
|
||||
args: args{
|
||||
api: base64.StdEncoding.EncodeToString([]byte("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: base64.StdEncoding.EncodeToString([]byte("putgroup1")),
|
||||
members: []string{"member3"},
|
||||
status: "enabled",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Put Group - Invalid",
|
||||
args: args{
|
||||
api: base64.StdEncoding.EncodeToString([]byte("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: base64.StdEncoding.EncodeToString([]byte("grouptests1")),
|
||||
},
|
||||
verb: "DELETE",
|
||||
expectedStatus: 204,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Delete Group - Invalid",
|
||||
args: args{
|
||||
api: base64.StdEncoding.EncodeToString([]byte("grouptests12345")),
|
||||
},
|
||||
verb: "DELETE",
|
||||
expectedStatus: 404,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Access Group After Delete - Invalid",
|
||||
args: args{
|
||||
api: base64.StdEncoding.EncodeToString([]byte("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")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
106
integration/inspect_test.go
Normal file
106
integration/inspect_test.go
Normal file
@@ -0,0 +1,106 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Inspect(volume string, file string, enc bool) (*http.Response, error) {
|
||||
requestURL := fmt.Sprintf("http://localhost:9090/api/v1/admin/inspect?volume=%s&file=%s&encrypt=%t", volume, file, enc)
|
||||
request, err := http.NewRequest(
|
||||
"GET", requestURL, 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 TestInspect(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
type args struct {
|
||||
volume string
|
||||
file string
|
||||
encrypt bool
|
||||
}
|
||||
|
||||
// Inspect returns successful response always
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expStatusCode int
|
||||
expectedError bool
|
||||
}{
|
||||
{
|
||||
name: "Test Invalid Path",
|
||||
args: args{
|
||||
volume: "/test-with-slash",
|
||||
file: "/test-with-slash",
|
||||
encrypt: false,
|
||||
},
|
||||
expStatusCode: 200,
|
||||
expectedError: false,
|
||||
},
|
||||
|
||||
{
|
||||
name: "Test Invalid characters in Path",
|
||||
args: args{
|
||||
volume: "//test",
|
||||
file: "//bucket",
|
||||
encrypt: false,
|
||||
},
|
||||
expStatusCode: 200,
|
||||
expectedError: true,
|
||||
},
|
||||
{
|
||||
name: "Test valid bucket",
|
||||
args: args{
|
||||
volume: "test-bucket",
|
||||
file: "test.txt",
|
||||
encrypt: true,
|
||||
},
|
||||
expStatusCode: 200,
|
||||
expectedError: false,
|
||||
},
|
||||
{
|
||||
name: "Test Empty Path", // Un processable entity error
|
||||
args: args{
|
||||
volume: "",
|
||||
file: "",
|
||||
encrypt: false,
|
||||
},
|
||||
expStatusCode: 422,
|
||||
expectedError: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
resp, err := Inspect(tt.args.volume, tt.args.file, tt.args.encrypt)
|
||||
if tt.expectedError {
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
if resp != nil {
|
||||
assert.Equal(
|
||||
tt.expStatusCode,
|
||||
resp.StatusCode,
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,10 @@
|
||||
package integration
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"testing"
|
||||
@@ -54,7 +56,7 @@ func TestLoginStrategy(t *testing.T) {
|
||||
}
|
||||
|
||||
if response != nil {
|
||||
bodyBytes, _ := ioutil.ReadAll(response.Body)
|
||||
bodyBytes, _ := io.ReadAll(response.Body)
|
||||
|
||||
loginDetails := models.LoginDetails{}
|
||||
|
||||
@@ -67,5 +69,94 @@ func TestLoginStrategy(t *testing.T) {
|
||||
assert.Equal(models.LoginDetailsLoginStrategyForm, loginDetails.LoginStrategy, "Login Details don't match")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
logoutRequest := bytes.NewReader([]byte("{}"))
|
||||
request, err = http.NewRequest("POST", "http://localhost:9090/api/v1/logout", logoutRequest)
|
||||
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)
|
||||
}
|
||||
|
||||
func TestBadLogin(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
requestData := map[string]string{
|
||||
"accessKey": "minioadmin",
|
||||
"secretKey": "minioadminbad",
|
||||
}
|
||||
|
||||
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.Equal(401, response.StatusCode, "Login request not rejected")
|
||||
assert.NotNil(response, "Login response is nil")
|
||||
assert.Nil(err, "Login errored out")
|
||||
}
|
||||
|
||||
281
integration/objects_test.go
Normal file
281
integration/objects_test.go
Normal file
@@ -0,0 +1,281 @@
|
||||
// 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"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"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))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func downloadMultipleFiles(bucketName string, objects []string) (*http.Response, error) {
|
||||
requestURL := fmt.Sprintf("http://localhost:9090/api/v1/buckets/%s/objects/download-multiple", bucketName)
|
||||
|
||||
postReqParams, _ := json.Marshal(objects)
|
||||
reqBody := bytes.NewReader(postReqParams)
|
||||
|
||||
request, err := http.NewRequest(
|
||||
"POST", requestURL, reqBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
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 TestDownloadMultipleFiles(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
type args struct {
|
||||
bucketName string
|
||||
objectLis []string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError bool
|
||||
}{
|
||||
{
|
||||
name: "Test empty Bucket",
|
||||
args: args{
|
||||
bucketName: "",
|
||||
},
|
||||
expectedStatus: 400,
|
||||
expectedError: true,
|
||||
},
|
||||
{
|
||||
name: "Test empty object list",
|
||||
args: args{
|
||||
bucketName: "test-bucket",
|
||||
},
|
||||
expectedStatus: 400,
|
||||
expectedError: true,
|
||||
},
|
||||
{
|
||||
name: "Test with bucket and object list",
|
||||
args: args{
|
||||
bucketName: "test-bucket",
|
||||
objectLis: []string{
|
||||
"my-object.txt",
|
||||
"test-prefix/",
|
||||
"test-prefix/nested-prefix/",
|
||||
"test-prefix/nested-prefix/deep-nested/",
|
||||
},
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
resp, err := downloadMultipleFiles(tt.args.bucketName, tt.args.objectLis)
|
||||
if tt.expectedError {
|
||||
assert.Nil(err)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
if resp != nil {
|
||||
assert.NotNil(resp)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
862
integration/policy_test.go
Normal file
862
integration/policy_test.go
Normal file
@@ -0,0 +1,862 @@
|
||||
// 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/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func AddPolicy(name, 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, 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: base64.StdEncoding.EncodeToString([]byte("test3")),
|
||||
},
|
||||
expectedStatus: 500,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Get Policies - Valid",
|
||||
args: args{
|
||||
api: base64.StdEncoding.EncodeToString([]byte("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/policy/%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/" + base64.StdEncoding.EncodeToString([]byte("policylistusers")) + "/users",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "List Users for Policy - Invalid",
|
||||
args: args{
|
||||
api: "/policies/" + base64.StdEncoding.EncodeToString([]byte("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, _ := io.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/" + base64.StdEncoding.EncodeToString([]byte("policylistgroups")) + "/groups",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "List Users for Policy - Invalid",
|
||||
args: args{
|
||||
api: "/policies/" + base64.StdEncoding.EncodeToString([]byte("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, _ := io.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: base64.StdEncoding.EncodeToString([]byte("testdelete")),
|
||||
method: "DELETE",
|
||||
},
|
||||
expectedStatus: 204,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Get Policy After Delete - Invalid",
|
||||
args: args{
|
||||
api: base64.StdEncoding.EncodeToString([]byte("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/policy/%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_GetAUserPolicyAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
// Create a User with a Policy to use for testing
|
||||
groups := []string{}
|
||||
policies := []string{"readwrite"}
|
||||
_, err := AddUser("getuserpolicyuser", "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
// encode usernames to pass to api
|
||||
bName := []byte("getuserpolicyuser")
|
||||
fName := []byte("failname")
|
||||
encodedName := base64.URLEncoding.EncodeToString(bName)
|
||||
encodedFailName := base64.URLEncoding.EncodeToString(fName)
|
||||
|
||||
type args struct {
|
||||
api string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Get User Policy - Invalid",
|
||||
args: args{
|
||||
api: "/user/" + encodedFailName + "/policies",
|
||||
},
|
||||
expectedStatus: 401,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Get User Policy - Valid",
|
||||
args: args{
|
||||
api: "/user/" + encodedName + "/policies",
|
||||
},
|
||||
expectedStatus: 200,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
request, err := http.NewRequest(
|
||||
"GET", fmt.Sprintf("http://localhost:9090/api/v1%s", tt.args.api), nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
assert.Equal(tt.expectedStatus, response.StatusCode, tt.name+" Failed")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
93
integration/profiling_test.go
Normal file
93
integration/profiling_test.go
Normal file
@@ -0,0 +1,93 @@
|
||||
// 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"
|
||||
"log"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/minio/websocket"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestStartProfiling(t *testing.T) {
|
||||
testAssert := 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,
|
||||
}
|
||||
|
||||
wsDestination := "/ws/profile?types=cpu,mem,block,mutex,trace,threads,goroutines"
|
||||
wsFinalURL := fmt.Sprintf("ws://localhost:9090%s", wsDestination)
|
||||
|
||||
ws, _, err := websocket.DefaultDialer.Dial(wsFinalURL, nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
defer ws.Close()
|
||||
|
||||
_, zipFileBytes, err := ws.ReadMessage()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
filetype := http.DetectContentType(zipFileBytes)
|
||||
testAssert.Equal("application/zip", filetype)
|
||||
|
||||
zipReader, err := zip.NewReader(bytes.NewReader(zipFileBytes), int64(len(zipFileBytes)))
|
||||
if err != nil {
|
||||
testAssert.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 {
|
||||
testAssert.Equal(true, v, fmt.Sprintf("%s : compressed file expected to have %v file inside", tt.name, k))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
28
integration/sample-import-config.txt
Normal file
28
integration/sample-import-config.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
subnet license= api_key= proxy=
|
||||
# callhome enable=off frequency=24h
|
||||
# site name= region=
|
||||
# api requests_max=0 requests_deadline=10s cluster_deadline=10s cors_allow_origin=* remote_transport_deadline=2h list_quorum=strict replication_priority=auto transition_workers=100 stale_uploads_cleanup_interval=6h stale_uploads_expiry=24h delete_cleanup_interval=5m disable_odirect=off gzip_objects=off
|
||||
# scanner speed=default
|
||||
# compression enable=off allow_encryption=off extensions=.txt,.log,.csv,.json,.tar,.xml,.bin mime_types=text/*,application/json,application/xml,binary/octet-stream
|
||||
# identity_openid enable= display_name= config_url= client_id= client_secret= claim_name=policy claim_userinfo= role_policy= claim_prefix= redirect_uri= redirect_uri_dynamic=off scopes= vendor= keycloak_realm= keycloak_admin_url=
|
||||
# identity_ldap server_addr= srv_record_name= user_dn_search_base_dn= user_dn_search_filter= group_search_filter= group_search_base_dn= tls_skip_verify=off server_insecure=off server_starttls=off lookup_bind_dn= lookup_bind_password=
|
||||
# identity_tls skip_verify=off
|
||||
# identity_plugin url= auth_token= role_policy= role_id=
|
||||
# policy_plugin url= auth_token= enable_http2=off
|
||||
# logger_webhook enable=off endpoint= auth_token= client_cert= client_key= queue_size=100000
|
||||
# audit_webhook enable=off endpoint= auth_token= client_cert= client_key= queue_size=100000
|
||||
# audit_kafka enable=off topic= brokers= sasl_username= sasl_password= sasl_mechanism=plain client_tls_cert= client_tls_key= tls_client_auth=0 sasl=off tls=off tls_skip_verify=off version=
|
||||
# notify_webhook enable=off endpoint= auth_token= queue_limit=0 queue_dir= client_cert= client_key=
|
||||
# notify_amqp enable=off url= exchange= exchange_type= routing_key= mandatory=off durable=off no_wait=off internal=off auto_deleted=off delivery_mode=0 publisher_confirms=off queue_limit=0 queue_dir=
|
||||
# notify_kafka enable=off topic= brokers= sasl_username= sasl_password= sasl_mechanism=plain client_tls_cert= client_tls_key= tls_client_auth=0 sasl=off tls=off tls_skip_verify=off queue_limit=0 queue_dir= version=
|
||||
# notify_mqtt enable=off broker= topic= password= username= qos=0 keep_alive_interval=0s reconnect_interval=0s queue_dir= queue_limit=0
|
||||
# notify_nats enable=off address= subject= username= password= token= tls=off tls_skip_verify=off cert_authority= client_cert= client_key= ping_interval=0 jetstream=off streaming=off streaming_async=off streaming_max_pub_acks_in_flight=0 streaming_cluster_id= queue_dir= queue_limit=0
|
||||
# notify_nsq enable=off nsqd_address= topic= tls=off tls_skip_verify=off queue_dir= queue_limit=0
|
||||
# notify_mysql enable=off format=namespace dsn_string= table= queue_dir= queue_limit=0 max_open_connections=2
|
||||
# notify_postgres enable=off format=namespace connection_string= table= queue_dir= queue_limit=0 max_open_connections=2
|
||||
# notify_elasticsearch enable=off url= format=namespace index= queue_dir= queue_limit=0 username= password=
|
||||
# notify_redis enable=off format=namespace address= key= password= queue_dir= queue_limit=0
|
||||
# etcd endpoints= path_prefix= coredns_path=/skydns client_cert= client_cert_key=
|
||||
# cache drives= exclude= expiry=90 quota=80 after=0 watermark_low=70 watermark_high=80 range=on commit=
|
||||
# storage_class standard= rrs=EC:1
|
||||
# heal bitrotscan=off max_sleep=1s max_io=100
|
||||
349
integration/service_account_test.go
Normal file
349
integration/service_account_test.go
Normal file
@@ -0,0 +1,349 @@
|
||||
// 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/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestAddServiceAccount(t *testing.T) {
|
||||
/*
|
||||
This is an atomic API Test to add a user service account, the intention
|
||||
is simple, add a user and make sure the response is 201 meaning that the
|
||||
user got added successfully.
|
||||
After test completion, it is expected that user is removed, so other
|
||||
tests like users.ts can run over clean data and we don't collide against
|
||||
it.
|
||||
*/
|
||||
|
||||
assert := assert.New(t)
|
||||
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
// Add service account
|
||||
requestDataAddServiceAccount := map[string]interface{}{
|
||||
"accessKey": "testuser1",
|
||||
"secretKey": "password",
|
||||
"policy": `{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:GetBucketLocation",
|
||||
"s3:GetObject"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}`,
|
||||
}
|
||||
|
||||
requestDataJSON, _ := json.Marshal(requestDataAddServiceAccount)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST", "http://localhost:9090/api/v1/service-account-credentials", requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
response, err := client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// {{baseUrl}}/user?name=proident velit
|
||||
// Investiga como se borra en el browser.
|
||||
request, err = http.NewRequest(
|
||||
"DELETE", "http://localhost:9090/api/v1/service-accounts/"+base64.StdEncoding.EncodeToString([]byte("testuser1")), nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err = client.Do(request)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("DELETE StatusCode:", response.StatusCode)
|
||||
assert.Equal(204, response.StatusCode, "has to be 204 when delete user")
|
||||
}
|
||||
}
|
||||
|
||||
func Test_ServiceAccountsAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
type args struct {
|
||||
api string
|
||||
policy *string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Create Service Account - Default",
|
||||
args: args{
|
||||
api: "/service-accounts",
|
||||
policy: nil,
|
||||
},
|
||||
expectedStatus: 201,
|
||||
expectedError: nil,
|
||||
},
|
||||
{
|
||||
name: "Create Service Account - Valid Policy",
|
||||
args: args{
|
||||
api: "/service-accounts",
|
||||
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 Service Account - Invalid Policy",
|
||||
args: args{
|
||||
api: "/service-accounts",
|
||||
policy: swag.String(`
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"s3:GetBucketLocation"
|
||||
"s3:GetObject"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:s3:::*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}`),
|
||||
},
|
||||
expectedStatus: 500,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
// Add service account
|
||||
|
||||
requestDataPolicy := map[string]interface{}{}
|
||||
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, "Status Code is incorrect")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func DeleteMultipleServiceAccounts(serviceAccounts []string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to delete multiple service accounts
|
||||
URL: http://localhost:9001/api/v1/service-accounts/delete-multi
|
||||
HTTP Verb: DELETE
|
||||
Data: ["U3RADB7J2ZZHELR0WSBB","ZE8H1HYOA6AVGKFCV6YU"]
|
||||
Response: Status Code: 204 No Content
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(serviceAccounts)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"DELETE", "http://localhost:9090/api/v1/service-accounts/delete-multi", 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 TestCreateServiceAccountForUserWithCredentials(t *testing.T) {
|
||||
/*
|
||||
To test creation of service account for a user.
|
||||
*/
|
||||
|
||||
// Test's variables
|
||||
userName := "testcreateserviceaccountforuserwithcredentials1"
|
||||
assert := assert.New(t)
|
||||
policy := ""
|
||||
|
||||
// 1. Create the user
|
||||
groups := []string{}
|
||||
policies := []string{}
|
||||
secretKey := "testcreateserviceaccountforuserwithcrede"
|
||||
response, err := AddUser(userName, "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// Table driven testing part
|
||||
type args struct {
|
||||
accessKey string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
expectedStatus int
|
||||
}{
|
||||
{
|
||||
name: "Service Account With Valid Credentials",
|
||||
expectedStatus: 201,
|
||||
args: args{
|
||||
accessKey: "testcreateserviceacc",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Service Account With Invalid Credentials",
|
||||
expectedStatus: 500,
|
||||
args: args{
|
||||
accessKey: "tooooooooooooooooooooolongggggggggggggggggg",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// 2. Create the service account for the user
|
||||
createServiceAccountWithCredentialsResponse,
|
||||
createServiceAccountWithCredentialsError := CreateServiceAccountForUserWithCredentials(
|
||||
userName,
|
||||
policy,
|
||||
tt.args.accessKey,
|
||||
secretKey,
|
||||
)
|
||||
if createServiceAccountWithCredentialsError != nil {
|
||||
log.Println(createServiceAccountWithCredentialsError)
|
||||
assert.Fail("Error in createServiceAccountWithCredentialsError")
|
||||
}
|
||||
if createServiceAccountWithCredentialsResponse != nil {
|
||||
fmt.Println("StatusCode:", createServiceAccountWithCredentialsResponse.StatusCode)
|
||||
assert.Equal(
|
||||
tt.expectedStatus, // different status expected per table's row
|
||||
createServiceAccountWithCredentialsResponse.StatusCode,
|
||||
inspectHTTPResponse(createServiceAccountWithCredentialsResponse),
|
||||
)
|
||||
}
|
||||
|
||||
// 3. Verify the service account for the user
|
||||
listOfAccountsResponse,
|
||||
listOfAccountsError := ReturnsAListOfServiceAccountsForAUser(userName)
|
||||
if listOfAccountsError != nil {
|
||||
log.Println(listOfAccountsError)
|
||||
assert.Fail("Error in listOfAccountsError")
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(listOfAccountsResponse)
|
||||
if listOfAccountsResponse != nil {
|
||||
fmt.Println("StatusCode:", listOfAccountsResponse.StatusCode)
|
||||
assert.Equal(
|
||||
200, listOfAccountsResponse.StatusCode,
|
||||
finalResponse,
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Delete Multiple Service Accounts
|
||||
serviceAccount := make([]string, 1)
|
||||
serviceAccount[0] = "testcreateserviceacc"
|
||||
response, err = DeleteMultipleServiceAccounts(serviceAccount)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("StatusCode:", response.StatusCode)
|
||||
assert.Equal(
|
||||
204,
|
||||
response.StatusCode,
|
||||
inspectHTTPResponse(response),
|
||||
)
|
||||
}
|
||||
}
|
||||
53
integration/tiers_test.go
Normal file
53
integration/tiers_test.go
Normal file
@@ -0,0 +1,53 @@
|
||||
// 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)
|
||||
}
|
||||
3974
integration/user_api_bucket_test.go
Normal file
3974
integration/user_api_bucket_test.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,7 @@ package integration
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -31,7 +32,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func AddUser(accessKey string, secretKey string, groups []string, policies []string) (*http.Response, error) {
|
||||
func AddUser(accessKey, secretKey string, groups, policies []string) (*http.Response, error) {
|
||||
/*
|
||||
This is an atomic function to add user and can be reused across
|
||||
different functions.
|
||||
@@ -40,7 +41,6 @@ func AddUser(accessKey string, secretKey string, groups []string, policies []str
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
|
||||
fmt.Println(".......................TestAddUser(): Create Data to add user")
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"accessKey": accessKey,
|
||||
"secretKey": secretKey,
|
||||
@@ -48,7 +48,6 @@ func AddUser(accessKey string, secretKey string, groups []string, policies []str
|
||||
"policies": policies,
|
||||
}
|
||||
|
||||
fmt.Println("..............................TestAddUser(): Prepare the POST")
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
@@ -59,12 +58,12 @@ func AddUser(accessKey string, secretKey string, groups []string, policies []str
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
fmt.Println(".................................TestAddUser(): Make the POST")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func DeleteUser(userName string) (*http.Response, error) {
|
||||
userName = base64.StdEncoding.EncodeToString([]byte(userName))
|
||||
/*
|
||||
This is an atomic function to delete user and can be reused across
|
||||
different functions.
|
||||
@@ -72,21 +71,18 @@ func DeleteUser(userName string) (*http.Response, error) {
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
fmt.Println("...................................TestAddUser(): Remove user")
|
||||
request, err := http.NewRequest(
|
||||
"DELETE", "http://localhost:9090/api/v1/user?name="+userName, nil)
|
||||
"DELETE", "http://localhost:9090/api/v1/user/"+userName, nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
fmt.Println("...............................TestAddUser(): Make the DELETE")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func ListUsers(offset string, limit string) (*http.Response, error) {
|
||||
func ListUsers(offset, limit string) (*http.Response, error) {
|
||||
/*
|
||||
This is an atomic function to list users.
|
||||
{{baseUrl}}/users?offset=-5480083&limit=-5480083
|
||||
@@ -94,7 +90,6 @@ func ListUsers(offset string, limit string) (*http.Response, error) {
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
fmt.Println("...................................TestAddUser(): Remove user")
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/users?offset="+offset+"&limit="+limit,
|
||||
@@ -104,13 +99,12 @@ func ListUsers(offset string, limit string) (*http.Response, error) {
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
|
||||
fmt.Println("...............................TestAddUser(): Make the DELETE")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func GetUserInformation(userName string) (*http.Response, error) {
|
||||
userName = base64.StdEncoding.EncodeToString([]byte(userName))
|
||||
/*
|
||||
Helper function to get user information via API:
|
||||
{{baseUrl}}/user?name=proident velit
|
||||
@@ -120,7 +114,7 @@ func GetUserInformation(userName string) (*http.Response, error) {
|
||||
}
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/user?name="+userName,
|
||||
"http://localhost:9090/api/v1/user/"+userName,
|
||||
nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
@@ -131,7 +125,8 @@ func GetUserInformation(userName string) (*http.Response, error) {
|
||||
return response, err
|
||||
}
|
||||
|
||||
func UpdateUserInformation(name string, status string, groups []string) (*http.Response, error) {
|
||||
func UpdateUserInformation(name, status string, groups []string) (*http.Response, error) {
|
||||
name = base64.StdEncoding.EncodeToString([]byte(name))
|
||||
/*
|
||||
Helper function to update user information:
|
||||
PUT: {{baseUrl}}/user?name=proident velit
|
||||
@@ -154,7 +149,7 @@ func UpdateUserInformation(name string, status string, groups []string) (*http.R
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT", "http://localhost:9090/api/v1/user?name="+name, requestDataBody)
|
||||
"PUT", "http://localhost:9090/api/v1/user/"+name, requestDataBody)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
@@ -165,6 +160,7 @@ func UpdateUserInformation(name string, status string, groups []string) (*http.R
|
||||
}
|
||||
|
||||
func RemoveUser(name string) (*http.Response, error) {
|
||||
name = base64.StdEncoding.EncodeToString([]byte(name))
|
||||
/*
|
||||
Helper function to remove user.
|
||||
DELETE: {{baseUrl}}/user?name=proident velit
|
||||
@@ -173,7 +169,7 @@ func RemoveUser(name string) (*http.Response, error) {
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
request, err := http.NewRequest(
|
||||
"DELETE", "http://localhost:9090/api/v1/user?name="+name, nil)
|
||||
"DELETE", "http://localhost:9090/api/v1/user/"+name, nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
@@ -183,6 +179,186 @@ func RemoveUser(name string) (*http.Response, error) {
|
||||
return response, err
|
||||
}
|
||||
|
||||
func UpdateGroupsForAUser(userName string, groups []string) (*http.Response, error) {
|
||||
userName = base64.StdEncoding.EncodeToString([]byte(userName))
|
||||
/*
|
||||
Helper function to update groups for a user
|
||||
PUT: {{baseUrl}}/user/groups?name=username
|
||||
{
|
||||
"groups":[
|
||||
"groupone",
|
||||
"grouptwo"
|
||||
]
|
||||
}
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"groups": groups,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT",
|
||||
"http://localhost:9090/api/v1/user/"+userName+"/groups",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func CreateServiceAccountForUser(userName, policy string) (*http.Response, error) {
|
||||
userName = base64.StdEncoding.EncodeToString([]byte(userName))
|
||||
/*
|
||||
Helper function to Create Service Account for user
|
||||
POST: api/v1/user/username/service-accounts
|
||||
{
|
||||
"policy": "ad magna"
|
||||
}
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"policy": policy,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/user/"+userName+"/service-accounts",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func CreateServiceAccountForUserWithCredentials(userName, policy, accessKey, secretKey string) (*http.Response, error) {
|
||||
userName = base64.StdEncoding.EncodeToString([]byte(userName))
|
||||
// Helper function to test "Create Service Account for User With Credentials" end point.
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"policy": policy,
|
||||
"accessKey": accessKey,
|
||||
"secretKey": secretKey,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/user/"+userName+"/service-account-credentials",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func ReturnsAListOfServiceAccountsForAUser(userName string) (*http.Response, error) {
|
||||
userName = base64.StdEncoding.EncodeToString([]byte(userName))
|
||||
/*
|
||||
Helper function to return a list of service accounts for a user.
|
||||
GET: {{baseUrl}}/user/:name/service-accounts
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
request, err := http.NewRequest(
|
||||
"GET",
|
||||
"http://localhost:9090/api/v1/user/"+userName+"/service-accounts",
|
||||
nil,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func AddGroup(group string, members []string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to add a group.
|
||||
*/
|
||||
client := &http.Client{
|
||||
Timeout: 3 * time.Second,
|
||||
}
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"group": group,
|
||||
"members": members,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"POST",
|
||||
"http://localhost:9090/api/v1/groups",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func UsersGroupsBulk(users, groups []string) (*http.Response, error) {
|
||||
/*
|
||||
Helper function to test Bulk functionality to Add Users to Groups.
|
||||
PUT: {{baseUrl}}/users-groups-bulk
|
||||
{
|
||||
"users": [
|
||||
"magna id",
|
||||
"enim sit tempor incididunt"
|
||||
],
|
||||
"groups": [
|
||||
"nisi est esse",
|
||||
"fugiat eu"
|
||||
]
|
||||
}
|
||||
*/
|
||||
requestDataAdd := map[string]interface{}{
|
||||
"users": users,
|
||||
"groups": groups,
|
||||
}
|
||||
requestDataJSON, _ := json.Marshal(requestDataAdd)
|
||||
requestDataBody := bytes.NewReader(requestDataJSON)
|
||||
request, err := http.NewRequest(
|
||||
"PUT",
|
||||
"http://localhost:9090/api/v1/users-groups-bulk",
|
||||
requestDataBody,
|
||||
)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
|
||||
request.Header.Add("Content-Type", "application/json")
|
||||
client := &http.Client{
|
||||
Timeout: 2 * time.Second,
|
||||
}
|
||||
response, err := client.Do(request)
|
||||
return response, err
|
||||
}
|
||||
|
||||
func TestAddUser(t *testing.T) {
|
||||
/*
|
||||
This is an API Test to add a user via api/v1/users, the intention
|
||||
@@ -196,20 +372,13 @@ func TestAddUser(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
// With no groups & no policies
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
|
||||
fmt.Println(".................................TestAddUser(): Make the POST")
|
||||
groups := []string{}
|
||||
policies := []string{}
|
||||
response, err := AddUser("accessKey", "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("..................................TestAddUser(): Verification")
|
||||
fmt.Println(".................................TestAddUser(): POST response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("....................................TestAddUser(): POST error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
@@ -220,16 +389,10 @@ func TestAddUser(t *testing.T) {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("..................................TestAddUser(): Verification")
|
||||
fmt.Println("...............................TestAddUser(): DELETE response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("..................................TestAddUser(): DELETE error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("DELETE StatusCode:", response.StatusCode)
|
||||
assert.Equal(204, response.StatusCode, "has to be 204 when delete user")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestListUsers(t *testing.T) {
|
||||
@@ -243,14 +406,12 @@ func TestListUsers(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
// With no groups & no policies
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
groups := []string{}
|
||||
policies := []string{}
|
||||
|
||||
// 1. Create the users
|
||||
numberOfUsers := 5
|
||||
for i := 1; i < numberOfUsers; i++ {
|
||||
fmt.Println("............................TestListUsers(): Adding users")
|
||||
fmt.Println(strconv.Itoa(i) + "accessKey" + strconv.Itoa(i))
|
||||
response, err := AddUser(
|
||||
strconv.Itoa(i)+"accessKey"+strconv.Itoa(i),
|
||||
"secretKey"+strconv.Itoa(i), groups, policies)
|
||||
@@ -258,11 +419,6 @@ func TestListUsers(t *testing.T) {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("............................TestListUsers(): Verification")
|
||||
fmt.Println("...........................TestListUsers(): POST response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("..............................TestListUsers(): POST error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode,
|
||||
@@ -300,11 +456,6 @@ func TestListUsers(t *testing.T) {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Println("............................TestListUsers(): Verification")
|
||||
fmt.Println(".........................TestListUsers(): DELETE response")
|
||||
fmt.Println(response)
|
||||
fmt.Println("............................TestListUsers(): DELETE error")
|
||||
fmt.Println(err)
|
||||
if response != nil {
|
||||
fmt.Println("DELETE StatusCode:", response.StatusCode)
|
||||
assert.Equal(204,
|
||||
@@ -321,8 +472,8 @@ func TestGetUserInfo(t *testing.T) {
|
||||
// 1. Create the user
|
||||
fmt.Println("TestGetUserInfo(): 1. Create the user")
|
||||
assert := assert.New(t)
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
groups := []string{}
|
||||
policies := []string{}
|
||||
response, err := AddUser("accessKey", "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
@@ -366,8 +517,8 @@ func TestUpdateUserInfoSuccessfulResponse(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
// 1. Create an active user
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
groups := []string{}
|
||||
policies := []string{}
|
||||
addUserResponse, addUserError := AddUser(
|
||||
"updateuser", "secretKey", groups, policies)
|
||||
if addUserError != nil {
|
||||
@@ -400,7 +551,6 @@ func TestUpdateUserInfoSuccessfulResponse(t *testing.T) {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
assert.True(strings.Contains(string(b), "disabled"))
|
||||
|
||||
}
|
||||
|
||||
func TestUpdateUserInfoGenericErrorResponse(t *testing.T) {
|
||||
@@ -411,8 +561,8 @@ func TestUpdateUserInfoGenericErrorResponse(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
// 1. Create an active user
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
groups := []string{}
|
||||
policies := []string{}
|
||||
addUserResponse, addUserError := AddUser(
|
||||
"updateusererror", "secretKey", groups, policies)
|
||||
if addUserError != nil {
|
||||
@@ -445,18 +595,18 @@ func TestUpdateUserInfoGenericErrorResponse(t *testing.T) {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
assert.True(strings.Contains(string(b), "status not valid"))
|
||||
|
||||
}
|
||||
|
||||
func TestRemoveUserSuccessfulResponse(t *testing.T) {
|
||||
/*
|
||||
To test removing a user from API
|
||||
*/
|
||||
|
||||
assert := assert.New(t)
|
||||
|
||||
// 1. Create an active user
|
||||
var groups = []string{}
|
||||
var policies = []string{}
|
||||
groups := []string{}
|
||||
policies := []string{}
|
||||
addUserResponse, addUserError := AddUser(
|
||||
"testremoveuser1", "secretKey", groups, policies)
|
||||
if addUserError != nil {
|
||||
@@ -495,8 +645,275 @@ func TestRemoveUserSuccessfulResponse(t *testing.T) {
|
||||
404, getUserInfoResponse.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(getUserInfoResponse)
|
||||
printMessage(finalResponse)
|
||||
fmt.Println(finalResponse)
|
||||
assert.True(strings.Contains(
|
||||
finalResponse, "The specified user does not exist"), finalResponse)
|
||||
|
||||
}
|
||||
|
||||
func TestUpdateGroupsForAUser(t *testing.T) {
|
||||
/*
|
||||
To test Update Groups For a User End Point.
|
||||
*/
|
||||
|
||||
// 1. Create the user
|
||||
numberOfGroups := 3
|
||||
groupName := "updategroupforausergroup"
|
||||
userName := "updategroupsforauser1"
|
||||
assert := assert.New(t)
|
||||
groups := []string{}
|
||||
policies := []string{}
|
||||
response, err := AddUser(userName, "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 2. Update the groups of the created user with newGroups
|
||||
newGroups := make([]string, 3)
|
||||
for i := 0; i < numberOfGroups; i++ {
|
||||
newGroups[i] = groupName + strconv.Itoa(i)
|
||||
}
|
||||
response, err = UpdateGroupsForAUser(userName, newGroups)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("StatusCode:", response.StatusCode)
|
||||
assert.Equal(200, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 3. Verify the newGroups were updated accordingly
|
||||
getUserInfoResponse, getUserInfoErr := GetUserInformation(userName)
|
||||
if getUserInfoErr != nil {
|
||||
log.Println(getUserInfoErr)
|
||||
assert.Fail("There was an error in the response")
|
||||
return
|
||||
}
|
||||
if getUserInfoResponse != nil {
|
||||
fmt.Println("StatusCode:", getUserInfoResponse.StatusCode)
|
||||
assert.Equal(
|
||||
200, getUserInfoResponse.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(getUserInfoResponse)
|
||||
for i := 0; i < numberOfGroups; i++ {
|
||||
assert.True(strings.Contains(
|
||||
finalResponse, groupName+strconv.Itoa(i)), finalResponse)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateServiceAccountForUser(t *testing.T) {
|
||||
/*
|
||||
To test creation of service account for a user.
|
||||
*/
|
||||
|
||||
// Test's variables
|
||||
userName := "testcreateserviceaccountforuser1"
|
||||
assert := assert.New(t)
|
||||
policy := ""
|
||||
|
||||
// 1. Create the user
|
||||
groups := []string{}
|
||||
policies := []string{}
|
||||
response, err := AddUser(userName, "secretKey", groups, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode, "Status Code is incorrect")
|
||||
}
|
||||
|
||||
// 2. Create the service account for the user
|
||||
createServiceAccountResponse,
|
||||
createServiceAccountError := CreateServiceAccountForUser(
|
||||
userName,
|
||||
policy,
|
||||
)
|
||||
if createServiceAccountError != nil {
|
||||
log.Println(createServiceAccountError)
|
||||
assert.Fail("Error in createServiceAccountError")
|
||||
}
|
||||
if createServiceAccountResponse != nil {
|
||||
fmt.Println("StatusCode:", createServiceAccountResponse.StatusCode)
|
||||
assert.Equal(
|
||||
201, createServiceAccountResponse.StatusCode,
|
||||
inspectHTTPResponse(createServiceAccountResponse),
|
||||
)
|
||||
}
|
||||
|
||||
// 3. Verify the service account for the user
|
||||
listOfAccountsResponse, listOfAccountsError := ReturnsAListOfServiceAccountsForAUser(userName)
|
||||
|
||||
fmt.Println(listOfAccountsResponse, listOfAccountsError)
|
||||
|
||||
if listOfAccountsError != nil {
|
||||
log.Println(listOfAccountsError)
|
||||
assert.Fail("Error in listOfAccountsError")
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(listOfAccountsResponse)
|
||||
if listOfAccountsResponse != nil {
|
||||
fmt.Println("StatusCode:", listOfAccountsResponse.StatusCode)
|
||||
assert.Equal(
|
||||
200, listOfAccountsResponse.StatusCode,
|
||||
finalResponse,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUsersGroupsBulk(t *testing.T) {
|
||||
/*
|
||||
To test UsersGroupsBulk End Point
|
||||
*/
|
||||
|
||||
// Vars
|
||||
assert := assert.New(t)
|
||||
numberOfUsers := 5
|
||||
numberOfGroups := 1
|
||||
// var groups = []string{}
|
||||
policies := []string{}
|
||||
username := "testusersgroupbulk"
|
||||
groupName := "testusersgroupsbulkgroupone"
|
||||
members := []string{}
|
||||
users := make([]string, numberOfUsers)
|
||||
groups := make([]string, numberOfGroups)
|
||||
|
||||
// 1. Create some users
|
||||
for i := 0; i < numberOfUsers; i++ {
|
||||
users[i] = username + strconv.Itoa(i)
|
||||
response, err := AddUser(
|
||||
users[i],
|
||||
"secretKey"+strconv.Itoa(i), []string{}, policies)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
if response != nil {
|
||||
fmt.Println("POST StatusCode:", response.StatusCode)
|
||||
assert.Equal(201, response.StatusCode,
|
||||
"Status Code is incorrect on index: "+strconv.Itoa(i))
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Create a group with no members
|
||||
responseAddGroup, errorAddGroup := AddGroup(groupName, members)
|
||||
if errorAddGroup != nil {
|
||||
log.Println(errorAddGroup)
|
||||
return
|
||||
}
|
||||
finalResponse := inspectHTTPResponse(responseAddGroup)
|
||||
if responseAddGroup != nil {
|
||||
fmt.Println("POST StatusCode:", responseAddGroup.StatusCode)
|
||||
assert.Equal(
|
||||
201,
|
||||
responseAddGroup.StatusCode,
|
||||
finalResponse,
|
||||
)
|
||||
}
|
||||
|
||||
// 3. Add users to the group
|
||||
groups[0] = groupName
|
||||
responseUsersGroupsBulk, errorUsersGroupsBulk := UsersGroupsBulk(
|
||||
users,
|
||||
groups,
|
||||
)
|
||||
if errorUsersGroupsBulk != nil {
|
||||
log.Println(errorUsersGroupsBulk)
|
||||
return
|
||||
}
|
||||
finalResponse = inspectHTTPResponse(responseUsersGroupsBulk)
|
||||
if responseUsersGroupsBulk != nil {
|
||||
fmt.Println("POST StatusCode:", responseUsersGroupsBulk.StatusCode)
|
||||
assert.Equal(
|
||||
200,
|
||||
responseUsersGroupsBulk.StatusCode,
|
||||
finalResponse,
|
||||
)
|
||||
}
|
||||
|
||||
// 4. Verify users got added to the group
|
||||
for i := 0; i < numberOfUsers; i++ {
|
||||
responseGetUserInfo, errGetUserInfo := GetUserInformation(
|
||||
username + strconv.Itoa(i),
|
||||
)
|
||||
if errGetUserInfo != nil {
|
||||
log.Println(errGetUserInfo)
|
||||
assert.Fail("There was an error in the response")
|
||||
return
|
||||
}
|
||||
finalResponse = inspectHTTPResponse(responseGetUserInfo)
|
||||
if responseGetUserInfo != nil {
|
||||
assert.Equal(200, responseGetUserInfo.StatusCode, finalResponse)
|
||||
}
|
||||
// Make sure the user belongs to the created group
|
||||
assert.True(strings.Contains(finalResponse, groupName))
|
||||
}
|
||||
}
|
||||
|
||||
func Test_GetUserPolicyAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
// 1. Create an active user with valid policy
|
||||
groups := []string{}
|
||||
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")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +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/>.
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# setup environment variables based on flags to see if we should build the docker containers again
|
||||
CONSOLE_DOCKER="true"
|
||||
|
||||
# evaluate flags
|
||||
# `-m` for console
|
||||
|
||||
|
||||
while getopts ":m:" opt; do
|
||||
case $opt in
|
||||
m)
|
||||
CONSOLE_DOCKER="$OPTARG"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument." >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "Provisioning Kind"
|
||||
kind create cluster --config kind-cluster.yaml
|
||||
echo "Remove Master Taint"
|
||||
kubectl taint nodes --all node-role.kubernetes.io/master-
|
||||
echo "Install Contour"
|
||||
kubectl apply -f https://projectcontour.io/quickstart/contour.yaml
|
||||
kubectl patch daemonsets -n projectcontour envoy -p '{"spec":{"template":{"spec":{"nodeSelector":{"ingress-ready":"true"},"tolerations":[{"key":"node-role.kubernetes.io/master","operator":"Equal","effect":"NoSchedule"}]}}}}'
|
||||
echo "install metrics server"
|
||||
kubectl apply -f metrics-dev.yaml
|
||||
|
||||
# Whether or not to build the m3 container and load it to kind or just load it
|
||||
if [[ $CONSOLE_DOCKER == "true" ]]; then
|
||||
# Build mkube
|
||||
make --directory=".." k8sdev TAG=minio/console:latest
|
||||
else
|
||||
kind load docker-image minio/console:latest
|
||||
fi
|
||||
|
||||
echo "done"
|
||||
@@ -1,22 +0,0 @@
|
||||
# three node (two workers) cluster config
|
||||
kind: Cluster
|
||||
apiVersion: kind.x-k8s.io/v1alpha4
|
||||
nodes:
|
||||
- role: control-plane
|
||||
kubeadmConfigPatches:
|
||||
- |
|
||||
kind: InitConfiguration
|
||||
nodeRegistration:
|
||||
kubeletExtraArgs:
|
||||
node-labels: "ingress-ready=true"
|
||||
extraPortMappings:
|
||||
- containerPort: 80
|
||||
hostPort: 8844
|
||||
protocol: TCP
|
||||
- containerPort: 443
|
||||
hostPort: 8843
|
||||
protocol: TCP
|
||||
#- role: worker
|
||||
#- role: worker
|
||||
#- role: worker
|
||||
#- role: worker
|
||||
@@ -1,153 +0,0 @@
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:aggregated-metrics-reader
|
||||
labels:
|
||||
rbac.authorization.k8s.io/aggregate-to-view: "true"
|
||||
rbac.authorization.k8s.io/aggregate-to-edit: "true"
|
||||
rbac.authorization.k8s.io/aggregate-to-admin: "true"
|
||||
rules:
|
||||
- apiGroups: ["metrics.k8s.io"]
|
||||
resources: ["pods", "nodes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: metrics-server:system:auth-delegator
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:auth-delegator
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: metrics-server
|
||||
namespace: kube-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: metrics-server-auth-reader
|
||||
namespace: kube-system
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: extension-apiserver-authentication-reader
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: metrics-server
|
||||
namespace: kube-system
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: system:metrics-server
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
- nodes
|
||||
- nodes/stats
|
||||
- namespaces
|
||||
- configmaps
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: system:metrics-server
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:metrics-server
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: metrics-server
|
||||
namespace: kube-system
|
||||
---
|
||||
apiVersion: apiregistration.k8s.io/v1beta1
|
||||
kind: APIService
|
||||
metadata:
|
||||
name: v1beta1.metrics.k8s.io
|
||||
spec:
|
||||
service:
|
||||
name: metrics-server
|
||||
namespace: kube-system
|
||||
group: metrics.k8s.io
|
||||
version: v1beta1
|
||||
insecureSkipTLSVerify: true
|
||||
groupPriorityMinimum: 100
|
||||
versionPriority: 100
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: metrics-server
|
||||
namespace: kube-system
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: metrics-server
|
||||
namespace: kube-system
|
||||
labels:
|
||||
kubernetes.io/name: "Metrics-server"
|
||||
kubernetes.io/cluster-service: "true"
|
||||
spec:
|
||||
selector:
|
||||
k8s-app: metrics-server
|
||||
ports:
|
||||
- port: 443
|
||||
protocol: TCP
|
||||
targetPort: main-port
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: metrics-server
|
||||
namespace: kube-system
|
||||
labels:
|
||||
k8s-app: metrics-server
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: metrics-server
|
||||
template:
|
||||
metadata:
|
||||
name: metrics-server
|
||||
labels:
|
||||
k8s-app: metrics-server
|
||||
spec:
|
||||
serviceAccountName: metrics-server
|
||||
volumes:
|
||||
# mount in tmp so we can safely use from-scratch images and/or read-only containers
|
||||
- name: tmp-dir
|
||||
emptyDir: {}
|
||||
containers:
|
||||
- name: metrics-server
|
||||
image: k8s.gcr.io/metrics-server-amd64:v0.3.6
|
||||
args:
|
||||
- --cert-dir=/tmp
|
||||
- --secure-port=4443
|
||||
- --kubelet-insecure-tls
|
||||
- --kubelet-preferred-address-types=InternalIP
|
||||
ports:
|
||||
- name: main-port
|
||||
containerPort: 4443
|
||||
protocol: TCP
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
imagePullPolicy: Always
|
||||
volumeMounts:
|
||||
- name: tmp-dir
|
||||
mountPath: /tmp
|
||||
nodeSelector:
|
||||
beta.kubernetes.io/os: linux
|
||||
kubernetes.io/arch: "amd64"
|
||||
@@ -1,12 +0,0 @@
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: console-sa-binding
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: console-sa-role
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: console-sa
|
||||
namespace: default
|
||||
@@ -1,234 +0,0 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: console-sa-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- secrets
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- create
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- namespaces
|
||||
- services
|
||||
- events
|
||||
- resourcequotas
|
||||
- nodes
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- create
|
||||
- list
|
||||
- patch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- create
|
||||
- list
|
||||
- patch
|
||||
- delete
|
||||
- deletecollection
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- persistentvolumeclaims
|
||||
verbs:
|
||||
- deletecollection
|
||||
- list
|
||||
- get
|
||||
- watch
|
||||
- update
|
||||
- apiGroups:
|
||||
- "storage.k8s.io"
|
||||
resources:
|
||||
- storageclasses
|
||||
verbs:
|
||||
- get
|
||||
- watch
|
||||
- create
|
||||
- list
|
||||
- patch
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- statefulsets
|
||||
- deployments
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- list
|
||||
- patch
|
||||
- watch
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- batch
|
||||
resources:
|
||||
- jobs
|
||||
verbs:
|
||||
- get
|
||||
- create
|
||||
- list
|
||||
- patch
|
||||
- watch
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- "certificates.k8s.io"
|
||||
resources:
|
||||
- "certificatesigningrequests"
|
||||
- "certificatesigningrequests/approval"
|
||||
- "certificatesigningrequests/status"
|
||||
verbs:
|
||||
- update
|
||||
- create
|
||||
- get
|
||||
- apiGroups:
|
||||
- minio.min.io
|
||||
resources:
|
||||
- "*"
|
||||
verbs:
|
||||
- "*"
|
||||
- apiGroups:
|
||||
- min.io
|
||||
resources:
|
||||
- "*"
|
||||
verbs:
|
||||
- "*"
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- persistentvolumes
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- persistentvolumeclaims
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- list
|
||||
- watch
|
||||
- update
|
||||
- patch
|
||||
- apiGroups:
|
||||
- snapshot.storage.k8s.io
|
||||
resources:
|
||||
- volumesnapshots
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- apiGroups:
|
||||
- snapshot.storage.k8s.io
|
||||
resources:
|
||||
- volumesnapshotcontents
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- apiGroups:
|
||||
- storage.k8s.io
|
||||
resources:
|
||||
- csinodes
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- storage.k8s.io
|
||||
resources:
|
||||
- volumeattachments
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- endpoints
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- coordination.k8s.io
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- direct.csi.min.io
|
||||
resources:
|
||||
- volumes
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- direct.csi.min.io
|
||||
resources:
|
||||
- directcsidrives
|
||||
- directcsivolumes
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pod
|
||||
- pods/log
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
@@ -1,7 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: console-env
|
||||
data:
|
||||
CONSOLE_PORT: "9090"
|
||||
CONSOLE_TLS_PORT: "9443"
|
||||
@@ -1,29 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: console
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: console
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: console
|
||||
spec:
|
||||
serviceAccountName: console-sa
|
||||
containers:
|
||||
- name: console
|
||||
image: minio/console:v0.14.0
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
env:
|
||||
- name: CONSOLE_OPERATOR_MODE
|
||||
value: "on"
|
||||
args:
|
||||
- server
|
||||
ports:
|
||||
- containerPort: 9090
|
||||
name: http
|
||||
- containerPort: 9433
|
||||
name: https
|
||||
@@ -1,5 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: console-sa
|
||||
namespace: default
|
||||
@@ -1,14 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: console
|
||||
labels:
|
||||
name: console
|
||||
spec:
|
||||
ports:
|
||||
- port: 9090
|
||||
name: http
|
||||
- port: 9443
|
||||
name: https
|
||||
selector:
|
||||
app: console
|
||||
@@ -1,10 +0,0 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
# beginning of customizations
|
||||
resources:
|
||||
- console-service-account.yaml
|
||||
- console-cluster-role.yaml
|
||||
- console-cluster-role-binding.yaml
|
||||
- console-configmap.yaml
|
||||
- console-service.yaml
|
||||
- console-deployment.yaml
|
||||
@@ -1,46 +0,0 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: console
|
||||
namespace: default
|
||||
labels:
|
||||
name: console
|
||||
spec:
|
||||
ports:
|
||||
- port: 9090
|
||||
name: http
|
||||
- port: 9443
|
||||
name: https
|
||||
selector:
|
||||
app: console-standalone
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: console
|
||||
namespace: default
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: console-standalone
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: console-standalone
|
||||
spec:
|
||||
containers:
|
||||
- name: console
|
||||
image: minio/console:v0.14.0
|
||||
imagePullPolicy: "IfNotPresent"
|
||||
env:
|
||||
- name: CONSOLE_MINIO_SERVER
|
||||
value: "https://minio.default.svc.cluster.local"
|
||||
args:
|
||||
- server
|
||||
ports:
|
||||
- containerPort: 9090
|
||||
name: http
|
||||
- containerPort: 9433
|
||||
name: https
|
||||
20
k8s/tools.go
20
k8s/tools.go
@@ -1,20 +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 k8s - this package imports things required by build scripts, to force `go mod` to see them as dependencies
|
||||
package k8s
|
||||
|
||||
// import _ "k8s.io/code-generator"
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2017 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
|
||||
|
||||
# generate the code with:
|
||||
# --output-base because this script should also be able to run inside the vendor dir of
|
||||
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
|
||||
# instead of the $GOPATH directly. For normal projects this can be dropped.
|
||||
bash "${CODEGEN_PKG}"/generate-groups.sh "all" \
|
||||
github.com/minio/console/pkg/generated \
|
||||
github.com/minio/console/pkg/apis \
|
||||
mkube:v1 \
|
||||
--go-header-file "${SCRIPT_ROOT}"/k8s/boilerplate.go.txt
|
||||
|
||||
# To use your own boilerplate text append:
|
||||
# --go-header-file "${SCRIPT_ROOT}"/hack/custom-boilerplate.go.txt
|
||||
67
models/a_user_policy_response.go
Normal file
67
models/a_user_policy_response.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// AUserPolicyResponse a user policy response
|
||||
//
|
||||
// swagger:model aUserPolicyResponse
|
||||
type AUserPolicyResponse struct {
|
||||
|
||||
// policy
|
||||
Policy string `json:"policy,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this a user policy response
|
||||
func (m *AUserPolicyResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this a user policy response based on context it is used
|
||||
func (m *AUserPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AUserPolicyResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AUserPolicyResponse) UnmarshalBinary(b []byte) error {
|
||||
var res AUserPolicyResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -24,9 +24,12 @@ package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AddBucketLifecycle add bucket lifecycle
|
||||
@@ -40,12 +43,12 @@ type AddBucketLifecycle struct {
|
||||
// Non required, toggle to disable or enable rule
|
||||
ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"`
|
||||
|
||||
// Required in case of expiry_days or transition fields are not set. it defines an expiry date for ILM
|
||||
ExpiryDate string `json:"expiry_date,omitempty"`
|
||||
|
||||
// Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM
|
||||
ExpiryDays int32 `json:"expiry_days,omitempty"`
|
||||
|
||||
// Non required, can be set in case of expiration is enabled
|
||||
NewerNoncurrentversionExpirationVersions int32 `json:"newer_noncurrentversion_expiration_versions,omitempty"`
|
||||
|
||||
// Non required, can be set in case of expiration is enabled
|
||||
NoncurrentversionExpirationDays int32 `json:"noncurrentversion_expiration_days,omitempty"`
|
||||
|
||||
@@ -64,15 +67,67 @@ type AddBucketLifecycle struct {
|
||||
// Non required field, tags to match ILM files
|
||||
Tags string `json:"tags,omitempty"`
|
||||
|
||||
// Required in case of transition_days or expiry fields are not set. it defines a transition date for ILM
|
||||
TransitionDate string `json:"transition_date,omitempty"`
|
||||
|
||||
// Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM
|
||||
TransitionDays int32 `json:"transition_days,omitempty"`
|
||||
|
||||
// ILM Rule type (Expiry or transition)
|
||||
// Enum: [expiry transition]
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this add bucket lifecycle
|
||||
func (m *AddBucketLifecycle) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateType(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var addBucketLifecycleTypeTypePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
addBucketLifecycleTypeTypePropEnum = append(addBucketLifecycleTypeTypePropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// AddBucketLifecycleTypeExpiry captures enum value "expiry"
|
||||
AddBucketLifecycleTypeExpiry string = "expiry"
|
||||
|
||||
// AddBucketLifecycleTypeTransition captures enum value "transition"
|
||||
AddBucketLifecycleTypeTransition string = "transition"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *AddBucketLifecycle) validateTypeEnum(path, location string, value string) error {
|
||||
if err := validate.EnumCase(path, location, value, addBucketLifecycleTypeTypePropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AddBucketLifecycle) validateType(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Type) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validateTypeEnum("type", "body", m.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
168
models/add_multi_bucket_lifecycle.go
Normal file
168
models/add_multi_bucket_lifecycle.go
Normal file
@@ -0,0 +1,168 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AddMultiBucketLifecycle add multi bucket lifecycle
|
||||
//
|
||||
// swagger:model addMultiBucketLifecycle
|
||||
type AddMultiBucketLifecycle struct {
|
||||
|
||||
// buckets
|
||||
// Required: true
|
||||
Buckets []string `json:"buckets"`
|
||||
|
||||
// Non required, toggle to disable or enable rule
|
||||
ExpiredObjectDeleteMarker bool `json:"expired_object_delete_marker,omitempty"`
|
||||
|
||||
// Required in case of expiry_date or transition fields are not set. it defines an expiry days for ILM
|
||||
ExpiryDays int32 `json:"expiry_days,omitempty"`
|
||||
|
||||
// Non required, can be set in case of expiration is enabled
|
||||
NoncurrentversionExpirationDays int32 `json:"noncurrentversion_expiration_days,omitempty"`
|
||||
|
||||
// Non required, can be set in case of transition is enabled
|
||||
NoncurrentversionTransitionDays int32 `json:"noncurrentversion_transition_days,omitempty"`
|
||||
|
||||
// Non required, can be set in case of transition is enabled
|
||||
NoncurrentversionTransitionStorageClass string `json:"noncurrentversion_transition_storage_class,omitempty"`
|
||||
|
||||
// Non required field, it matches a prefix to perform ILM operations on it
|
||||
Prefix string `json:"prefix,omitempty"`
|
||||
|
||||
// Required only in case of transition is set. it refers to a tier
|
||||
StorageClass string `json:"storage_class,omitempty"`
|
||||
|
||||
// Non required field, tags to match ILM files
|
||||
Tags string `json:"tags,omitempty"`
|
||||
|
||||
// Required in case of transition_date or expiry fields are not set. it defines a transition days for ILM
|
||||
TransitionDays int32 `json:"transition_days,omitempty"`
|
||||
|
||||
// ILM Rule type (Expiry or transition)
|
||||
// Required: true
|
||||
// Enum: [expiry transition]
|
||||
Type *string `json:"type"`
|
||||
}
|
||||
|
||||
// Validate validates this add multi bucket lifecycle
|
||||
func (m *AddMultiBucketLifecycle) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateBuckets(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateType(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AddMultiBucketLifecycle) validateBuckets(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("buckets", "body", m.Buckets); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var addMultiBucketLifecycleTypeTypePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["expiry","transition"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
addMultiBucketLifecycleTypeTypePropEnum = append(addMultiBucketLifecycleTypeTypePropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// AddMultiBucketLifecycleTypeExpiry captures enum value "expiry"
|
||||
AddMultiBucketLifecycleTypeExpiry string = "expiry"
|
||||
|
||||
// AddMultiBucketLifecycleTypeTransition captures enum value "transition"
|
||||
AddMultiBucketLifecycleTypeTransition string = "transition"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *AddMultiBucketLifecycle) validateTypeEnum(path, location string, value string) error {
|
||||
if err := validate.EnumCase(path, location, value, addMultiBucketLifecycleTypeTypePropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AddMultiBucketLifecycle) validateType(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("type", "body", m.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validateTypeEnum("type", "body", *m.Type); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this add multi bucket lifecycle based on context it is used
|
||||
func (m *AddMultiBucketLifecycle) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AddMultiBucketLifecycle) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AddMultiBucketLifecycle) UnmarshalBinary(b []byte) error {
|
||||
var res AddMultiBucketLifecycle
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -24,11 +24,13 @@ package models
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strconv"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AdminInfoResponse admin info response
|
||||
@@ -36,15 +38,19 @@ import (
|
||||
// swagger:model adminInfoResponse
|
||||
type AdminInfoResponse struct {
|
||||
|
||||
// advanced metrics status
|
||||
// Enum: [not configured available unavailable]
|
||||
AdvancedMetricsStatus string `json:"advancedMetricsStatus,omitempty"`
|
||||
|
||||
// backend
|
||||
Backend *BackendProperties `json:"backend,omitempty"`
|
||||
|
||||
// buckets
|
||||
Buckets int64 `json:"buckets,omitempty"`
|
||||
|
||||
// objects
|
||||
Objects int64 `json:"objects,omitempty"`
|
||||
|
||||
// prometheus not ready
|
||||
PrometheusNotReady bool `json:"prometheusNotReady,omitempty"`
|
||||
|
||||
// servers
|
||||
Servers []*ServerProperties `json:"servers"`
|
||||
|
||||
@@ -59,6 +65,14 @@ type AdminInfoResponse struct {
|
||||
func (m *AdminInfoResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateAdvancedMetricsStatus(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateBackend(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateServers(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -73,6 +87,70 @@ func (m *AdminInfoResponse) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var adminInfoResponseTypeAdvancedMetricsStatusPropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["not configured","available","unavailable"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
adminInfoResponseTypeAdvancedMetricsStatusPropEnum = append(adminInfoResponseTypeAdvancedMetricsStatusPropEnum, v)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
// AdminInfoResponseAdvancedMetricsStatusNotConfigured captures enum value "not configured"
|
||||
AdminInfoResponseAdvancedMetricsStatusNotConfigured string = "not configured"
|
||||
|
||||
// AdminInfoResponseAdvancedMetricsStatusAvailable captures enum value "available"
|
||||
AdminInfoResponseAdvancedMetricsStatusAvailable string = "available"
|
||||
|
||||
// AdminInfoResponseAdvancedMetricsStatusUnavailable captures enum value "unavailable"
|
||||
AdminInfoResponseAdvancedMetricsStatusUnavailable string = "unavailable"
|
||||
)
|
||||
|
||||
// prop value enum
|
||||
func (m *AdminInfoResponse) validateAdvancedMetricsStatusEnum(path, location string, value string) error {
|
||||
if err := validate.EnumCase(path, location, value, adminInfoResponseTypeAdvancedMetricsStatusPropEnum, true); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AdminInfoResponse) validateAdvancedMetricsStatus(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.AdvancedMetricsStatus) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
// value enum
|
||||
if err := m.validateAdvancedMetricsStatusEnum("advancedMetricsStatus", "body", m.AdvancedMetricsStatus); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AdminInfoResponse) validateBackend(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Backend) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.Backend != nil {
|
||||
if err := m.Backend.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("backend")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("backend")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AdminInfoResponse) validateServers(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Servers) { // not required
|
||||
return nil
|
||||
@@ -129,6 +207,10 @@ func (m *AdminInfoResponse) validateWidgets(formats strfmt.Registry) error {
|
||||
func (m *AdminInfoResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateBackend(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateServers(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
@@ -143,11 +225,37 @@ func (m *AdminInfoResponse) ContextValidate(ctx context.Context, formats strfmt.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AdminInfoResponse) contextValidateBackend(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Backend != nil {
|
||||
|
||||
if swag.IsZero(m.Backend) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Backend.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("backend")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("backend")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AdminInfoResponse) contextValidateServers(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
for i := 0; i < len(m.Servers); i++ {
|
||||
|
||||
if m.Servers[i] != nil {
|
||||
|
||||
if swag.IsZero(m.Servers[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Servers[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("servers" + "." + strconv.Itoa(i))
|
||||
@@ -168,6 +276,11 @@ func (m *AdminInfoResponse) contextValidateWidgets(ctx context.Context, formats
|
||||
for i := 0; i < len(m.Widgets); i++ {
|
||||
|
||||
if m.Widgets[i] != nil {
|
||||
|
||||
if swag.IsZero(m.Widgets[i]) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Widgets[i].ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("widgets" + "." + strconv.Itoa(i))
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// AllocatableResourcesResponse allocatable resources response
|
||||
//
|
||||
// swagger:model allocatableResourcesResponse
|
||||
type AllocatableResourcesResponse struct {
|
||||
|
||||
// cpu priority
|
||||
CPUPriority *NodeMaxAllocatableResources `json:"cpu_priority,omitempty"`
|
||||
|
||||
// mem priority
|
||||
MemPriority *NodeMaxAllocatableResources `json:"mem_priority,omitempty"`
|
||||
|
||||
// min allocatable cpu
|
||||
MinAllocatableCPU int64 `json:"min_allocatable_cpu,omitempty"`
|
||||
|
||||
// min allocatable mem
|
||||
MinAllocatableMem int64 `json:"min_allocatable_mem,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this allocatable resources response
|
||||
func (m *AllocatableResourcesResponse) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateCPUPriority(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateMemPriority(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AllocatableResourcesResponse) validateCPUPriority(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.CPUPriority) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.CPUPriority != nil {
|
||||
if err := m.CPUPriority.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("cpu_priority")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("cpu_priority")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AllocatableResourcesResponse) validateMemPriority(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.MemPriority) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.MemPriority != nil {
|
||||
if err := m.MemPriority.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("mem_priority")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("mem_priority")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this allocatable resources response based on the context it is used
|
||||
func (m *AllocatableResourcesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateCPUPriority(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.contextValidateMemPriority(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AllocatableResourcesResponse) contextValidateCPUPriority(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.CPUPriority != nil {
|
||||
if err := m.CPUPriority.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("cpu_priority")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("cpu_priority")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AllocatableResourcesResponse) contextValidateMemPriority(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.MemPriority != nil {
|
||||
if err := m.MemPriority.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("mem_priority")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("mem_priority")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AllocatableResourcesResponse) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AllocatableResourcesResponse) UnmarshalBinary(b []byte) error {
|
||||
var res AllocatableResourcesResponse
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// Annotation annotation
|
||||
//
|
||||
// swagger:model annotation
|
||||
type Annotation struct {
|
||||
|
||||
// key
|
||||
Key string `json:"key,omitempty"`
|
||||
|
||||
// value
|
||||
Value string `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this annotation
|
||||
func (m *Annotation) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this annotation based on context it is used
|
||||
func (m *Annotation) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *Annotation) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *Annotation) UnmarshalBinary(b []byte) error {
|
||||
var res Annotation
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
70
models/api_error.go
Normal file
70
models/api_error.go
Normal file
@@ -0,0 +1,70 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package 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"
|
||||
)
|
||||
|
||||
// APIError Api error
|
||||
//
|
||||
// swagger:model ApiError
|
||||
type APIError struct {
|
||||
|
||||
// detailed message
|
||||
DetailedMessage string `json:"detailedMessage,omitempty"`
|
||||
|
||||
// message
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this Api error
|
||||
func (m *APIError) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this Api error based on context it is used
|
||||
func (m *APIError) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *APIError) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *APIError) UnmarshalBinary(b []byte) error {
|
||||
var res APIError
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
67
models/api_key.go
Normal file
67
models/api_key.go
Normal file
@@ -0,0 +1,67 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// APIKey api key
|
||||
//
|
||||
// swagger:model apiKey
|
||||
type APIKey struct {
|
||||
|
||||
// api key
|
||||
APIKey string `json:"apiKey,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this api key
|
||||
func (m *APIKey) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this api key based on context it is used
|
||||
func (m *APIKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *APIKey) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *APIKey) UnmarshalBinary(b []byte) error {
|
||||
var res APIKey
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@@ -1,329 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AwsConfiguration aws configuration
|
||||
//
|
||||
// swagger:model awsConfiguration
|
||||
type AwsConfiguration struct {
|
||||
|
||||
// secretsmanager
|
||||
// Required: true
|
||||
Secretsmanager *AwsConfigurationSecretsmanager `json:"secretsmanager"`
|
||||
}
|
||||
|
||||
// Validate validates this aws configuration
|
||||
func (m *AwsConfiguration) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateSecretsmanager(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AwsConfiguration) validateSecretsmanager(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("secretsmanager", "body", m.Secretsmanager); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.Secretsmanager != nil {
|
||||
if err := m.Secretsmanager.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretsmanager")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretsmanager")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this aws configuration based on the context it is used
|
||||
func (m *AwsConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateSecretsmanager(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AwsConfiguration) contextValidateSecretsmanager(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Secretsmanager != nil {
|
||||
if err := m.Secretsmanager.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretsmanager")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretsmanager")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AwsConfiguration) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AwsConfiguration) UnmarshalBinary(b []byte) error {
|
||||
var res AwsConfiguration
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// AwsConfigurationSecretsmanager aws configuration secretsmanager
|
||||
//
|
||||
// swagger:model AwsConfigurationSecretsmanager
|
||||
type AwsConfigurationSecretsmanager struct {
|
||||
|
||||
// credentials
|
||||
// Required: true
|
||||
Credentials *AwsConfigurationSecretsmanagerCredentials `json:"credentials"`
|
||||
|
||||
// endpoint
|
||||
// Required: true
|
||||
Endpoint *string `json:"endpoint"`
|
||||
|
||||
// kmskey
|
||||
Kmskey string `json:"kmskey,omitempty"`
|
||||
|
||||
// region
|
||||
// Required: true
|
||||
Region *string `json:"region"`
|
||||
}
|
||||
|
||||
// Validate validates this aws configuration secretsmanager
|
||||
func (m *AwsConfigurationSecretsmanager) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateCredentials(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateEndpoint(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateRegion(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AwsConfigurationSecretsmanager) validateCredentials(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("secretsmanager"+"."+"credentials", "body", m.Credentials); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.Credentials != nil {
|
||||
if err := m.Credentials.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretsmanager" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretsmanager" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AwsConfigurationSecretsmanager) validateEndpoint(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("secretsmanager"+"."+"endpoint", "body", m.Endpoint); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AwsConfigurationSecretsmanager) validateRegion(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("secretsmanager"+"."+"region", "body", m.Region); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this aws configuration secretsmanager based on the context it is used
|
||||
func (m *AwsConfigurationSecretsmanager) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateCredentials(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AwsConfigurationSecretsmanager) contextValidateCredentials(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Credentials != nil {
|
||||
if err := m.Credentials.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("secretsmanager" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("secretsmanager" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AwsConfigurationSecretsmanager) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AwsConfigurationSecretsmanager) UnmarshalBinary(b []byte) error {
|
||||
var res AwsConfigurationSecretsmanager
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// AwsConfigurationSecretsmanagerCredentials aws configuration secretsmanager credentials
|
||||
//
|
||||
// swagger:model AwsConfigurationSecretsmanagerCredentials
|
||||
type AwsConfigurationSecretsmanagerCredentials struct {
|
||||
|
||||
// accesskey
|
||||
// Required: true
|
||||
Accesskey *string `json:"accesskey"`
|
||||
|
||||
// secretkey
|
||||
// Required: true
|
||||
Secretkey *string `json:"secretkey"`
|
||||
|
||||
// token
|
||||
Token string `json:"token,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this aws configuration secretsmanager credentials
|
||||
func (m *AwsConfigurationSecretsmanagerCredentials) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateAccesskey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateSecretkey(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AwsConfigurationSecretsmanagerCredentials) validateAccesskey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("secretsmanager"+"."+"credentials"+"."+"accesskey", "body", m.Accesskey); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AwsConfigurationSecretsmanagerCredentials) validateSecretkey(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("secretsmanager"+"."+"credentials"+"."+"secretkey", "body", m.Secretkey); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this aws configuration secretsmanager credentials based on context it is used
|
||||
func (m *AwsConfigurationSecretsmanagerCredentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AwsConfigurationSecretsmanagerCredentials) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AwsConfigurationSecretsmanagerCredentials) UnmarshalBinary(b []byte) error {
|
||||
var res AwsConfigurationSecretsmanagerCredentials
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -1,321 +0,0 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// AzureConfiguration azure configuration
|
||||
//
|
||||
// swagger:model azureConfiguration
|
||||
type AzureConfiguration struct {
|
||||
|
||||
// keyvault
|
||||
// Required: true
|
||||
Keyvault *AzureConfigurationKeyvault `json:"keyvault"`
|
||||
}
|
||||
|
||||
// Validate validates this azure configuration
|
||||
func (m *AzureConfiguration) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateKeyvault(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AzureConfiguration) validateKeyvault(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("keyvault", "body", m.Keyvault); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if m.Keyvault != nil {
|
||||
if err := m.Keyvault.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keyvault")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keyvault")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this azure configuration based on the context it is used
|
||||
func (m *AzureConfiguration) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateKeyvault(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AzureConfiguration) contextValidateKeyvault(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Keyvault != nil {
|
||||
if err := m.Keyvault.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keyvault")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keyvault")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AzureConfiguration) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AzureConfiguration) UnmarshalBinary(b []byte) error {
|
||||
var res AzureConfiguration
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// AzureConfigurationKeyvault azure configuration keyvault
|
||||
//
|
||||
// swagger:model AzureConfigurationKeyvault
|
||||
type AzureConfigurationKeyvault struct {
|
||||
|
||||
// credentials
|
||||
Credentials *AzureConfigurationKeyvaultCredentials `json:"credentials,omitempty"`
|
||||
|
||||
// endpoint
|
||||
// Required: true
|
||||
Endpoint *string `json:"endpoint"`
|
||||
}
|
||||
|
||||
// Validate validates this azure configuration keyvault
|
||||
func (m *AzureConfigurationKeyvault) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateCredentials(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateEndpoint(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AzureConfigurationKeyvault) validateCredentials(formats strfmt.Registry) error {
|
||||
if swag.IsZero(m.Credentials) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if m.Credentials != nil {
|
||||
if err := m.Credentials.Validate(formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keyvault" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keyvault" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AzureConfigurationKeyvault) validateEndpoint(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("keyvault"+"."+"endpoint", "body", m.Endpoint); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validate this azure configuration keyvault based on the context it is used
|
||||
func (m *AzureConfigurationKeyvault) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.contextValidateCredentials(ctx, formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AzureConfigurationKeyvault) contextValidateCredentials(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Credentials != nil {
|
||||
if err := m.Credentials.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("keyvault" + "." + "credentials")
|
||||
} else if ce, ok := err.(*errors.CompositeError); ok {
|
||||
return ce.ValidateName("keyvault" + "." + "credentials")
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AzureConfigurationKeyvault) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AzureConfigurationKeyvault) UnmarshalBinary(b []byte) error {
|
||||
var res AzureConfigurationKeyvault
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
|
||||
// AzureConfigurationKeyvaultCredentials azure configuration keyvault credentials
|
||||
//
|
||||
// swagger:model AzureConfigurationKeyvaultCredentials
|
||||
type AzureConfigurationKeyvaultCredentials struct {
|
||||
|
||||
// client id
|
||||
// Required: true
|
||||
ClientID *string `json:"client_id"`
|
||||
|
||||
// client secret
|
||||
// Required: true
|
||||
ClientSecret *string `json:"client_secret"`
|
||||
|
||||
// tenant id
|
||||
// Required: true
|
||||
TenantID *string `json:"tenant_id"`
|
||||
}
|
||||
|
||||
// Validate validates this azure configuration keyvault credentials
|
||||
func (m *AzureConfigurationKeyvaultCredentials) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateClientID(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateClientSecret(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateTenantID(formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AzureConfigurationKeyvaultCredentials) validateClientID(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("keyvault"+"."+"credentials"+"."+"client_id", "body", m.ClientID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AzureConfigurationKeyvaultCredentials) validateClientSecret(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("keyvault"+"."+"credentials"+"."+"client_secret", "body", m.ClientSecret); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *AzureConfigurationKeyvaultCredentials) validateTenantID(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("keyvault"+"."+"credentials"+"."+"tenant_id", "body", m.TenantID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this azure configuration keyvault credentials based on context it is used
|
||||
func (m *AzureConfigurationKeyvaultCredentials) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *AzureConfigurationKeyvaultCredentials) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *AzureConfigurationKeyvaultCredentials) UnmarshalBinary(b []byte) error {
|
||||
var res AzureConfigurationKeyvaultCredentials
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
79
models/backend_properties.go
Normal file
79
models/backend_properties.go
Normal file
@@ -0,0 +1,79 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
package 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"
|
||||
)
|
||||
|
||||
// BackendProperties backend properties
|
||||
//
|
||||
// swagger:model BackendProperties
|
||||
type BackendProperties struct {
|
||||
|
||||
// backend type
|
||||
BackendType string `json:"backendType,omitempty"`
|
||||
|
||||
// offline drives
|
||||
OfflineDrives int64 `json:"offlineDrives,omitempty"`
|
||||
|
||||
// online drives
|
||||
OnlineDrives int64 `json:"onlineDrives,omitempty"`
|
||||
|
||||
// rr s c parity
|
||||
RrSCParity int64 `json:"rrSCParity,omitempty"`
|
||||
|
||||
// standard s c parity
|
||||
StandardSCParity int64 `json:"standardSCParity,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this backend properties
|
||||
func (m *BackendProperties) Validate(formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ContextValidate validates this backend properties based on context it is used
|
||||
func (m *BackendProperties) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalBinary interface implementation
|
||||
func (m *BackendProperties) MarshalBinary() ([]byte, error) {
|
||||
if m == nil {
|
||||
return nil, nil
|
||||
}
|
||||
return swag.WriteJSON(m)
|
||||
}
|
||||
|
||||
// UnmarshalBinary interface implementation
|
||||
func (m *BackendProperties) UnmarshalBinary(b []byte) error {
|
||||
var res BackendProperties
|
||||
if err := swag.ReadJSON(b, &res); err != nil {
|
||||
return err
|
||||
}
|
||||
*m = res
|
||||
return nil
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -185,6 +185,11 @@ func (m *Bucket) ContextValidate(ctx context.Context, formats strfmt.Registry) e
|
||||
func (m *Bucket) contextValidateAccess(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Access != nil {
|
||||
|
||||
if swag.IsZero(m.Access) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Access.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("access")
|
||||
@@ -201,6 +206,11 @@ func (m *Bucket) contextValidateAccess(ctx context.Context, formats strfmt.Regis
|
||||
func (m *Bucket) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Details != nil {
|
||||
|
||||
if swag.IsZero(m.Details) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Details.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("details")
|
||||
@@ -217,6 +227,11 @@ func (m *Bucket) contextValidateDetails(ctx context.Context, formats strfmt.Regi
|
||||
func (m *Bucket) contextValidateRwAccess(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.RwAccess != nil {
|
||||
|
||||
if swag.IsZero(m.RwAccess) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.RwAccess.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("rw_access")
|
||||
@@ -322,6 +337,11 @@ func (m *BucketDetails) ContextValidate(ctx context.Context, formats strfmt.Regi
|
||||
func (m *BucketDetails) contextValidateQuota(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.Quota != nil {
|
||||
|
||||
if swag.IsZero(m.Quota) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.Quota.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("details" + "." + "quota")
|
||||
@@ -362,7 +382,7 @@ type BucketDetailsQuota struct {
|
||||
Quota int64 `json:"quota,omitempty"`
|
||||
|
||||
// type
|
||||
// Enum: [fifo hard]
|
||||
// Enum: [hard]
|
||||
Type string `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
@@ -384,7 +404,7 @@ var bucketDetailsQuotaTypeTypePropEnum []interface{}
|
||||
|
||||
func init() {
|
||||
var res []string
|
||||
if err := json.Unmarshal([]byte(`["fifo","hard"]`), &res); err != nil {
|
||||
if err := json.Unmarshal([]byte(`["hard"]`), &res); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
for _, v := range res {
|
||||
@@ -394,9 +414,6 @@ func init() {
|
||||
|
||||
const (
|
||||
|
||||
// BucketDetailsQuotaTypeFifo captures enum value "fifo"
|
||||
BucketDetailsQuotaTypeFifo string = "fifo"
|
||||
|
||||
// BucketDetailsQuotaTypeHard captures enum value "hard"
|
||||
BucketDetailsQuotaTypeHard string = "hard"
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -37,8 +37,12 @@ import (
|
||||
type BucketAccess string
|
||||
|
||||
func NewBucketAccess(value BucketAccess) *BucketAccess {
|
||||
v := value
|
||||
return &v
|
||||
return &value
|
||||
}
|
||||
|
||||
// Pointer returns a pointer to a freshly-allocated BucketAccess.
|
||||
func (m BucketAccess) Pointer() *BucketAccess {
|
||||
return &m
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Code generated by go-swagger; DO NOT EDIT.
|
||||
|
||||
// This file is part of MinIO Console Server
|
||||
// Copyright (c) 2021 MinIO, Inc.
|
||||
// Copyright (c) 2023 MinIO, Inc.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -92,6 +92,11 @@ func (m *BucketEncryptionRequest) ContextValidate(ctx context.Context, formats s
|
||||
func (m *BucketEncryptionRequest) contextValidateEncType(ctx context.Context, formats strfmt.Registry) error {
|
||||
|
||||
if m.EncType != nil {
|
||||
|
||||
if swag.IsZero(m.EncType) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := m.EncType.ContextValidate(ctx, formats); err != nil {
|
||||
if ve, ok := err.(*errors.Validation); ok {
|
||||
return ve.ValidateName("encType")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user