mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-21 00:24:07 +08:00
Compare commits
625 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca7f5495fe | ||
|
|
34b7d1e9c3 | ||
|
|
13a3e1c778 | ||
|
|
603b3f8b8e | ||
|
|
2c1e0a4fe2 | ||
|
|
f9a9f92003 | ||
|
|
8d1c0ba9c9 | ||
|
|
845ba285fc | ||
|
|
72f1e58833 | ||
|
|
1cc1ff7213 | ||
|
|
6c15c80abb | ||
|
|
7869e3d134 | ||
|
|
2e0efc6c4a | ||
|
|
1d440b57ce | ||
|
|
e3c564bd56 | ||
|
|
45e04c4d50 | ||
|
|
ee0f6de3b0 | ||
|
|
608be69260 | ||
|
|
88fa459aac | ||
|
|
b4bb5d902f | ||
|
|
7f467ab3a7 | ||
|
|
5c1714d11d | ||
|
|
5f36cbb31c | ||
|
|
850544ee4d | ||
|
|
7ff8935abc | ||
|
|
874cf21b00 | ||
|
|
231fefed1f | ||
|
|
5dd591f1bb | ||
|
|
ab32057ab1 | ||
|
|
84fec885e8 | ||
|
|
8057b95ac2 | ||
|
|
9adac58590 | ||
|
|
f409fca66b | ||
|
|
edd7136d3e | ||
|
|
b1c80010cc | ||
|
|
5ff255d622 | ||
|
|
fb531b4d68 | ||
|
|
03cd5dc63a | ||
|
|
fa48381bd7 | ||
|
|
38a6decc25 | ||
|
|
627495d200 | ||
|
|
37b823a43c | ||
|
|
112eb0d7ae | ||
|
|
bee314a0e6 | ||
|
|
60ef016f42 | ||
|
|
da235de896 | ||
|
|
68a425ebd5 | ||
|
|
15f6b94bec | ||
|
|
d8dd372cb0 | ||
|
|
e14a596d9f | ||
|
|
a0ab40dbb8 | ||
|
|
75e49ac8c6 | ||
|
|
590ec32860 | ||
|
|
57fd313b43 | ||
|
|
86e4df54d9 | ||
|
|
a9f60a7b1a | ||
|
|
087de62171 | ||
|
|
8577cb096e | ||
|
|
2110057bac | ||
|
|
3c09ce17d0 | ||
|
|
dc870afaed | ||
|
|
fcb8bba00c | ||
|
|
7996a02a80 | ||
|
|
3349dc46c5 | ||
|
|
a85fd307d3 | ||
|
|
37f1906f72 | ||
|
|
d5096ad4ee | ||
|
|
24da237790 | ||
|
|
d34b00ddc4 | ||
|
|
2f47d93215 | ||
|
|
1bbf79528b | ||
|
|
0c0c4fc94d | ||
|
|
01de80ed09 | ||
|
|
3861bb6bc1 | ||
|
|
681fee1317 | ||
|
|
2496a12833 | ||
|
|
c76062406d | ||
|
|
df94352e00 | ||
|
|
5b9c7ba9f2 | ||
|
|
e8dc05084a | ||
|
|
0774a2ded0 | ||
|
|
50421b06b9 | ||
|
|
7e7825a681 | ||
|
|
45b8a7afd9 | ||
|
|
4ec1fc58d9 | ||
|
|
69564365b9 | ||
|
|
54caca2d04 | ||
|
|
ce3241d046 | ||
|
|
40773180fa | ||
|
|
32411bf2ec | ||
|
|
c99265e743 | ||
|
|
2d4cff4ef1 | ||
|
|
bb90b5e8a1 | ||
|
|
b1c4bc276f | ||
|
|
1923e36740 | ||
|
|
7bec5e6f7e | ||
|
|
b40be2608b | ||
|
|
46d2f6efb7 | ||
|
|
d55f1db7ff | ||
|
|
0bcc19d7c1 | ||
|
|
b395dc8cee | ||
|
|
c908e0c19a | ||
|
|
ce5a95607f | ||
|
|
d4ba5ca52e | ||
|
|
92129824c0 | ||
|
|
7326b1fb0d | ||
|
|
1b5756fe1c | ||
|
|
08f8ce1f7c | ||
|
|
2c5234b97e | ||
|
|
37049bd5f3 | ||
|
|
177ba6cf2c | ||
|
|
bf2bb9878f | ||
|
|
530b2a1422 | ||
|
|
1eba8b8a7e | ||
|
|
4829e0d285 | ||
|
|
b29d6d4f4e | ||
|
|
d41c3bfea7 | ||
|
|
907058464a | ||
|
|
c727334bc4 | ||
|
|
b7e2c462cb | ||
|
|
1efc0fe07b | ||
|
|
9d1b407c40 | ||
|
|
67c2435f4f | ||
|
|
c11c79ef71 | ||
|
|
c245013e59 | ||
|
|
83b4916646 | ||
|
|
f6d1ea7b25 | ||
|
|
c988fd1b1f | ||
|
|
f6df6d34e0 | ||
|
|
44183902f7 | ||
|
|
64fda24e76 | ||
|
|
0701512da9 | ||
|
|
71499e7e1b | ||
|
|
6f6cf7cd64 | ||
|
|
8f175ec326 | ||
|
|
c0c26c7c40 | ||
|
|
42cd5b1435 | ||
|
|
4fafb8ae75 | ||
|
|
8349dcbba3 | ||
|
|
85a792d2b1 | ||
|
|
71fee70283 | ||
|
|
456c5fb50e | ||
|
|
b706356ba9 | ||
|
|
ed2bba3dd5 | ||
|
|
b6e701a6b2 | ||
|
|
c21636b521 | ||
|
|
2e0f424c73 | ||
|
|
a2f30806cf | ||
|
|
0c0b4b43aa | ||
|
|
209bee4181 | ||
|
|
ba265a7b83 | ||
|
|
1a8f8dcb93 | ||
|
|
2a01c86428 | ||
|
|
dc75d93414 | ||
|
|
fe44564bf7 | ||
|
|
8cd23304ae | ||
|
|
4b8e13f171 | ||
|
|
b6739ba7e8 | ||
|
|
3db7b0c962 | ||
|
|
0d6480723d | ||
|
|
9a91bf244c | ||
|
|
b1a641ca4d | ||
|
|
c65e1e0855 | ||
|
|
d8fc57b217 | ||
|
|
f9a47d94c7 | ||
|
|
ac2c3697bf | ||
|
|
b1048baef3 | ||
|
|
bfc1f0125f | ||
|
|
4b6d0107b0 | ||
|
|
1948c12012 | ||
|
|
6345086c5b | ||
|
|
08d412669d | ||
|
|
c85a8d354e | ||
|
|
03be58f39a | ||
|
|
60cb619043 | ||
|
|
91c39cf8cd | ||
|
|
f73ac4844f | ||
|
|
e681f66aad | ||
|
|
d7bf41e173 | ||
|
|
ea3247eaba | ||
|
|
d91dbf5f47 | ||
|
|
52129c544b | ||
|
|
a3b3e9c627 | ||
|
|
04c73b189d | ||
|
|
f75dbefbfd | ||
|
|
a2e4490613 | ||
|
|
2c32832946 | ||
|
|
18239e30cc | ||
|
|
77d6e24ae7 | ||
|
|
d5f6473d57 | ||
|
|
f7d927cbdd | ||
|
|
56a3d9c05d | ||
|
|
a4b76036c5 | ||
|
|
9e20cce793 | ||
|
|
f7b3b0c1a0 | ||
|
|
6404e3c2a0 | ||
|
|
9a1b040933 | ||
|
|
b5468ca840 | ||
|
|
77bbb2bda8 | ||
|
|
562498da68 | ||
|
|
b91c19bcb5 | ||
|
|
e48c4d0bb2 | ||
|
|
8c3872000a | ||
|
|
7fde85b83f | ||
|
|
262096d99d | ||
|
|
60ba83b40f | ||
|
|
5834ec297e | ||
|
|
8701c6172e | ||
|
|
d912e29772 | ||
|
|
bf0adeb0e2 | ||
|
|
8857a6281e | ||
|
|
5537648dc7 | ||
|
|
158750373b | ||
|
|
8a719ffe1f | ||
|
|
c1278bf088 | ||
|
|
86d6a224cd | ||
|
|
6b6a15e6b8 | ||
|
|
4a2b10e842 | ||
|
|
38557f8bcd | ||
|
|
8739393e52 | ||
|
|
fdad1303bc | ||
|
|
bd2d11f964 | ||
|
|
01c962f1c6 | ||
|
|
d5ec862e26 | ||
|
|
1e04ddfe5e | ||
|
|
67a6f9687d | ||
|
|
9bfb6c0c8e | ||
|
|
b4fff49236 | ||
|
|
8536166426 | ||
|
|
4bd9051ae4 | ||
|
|
74c272cfae | ||
|
|
38aed0ca4a | ||
|
|
06eea75674 | ||
|
|
ad73aa590a | ||
|
|
4322981be4 | ||
|
|
655d3632fa | ||
|
|
cd34e0db95 | ||
|
|
aae5d0dc33 | ||
|
|
51b2f4d3af | ||
|
|
f7987dbf61 | ||
|
|
f1282345f1 | ||
|
|
9046117e00 | ||
|
|
a5221d2b23 | ||
|
|
d2b6c4e90f | ||
|
|
c16dc54112 | ||
|
|
bf717adcd5 | ||
|
|
2f56b98778 | ||
|
|
d4593f1ac2 | ||
|
|
ee9573c786 | ||
|
|
d6a708fc55 | ||
|
|
a1526d07de | ||
|
|
1073f9edd3 | ||
|
|
9fc698b1c6 | ||
|
|
682361acb8 | ||
|
|
4a34ab9552 | ||
|
|
3b6142d874 | ||
|
|
b301bb01b7 | ||
|
|
c0e2019acd | ||
|
|
de34764cad | ||
|
|
c8eb7ee127 | ||
|
|
14ea4c8d39 | ||
|
|
86d22fea9d | ||
|
|
25c0e8cefd | ||
|
|
bb8d93b371 | ||
|
|
0d52727cab | ||
|
|
2e65633c4c | ||
|
|
b97ef4a95a | ||
|
|
187d8e72fe | ||
|
|
7212ce84d1 | ||
|
|
f39301adc9 | ||
|
|
b6af0076c7 | ||
|
|
9f6d971681 | ||
|
|
83336a36d4 | ||
|
|
a2358f6aaf | ||
|
|
c74d8ca0c7 | ||
|
|
9b14311965 | ||
|
|
c114ef9411 | ||
|
|
fd94dc7839 | ||
|
|
9fcb011c77 | ||
|
|
f0a606a687 | ||
|
|
ade64ab485 | ||
|
|
cafc0d2476 | ||
|
|
c91a7818b8 | ||
|
|
6eeeb27378 | ||
|
|
44dcbb6061 | ||
|
|
96862a2560 | ||
|
|
bc999888a2 | ||
|
|
7c29b06669 | ||
|
|
d17452240b | ||
|
|
da68e7fccf | ||
|
|
99e2a1a948 | ||
|
|
2a6f76539c | ||
|
|
496bbbf5c0 | ||
|
|
9173e8aa0b | ||
|
|
5226deb366 | ||
|
|
3cd8049222 | ||
|
|
770a6d194d | ||
|
|
4221e214f0 | ||
|
|
54783f601a | ||
|
|
2fbe4a30b7 | ||
|
|
5f623cb892 | ||
|
|
282da02f9f | ||
|
|
d9d343822f | ||
|
|
f194ad7183 | ||
|
|
93c2192b77 | ||
|
|
81dc7fd91e | ||
|
|
0a3c8acbd4 | ||
|
|
e9e8cd1519 | ||
|
|
fb682c8e2b | ||
|
|
5b0f36dbcb | ||
|
|
b5a9625575 | ||
|
|
fca1a6d795 | ||
|
|
72a4c8244d | ||
|
|
7524141e49 | ||
|
|
75c22ea603 | ||
|
|
b896ae5ca7 | ||
|
|
24591ecfab | ||
|
|
a4495dd731 | ||
|
|
fd698314be | ||
|
|
1c44b51913 | ||
|
|
050c4173a0 | ||
|
|
ea27a3c029 | ||
|
|
c4f9e47a1b | ||
|
|
5b1c97af58 | ||
|
|
139d2cacee | ||
|
|
e7a3905669 | ||
|
|
0fa2e68627 | ||
|
|
4aee13b813 | ||
|
|
cd3899eb15 | ||
|
|
975728bb31 | ||
|
|
bd1efb1716 | ||
|
|
6f49ceade3 | ||
|
|
5d1905aa3c | ||
|
|
bc83e2940a | ||
|
|
5a698a76bd | ||
|
|
cab9960d6c | ||
|
|
ea1e9c75fa | ||
|
|
167bca1931 | ||
|
|
5cd60db1b4 | ||
|
|
1a5f6ee0f6 | ||
|
|
8b5b6bc591 | ||
|
|
697c441acf | ||
|
|
495214e4c2 | ||
|
|
ad57f66781 | ||
|
|
c952693b82 | ||
|
|
9956a04e22 | ||
|
|
8b0f4b6576 | ||
|
|
3e9915523f | ||
|
|
ea123270b3 | ||
|
|
5efeb6fe50 | ||
|
|
c3191c9c83 | ||
|
|
33010e2d93 | ||
|
|
25c2165b81 | ||
|
|
eb670de2b4 | ||
|
|
276bfe40ab | ||
|
|
14b58d8c6d | ||
|
|
f6cb85592d | ||
|
|
c71b20c748 | ||
|
|
abbc8cbc63 | ||
|
|
eef972ea05 | ||
|
|
52ad575184 | ||
|
|
edc6711d96 | ||
|
|
4a6a4c594a | ||
|
|
4d6921285e | ||
|
|
129ed08a5c | ||
|
|
5e4155061f | ||
|
|
fec7ecbee7 | ||
|
|
c1dacdda12 | ||
|
|
5f16a5fae8 | ||
|
|
a468ffedbf | ||
|
|
12c4664d85 | ||
|
|
a363221e68 | ||
|
|
96f972877a | ||
|
|
2f7f26e640 | ||
|
|
3f684ef94c | ||
|
|
dd01610931 | ||
|
|
dcb4366e6d | ||
|
|
4d8d20fe95 | ||
|
|
480ed8ebc6 | ||
|
|
212af8b864 | ||
|
|
0987655e03 | ||
|
|
1f21fafb65 | ||
|
|
58b03973a5 | ||
|
|
fc4189694b | ||
|
|
358ce8e6e6 | ||
|
|
da3797275f | ||
|
|
5b907fc3e9 | ||
|
|
b113c0599f | ||
|
|
bb82d30331 | ||
|
|
5e599b180e | ||
|
|
90a541b9bf | ||
|
|
aa55b51106 | ||
|
|
f51ca4201d | ||
|
|
7d7fd841b4 | ||
|
|
82184636a2 | ||
|
|
2c57279e83 | ||
|
|
a520e04aa8 | ||
|
|
bbc2770045 | ||
|
|
4a07f1984c | ||
|
|
45849355e6 | ||
|
|
2cf9785881 | ||
|
|
6cd9e9670c | ||
|
|
0320134cea | ||
|
|
a28e914782 | ||
|
|
b32f534b50 | ||
|
|
3659899881 | ||
|
|
eb32cf7cac | ||
|
|
953cd5f143 | ||
|
|
6d407e7fbd | ||
|
|
a1627c4e24 | ||
|
|
f2dbd426cb | ||
|
|
e81c5e03c9 | ||
|
|
26d2913a95 | ||
|
|
86e0d5f68f | ||
|
|
8d96105c8f | ||
|
|
76ed60d6c0 | ||
|
|
7cf59a1fc1 | ||
|
|
8154999c05 | ||
|
|
63eeafea27 | ||
|
|
ee67c84af1 | ||
|
|
136423fdf8 | ||
|
|
86db85bddf | ||
|
|
7fba2df0f2 | ||
|
|
750cd9d4dc | ||
|
|
877fdf90d9 | ||
|
|
f526acc5bf | ||
|
|
b9be567ebf | ||
|
|
29c9d05b5f | ||
|
|
14c1ddaccb | ||
|
|
49b8d52634 | ||
|
|
3f265d8b8b | ||
|
|
12fe979952 | ||
|
|
2db8cca6cd | ||
|
|
d8ff92b39c | ||
|
|
d828d1a43f | ||
|
|
cda5608d2f | ||
|
|
4592928398 | ||
|
|
8a936fc339 | ||
|
|
9700dbcc49 | ||
|
|
dc45c21e4a | ||
|
|
6104dd28bb | ||
|
|
64252402a3 | ||
|
|
53eed495c1 | ||
|
|
9d37deddcb | ||
|
|
5fb17ce3f2 | ||
|
|
df81d7a9fe | ||
|
|
1e285a0043 | ||
|
|
de0983a6f7 | ||
|
|
dfee0713e9 | ||
|
|
d41805f513 | ||
|
|
87d2a5da13 | ||
|
|
b41d2f7248 | ||
|
|
0c00b3ac98 | ||
|
|
60eb3bcbb2 | ||
|
|
f90b4cd9e1 | ||
|
|
0eec98d1f8 | ||
|
|
6f093f0473 | ||
|
|
8a2641c8ea | ||
|
|
5ac63fceb0 | ||
|
|
a3c7d765c8 | ||
|
|
77ca9f5fe1 | ||
|
|
3174adde04 | ||
|
|
8cb5bcce15 | ||
|
|
4703567fe1 | ||
|
|
3b36f67c53 | ||
|
|
51f9ef4ee6 | ||
|
|
7ac8fc8026 | ||
|
|
2adc3e03fc | ||
|
|
0d738d06d3 | ||
|
|
fb9e3c9522 | ||
|
|
1c84754373 | ||
|
|
b904b58de0 | ||
|
|
74af253254 | ||
|
|
891a018bef | ||
|
|
5dc98f2645 | ||
|
|
ddb4d72527 | ||
|
|
1b7acb4eee | ||
|
|
ab8f96ee67 | ||
|
|
5fd512cf11 | ||
|
|
7c31d1a7da | ||
|
|
adcfaaa555 | ||
|
|
7c51a354e7 | ||
|
|
8cbf8caf79 | ||
|
|
112dd56081 | ||
|
|
90c301ca01 | ||
|
|
883871d551 | ||
|
|
a0d48290af | ||
|
|
2021c2095a | ||
|
|
4baa85932c | ||
|
|
3f148f78e7 | ||
|
|
3c9d6b929a | ||
|
|
8d3434cdab | ||
|
|
6c7b477956 | ||
|
|
4a9a72d530 | ||
|
|
9e62b4dace | ||
|
|
899f90f60b | ||
|
|
00237495b9 | ||
|
|
77ca8b147b | ||
|
|
eb16796db1 | ||
|
|
0c0e414b7b | ||
|
|
1d6cf71cfc | ||
|
|
92e4dc7cd6 | ||
|
|
356b021cd3 | ||
|
|
d1db323c77 | ||
|
|
1560fb53a9 | ||
|
|
0b84c1f97e | ||
|
|
3e9c68abad | ||
|
|
7b8d617b5b | ||
|
|
61f72fbbfd | ||
|
|
8607d25035 | ||
|
|
2d2384df19 | ||
|
|
3982f7fb19 | ||
|
|
49603570ec | ||
|
|
0a0386f76f | ||
|
|
8d7808b3fb | ||
|
|
1514c4ace7 | ||
|
|
b90a1e8013 | ||
|
|
96c48ca30b | ||
|
|
8964b9a406 | ||
|
|
79f1d1d85e | ||
|
|
50a5cc2570 | ||
|
|
b93cde73b5 | ||
|
|
a6ecd32f35 | ||
|
|
2066adbd81 | ||
|
|
fd479d8f77 | ||
|
|
3359254efa | ||
|
|
bcf3407110 | ||
|
|
6c6da5ff2c | ||
|
|
8dd88ecae1 | ||
|
|
5be08d9cdd | ||
|
|
2c4d3f5215 | ||
|
|
02d2c69d39 | ||
|
|
715ac1adf5 | ||
|
|
ef1ad52bae | ||
|
|
e3d51bacb3 | ||
|
|
b386e98ddd | ||
|
|
06ddb4d069 | ||
|
|
656a9c74b9 | ||
|
|
a2f71e936a | ||
|
|
ae1d7b8184 | ||
|
|
d048c3ac69 | ||
|
|
008ac4c2ab | ||
|
|
6810401fe1 | ||
|
|
1459f1420c | ||
|
|
a54e5d2a80 | ||
|
|
5d29e1ca6d | ||
|
|
f1afe696e2 | ||
|
|
6e5b560192 | ||
|
|
8498343481 | ||
|
|
2b6c95d690 | ||
|
|
165e2f5693 | ||
|
|
b17d299a47 | ||
|
|
d9f4134f7f | ||
|
|
9d8933b030 | ||
|
|
e660135d85 | ||
|
|
359ed35e7d | ||
|
|
babc05b772 | ||
|
|
e36cea3b05 | ||
|
|
325ff3af61 | ||
|
|
8df61823e4 | ||
|
|
7b794390cb | ||
|
|
75f9b82dba | ||
|
|
d459d64fc4 | ||
|
|
8f400aec6b | ||
|
|
e9d11e8d7d | ||
|
|
3289bf835c | ||
|
|
fd741406a6 | ||
|
|
53cbbb920b | ||
|
|
79037ee1f3 | ||
|
|
39752b2f02 | ||
|
|
67230158c8 | ||
|
|
2d20843d08 | ||
|
|
41820a8d4d | ||
|
|
2c1974c544 | ||
|
|
4f3498959e | ||
|
|
499e585377 | ||
|
|
58d2ef7f15 | ||
|
|
a75fc6b37d | ||
|
|
c777817c7a | ||
|
|
35735f1d0a | ||
|
|
20860c369d | ||
|
|
307689b3e7 | ||
|
|
8b546df667 | ||
|
|
ce961db085 | ||
|
|
5d3e2131b2 | ||
|
|
cddcfd24ba | ||
|
|
77ebb80277 | ||
|
|
131861e0b4 | ||
|
|
1d002cb9ec | ||
|
|
769305e74c | ||
|
|
fa2e0e344c | ||
|
|
8c201e7602 | ||
|
|
cd52997804 | ||
|
|
bdb943c552 | ||
|
|
ab3c68ba69 | ||
|
|
f22b5b4275 | ||
|
|
4bb432afd4 | ||
|
|
7dadb333ca | ||
|
|
9adf705476 | ||
|
|
e23742be52 | ||
|
|
155cb7ee93 | ||
|
|
94fccb0f53 | ||
|
|
502df4114a | ||
|
|
3ca229327e | ||
|
|
77435fcac9 | ||
|
|
3499ab7644 | ||
|
|
5ae9d513a7 | ||
|
|
4b4d9cf773 | ||
|
|
3bd4c65e6a | ||
|
|
efd4fc1ef2 | ||
|
|
99bb6af52c | ||
|
|
9ecaba7ebc | ||
|
|
940f6c84de | ||
|
|
f62cea0e1d | ||
|
|
4a8a79a786 | ||
|
|
82f4885b3b | ||
|
|
bc7f62a2ad | ||
|
|
61f04ff338 | ||
|
|
c381a47398 | ||
|
|
0cb2abe8a4 | ||
|
|
9a207261c3 | ||
|
|
15b5a78896 | ||
|
|
ba6882099c | ||
|
|
220cc6883c | ||
|
|
df233595b4 |
@@ -1,38 +0,0 @@
|
||||
FROM centos:7
|
||||
MAINTAINER Yousong Zhou <zhouyousong@yunion.cn>
|
||||
|
||||
RUN true \
|
||||
&& yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
|
||||
&& yum install -y git wget \
|
||||
&& yum groupinstall -y "Development Tools" \
|
||||
&& : ceph for cmd/host \
|
||||
&& rpm --import 'https://download.ceph.com/keys/release.asc' \
|
||||
&& yum install -y https://download.ceph.com/rpm-luminous/el7/noarch/ceph-release-1-1.el7.noarch.rpm \
|
||||
&& yum install -y libcephfs-devel librbd-devel librados-devel \
|
||||
&& yum clean all
|
||||
|
||||
WORKDIR /opt
|
||||
RUN true \
|
||||
&& wget https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz \
|
||||
&& tar xzf go1.13.3.linux-amd64.tar.gz \
|
||||
&& rm -vf go1.13.3.linux-amd64.tar.gz \
|
||||
&& true
|
||||
ENV GOROOT="/opt/go"
|
||||
ENV PATH="/opt/go/bin:${PATH}"
|
||||
|
||||
RUN useradd -c "OneCloud Builder" --create-home --home-dir /home/build --shell /bin/bash build
|
||||
ENV HOME /home/build
|
||||
WORKDIR /home/build
|
||||
USER build
|
||||
|
||||
ENV GOPATH="/home/build/go"
|
||||
ENV PATH="${GOPATH}/bin:${PATH}"
|
||||
|
||||
RUN true \
|
||||
&& mkdir -p "$GOPATH" \
|
||||
&& d="$GOPATH/src/golang.org/x/tools" \
|
||||
&& mkdir -p "$d" \
|
||||
&& git clone --branch yun --depth 8 https://github.com/yousong/tools "$d" \
|
||||
&& cd "$d" \
|
||||
&& go install ./cmd/goimports \
|
||||
&& true
|
||||
@@ -5,10 +5,10 @@ version: 2
|
||||
jobs:
|
||||
check:
|
||||
docker:
|
||||
- image: yunionio/onecloud-ci:v1.0.3
|
||||
- image: yunionio/centos-build:1.0-1
|
||||
environment:
|
||||
ONECLOUD_CI_BUILD: "1"
|
||||
working_directory: /home/build/go/src/yunion.io/x/onecloud
|
||||
working_directory: /root/go/onecloud
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
requires:
|
||||
- check
|
||||
docker:
|
||||
- image: yunionio/onecloud-ci:v1.0.2
|
||||
- image: yunionio/centos-build:1.0-1
|
||||
environment:
|
||||
ONECLOUD_CI_BUILD: "1"
|
||||
|
||||
@@ -26,14 +26,14 @@ jobs:
|
||||
#### expecting it in the form of
|
||||
#### /go/src/github.com/circleci/go-tool
|
||||
#### /go/src/bitbucket.org/circleci/go-tool
|
||||
working_directory: /home/build/go/src/yunion.io/x/onecloud
|
||||
working_directory: /root/go/onecloud
|
||||
parallelism: 4
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: onecloud-build-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
|
||||
paths:
|
||||
- /home/build/.cache/go-build
|
||||
- /root/.cache/go-build
|
||||
- run:
|
||||
command: |
|
||||
targets="$(circleci tests glob "cmd/*" | grep -v cmd/host-image | circleci tests split)"
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
- save_cache:
|
||||
key: onecloud-build-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
|
||||
paths:
|
||||
- /home/build/.cache/go-build
|
||||
- /root/.cache/go-build
|
||||
- store_artifacts:
|
||||
path: _output/
|
||||
|
||||
@@ -51,16 +51,16 @@ jobs:
|
||||
requires:
|
||||
- check
|
||||
docker:
|
||||
- image: yunionio/onecloud-ci:v1.0.2
|
||||
- image: yunionio/centos-build:1.0-1
|
||||
environment:
|
||||
GO111MODULE: "on"
|
||||
working_directory: /home/build/go/src/yunion.io/x/onecloud
|
||||
working_directory: /root/go/onecloud
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: onecloud-test-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
|
||||
paths:
|
||||
- /home/build/.cache/go-build
|
||||
- /root/.cache/go-build
|
||||
- run:
|
||||
name: unit_test
|
||||
command: |
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
- save_cache:
|
||||
key: onecloud-test-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
|
||||
paths:
|
||||
- /home/build/.cache/go-build
|
||||
- /root/.cache/go-build
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
|
||||
14
.github/workflows/docker.yml
vendored
14
.github/workflows/docker.yml
vendored
@@ -29,17 +29,17 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install librados-dev librbd-dev
|
||||
sudo apt-get install librados-dev librbd-dev # baremetal-agent needs this
|
||||
make cmd/apigateway cmd/climc cmd/keystone
|
||||
make cmd/logger cmd/region cmd/scheduler cmd/webconsole
|
||||
make cmd/yunionconf cmd/glance cmd/torrent cmd/s3gateway
|
||||
make cmd/ansibleserver cmd/cloudnet cmd/notify
|
||||
make cmd/host && ./scripts/bundle_libraries.sh _output/bin/bundles/host _output/bin/host && ./scripts/host_find_libraries.sh _output/bin/bundles/host
|
||||
make cmd/host-deployer && ./scripts/bundle_libraries.sh _output/bin/bundles/host-deployer _output/bin/host-deployer
|
||||
make cmd/baremetal-agent && ./scripts/bundle_libraries.sh _output/bin/bundles/baremetal-agent _output/bin/baremetal-agent
|
||||
make cmd/cloudevent cmd/devtool
|
||||
make cmd/*cli
|
||||
make cmd/esxi-agent
|
||||
make docker-alpine-build F='-j4 cmd/host cmd/vpcagent'
|
||||
|
||||
- name: Image baremetal-agent
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
@@ -61,6 +61,16 @@ jobs:
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.esxi-agent
|
||||
|
||||
- name: Image vpcagent
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/vpcagent
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.vpcagent
|
||||
|
||||
- name: Image climc
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
|
||||
64
Makefile
64
Makefile
@@ -192,43 +192,75 @@ mod:
|
||||
go mod vendor -v
|
||||
|
||||
|
||||
DOCKER_BUILD_IMAGE_VERSION?=latest
|
||||
DOCKER_BUILD_IMAGE_VERSION?=1.0-1
|
||||
|
||||
define dockerBuildCmd
|
||||
define dockerCentOSBuildCmd
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
cd /home/build/onecloud
|
||||
cd /root/onecloud
|
||||
export GOFLAGS=-mod=vendor
|
||||
make $(1)
|
||||
chown -R $(shell id -u):$(shell id -g) _output
|
||||
endef
|
||||
|
||||
docker-build: export dockerBuildCmd:=$(call dockerBuildCmd,$(F))
|
||||
docker-build:
|
||||
echo "$$dockerBuildCmd"
|
||||
docker-centos-build: export dockerCentOSBuildCmd:=$(call dockerCentOSBuildCmd,$(F))
|
||||
docker-centos-build:
|
||||
docker rm --force onecloud-ci-build &>/dev/null || true
|
||||
docker run \
|
||||
--name onecloud-ci-build \
|
||||
--rm \
|
||||
--volume $(CURDIR):/home/build/onecloud \
|
||||
yunionio/onecloud-ci:$(DOCKER_BUILD_IMAGE_VERSION) \
|
||||
/bin/bash -c "$$dockerBuildCmd"
|
||||
--volume $(CURDIR):/root/onecloud \
|
||||
registry.cn-beijing.aliyuncs.com/yunionio/centos-build:$(DOCKER_BUILD_IMAGE_VERSION) \
|
||||
/bin/bash -c "$$dockerCentOSBuildCmd"
|
||||
chown -R $$(id -u):$$(id -g) _output
|
||||
ls -lh _output/bin
|
||||
|
||||
# NOTE we need a way to stop and remove the container started by docker-build.
|
||||
# No --tty, --stop-signal won't work
|
||||
docker-build-stop:
|
||||
docker stop --time 0 onecloud-ci-build || true
|
||||
docker-centos-build-stop:
|
||||
docker-centos stop --time 0 onecloud-ci-build || true
|
||||
|
||||
.PHONY: docker-build
|
||||
.PHONY: docker-build-stop
|
||||
.PHONY: docker-centos-build
|
||||
.PHONY: docker-centos-build-stop
|
||||
|
||||
define dockerAlpineBuildCmd
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
cd /root/go/src/yunion.io/x/onecloud
|
||||
export GOFLAGS=-mod=vendor
|
||||
make $(1)
|
||||
chown -R $(shell id -u):$(shell id -g) _output
|
||||
endef
|
||||
|
||||
docker-alpine-build: export dockerAlpineBuildCmd:=$(call dockerAlpineBuildCmd,$(F))
|
||||
docker-alpine-build:
|
||||
docker rm --force onecloud-docker-alpine-build &>/dev/null || true
|
||||
docker run --rm \
|
||||
--name onecloud-docker-alpine-build \
|
||||
-v $(CURDIR):/root/go/src/yunion.io/x/onecloud \
|
||||
-v $(CURDIR)/_output/alpine-build:/root/go/src/yunion.io/x/onecloud/_output \
|
||||
registry.cn-beijing.aliyuncs.com/yunionio/alpine-build:1.0-1 \
|
||||
/bin/sh -c "$$dockerAlpineBuildCmd"
|
||||
ls -lh _output/alpine-build/bin
|
||||
|
||||
docker-alpine-build-stop:
|
||||
docker stop --time 0 onecloud-docker-alpine-build || true
|
||||
|
||||
.PHONY: docker-alpine-build
|
||||
.PHONY: docker-alpine-build-stop
|
||||
|
||||
define helpText
|
||||
Build with docker
|
||||
|
||||
make docker-build F='-j4'
|
||||
make docker-build F='-j4 cmd/region cmd/climc'
|
||||
make docker-build-stop
|
||||
make docker-centos-build F='-j4'
|
||||
make docker-centos-build F='-j4 cmd/region cmd/climc'
|
||||
make docker-centos-build-stop
|
||||
|
||||
make docker-alpine-build F='-j4'
|
||||
make docker-alpine-build F='-j4 cmd/host cmd/host-deployer'
|
||||
make docker-alpine-build-stop
|
||||
|
||||
Tidy up go modules and vendor directory
|
||||
|
||||
|
||||
@@ -32,3 +32,8 @@ COPY ./opt/cloud/yunion/baremetal/pxelinux.0 /opt/cloud/yunion/baremetal
|
||||
ADD ./mkisofs /bin/mkisofs
|
||||
ADD ./.mkisofs.bin /bin/.mkisofs.bin
|
||||
ADD ./bundles/mkisofs /bin/bundles/mkisofs
|
||||
# use GNU timeout command replace busybox timeout command
|
||||
RUN rm /usr/bin/timeout
|
||||
ADD ./timeout /bin/timeout
|
||||
ADD ./.timeout.bin /bin/.timeout.bin
|
||||
ADD ./bundles/timeout /bin/bundles/timeout
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:v20200308
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:latest
|
||||
|
||||
ADD ./build/climc/root/opt /opt
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ ENV TZ Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
|
||||
RUN apk add --no-cache bash bash-completion tzdata ca-certificates vim && \
|
||||
RUN apk add --no-cache bash bash-completion tzdata ca-certificates && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-base:v0.0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-base:v0.1.0
|
||||
|
||||
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"
|
||||
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
RUN apk add librados librbd
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
|
||||
ADD ./_output/bin/host /opt/yunion/bin/host
|
||||
ADD ./_output/bin/.host.bin /opt/yunion/bin/.host.bin
|
||||
ADD ./_output/bin/bundles/host /opt/yunion/bin/bundles/host
|
||||
ADD ./_output/alpine-build/bin/host /opt/yunion/bin/host
|
||||
|
||||
4
build/docker/Dockerfile.monitor
Normal file
4
build/docker/Dockerfile.monitor
Normal file
@@ -0,0 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/monitor /opt/yunion/bin/monitor
|
||||
|
||||
6
build/docker/Dockerfile.vpcagent
Normal file
6
build/docker/Dockerfile.vpcagent
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/openvswitch:2.9.6-1
|
||||
|
||||
MAINTAINER "Yousong Zhou <zhouyousong@yunion.cn>"
|
||||
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
ADD ./_output/alpine-build/bin/vpcagent /opt/yunion/bin/vpcagent
|
||||
@@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=Yunion Host Image Server
|
||||
Documentation=https://docs.yunion.cn
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
ExecStart=/opt/yunion/bin/host-image --conf /etc/yunion/host.conf
|
||||
WorkingDirectory=/opt/yunion/bin
|
||||
KillMode=process
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
LimitNOFILE=500000
|
||||
LimitNPROC=500000
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
2
build/host-image/vars
Normal file
2
build/host-image/vars
Normal file
@@ -0,0 +1,2 @@
|
||||
DESCRIPTION="Yunion Host Image Server"
|
||||
SERVICE="yes"
|
||||
@@ -35,6 +35,7 @@ import (
|
||||
_ "yunion.io/x/onecloud/cmd/climc/shell/cloudnet"
|
||||
_ "yunion.io/x/onecloud/cmd/climc/shell/etcd"
|
||||
_ "yunion.io/x/onecloud/cmd/climc/shell/k8s"
|
||||
_ "yunion.io/x/onecloud/cmd/climc/shell/monitor"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type BucketOptionsVerifyOptions struct {
|
||||
options.BaseListOptions
|
||||
CloudaccountId string `help:"cloudaccount Id" required:"true"`
|
||||
BillingReportBucket string `help:"S3 bucket that stores account billing report"`
|
||||
BillingFilePrefix string `help:"prefix of billing file name"`
|
||||
BillingBucketAccount string `help:"Id of cloudaccount that can access billing bucket"`
|
||||
UsageReportBucket string `help:"S3 bucket that stores account usage report"`
|
||||
UsageFilePrefix string `help:"prefix of usage file name"`
|
||||
UsageBucketAccount string `help:"Id of cloudaccount that can access usage bucket"`
|
||||
}
|
||||
R(&BucketOptionsVerifyOptions{}, "bucket-options-verify", "billing bucket connection test",
|
||||
func(s *mcclient.ClientSession, args *BucketOptionsVerifyOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.BucketOptions.PerformAction(s, args.CloudaccountId, "verify", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -30,6 +30,7 @@ func init() {
|
||||
|
||||
type CloudaccountListOptions struct {
|
||||
options.BaseListOptions
|
||||
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
|
||||
}
|
||||
R(&CloudaccountListOptions{}, "cloud-account-list", "List cloud accounts", func(s *mcclient.ClientSession, args *CloudaccountListOptions) error {
|
||||
var params *jsonutils.JSONDict
|
||||
@@ -39,6 +40,9 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(args.Capability) > 0 {
|
||||
params.Add(jsonutils.NewStringArray(args.Capability), "capability")
|
||||
}
|
||||
}
|
||||
result, err := modules.Cloudaccounts.List(s, params)
|
||||
if err != nil {
|
||||
@@ -670,6 +674,23 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SGoogleCloudAccountUpdateCredentialOptions{}, "cloud-account-update-credential-google", "Update credential of a Google cloud account", func(s *mcclient.ClientSession, args *options.SGoogleCloudAccountUpdateCredentialOptions) error {
|
||||
data, err := ioutil.ReadFile(args.GoogleJsonFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
params, err := jsonutils.Parse(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "update-credential", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SS3CloudAccountUpdateCredentialOptions{}, "cloud-account-update-credential-s3", "Update credential of a generic S3 cloud account", func(s *mcclient.ClientSession, args *options.SS3CloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "update-credential", params)
|
||||
|
||||
@@ -31,8 +31,9 @@ func init() {
|
||||
|
||||
Usable bool `help:"Vpc & Network usable"`
|
||||
|
||||
HasObjectStorage bool `help:"filter cloudproviders that has object storage"`
|
||||
NoObjectStorage bool `help:"filter cloudproviders that has no object storage"`
|
||||
HasObjectStorage bool `help:"filter cloudproviders that has object storage"`
|
||||
NoObjectStorage bool `help:"filter cloudproviders that has no object storage"`
|
||||
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
|
||||
}
|
||||
R(&CloudproviderListOptions{}, "cloud-provider-list", "List cloud providers", func(s *mcclient.ClientSession, args *CloudproviderListOptions) error {
|
||||
var params *jsonutils.JSONDict
|
||||
@@ -52,6 +53,10 @@ func init() {
|
||||
} else if args.NoObjectStorage {
|
||||
params.Add(jsonutils.JSONFalse, "has_object_storage")
|
||||
}
|
||||
|
||||
if len(args.Capability) > 0 {
|
||||
params.Add(jsonutils.NewStringArray(args.Capability), "capability")
|
||||
}
|
||||
}
|
||||
result, err := modules.Cloudproviders.List(s, params)
|
||||
if err != nil {
|
||||
|
||||
@@ -29,11 +29,11 @@ func init() {
|
||||
* 操作用户的通信地址(如果用户的通信地址不存在则进行添加;如果已存在则进行修改;如果设置空则进行删除。)
|
||||
*/
|
||||
type ContactsUpdateOptions struct {
|
||||
UID string `help:"The user you wanna add contact to (Keystone User ID)"`
|
||||
CONTACTTYPE string `help:"The contact type email|mobile" choices:"email|mobile|dingtalk"`
|
||||
CONTACT string `help:"The contacts details mobile number or email address or dingtalk's userid, if set it the empty str means delete"`
|
||||
Status string `help:"Enabled or disabled contact status" choices:"enable|disable"`
|
||||
Pull []string `help:"pull some subcontacts(e.g., dingtalk, feishu, etc) related to mobile"`
|
||||
UID string `help:"The user you wanna add contact to (Keystone User ID)"`
|
||||
CONTACTTYPE string `help:"The contact type email|mobile" choices:"email|mobile|dingtalk"`
|
||||
CONTACT string `help:"The contacts details mobile number or email address or dingtalk's userid, if set it the empty str means delete"`
|
||||
Status string `help:"Enabled or disabled contact status" choices:"enable|disable"`
|
||||
Pull string `help:"pull some subcontacts(e.g., dingtalk, feishu, etc) related to mobile"`
|
||||
}
|
||||
R(&ContactsUpdateOptions{}, "contact-update", "Create, delete or update contact for user", func(s *mcclient.ClientSession, args *ContactsUpdateOptions) error {
|
||||
arr := jsonutils.NewArray()
|
||||
@@ -53,13 +53,7 @@ func init() {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(arr, "contacts")
|
||||
|
||||
pulls := jsonutils.NewArray()
|
||||
for _, pull := range args.Pull {
|
||||
pulls.Add(jsonutils.NewString(pull))
|
||||
}
|
||||
params.Add(pulls, "pull")
|
||||
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", args.Pull, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -75,8 +69,7 @@ func init() {
|
||||
R(&ContactsPullOptions{}, "contact-pull", "Pull contact", func(s *mcclient.ClientSession, args *ContactsPullOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Set("contacts", jsonutils.NewArray())
|
||||
params.Set("pull", jsonutils.NewArray(jsonutils.NewString(args.CONTACTTYPE)))
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", args.CONTACTTYPE, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -96,7 +89,7 @@ func init() {
|
||||
arr.Add(tmpObj)
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(arr, "contacts")
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", "", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -187,7 +180,7 @@ func init() {
|
||||
tmpDict := jsonutils.NewDict()
|
||||
tmpDict.Add(jsonutils.NewString(args.CONTACT_TYPE), "contact_type")
|
||||
tmpDict.Add(jsonutils.NewString(args.CONTACT), "contact")
|
||||
_, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "verify", tmpDict)
|
||||
_, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "verify", "", tmpDict)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ type ImageOptionalOptions struct {
|
||||
OsLang string `help:"OS Language" choices:"zh_CN|en_US"`
|
||||
Preference int64 `help:"Disk preferences"`
|
||||
Notes string `help:"Notes about the image"`
|
||||
Hypervisor []string `help:"Prefer hypervisor type" choices:"kvm|esxi|baremetal|container|openstack"`
|
||||
Hypervisor []string `help:"Prefer hypervisor type" choices:"kvm|esxi|baremetal|container|openstack|ctyun"`
|
||||
DiskDriver string `help:"Perfer disk driver" choices:"virtio|scsi|pvscsi|ide|sata"`
|
||||
NetDriver string `help:"Preferred network driver" choices:"virtio|e1000|vmxnet3"`
|
||||
}
|
||||
|
||||
@@ -205,70 +205,4 @@ func initKubeCluster() {
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.IdentOptions{}, cmdN("components-status"), "Get cluster component status", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
|
||||
ret, err := k8s.KubeClusters.GetSpecific(s, args.ID, "components-status", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterComponentTypeOptions{}, cmdN("component-setting"), "Get cluster component setting", func(s *mcclient.ClientSession, args *o.ClusterComponentTypeOptions) error {
|
||||
q := jsonutils.NewDict()
|
||||
q.Add(jsonutils.NewString(args.TYPE), "type")
|
||||
ret, err := k8s.KubeClusters.GetSpecific(s, args.ID, "component-setting", q)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterEnableComponentCephCSIOpt{}, cmdN("component-enable-ceph-csi"), "Enable cluster component", func(s *mcclient.ClientSession, args *o.ClusterEnableComponentCephCSIOpt) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "enable-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterDisableComponent{}, cmdN("component-disable"), "Enable cluster component", func(s *mcclient.ClientSession, args *o.ClusterDisableComponent) error {
|
||||
params := args.Params()
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "disable-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterDisableComponent{}, cmdN("component-delete"), "Delete cluster component", func(s *mcclient.ClientSession, args *o.ClusterDisableComponent) error {
|
||||
params := args.Params()
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "delete-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterUpdateComponentCephCSIOpt{}, cmdN("component-update-ceph-csi"), "Update cluster component", func(s *mcclient.ClientSession, args *o.ClusterUpdateComponentCephCSIOpt) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "update-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -58,23 +58,4 @@ func initSecret() {
|
||||
return nil
|
||||
})
|
||||
registryCmd.AddR(createCmd)
|
||||
|
||||
cephCSICmd := NewCmdNameFactory("secret-ceph-csi")
|
||||
cephCSICreateCmd := NewCommand(
|
||||
&o.CephCSISecretCreateOptions{},
|
||||
cephCSICmd.Do("create"),
|
||||
"Create ceph csi user secret",
|
||||
func(s *mcclient.ClientSession, args *o.CephCSISecretCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Secrets.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
secretCmd.AddR(cephCSICreateCmd)
|
||||
}
|
||||
|
||||
@@ -15,70 +15,9 @@
|
||||
package k8s
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
|
||||
)
|
||||
|
||||
func initStorageClass() {
|
||||
cmdN := NewCmdNameFactory("storageclass")
|
||||
scCmd := initK8sClusterResource("storageclass", k8s.Storageclass)
|
||||
|
||||
setDefaultCmd := NewCommand(
|
||||
&o.ClusterResourceBaseOptions{},
|
||||
cmdN.Do("set-default"),
|
||||
"Set storageclass as default",
|
||||
func(s *mcclient.ClientSession, args *o.ClusterResourceBaseOptions) error {
|
||||
ret, err := k8s.Storageclass.PerformAction(s, args.NAME, "set-default", args.Params())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
scCmd.AddR(setDefaultCmd)
|
||||
|
||||
addStorageClassCephCSI(scCmd)
|
||||
}
|
||||
|
||||
func addStorageClassCephCSI(cmd *ShellCommands) {
|
||||
rbdN := NewCmdNameFactory("storageclass-ceph-csi-rbd")
|
||||
rbdCreateCmd := NewCommand(
|
||||
&o.StorageClassCephCSIRBDCreateOptions{},
|
||||
rbdN.Do("create"),
|
||||
"Create ceph csi rbd",
|
||||
func(s *mcclient.ClientSession, args *o.StorageClassCephCSIRBDCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Storageclass.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
testConnCmd := NewCommand(
|
||||
&o.StorageClassCephCSIRBDTestOptions{},
|
||||
rbdN.Do("connection-test"),
|
||||
"Test storageclass connection",
|
||||
func(s *mcclient.ClientSession, args *o.StorageClassCephCSIRBDTestOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Storageclass.PerformClassAction(s, "connection-test", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
cmd.AddR(rbdCreateCmd, testConnCmd)
|
||||
initK8sClusterResource("storageclass", k8s.Storageclass)
|
||||
}
|
||||
|
||||
@@ -51,9 +51,10 @@ func init() {
|
||||
})
|
||||
|
||||
type KeypairCreate struct {
|
||||
NAME string `help:"Name of keypair to be created"`
|
||||
Scheme string `help:"Scheme of keypair, default is RSA" choices:"RSA|DSA" default:"RSA"`
|
||||
Desc string `help:"Short description of keypair"`
|
||||
NAME string `help:"Name of keypair to be created"`
|
||||
Scheme string `help:"Scheme of keypair, default is RSA" choices:"RSA" default:"RSA"`
|
||||
PublicKey string `help:"Publickey of keypair"`
|
||||
Desc string `help:"Short description of keypair"`
|
||||
}
|
||||
|
||||
R(&KeypairCreate{}, "keypair-create", "Create a new keypair", func(s *mcclient.ClientSession, args *KeypairCreate) error {
|
||||
@@ -63,6 +64,10 @@ func init() {
|
||||
params.Add(jsonutils.NewString(args.Scheme), "scheme")
|
||||
}
|
||||
|
||||
if len(args.PublicKey) > 0 {
|
||||
params.Add(jsonutils.NewString(args.PublicKey), "public_key")
|
||||
}
|
||||
|
||||
if len(args.Desc) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Desc), "description")
|
||||
}
|
||||
|
||||
69
cmd/climc/shell/monitor/alert.go
Normal file
69
cmd/climc/shell/monitor/alert.go
Normal file
@@ -0,0 +1,69 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
|
||||
func init() {
|
||||
aN := cmdN("alert")
|
||||
R(&options.AlertListOptions{}, aN("list"), "List all alerts",
|
||||
func(s *mcclient.ClientSession, args *options.AlertListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Alerts.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(ret, monitor.Alerts.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertShowOptions{}, aN("show"), "Show details of a alert rule",
|
||||
func(s *mcclient.ClientSession, args *options.AlertShowOptions) error {
|
||||
ret, err := monitor.Alerts.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertUpdateOptions{}, aN("update"), "Update a alert rule",
|
||||
func(s *mcclient.ClientSession, args *options.AlertUpdateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Alerts.Update(s, args.ID, params.JSON(params))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertDeleteOptions{}, aN("delete"), "Delete alerts",
|
||||
func(s *mcclient.ClientSession, args *options.AlertDeleteOptions) error {
|
||||
ret := monitor.Alerts.BatchDelete(s, args.ID, nil)
|
||||
printBatchResults(ret, monitor.Alerts.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
}
|
||||
27
cmd/climc/shell/monitor/common.go
Normal file
27
cmd/climc/shell/monitor/common.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
R = shell.R
|
||||
printList = printutils.PrintJSONList
|
||||
printObject = printutils.PrintJSONObject
|
||||
printBatchResults = printutils.PrintJSONBatchResults
|
||||
)
|
||||
56
cmd/climc/shell/monitor/monitor.go
Normal file
56
cmd/climc/shell/monitor/monitor.go
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
|
||||
func cmdN(suffix string) func(action string) string {
|
||||
return func(action string) string {
|
||||
return fmt.Sprintf("monitor-%s-%s", suffix, action)
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
dsN := cmdN("datasource")
|
||||
R(&options.DataSourceListOptions{}, dsN("list"), "List all monitor data source",
|
||||
func(s *mcclient.ClientSession, args *options.DataSourceListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.DataSources.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(ret, monitor.DataSources.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.DataSourceDeleteOptions{}, dsN("delete"), "Delete monitor data source",
|
||||
func(s *mcclient.ClientSession, args *options.DataSourceDeleteOptions) error {
|
||||
ret, err := monitor.DataSources.Delete(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
99
cmd/climc/shell/monitor/notification.go
Normal file
99
cmd/climc/shell/monitor/notification.go
Normal file
@@ -0,0 +1,99 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
|
||||
func init() {
|
||||
nN := cmdN("notification")
|
||||
R(&options.NotificationListOptions{}, nN("list"), "List all alert notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Notifications.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(ret, monitor.Notifications.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NotificationDingDingCreateOptions{}, nN("create-dingding"),
|
||||
"Create dingding alert notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationDingDingCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Notifications.Create(s, params.JSON(params))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NotificationFeishuCreateOptions{}, nN("create-feishu"),
|
||||
"Create feishu alert notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationFeishuCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Notifications.Create(s, params.JSON(params))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NotificationShowOptions{}, nN("show"), "Show alert notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationShowOptions) error {
|
||||
ret, err := monitor.Notifications.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NotificationUpdateOptions{}, nN("update"), "Update alert notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationUpdateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Notifications.Update(s, args.ID, params.JSON(params))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NotificationDeleteOptions{}, nN("delete"), "Show delete notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationDeleteOptions) error {
|
||||
ret := monitor.Notifications.BatchDelete(s, args.ID, nil)
|
||||
printBatchResults(ret, monitor.Notifications.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -59,18 +59,18 @@ func init() {
|
||||
* 修改指定的报警规则
|
||||
*/
|
||||
type NodealertUpdateOptions struct {
|
||||
ID string `help:"ID of the alert rule" required:"true" positional:"true"`
|
||||
Type string `help:"Alert rule type" choices:"guest|host"`
|
||||
Metric string `help:"Metric name, include measurement and field, such as vm_cpu.usage_active"`
|
||||
NodeName string `help:"Name of the guest or host"`
|
||||
NodeID string `help:"ID of the guest or host"`
|
||||
Period string `help:"Specify the query time period for the data"`
|
||||
Window string `help:"Specify the query interval for the data"`
|
||||
Threshold float64 `help:"Threshold value of the metric"`
|
||||
Comparator string `help:"Comparison operator for join expressions" choices:">|<|>=|<=|=|!="`
|
||||
Recipients string `help:"Comma separated recipient ID"`
|
||||
Level string `help:"Alert level" choices:"normal|important|fatal"`
|
||||
Channel string `help:"Ways to send an alarm" choices:"email|mobile"`
|
||||
ID string `help:"ID of the alert rule" required:"true" positional:"true"`
|
||||
Type string `help:"Alert rule type" choices:"guest|host"`
|
||||
Metric string `help:"Metric name, include measurement and field, such as vm_cpu.usage_active"`
|
||||
NodeName string `help:"Name of the guest or host"`
|
||||
NodeID string `help:"ID of the guest or host"`
|
||||
Period string `help:"Specify the query time period for the data"`
|
||||
Window string `help:"Specify the query interval for the data"`
|
||||
Threshold *float64 `help:"Threshold value of the metric"`
|
||||
Comparator string `help:"Comparison operator for join expressions" choices:">|<|>=|<=|=|!="`
|
||||
Recipients string `help:"Comma separated recipient ID"`
|
||||
Level string `help:"Alert level" choices:"normal|important|fatal"`
|
||||
Channel string `help:"Ways to send an alarm" choices:"email|mobile"`
|
||||
}
|
||||
R(&NodealertUpdateOptions{}, "nodealert-update", "Update the node alert rule", func(s *mcclient.ClientSession, args *NodealertUpdateOptions) error {
|
||||
params, err := options.StructToParams(args)
|
||||
@@ -92,14 +92,11 @@ func init() {
|
||||
* 删除指定ID的报警规则
|
||||
*/
|
||||
type NodealertDeleteOptions struct {
|
||||
ID string `help:"ID of node alert" required:"true" positional:"true"`
|
||||
ID []string `help:"ID of node alert" required:"true" positional:"true"`
|
||||
}
|
||||
R(&NodealertDeleteOptions{}, "nodealert-delete", "Delete a node alert", func(s *mcclient.ClientSession, args *NodealertDeleteOptions) error {
|
||||
alarm, err := modules.NodeAlert.Delete(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(alarm)
|
||||
ret := modules.NodeAlert.BatchDelete(s, args.ID, nil)
|
||||
printBatchResults(ret, modules.NodeAlert.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ func init() {
|
||||
NotificationCreateOptions
|
||||
}
|
||||
|
||||
R(&NotificationCreateSingleOptions{}, "notify", "Send a notification to someone", func(s *mcclient.ClientSession,
|
||||
R(&NotificationCreateSingleOptions{}, "notify", "Send a notification to someones", func(s *mcclient.ClientSession,
|
||||
args *NotificationCreateSingleOptions) error {
|
||||
|
||||
msg := notify.SNotifyMessage{}
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/pkg/util/regutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/cmdline"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
@@ -150,12 +151,19 @@ func init() {
|
||||
})
|
||||
|
||||
type ServerAttachNetworkOptions struct {
|
||||
SERVER string `help:"ID or Name of server"`
|
||||
NETDESC string `help:"Network description"`
|
||||
SERVER string `help:"ID or Name of server"`
|
||||
NETDESC []string `help:"Network description"`
|
||||
}
|
||||
R(&ServerAttachNetworkOptions{}, "server-attach-network", "Attach a server to a virtual network", func(s *mcclient.ClientSession, args *ServerAttachNetworkOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.NETDESC), "net_desc")
|
||||
input := compute.AttachNetworkInput{[]*compute.NetworkConfig{}}
|
||||
for i := 0; i < len(args.NETDESC); i++ {
|
||||
conf, err := cmdline.ParseNetworkConfig(args.NETDESC[i], -1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
input.Nets = append(input.Nets, conf)
|
||||
}
|
||||
params := jsonutils.Marshal(input)
|
||||
srv, err := modules.Servers.PerformAction(s, args.SERVER, "attachnetwork", params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -178,19 +178,6 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
R(&options.ServerCreateOptions{}, "server-check-create-data", "Check create server data", func(s *mcclient.ClientSession, opts *options.ServerCreateOptions) error {
|
||||
params, err := opts.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
server, err := modules.Servers.PerformClassAction(s, "check-create-data", params.JSON(params))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(server)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ServerCreateOptions{}, "server-create", "Create a server", func(s *mcclient.ClientSession, opts *options.ServerCreateOptions) error {
|
||||
params, err := opts.Params()
|
||||
if err != nil {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
@@ -45,6 +46,9 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if decodeStr, err := base64.StdEncoding.DecodeString(connParams); err == nil {
|
||||
connParams = string(decodeStr)
|
||||
}
|
||||
var query url.Values
|
||||
connUrl, err := url.ParseRequestURI(connParams)
|
||||
if err == nil {
|
||||
@@ -64,7 +68,9 @@ func init() {
|
||||
return nil
|
||||
}
|
||||
|
||||
u.RawQuery = connParams
|
||||
newQuery := url.Values(make(map[string][]string))
|
||||
newQuery.Set("data", base64.StdEncoding.EncodeToString([]byte(connParams)))
|
||||
u.RawQuery = newQuery.Encode()
|
||||
fmt.Println(u.String())
|
||||
return nil
|
||||
}
|
||||
|
||||
23
cmd/monitor/main.go
Normal file
23
cmd/monitor/main.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/monitor/service"
|
||||
)
|
||||
|
||||
func main() {
|
||||
service.StartService()
|
||||
}
|
||||
71
cmd/vpcagent/main.go
Normal file
71
cmd/vpcagent/main.go
Normal file
@@ -0,0 +1,71 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/signal"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"yunion.io/x/log"
|
||||
|
||||
app_common "yunion.io/x/onecloud/pkg/cloudcommon/app"
|
||||
common_options "yunion.io/x/onecloud/pkg/cloudcommon/options"
|
||||
"yunion.io/x/onecloud/pkg/util/atexit"
|
||||
"yunion.io/x/onecloud/pkg/vpcagent/options"
|
||||
_ "yunion.io/x/onecloud/pkg/vpcagent/ovn"
|
||||
"yunion.io/x/onecloud/pkg/vpcagent/worker"
|
||||
)
|
||||
|
||||
func main() {
|
||||
defer atexit.Handle()
|
||||
|
||||
opts := &options.Options{}
|
||||
commonOpts := &opts.CommonOptions
|
||||
{
|
||||
common_options.ParseOptions(opts, os.Args, "vpcagent.conf", "vpcagent")
|
||||
app_common.InitAuth(commonOpts, func() {
|
||||
log.Infof("auth finished ok")
|
||||
})
|
||||
}
|
||||
if err := opts.ValidateThenInit(); err != nil {
|
||||
log.Fatalf("opts validate: %s", err)
|
||||
}
|
||||
|
||||
w := worker.NewWorker(opts)
|
||||
if w == nil {
|
||||
log.Fatalf("new worker failed")
|
||||
}
|
||||
|
||||
{
|
||||
wg := &sync.WaitGroup{}
|
||||
ctx, cancelFunc := context.WithCancel(context.Background())
|
||||
ctx = context.WithValue(ctx, "wg", wg)
|
||||
wg.Add(1)
|
||||
go w.Start(ctx)
|
||||
|
||||
go func() {
|
||||
sigChan := make(chan os.Signal)
|
||||
signal.Notify(sigChan, syscall.SIGINT)
|
||||
signal.Notify(sigChan, syscall.SIGTERM)
|
||||
sig := <-sigChan
|
||||
log.Infof("signal received: %s", sig)
|
||||
cancelFunc()
|
||||
}()
|
||||
wg.Wait()
|
||||
}
|
||||
}
|
||||
9
go.mod
9
go.mod
@@ -23,6 +23,7 @@ require (
|
||||
github.com/aokoli/goutils v1.0.1
|
||||
github.com/aws/aws-sdk-go v1.21.4
|
||||
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
|
||||
github.com/benbjohnson/clock v1.0.0
|
||||
github.com/bitly/go-simplejson v0.5.0
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
|
||||
github.com/c-bata/go-prompt v0.2.1
|
||||
@@ -101,6 +102,7 @@ require (
|
||||
github.com/shirou/gopsutil v2.18.10+incompatible
|
||||
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
|
||||
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9
|
||||
github.com/smartystreets/goconvey v1.6.4
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.3 // indirect
|
||||
github.com/stretchr/testify v1.4.0
|
||||
@@ -121,6 +123,7 @@ require (
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20191008142428-8d021180e987
|
||||
google.golang.org/api v0.13.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873
|
||||
@@ -138,11 +141,11 @@ require (
|
||||
k8s.io/klog v0.1.0 // indirect
|
||||
k8s.io/kubernetes v1.12.3
|
||||
yunion.io/x/executor v0.0.0-20200227030256-a18417815e74
|
||||
yunion.io/x/jsonutils v0.0.0-20200303051356-aa609aba0cda
|
||||
yunion.io/x/jsonutils v0.0.0-20200113074440-9297fd00ba07
|
||||
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d
|
||||
yunion.io/x/pkg v0.0.0-20200304112442-9dae9351325e
|
||||
yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57
|
||||
yunion.io/x/sqlchemy v0.0.0-20200221103553-6a98f7f8ab92
|
||||
yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3
|
||||
)
|
||||
|
||||
|
||||
20
go.sum
20
go.sum
@@ -80,6 +80,8 @@ github.com/aws/aws-sdk-go v1.21.4 h1:1xB+x6Dzev8ETmeHEiSfUVbIzmC/0EyFfXMkJpzKPCE
|
||||
github.com/aws/aws-sdk-go v1.21.4/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f h1:ZNv7On9kyUzm7fvRZumSyy/IUiSC7AzL0I1jKKtwooA=
|
||||
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc=
|
||||
github.com/benbjohnson/clock v1.0.0 h1:78Jk/r6m4wCi6sndMpty7A//t4dw/RW5fV4ZgDVfX1w=
|
||||
github.com/benbjohnson/clock v1.0.0/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
|
||||
@@ -219,6 +221,7 @@ github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/gopacket v1.1.17 h1:rMrlX2ZY2UbvT+sdz3+6J+pp2z+msCq9MxTU6ymxbBY=
|
||||
github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM=
|
||||
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
@@ -449,6 +452,8 @@ github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a h1:JSvGDIbm
|
||||
github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/gunit v0.0.0-20180314194857-6f0d6275bdcd h1:p5kvxG4NHogJX1brTLtvUSGdW0/aBvIyqDSW7tmnsmQ=
|
||||
github.com/smartystreets/gunit v0.0.0-20180314194857-6f0d6275bdcd/go.mod h1:XUKj4gbqj2QvJk/OdLWzyZ3FYli0f+MdpngyryX0gcw=
|
||||
github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
|
||||
@@ -618,6 +623,8 @@ golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.zx2c4.com/wireguard v0.0.20190908 h1:SUoXDdwSMtomLdvke+zz83/u9tNvl4hHmcTIWp38tow=
|
||||
golang.zx2c4.com/wireguard v0.0.20190908/go.mod h1:LhfXh5z6bLC2lW2ve6BzYZFwnnsXK3OQjySR0Yh2dO8=
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20191008142428-8d021180e987 h1:26OAgqBTufVr8WKonCEhhjO1oKsYhHv0iM5Dg92G1TM=
|
||||
@@ -694,8 +701,8 @@ yunion.io/x/executor v0.0.0-20200227030256-a18417815e74 h1:A15C6VdVRWvmQ9pAJHrUs
|
||||
yunion.io/x/executor v0.0.0-20200227030256-a18417815e74/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051 h1:vtZw2iwGrsARNSwRTREGjmr2BWPdxbmXVkb3kI1qu28=
|
||||
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
|
||||
yunion.io/x/jsonutils v0.0.0-20200303051356-aa609aba0cda h1:wSwQj3MDGchGYM2RAo1riYhrTz4apH+5XyBnchuDi84=
|
||||
yunion.io/x/jsonutils v0.0.0-20200303051356-aa609aba0cda/go.mod h1:T7kxQJR13+t7z0TuT+Wzd7MTxBOk2H9c0pO1ONQSv90=
|
||||
yunion.io/x/jsonutils v0.0.0-20200113074440-9297fd00ba07 h1:i6Im3w4UoyCIKOEtr0Y3aAPGrL9FYAzeFXoj3daXXt0=
|
||||
yunion.io/x/jsonutils v0.0.0-20200113074440-9297fd00ba07/go.mod h1:NpWHLv3D1iMpsp1Kv6o1ASPZmuSKutE3RIMhxKSOeAM=
|
||||
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b h1:Z9z+7iegu0HXuL+S8taVWRd1P4b9JJOgPXIeoqYrj7c=
|
||||
yunion.io/x/log v0.0.0-20190514041436-04ce53b17c6b/go.mod h1:+gauLs73omeJAPlsXcevLsJLKixV+sR/E7WSYTSx1fE=
|
||||
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d h1:59zrDL7Ft+hDukguJRmLr/Gdu/9V75x+yX99ovZwfaA=
|
||||
@@ -703,12 +710,13 @@ yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d/go.mod h1:LC6f/4FozL0iaAbnFt2
|
||||
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf h1:OsKC+2ghZHwp+Ztm/MwKlLKKRiE7QcPG8eTp0GmsHbg=
|
||||
yunion.io/x/pkg v0.0.0-20190620104149-945c25821dbf/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20190628082551-f4033ba2ea30/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20200103043034-27c6f82160fa h1:+7zYi8MhaOW/53/7FOERnhQqAU4UhgaOVIS+AMzTKNU=
|
||||
yunion.io/x/pkg v0.0.0-20200103043034-27c6f82160fa/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070 h1:rKnYgtvMHKmzPEUTkyNjyKOG7wzjpUvI7fcZwLNGQXw=
|
||||
yunion.io/x/pkg v0.0.0-20200302034534-fdf44d54b070/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/pkg v0.0.0-20200304112442-9dae9351325e h1:rBfX77+VEBVpe6Xxy2gDa4WB7qbtndWvXcrVKzleF84=
|
||||
yunion.io/x/pkg v0.0.0-20200304112442-9dae9351325e/go.mod h1:t6rEGG2sQ4J7DhFxSZVOTjNd0YO/KlfWQyK1W4tog+E=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e h1:v+EzIadodSwkdZ/7bremd7J8J50Cise/HCylsOJngmo=
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e/go.mod h1:0iFKpOs1y4lbCxeOmq3Xx/0AcQoewVPwj62eRluioEo=
|
||||
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57 h1:KtQAuLJ00RSUVqkiRmJ1DiDABiw0U3xxXnzD3lGavaY=
|
||||
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI=
|
||||
yunion.io/x/sqlchemy v0.0.0-20200221103553-6a98f7f8ab92 h1:Iz70/alKMAW3KeePhmExuhWsYw1MGTcMr5ewAL5lj1I=
|
||||
yunion.io/x/sqlchemy v0.0.0-20200221103553-6a98f7f8ab92/go.mod h1:FTdwPdGhMgh4E+UFXc9klI1Ok34fMuybTT+jLhOaIjI=
|
||||
yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3 h1:bfC8EhXYvyGYldRWlzxiCM39Zfj3s3+zham9mW2h2LE=
|
||||
yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3/go.mod h1:EP6NSv2C0zzqBDTKumv8hPWLb3XvgMZDHQRfyuOrQng=
|
||||
|
||||
@@ -187,7 +187,7 @@ func (f *ResourceHandlers) listHandler(ctx context.Context, w http.ResponseWrite
|
||||
}
|
||||
}
|
||||
|
||||
func (f *ResourceHandlers) doList(session *mcclient.ClientSession, module modulebase.BaseManagerInterface, query jsonutils.JSONObject, w http.ResponseWriter, r *http.Request) {
|
||||
func (f *ResourceHandlers) doList(session *mcclient.ClientSession, module modulebase.IBaseManager, query jsonutils.JSONObject, w http.ResponseWriter, r *http.Request) {
|
||||
var exportKeys []string
|
||||
var exportTexts []string
|
||||
exportFormat, _ := query.GetString("export")
|
||||
|
||||
@@ -29,7 +29,7 @@ type GatewayOptions struct {
|
||||
|
||||
SqlitePath string `help:"sqlite db path" default:"/etc/yunion/data/yunionapi.db"`
|
||||
|
||||
common_options.CommonOptions `"request_worker_count->default":"32"`
|
||||
common_options.CommonOptions
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -40,10 +40,9 @@ func OnOptionsChange(oldO, newO interface{}) bool {
|
||||
oldOpts := oldO.(*GatewayOptions)
|
||||
newOpts := newO.(*GatewayOptions)
|
||||
|
||||
changed := false
|
||||
if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
|
||||
changed = true
|
||||
return true
|
||||
}
|
||||
|
||||
return changed
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -18,21 +18,16 @@ import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
)
|
||||
|
||||
type CloudeventListInput struct {
|
||||
apis.BaseListInput
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
// 根据平台过滤
|
||||
Providers []string `json:"providers"`
|
||||
// 根据品牌过滤
|
||||
Brands []string `json:"brands"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Brand []string `json:"brand" deprecated-by:"brands"`
|
||||
compute.ManagedResourceListInput
|
||||
|
||||
// 操作日志起始日期
|
||||
// 操作日志起始时间
|
||||
Since time.Time `json:"since"`
|
||||
// 操作日志截止日期
|
||||
// 操作日志截止时间
|
||||
Until time.Time `json:"until"`
|
||||
}
|
||||
|
||||
@@ -16,8 +16,16 @@ package cloudprovider
|
||||
|
||||
// SGeographicInfo is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudprovider.SGeographicInfo.
|
||||
type SGeographicInfo struct {
|
||||
Latitude float32 `json:"latitude"`
|
||||
Longitude float32 `json:"longitude"`
|
||||
City string `json:"city"`
|
||||
CountryCode string `json:"country_code"`
|
||||
// 纬度
|
||||
// example: 26.647003
|
||||
Latitude float32 `json:"latitude"`
|
||||
// 经度
|
||||
// example: 106.630211
|
||||
Longitude float32 `json:"longitude"`
|
||||
// 城市
|
||||
// example: Guiyang
|
||||
City string `json:"city"`
|
||||
// 国家代码
|
||||
// example: CN
|
||||
CountryCode string `json:"country_code"`
|
||||
}
|
||||
|
||||
@@ -31,14 +31,36 @@ type SchedtagConfig struct {
|
||||
type NetworkConfig struct {
|
||||
apis.Meta
|
||||
|
||||
Index int `json:"index"`
|
||||
Network string `json:"network"`
|
||||
Wire string `json:"wire"`
|
||||
Exit bool `json:"exit"`
|
||||
Private bool `json:"private"`
|
||||
Mac string `json:"mac"`
|
||||
Address string `json:"address"`
|
||||
// 网卡序号, 从0开始
|
||||
// required: true
|
||||
Index int `json:"index"`
|
||||
|
||||
// 子网名称或ID
|
||||
// required: true
|
||||
Network string `json:"network"`
|
||||
|
||||
// swagger:ignore
|
||||
Wire string `json:"wire"`
|
||||
|
||||
// 内网地址
|
||||
Exit bool `json:"exit"`
|
||||
Private bool `json:"private"`
|
||||
|
||||
// 网卡MAC地址
|
||||
// requried: false
|
||||
Mac string `json:"mac"`
|
||||
|
||||
// 子网内的IPv4地址, 若不指定会安装子网的地址分配策略分配一个IP地址
|
||||
// required: false
|
||||
Address string `json:"address"`
|
||||
|
||||
// 子网内的IPv6地址
|
||||
// required: false
|
||||
// swagger:ignore
|
||||
Address6 string `json:"address6"`
|
||||
|
||||
// 驱动方式
|
||||
// 若指定镜像的网络驱动方式,此参数会被覆盖
|
||||
Driver string `json:"driver"`
|
||||
BwLimit int `json:"bw_limit"`
|
||||
Vip bool `json:"vip"`
|
||||
@@ -53,33 +75,132 @@ type NetworkConfig struct {
|
||||
StandbyPortCount int `json:"standby_port_count"`
|
||||
StandbyAddrCount int `json:"standby_addr_count"`
|
||||
|
||||
Project string `json:"project_id"`
|
||||
// swagger:ignore
|
||||
Project string `json:"project_id"`
|
||||
|
||||
// swagger:ignore
|
||||
Domain string `json:"domain_id"`
|
||||
Ifname string `json:"ifname"`
|
||||
Schedtags []*SchedtagConfig `json:"schedtags"`
|
||||
}
|
||||
|
||||
type AttachNetworkInput struct {
|
||||
// 添加的网卡的配置
|
||||
// required: true
|
||||
Nets []*NetworkConfig `json:"nets"`
|
||||
}
|
||||
|
||||
type DiskConfig struct {
|
||||
apis.Meta
|
||||
|
||||
Index int `json:"index"` // -1 means not attach to any guests
|
||||
ImageId string `json:"image_id"`
|
||||
SnapshotId string `json:"snapshot_id"`
|
||||
DiskType string `json:"disk_type"`
|
||||
Schedtags []*SchedtagConfig `json:"schedtags"`
|
||||
// 挂载到虚拟机的磁盘顺序, -1代表不挂载任何虚拟机
|
||||
// default: -1
|
||||
Index int `json:"index"`
|
||||
|
||||
SizeMb int `json:"size"`
|
||||
Fs string `json:"fs"`
|
||||
Format string `json:"format"`
|
||||
Driver string `json:"driver"`
|
||||
Cache string `json:"cache"`
|
||||
Mountpoint string `json:"mountpoint"`
|
||||
Backend string `json:"backend"` // stroageType
|
||||
Medium string `json:"medium"`
|
||||
// 镜像ID,通过镜像创建磁盘,创建虚拟机时第一块磁盘需要指定此参数
|
||||
// required: false
|
||||
ImageId string `json:"image_id"`
|
||||
|
||||
// 快照ID,通过快照创建磁盘,此参数必须加上 'snapshot-' 前缀
|
||||
// example: snapshot-3140cecb-ccc4-4865-abae-3a5ba8c69d9b
|
||||
// requried: false
|
||||
SnapshotId string `json:"snapshot_id"`
|
||||
|
||||
// 磁盘类型
|
||||
// enum: sys, data, swap
|
||||
DiskType string `json:"disk_type"`
|
||||
|
||||
Schedtags []*SchedtagConfig `json:"schedtags"`
|
||||
|
||||
// 磁盘大小,单位Mb
|
||||
// 若创建裸金属服务器是, -1代表自动向后扩展存储
|
||||
// requried:true
|
||||
SizeMb int `json:"size"`
|
||||
|
||||
// 文件系统,仅kvm支持自动格式化磁盘,私有云和公有云此参数不会生效
|
||||
// enum: swap, ext2, ext3, ext4, xfs, ntfs, fat, hfsplus
|
||||
// requried: false
|
||||
Fs string `json:"fs"`
|
||||
|
||||
// 磁盘存储格式
|
||||
// enum: qcow2, raw, docker, iso, vmdk, vmdkflatver1, vmdkflatver2, vmdkflat, vmdksparse, vmdksparsever1, vmdksparsever2, vmdksepsparse vhd
|
||||
// requried: false
|
||||
Format string `json:"format"`
|
||||
|
||||
// 磁盘驱动方式
|
||||
// enum: virtio, ide, scsi, sata, pvscsi
|
||||
// requried: false
|
||||
Driver string `json:"driver"`
|
||||
|
||||
// 磁盘缓存模式
|
||||
// enum: writeback, none, writethrough
|
||||
// requried: false
|
||||
Cache string `json:"cache"`
|
||||
|
||||
// 挂载点,必须以 '/' 开头,例如 /opt 仅KVM此参数有效
|
||||
// requried: false
|
||||
Mountpoint string `json:"mountpoint"`
|
||||
|
||||
//后端存储类型,若指定了存储ID,此参数会根据存储设置,若不指定,则作为调度的一个参考
|
||||
//
|
||||
//
|
||||
//
|
||||
//| 平台 | 存储类型 | 中文 | 数据盘 | 系统盘 | 可否扩容 | 可否单独创建 | 扩容步长 | 说明 |
|
||||
//| ---- | ---- | ---- | ----- | ----- | ------- | ----------- | ------- | ----- |
|
||||
//| Esxi |local |本地盘 |1-500GB |30~500GB | 是 | 否 | 1G | |
|
||||
//| Esxi |nas |NAS盘 |30-3072GB |30~500GB | 是 | 否 | 1G | |
|
||||
//| Esxi |vsan |VSAN盘 |30-3072GB |30~500GB | 是 | 否 | 1G | |
|
||||
//| KVM |local |本地盘盘 |1-500GB |30~500GB | 是 | 否 | 1G | |
|
||||
//| KVM |rbd |云硬盘 |1-3072GB |30~500GB | 是 | 是 | 1G | |
|
||||
//| Azure |standard_lrs |标准 HDD |1-4095GB |30~4095GB | 是 | 是 | 1G | |
|
||||
//| Azure |standardssd_lrs |标准 SSD |1-4095GB |30~4095GB | 是 | 是 | 1G | |
|
||||
//| Azure |premium_lrs |高级SSD |1-4095GB |30~4095GB | 是 | 是 | 1G | |
|
||||
//| AWS |gp2 |通用型SSD |1-16384GB |20~16384GB | 是 | 是 | 1G | |
|
||||
//| AWS |io1 |预配置 IOPS SSD|4-16384GB |20-16384GB | 是 | 是 | 1G | |
|
||||
//| AWS |st1 |吞吐优化HDD |500-16384GB |不支持 | 是 | 是 | 1G | |
|
||||
//| AWS |sc1 |Cold HDD |500-16384GB |不支持 | 是 | 是 | 1G | |
|
||||
//| AWS |standard |磁介质 |1-1024GB |20-1024GB | 是 | 是 | 1G | |
|
||||
//| 腾讯云 |cloud_ssd |SSD云硬盘 |10-16000GB |50~500GB | 是 | 是 | 10G | |
|
||||
//| 腾讯云 |cloud_basic |普通云硬盘 |10-16000GB |50~500GB | 是 | 是 | 10G | |
|
||||
//| 腾讯云 |cloud_preium |高性能云硬盘 |10-16000GB |50~1024GB | 是 | 是 | 10G | |
|
||||
//| 腾讯云 |local_basic |普通本地盘 |10-1600GB |不支持 | 否 | 否 | | |
|
||||
//| 腾讯云 |local_ssd |SSD本地盘 |10-7000GB |部分区域套餐支持 | 否 | 否 | | |
|
||||
//| 腾讯云 |local_pro |HDD本地盘 |跟随套餐 |部分区域套餐支持 | 否 | 否 | | |
|
||||
//| 华为云或天翼云 |SSD |超高IO云硬盘 |10-32768GB |40~1024GB | 是 | 是 | 1G | |
|
||||
//| 华为云或天翼云 |SAS |高IO云硬盘 |10-32768GB |40~1024GB | 是 | 是 | 1G | |
|
||||
//| 华为云或天翼云 |SATA |普通IO云硬盘 |10-32768GB |40~1024GB | 是 | 是 | 1G | |
|
||||
//| OpenStack |nova |nova |不支持 |30-500GB | 否 | 否 | | |
|
||||
//| OpenStack |自定义 |... |无限制 |无限制 | 是 | 是 | 1G | |
|
||||
//| Ucloud |CLOUD_NORMAL |普通云盘 |20-8000GB |不支持 | 是 | 是 | 1G | |
|
||||
//| Ucloud |CLOUD_SSD |SSD云盘 |20-4000GB |20-500GB | 是 | 是 | 1G | |
|
||||
//| Ucloud |LOCAL_NORMAL |普通本地盘 | | | 是 | 是 | 1G | |
|
||||
//| Ucloud |LOCAL_SSD |SSD本地盘 | | | 是 | 是 | 1G | |
|
||||
//| Ucloud |EXCLUSIVE_LOCAL_DISK |独享本地盘 | | | 是 | 是 | 1G | |
|
||||
//| ZStack |localstorage |本地盘 | | | 是 | 是 | 1G | |
|
||||
//| ZStack |ceph |云硬盘 | | | 是 | 是 | 1G | |
|
||||
//| Google |local-ssd |本地SSD暂存盘 |375GB |不支持 | 否 | 否 | | 跟随实例创建,一次最多添加8个 |
|
||||
//| Google |pd-standard |标准永久性磁盘 |10-65536GB |10-65536GB | 是 | 是 | 1G | |
|
||||
//| Google |pd-ssd |SSD永久性磁盘 |10-65536GB |10-65536GB | 是 | 是 | 1G | |
|
||||
Backend string `json:"backend"`
|
||||
|
||||
//介质类型
|
||||
//rotate: 机械盘
|
||||
//ssd: 固态硬盘
|
||||
//hybird: 混合盘
|
||||
//emum: [rotate, ssd, hybrid]
|
||||
//default: hybird
|
||||
Medium string `json:"medium"`
|
||||
|
||||
//swagger:ignore
|
||||
ImageProperties map[string]string `json:"image_properties"`
|
||||
|
||||
//存储ID, 指定存储后,磁盘会在此存储上创建
|
||||
//存储列表可以参数 storage 列表API
|
||||
//required: false
|
||||
Storage string `json:"storage_id"`
|
||||
DiskId string `json:"disk_id"`
|
||||
|
||||
//swagger:ignore
|
||||
DiskId string `json:"disk_id"`
|
||||
}
|
||||
|
||||
type IsolatedDeviceConfig struct {
|
||||
@@ -110,26 +231,92 @@ type BaremetalDiskConfig struct {
|
||||
}
|
||||
|
||||
type ServerConfigs struct {
|
||||
// prefer options
|
||||
PreferRegion string `json:"prefer_region_id"`
|
||||
PreferZone string `json:"prefer_zone_id"`
|
||||
PreferWire string `json:"prefer_wire_id"`
|
||||
PreferHost string `json:"prefer_host_id"`
|
||||
// 调度使用指定的云账号
|
||||
PreferManager string `json:"prefer_manager_id"`
|
||||
|
||||
// 调度到指定区域,优先级低于prefer_zone_id
|
||||
PreferRegion string `json:"prefer_region_id"`
|
||||
|
||||
// 调度到指定可用区,优先级低于prefer_host_id
|
||||
PreferZone string `json:"prefer_zone_id"`
|
||||
|
||||
// 调度使用指定二层网络, 优先级低于prefer_host_id
|
||||
PreferWire string `json:"prefer_wire_id"`
|
||||
|
||||
// 调度使用指定宿主机
|
||||
PreferHost string `json:"prefer_host_id"`
|
||||
|
||||
// 主机高可用时,将备机调度到指定宿主机, 此参数仅对KVM生效
|
||||
PreferBackupHost string `json:"prefer_backup_host"`
|
||||
|
||||
// 虚拟化技术或平台
|
||||
//
|
||||
//
|
||||
//
|
||||
// |hypervisor | 技术或平台 |
|
||||
// |------- | ---------- |
|
||||
// |kvm | 本地私有云 |
|
||||
// |esxi | VMWare |
|
||||
// |baremetal | 裸金属 |
|
||||
// |aliyun | 阿里云 |
|
||||
// |aws | 亚马逊 |
|
||||
// |qcloud | 腾讯云 |
|
||||
// |azure | 微软云 |
|
||||
// |huawei | 华为云 |
|
||||
// |openstack | OpenStack |
|
||||
// |ucloud | Ucloud |
|
||||
// |zstack | ZStack |
|
||||
// |google | 谷歌云 |
|
||||
// |ctyun | 天翼云 |
|
||||
// default: kvm
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
// ResourceType "shared|prepaid|dedicated"`
|
||||
|
||||
// 包年包月资源池
|
||||
// swagger:ignore
|
||||
// emum: shared, prepaid, dedicated
|
||||
ResourceType string `json:"resource_type"`
|
||||
|
||||
// 套餐名称, 此参数优先级高于vcpu_count和vmem_size
|
||||
// 套餐可以通过 serverskus 列表获取
|
||||
// esxi, openstack, zstack等私有云都统一使用provider为OneCloud的套餐
|
||||
// 公有云使用各自的套餐
|
||||
InstanceType string `json:"instance_type"`
|
||||
Backup bool `json:"backup"`
|
||||
Count int `json:"count"`
|
||||
|
||||
Disks []*DiskConfig `json:"disks"`
|
||||
Networks []*NetworkConfig `json:"nets"`
|
||||
Schedtags []*SchedtagConfig `json:"schedtags"`
|
||||
IsolatedDevices []*IsolatedDeviceConfig `json:"isolated_devices"`
|
||||
BaremetalDiskConfigs []*BaremetalDiskConfig `json:"baremetal_disk_configs"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// alias for InstanceType
|
||||
Sku string `json:"sku" deprecated-by:"instance_type"`
|
||||
|
||||
// 虚拟机高可用(创建备机)
|
||||
// default: false
|
||||
// requried: false
|
||||
Backup bool `json:"backup"`
|
||||
|
||||
// 创建虚拟机数量
|
||||
// default: 1
|
||||
Count int `json:"count"`
|
||||
|
||||
// 磁盘列表,第一块磁盘为系统盘,需要指定image_id
|
||||
// 若指定主机快照,此参数可以为空
|
||||
// required: true
|
||||
Disks []*DiskConfig `json:"disks"`
|
||||
|
||||
// 指定主机网络
|
||||
// required: false
|
||||
Networks []*NetworkConfig `json:"nets"`
|
||||
|
||||
// 调度标签
|
||||
// required: false
|
||||
Schedtags []*SchedtagConfig `json:"schedtags"`
|
||||
|
||||
// 透传设备列表
|
||||
// required: false
|
||||
IsolatedDevices []*IsolatedDeviceConfig `json:"isolated_devices"`
|
||||
|
||||
// 裸金属磁盘配置列表
|
||||
BaremetalDiskConfigs []*BaremetalDiskConfig `json:"baremetal_disk_configs"`
|
||||
|
||||
// 主机组列表, 参数可以是主机组名称或ID,建议使用ID
|
||||
InstanceGroupIds []string `json:"groups"`
|
||||
|
||||
// DEPRECATE
|
||||
@@ -159,53 +346,149 @@ type ServerCreateInput struct {
|
||||
|
||||
*ServerConfigs
|
||||
|
||||
VmemSize int `json:"vmem_size"`
|
||||
VcpuCount int `json:"vcpu_count"`
|
||||
UserData string `json:"user_data"`
|
||||
Metadata map[string]string `json:"__meta__"`
|
||||
// 虚拟机内存大小,单位Mb,若未指定instance_type,此参数为必传项
|
||||
VmemSize int `json:"vmem_size"`
|
||||
|
||||
// 虚拟机Cpu大小,若未指定instance_type,此参数为必传项
|
||||
// default: 1
|
||||
VcpuCount int `json:"vcpu_count"`
|
||||
|
||||
// 用户自定义启动脚本
|
||||
// required: false
|
||||
UserData string `json:"user_data"`
|
||||
|
||||
// swagger:ignore
|
||||
Keypair string `json:"keypair" deprecated-by:"keypair_id"`
|
||||
Keypair string `json:"keypair" deprecated-by:"keypair_id"`
|
||||
|
||||
// 秘钥对Id
|
||||
// required: false
|
||||
KeypairId string `json:"keypair_id"`
|
||||
Password string `json:"password"`
|
||||
Cdrom string `json:"cdrom"`
|
||||
Vga string `json:"vga"`
|
||||
Vdi string `json:"vdi"`
|
||||
Bios string `json:"bios"`
|
||||
// Description string `json:"description"`
|
||||
BootOrder string `json:"boot_order"`
|
||||
EnableCloudInit bool `json:"enable_cloud_init"`
|
||||
ResetPassword *bool `json:"reset_password"`
|
||||
// DisableDelete *bool `json:"disable_delete"`
|
||||
ShutdownBehavior string `json:"shutdown_behavior"`
|
||||
AutoStart bool `json:"auto_start"`
|
||||
DeployConfigs []*DeployConfig `json:"deploy_configs"`
|
||||
// IsSystem bool `json:"is_system"`
|
||||
Duration string `json:"duration"`
|
||||
AutoPrepaidRecycle bool `json:"auto_prepaid_recycle,omitfalse"`
|
||||
SecgroupId string `json:"secgrp_id"`
|
||||
EipBw int `json:"eip_bw,omitzero"`
|
||||
EipChargeType string `json:"eip_charge_type,omitempty"`
|
||||
Eip string `json:"eip,omitempty"`
|
||||
InstanceSnapshotId string `json:"instance_snapshot_id,omitempty"`
|
||||
Secgroups []string `json:"secgroups"`
|
||||
|
||||
// 密码
|
||||
// 要求: 密码长度 >= 20, 至少包含一个数字一个小写字母一个大小字母及特殊字符~`!@#$%^&*()-_=+[]{}|:';\",./<>?中的一个
|
||||
// requried: false
|
||||
Password string `json:"password"`
|
||||
|
||||
// 使用ISO光盘启动, 仅KVM平台支持
|
||||
// required: false
|
||||
Cdrom string `json:"cdrom"`
|
||||
|
||||
// enum: cirros, vmware, qxl, std
|
||||
// default: std
|
||||
Vga string `json:"vga"`
|
||||
|
||||
// 远程连接协议
|
||||
// enum: vnc, spice
|
||||
// default: vnc
|
||||
Vdi string `json:"vdi"`
|
||||
|
||||
// BIOS类型, 若镜像是Windows,并且支持UEFI,则自动会设置为UEFI
|
||||
// emulate: BIOS, UEFI
|
||||
Bios string `json:"bios"`
|
||||
|
||||
// 启动顺序
|
||||
// c: cdrome
|
||||
// d: disk
|
||||
// n: network
|
||||
// example: cnd
|
||||
// default: cdn
|
||||
BootOrder string `json:"boot_order"`
|
||||
|
||||
// 启用cloud-init,需要镜像装有cloud-init服务
|
||||
// default: false
|
||||
EnableCloudInit bool `json:"enable_cloud_init"`
|
||||
|
||||
// 随机密码, 若指定password参数,此参数不生效
|
||||
// 若值为false并且password为空,则表示保留镜像密码
|
||||
ResetPassword *bool `json:"reset_password"`
|
||||
|
||||
// 关机后执行的操作
|
||||
// terminate: 关机后自动删除
|
||||
// emum: stop, terminate
|
||||
// default: stop
|
||||
ShutdownBehavior string `json:"shutdown_behavior"`
|
||||
|
||||
// 创建后自动启动
|
||||
// 部分云创建后会自动启动例如: 腾讯云, AWS, OpenStack, ZStack, Ucloud, Huawei, Azure, 天翼云
|
||||
// default: false
|
||||
AutoStart bool `json:"auto_start"`
|
||||
DeployConfigs []*DeployConfig `json:"deploy_configs"`
|
||||
|
||||
// 包年包月时长
|
||||
//
|
||||
//
|
||||
// |平台 |是否支持 |
|
||||
// |---- |------- |
|
||||
// |KVM |否 |
|
||||
// |ESxi |否 |
|
||||
// |OpenStack |否 |
|
||||
// |ZStack |否 |
|
||||
// |Google |否 |
|
||||
// |Azure |否 |
|
||||
// |AWS |否 |
|
||||
// |腾讯云 |是 |
|
||||
// |Aliyun |是 |
|
||||
// |Ucloud |是 |
|
||||
// |Huawei |是 |
|
||||
// |天翼云 |是 |
|
||||
Duration string `json:"duration"`
|
||||
|
||||
// swagger:ignore
|
||||
AutoPrepaidRecycle bool `json:"auto_prepaid_recycle,omitfalse"`
|
||||
|
||||
// 弹性公网IP带宽
|
||||
// 指定此参数后会创建新的弹性公网IP并绑定到新建的虚拟机
|
||||
// 私有云不支持此参数
|
||||
EipBw int `json:"eip_bw,omitzero"`
|
||||
|
||||
// 弹性公网IP计费类型
|
||||
EipChargeType string `json:"eip_charge_type,omitempty"`
|
||||
|
||||
// 弹性公网IP名称或ID
|
||||
// 绑定已有弹性公网IP, 此参数会限制虚拟机再谈下公网IP所在的区域创建
|
||||
// required: false
|
||||
Eip string `json:"eip,omitempty"`
|
||||
|
||||
// 使用主机快照创建虚拟机, 主机快照不会重置密码及秘钥信息
|
||||
// 使用主机快照创建的虚拟机将沿用之前的密码秘钥及安全组信息
|
||||
// required: false
|
||||
InstanceSnapshotId string `json:"instance_snapshot_id,omitempty"`
|
||||
|
||||
// 安全组Id, 此参数会和secgroups参数合并
|
||||
SecgroupId string `json:"secgrp_id"`
|
||||
// 安全组Id列表
|
||||
Secgroups []string `json:"secgroups"`
|
||||
|
||||
// swagger:ignore
|
||||
OsType string `json:"os_type"`
|
||||
// Fill by server
|
||||
OsProfile jsonutils.JSONObject `json:"__os_profile__"`
|
||||
BillingType string `json:"billing_type"`
|
||||
BillingCycle string `json:"billing_cycle"`
|
||||
|
||||
// DEPRECATE or not used fields
|
||||
// swagger:ignore
|
||||
OsProfile jsonutils.JSONObject `json:"__os_profile__"`
|
||||
// swagger:ignore
|
||||
BillingType string `json:"billing_type"`
|
||||
// swagger:ignore
|
||||
BillingCycle string `json:"billing_cycle"`
|
||||
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// 此参数等同于 hypervisor=baremetal
|
||||
Baremetal bool `json:"baremetal"`
|
||||
|
||||
// Used to store BaremetalConvertHypervisorTaskId
|
||||
ParentTaskId string `json:"__parent_task_id,omitempty"`
|
||||
// default stroage type if host is given
|
||||
|
||||
// 指定系统盘默认存储类型, 如果指定宿主机
|
||||
// swagger:ignore
|
||||
DefaultStorageType string `json:"default_storage_type,omitempty"`
|
||||
|
||||
// Guest Image ID
|
||||
GuestImageID string
|
||||
// 指定用于新建主机的主机镜像ID
|
||||
GuestImageID string `json:"guest_image_id"`
|
||||
}
|
||||
|
||||
func (input *ServerCreateInput) AfterUnmarshal() {
|
||||
if input.Baremetal {
|
||||
input.Hypervisor = HYPERVISOR_BAREMETAL
|
||||
}
|
||||
}
|
||||
|
||||
type ServerCloneInput struct {
|
||||
|
||||
@@ -12,18 +12,15 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package apis
|
||||
package compute
|
||||
|
||||
type ModelBaseDetails struct {
|
||||
CanDelete bool `json:"can_delete"`
|
||||
DeleteFailReason string `json:"delete_fail_reason"`
|
||||
CanUpdate bool `json:"can_update"`
|
||||
UpdateFailReason string `json:"update_fail_reason"`
|
||||
}
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ModelBaseShortDescDetail struct {
|
||||
ResName string `json:"res_name"`
|
||||
}
|
||||
type BaremetalagentDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SBaremetalagent
|
||||
|
||||
type ModelBaseListInput struct {
|
||||
// 裸金属代理程序所在的可用区
|
||||
// example: zone1
|
||||
Zone string `json:"zone"`
|
||||
}
|
||||
@@ -49,10 +49,13 @@ type BucketCreateInput struct {
|
||||
StorageClass string `json:"storage_class"`
|
||||
}
|
||||
|
||||
type BucketDetail struct {
|
||||
apis.Meta
|
||||
type BucketDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SBucket
|
||||
CloudproviderDetails
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
AccessUrls []cloudprovider.SBucketAccessUrl `json:"access_urls"`
|
||||
}
|
||||
|
||||
type BucketObjectsActionInput struct {
|
||||
@@ -90,3 +93,9 @@ func (input *BucketMetadataInput) Validate() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type BucketListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
}
|
||||
|
||||
55
pkg/apis/compute/cachedimage.go
Normal file
55
pkg/apis/compute/cachedimage.go
Normal file
@@ -0,0 +1,55 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type CachedImageUncacheImageInput struct {
|
||||
// 存储缓存名Id
|
||||
// required: true
|
||||
StoragecacheId string `json:"storagecache_id"`
|
||||
|
||||
// 是否强制清除缓存
|
||||
// default: false
|
||||
IsForce bool `json:"is_force"`
|
||||
}
|
||||
|
||||
type CachedimageDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SCachedimage
|
||||
|
||||
// 镜像状态, 和info里面的status一致
|
||||
// example: active
|
||||
Status string `json:"status"`
|
||||
|
||||
// 操作系统类型
|
||||
// example: FreeBSD
|
||||
OsType string `json:"os_type"`
|
||||
|
||||
// 操作系统发行版
|
||||
// example: FreeBSD
|
||||
OsDistribution string `json:"os_distribution"`
|
||||
|
||||
// 操作系统版本
|
||||
// example: 11
|
||||
OsVersion string `json:"os_version"`
|
||||
|
||||
// 虚拟化类型
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
|
||||
// 此镜像被使用次数
|
||||
// example: 0
|
||||
CachedCount int `json:"cached_count"`
|
||||
}
|
||||
24
pkg/apis/compute/cachedloadbalanceracl.go
Normal file
24
pkg/apis/compute/cachedloadbalanceracl.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type CachedLoadbalancerAclDetails struct {
|
||||
apis.SharableVirtualResourceDetails
|
||||
SCachedLoadbalancerAcl
|
||||
|
||||
CloudproviderInfo
|
||||
}
|
||||
24
pkg/apis/compute/cachedloadbalancercertificate.go
Normal file
24
pkg/apis/compute/cachedloadbalancercertificate.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type CachedLoadbalancerCertificateDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SCachedLoadbalancerCertificate
|
||||
|
||||
CloudproviderInfo
|
||||
}
|
||||
@@ -26,17 +26,58 @@ import (
|
||||
type CloudaccountCreateInput struct {
|
||||
apis.EnabledStatusStandaloneResourceCreateInput
|
||||
|
||||
Provider string
|
||||
AccountId string
|
||||
Brand string
|
||||
IsPublicCloud bool
|
||||
IsOnPremise bool
|
||||
Tenant string
|
||||
TenantId string
|
||||
EnableAutoSync bool
|
||||
SyncIntervalSeconds int
|
||||
AutoCreateProject bool
|
||||
Options *jsonutils.JSONObject
|
||||
// 指定云平台
|
||||
// Qcloud: 腾讯云
|
||||
// Ctyun: 天翼云
|
||||
// enum: VMware, Aliyun, Qcloud, Azure, Aws, Huawei, OpenStack, Ucloud, ZStack, Google, Ctyun
|
||||
Provider string `json:"provider"`
|
||||
// swagger:ignore
|
||||
AccountId string
|
||||
|
||||
// 指定云平台品牌, 此参数默认和provider相同
|
||||
// requried: false
|
||||
//
|
||||
//
|
||||
//
|
||||
// | provider | 支持的参数 |
|
||||
// | -------- | ---------- |
|
||||
// | VMware | VMware |
|
||||
// | Aliyun | Aliyun |
|
||||
// | Qcloud | Qcloud |
|
||||
// | Azure | Azure |
|
||||
// | Aws | Aws |
|
||||
// | Huawei | Huawei |
|
||||
// | OpenStack | OpenStack |
|
||||
// | Ucloud | Ucloud |
|
||||
// | ZStack | ZStack, DStack |
|
||||
// | Google | Google |
|
||||
// | Ctyun | Ctyun |
|
||||
Brand string `json:"brand"`
|
||||
|
||||
// swagger:ignore
|
||||
IsPublicCloud bool
|
||||
// swagger:ignore
|
||||
IsOnPremise bool
|
||||
|
||||
// 指定云账号所属的项目
|
||||
Tenant string `json:"tenant"`
|
||||
|
||||
// swagger:ignore
|
||||
TenantId string
|
||||
|
||||
// 启用自动同步
|
||||
// default: false
|
||||
EnableAutoSync bool `json:"enable_auto_sync"`
|
||||
|
||||
// 自动同步间隔时间
|
||||
SyncIntervalSeconds int `json:"sync_interval_seconds"`
|
||||
|
||||
// 自动根据云上项目或订阅创建本地项目
|
||||
// default: false
|
||||
AutoCreateProject bool `json:"auto_create_project"`
|
||||
|
||||
// 额外信息,例如账单的access key
|
||||
Options *jsonutils.JSONObject `json:"options"`
|
||||
|
||||
cloudprovider.SCloudaccount
|
||||
cloudprovider.SCloudaccountCredential
|
||||
@@ -57,3 +98,83 @@ func (i CloudaccountShareModeInput) Validate() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CloudaccountListInput struct {
|
||||
apis.EnabledStatusStandaloneResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
|
||||
CapabilityListInput
|
||||
}
|
||||
|
||||
type ProviderProject struct {
|
||||
// 子订阅项目名称
|
||||
// example: system
|
||||
Tenant string `json:"tenant"`
|
||||
|
||||
// 子订阅项目Id
|
||||
// 9a48383a-467a-4542-8b50-4e15b0a8715f
|
||||
TenantId string `json:"tenant_id"`
|
||||
}
|
||||
|
||||
type CloudaccountDetail struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SCloudaccount
|
||||
|
||||
// 子订阅项目信息
|
||||
Projects []ProviderProject `json:"projects"`
|
||||
|
||||
// 同步时间间隔
|
||||
// example: 3600
|
||||
SyncIntervalSeconds int `json:"sync_interval_seconds"`
|
||||
|
||||
// 同步状态
|
||||
SyncStatus2 string `json:"sync_stauts2"`
|
||||
|
||||
// 云账号环境类型
|
||||
// public: 公有云
|
||||
// private: 私有云
|
||||
// onpremise: 本地IDC
|
||||
// example: public
|
||||
CloudEnv string `json:"cloud_env"`
|
||||
|
||||
// 云账号项目名称
|
||||
// example: system
|
||||
Tenant string `json:"tenant"`
|
||||
|
||||
// 弹性公网Ip数量
|
||||
// example: 2
|
||||
EipCount int `json:"eip_count,allowempty"`
|
||||
|
||||
// 虚拟私有网络数量
|
||||
// example: 4
|
||||
VpcCount int `json:"vpc_count,allowempty"`
|
||||
|
||||
// 云盘数量
|
||||
// example: 12
|
||||
DiskCount int `json:"disk_count,allowempty"`
|
||||
|
||||
// 宿主机数量(不计算虚拟机宿主机数量)
|
||||
// example: 0
|
||||
HostCount int `json:"host_count,allowempty"`
|
||||
|
||||
// 云主机数量
|
||||
// example: 4
|
||||
GuestCount int `json:"guest_count,allowempty"`
|
||||
|
||||
// 块存储数量
|
||||
// example: 12
|
||||
StorageCount int `json:"storage_count,allowempty"`
|
||||
|
||||
// 子订阅数量
|
||||
// example: 1
|
||||
ProviderCount int `json:"provider_count,allowempty"`
|
||||
|
||||
// 路由表数量
|
||||
// example: 0
|
||||
RoutetableCount int `json:"routetable_count,allowempty"`
|
||||
|
||||
// 存储缓存数量
|
||||
// example: 10
|
||||
StoragecacheCount int `json:"storagecache_count,allowempty"`
|
||||
}
|
||||
|
||||
@@ -14,85 +14,271 @@
|
||||
|
||||
package compute
|
||||
|
||||
type CloudproviderDetails struct {
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Brand string `json:"brand,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
AccountId string `json:"account_id,omitempty"`
|
||||
Manager string `json:"manager,omitempty"`
|
||||
ManagerId string `json:"manager_id,omitempty"`
|
||||
ManagerProject string `json:"manager_project,omitempty"`
|
||||
import (
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
)
|
||||
|
||||
type CloudproviderInfo struct {
|
||||
// 云平台
|
||||
// example: Google
|
||||
Provider string `json:"provider,omitempty"`
|
||||
|
||||
// 云平台品牌
|
||||
// example: Google
|
||||
Brand string `json:"brand,omitempty"`
|
||||
|
||||
// 云账号名称
|
||||
// example: google-account
|
||||
Account string `json:"account,omitempty"`
|
||||
|
||||
// 云账号Id
|
||||
// example: 4d3c8979-9dd0-439b-8d78-36fe1ab1666c
|
||||
AccountId string `json:"account_id,omitempty"`
|
||||
|
||||
// 子订阅名称
|
||||
// example: google-account
|
||||
Manager string `json:"manager,omitempty"`
|
||||
|
||||
// 子订阅Id
|
||||
// example: fa4aaf88-aed8-422d-84e7-56dea533b364
|
||||
ManagerId string `json:"manager_id,omitempty"`
|
||||
|
||||
// 子订阅所在项目名称
|
||||
// example: system
|
||||
ManagerProject string `json:"manager_project,omitempty"`
|
||||
// 子订阅所在项目Id
|
||||
// example: 4d3c8979-9dd0-439b-8d78-36fe1ab1666c
|
||||
ManagerProjectId string `json:"manager_project_id,omitempty"`
|
||||
ManagerDomain string `json:"manager_domain,omitempty"`
|
||||
ManagerDomainId string `json:"manager_domain_id,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
RegionId string `json:"region_id,omitempty"`
|
||||
CloudregionId string `json:"cloudregion_id,omitempty"`
|
||||
|
||||
// 子订阅所在域名称
|
||||
// example: Default
|
||||
ManagerDomain string `json:"manager_domain,omitempty"`
|
||||
|
||||
// 子订阅所在域Id
|
||||
// example: default
|
||||
ManagerDomainId string `json:"manager_domain_id,omitempty"`
|
||||
|
||||
// 区域名称
|
||||
// example: 腾讯云 华南地区(广州)
|
||||
Region string `json:"region,omitempty"`
|
||||
// 区域Id
|
||||
// example: 6151c89b-77f2-4d43-8ef9-cd03d604a16b
|
||||
RegionId string `json:"region_id,omitempty"`
|
||||
// 区域Id
|
||||
// example: 6151c89b-77f2-4d43-8ef9-cd03d604a16b
|
||||
CloudregionId string `json:"cloudregion_id,omitempty"`
|
||||
// 区域外部Id
|
||||
// Qcloud/ap-guangzhou
|
||||
RegionExternalId string `json:"region_external_id,omitempty"`
|
||||
RegionExtId string `json:"region_ext_id,omitempty"`
|
||||
Zone string `json:"zone,omitempty"`
|
||||
ZoneId string `json:"zone_id,omitempty"`
|
||||
ZoneExtId string `json:"zone_ext_id,omitempty"`
|
||||
CloudEnv string `json:"cloud_env,omitempty"`
|
||||
// 区域外部Id(不携带平台信息)
|
||||
// example: ap-guangzhou
|
||||
RegionExtId string `json:"region_ext_id,omitempty"`
|
||||
|
||||
// 可用区名称
|
||||
// example: 腾讯云 广州四区
|
||||
Zone string `json:"zone,omitempty"`
|
||||
// 可用区Id
|
||||
// example: 336ac6d2-b80d-43bb-86d5-1ebf474da8d4
|
||||
ZoneId string `json:"zone_id,omitempty"`
|
||||
// 可用区外部Id
|
||||
// example: ap-guangzhou-4
|
||||
ZoneExtId string `json:"zone_ext_id,omitempty"`
|
||||
|
||||
// 云环境
|
||||
// example: public
|
||||
CloudEnv string `json:"cloud_env,omitempty"`
|
||||
}
|
||||
|
||||
type CloudaccountListInput struct {
|
||||
// List objects belonging to the cloud provider
|
||||
Cloudprovider string `json:"cloudprovider"`
|
||||
type CloudproviderDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SCloudprovider
|
||||
|
||||
// List objects belonging to the cloud provider
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
Manager string `json:"manager"`
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
ManagerId string `json:"manager_id"`
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudproviderId string `json:"cloudprovider_id"`
|
||||
|
||||
// List objects belonging to the cloud account
|
||||
// 云账号名称
|
||||
// example: google-account
|
||||
Cloudaccount string `json:"cloudaccount"`
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudaccountId string `json:"cloudaccount_id"`
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
Account string `json:"account"`
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
AccountId string `json:"account_id"`
|
||||
// 子订阅同步状态
|
||||
SyncStatus2 string `json:"sync_status2"`
|
||||
// 支持服务列表
|
||||
Capabilities []string `json:"capabilities"`
|
||||
|
||||
// List objects from the providers, choices:"OneCloud|VMware|Aliyun|Qcloud|Azure|Aws|Huawei|OpenStack|Ucloud|ZStack|Google"
|
||||
Providers []string `json:"provider"`
|
||||
// 云主机数量
|
||||
// example: 1
|
||||
GuestCount int `json:"guest_count"`
|
||||
// 宿主机数量
|
||||
// example: 2
|
||||
HostCount int `json:"host_count"`
|
||||
// 虚拟私有网络数量
|
||||
// example: 4
|
||||
VpcCount int `json:"vpc_count"`
|
||||
// 块存储梳理
|
||||
// example: 4
|
||||
StorageCount int `json:"storage_count"`
|
||||
// 存储缓存数量
|
||||
// example: 1
|
||||
StorageCacheCount int `json:"storagecache_count"`
|
||||
// 弹性公网IP数量
|
||||
// example: 12
|
||||
EipCount int `json:"eip_count"`
|
||||
// 快照数量
|
||||
// example: 0
|
||||
SnapshotCount int `json:"snapshot_count"`
|
||||
// 负载均衡器数量
|
||||
// example: 2
|
||||
LoadbalancerCount int `json:"loadbalancer_count"`
|
||||
// 项目数量
|
||||
ProjectCount int `json:"project_count"`
|
||||
// 同步区域数量
|
||||
SyncRegionCount int `json:"sync_region_count"`
|
||||
|
||||
// List objects belonging to brands
|
||||
Brands []string `json:"brand"`
|
||||
// 子订阅品牌信息
|
||||
Brand string `json:"brand"`
|
||||
}
|
||||
|
||||
type CloudTypeListInput struct {
|
||||
// enum: public_cloud,private_cloud,on_premise
|
||||
type ManagedResourceListInput struct {
|
||||
// 列出关联指定云订阅(ID或Name)的资源
|
||||
Cloudprovider string `json:"cloudprovider"`
|
||||
// List objects belonging to the cloud provider
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
Manager string `json:"manager" deprecated-by:"cloudprovider"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
ManagerId string `json:"manager_id" deprecated-by:"cloudprovider"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudproviderId string `json:"cloudprovider_id" deprecated-by:"cloudprovider"`
|
||||
|
||||
// 列出关联指定云账号(ID或Name)的资源
|
||||
Cloudaccount string `json:"cloudaccount"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudaccountId string `json:"cloudaccount_id" deprecated-by:"cloudaccount"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
Account string `json:"account" deprecated-by:"cloudaccount"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
AccountId string `json:"account_id" deprecated-by:"cloudaccount"`
|
||||
|
||||
// 列出指定云平台的资源,支持的云平台如下
|
||||
//
|
||||
// | Provider | 开始支持版本 | 平台 |
|
||||
// |-----------|------------|-------------------------------------|
|
||||
// | OneCloud | 0.0 | OneCloud内置私有云,包括KVM和裸金属管理 |
|
||||
// | VMware | 1.2 | VMware vCenter |
|
||||
// | OpenStack | 2.6 | OpenStack M版本以上私有云 |
|
||||
// | ZStack | 2.10 | ZStack私有云 |
|
||||
// | Aliyun | 2.0 | 阿里云 |
|
||||
// | Aws | 2.3 | Amazon AWS |
|
||||
// | Azure | 2.2 | Microsoft Azure |
|
||||
// | Google | 2.13 | Google Cloud Platform |
|
||||
// | Qcloud | 2.3 | 腾讯云 |
|
||||
// | Huawei | 2.5 | 华为公有云 |
|
||||
// | Ucloud | 2.7 | UCLOUD |
|
||||
// | Ctyun | 2.13 | 天翼云 |
|
||||
// | S3 | 2.11 | 通用s3对象存储 |
|
||||
// | Ceph | 2.11 | Ceph对象存储 |
|
||||
// | Xsky | 2.11 | XSKY启明星辰Ceph对象存储 |
|
||||
//
|
||||
// enum: OneCloud,VMware,Aliyun,Qcloud,Azure,Aws,Huawei,OpenStack,Ucloud,ZStack,Google,Ctyun,S3,Ceph,Xsky"
|
||||
Providers []string `json:"providers"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Provider []string `json:"provider" deprecated-by:"providers"`
|
||||
|
||||
// 列出指定云平台品牌的资源,一般来说brand和provider相同,除了以上支持的provider之外,还支持以下band
|
||||
//
|
||||
// | Brand | Provider | 说明 |
|
||||
// |----------|----------|------------|
|
||||
// | DStack | ZStack | 滴滴云私有云 |
|
||||
//
|
||||
Brands []string `json:"brands"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Brand []string `json:"brand" deprecated-by:"brands"`
|
||||
|
||||
// 列出指定云环境的资源,支持云环境如下:
|
||||
//
|
||||
// | CloudEnv | 说明 |
|
||||
// |-----------|--------|
|
||||
// | public | 公有云 |
|
||||
// | private | 私有云 |
|
||||
// | onpremise | 本地IDC |
|
||||
//
|
||||
// enum: public,private,onpremise
|
||||
CloudEnv string `json:"cloud_env"`
|
||||
|
||||
// deprecate:true
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
PublicCloud bool `json:"public_cloud"`
|
||||
// deprecate:true
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
IsPublic bool `json:"is_public"`
|
||||
|
||||
// deprecate:true
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
PrivateCloud bool `json:"private_cloud"`
|
||||
// deprecate:true
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
IsPrivate bool `json:"is_private"`
|
||||
|
||||
// deprecate:true
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
IsOnPremise bool `json:"is_on_premise"`
|
||||
|
||||
// List objects managed by external providers
|
||||
// 过滤资源,是否为非OneCloud内置私有云管理的资源
|
||||
// default: false
|
||||
IsManaged bool `json:"is_managed"`
|
||||
}
|
||||
|
||||
func (input *ManagedResourceListInput) AfterUnmarshal() {
|
||||
if len(input.CloudEnv) > 0 {
|
||||
return
|
||||
}
|
||||
if input.PublicCloud || input.IsPublic {
|
||||
input.CloudEnv = CLOUD_ENV_PUBLIC_CLOUD
|
||||
} else if input.PrivateCloud || input.IsPrivate {
|
||||
input.CloudEnv = CLOUD_ENV_PRIVATE_CLOUD
|
||||
} else if input.IsOnPremise {
|
||||
input.CloudEnv = CLOUD_ENV_ON_PREMISE
|
||||
}
|
||||
}
|
||||
|
||||
type CapabilityListInput struct {
|
||||
// 根据该云平台的功能对云账号或云订阅进行过滤
|
||||
Capability []string `json:"capability"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by HasObjectStorage
|
||||
HasObjectStorage *bool `json:"has_object_storage"`
|
||||
}
|
||||
|
||||
type CloudproviderListInput struct {
|
||||
apis.EnabledStatusStandaloneResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
|
||||
UsableResourceListInput
|
||||
|
||||
CapabilityListInput
|
||||
}
|
||||
|
||||
func (input *CapabilityListInput) AfterUnmarshal() {
|
||||
if input.HasObjectStorage != nil && *input.HasObjectStorage && !utils.IsInStringArray(cloudprovider.CLOUD_CAPABILITY_OBJECTSTORE, input.Capability) {
|
||||
input.Capability = append(input.Capability, cloudprovider.CLOUD_CAPABILITY_OBJECTSTORE)
|
||||
}
|
||||
}
|
||||
|
||||
41
pkg/apis/compute/cloudproviderregion.go
Normal file
41
pkg/apis/compute/cloudproviderregion.go
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type CloudproviderregionDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
|
||||
Cloudprovider string
|
||||
Cloudregion string
|
||||
|
||||
// 云账号Id
|
||||
// example: fa4aaf88-aed8-422d-84e7-56dea533b364
|
||||
CloudaccountId string `json:"cloudaccount_id"`
|
||||
// 云账号名称
|
||||
// example: googl-account
|
||||
Cloudaccount string `json:"cloudaccount"`
|
||||
|
||||
// 云账号所在域Id
|
||||
// example: 0df40413-eb69-49c7-895e-618ddeb80f55
|
||||
CloudaccountDomainId string `json:"cloudaccount_domain_id"`
|
||||
// 是否开启自动同步
|
||||
// example: false
|
||||
EnableAutoSync bool `json:"enable_auto_sync"`
|
||||
// 自动同步周期
|
||||
// example: 300
|
||||
SyncIntervalSeconds int `json:"sync_interval_seconds"`
|
||||
}
|
||||
56
pkg/apis/compute/cloudregion.go
Normal file
56
pkg/apis/compute/cloudregion.go
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type CloudregionDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SCloudregion
|
||||
|
||||
// 虚拟私有网络数量
|
||||
// example: 2
|
||||
VpcCount int `json:"vpc_count,allowempty"`
|
||||
// 可用区数量
|
||||
// example: 3
|
||||
ZoneCount int `json:"zone_count,allowempty"`
|
||||
// 云主机梳理
|
||||
// example: 2
|
||||
GuestCount int `json:"guest_count,allowempty"`
|
||||
// IP子网数量
|
||||
// example: 12
|
||||
NetworkCount int `json:"network_count,allowempty"`
|
||||
// 距离前天0点新增云主机数量
|
||||
// example: 0
|
||||
GuestIncrementCount int `json:"guest_increment_count,allowempty"`
|
||||
}
|
||||
|
||||
type CloudregionInfo struct {
|
||||
// 区域的名称
|
||||
// example: Default
|
||||
Region string `json:"region"`
|
||||
|
||||
// 区域的Id
|
||||
// example: default
|
||||
RegionId string `json:"region_id"`
|
||||
|
||||
// 纳管云区域的组合Id(平台+Id)
|
||||
// example: ZStack/59e7bc87-a6b3-4c39-8f02-c68e8243d4e4
|
||||
RegionExternalId string `json:"region_external_id"`
|
||||
|
||||
// 纳管云区域的Id
|
||||
// example: 59e7bc87-a6b3-4c39-8f02-c68e8243d4e4
|
||||
RegionExtId string `json:"region_ext_id"`
|
||||
}
|
||||
@@ -16,38 +16,131 @@ package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type SDBInstanceCreateInput struct {
|
||||
apis.Meta
|
||||
type DBInstanceCreateInput struct {
|
||||
apis.VirtualResourceCreateInput
|
||||
DeletePreventableCreateInput
|
||||
|
||||
Name string
|
||||
Description string
|
||||
DisableDelete *bool
|
||||
NetworkId string
|
||||
Address string
|
||||
MasterInstanceId string
|
||||
SecgroupId string
|
||||
Zone1 string
|
||||
Zone2 string
|
||||
Zone3 string
|
||||
ZoneId string
|
||||
CloudregionId string
|
||||
Cloudregion string
|
||||
VpcId string
|
||||
ManagerId string
|
||||
// Ip子网名称或Id,建议使用Id
|
||||
// required: true
|
||||
Network string `json:"network"`
|
||||
// swagger:ignore
|
||||
NetworkId string
|
||||
|
||||
// Ip子网内的地址,不填则按照ip子网的地址分配策略分配一个ip
|
||||
// required: false
|
||||
Address string `json:"address"`
|
||||
|
||||
// rds实例名称或Id,建议使用Id
|
||||
// 创建只读实例时此参数必传
|
||||
MasterInstance string `json:"master_instance"`
|
||||
// swagger:ignore
|
||||
MasterInstanceId string
|
||||
|
||||
// 安全组名称或Id
|
||||
// default: default
|
||||
Secgroup string `json:"secgroup"`
|
||||
// swagger:ignore
|
||||
SecgroupId string
|
||||
|
||||
// 主可用区名称或Id, 此参数从指定的套餐所在的可用区获取
|
||||
Zone1 string `json:"zone1"`
|
||||
|
||||
// 次可用区名称或Id, 此参数从指定的套餐所在的可用区获取
|
||||
Zone2 string `json:"zone2"`
|
||||
|
||||
// 三节点可用区名称或Id,, 此参数从指定的套餐所在的可用区获取
|
||||
Zone3 string `json:"zone3"`
|
||||
|
||||
// swagger:ignore
|
||||
ZoneId string
|
||||
|
||||
// 区域名称或Id,建议使用Id
|
||||
// swagger:ignore
|
||||
Cloudregion string `json:"cloudregion"`
|
||||
|
||||
// swagger:ignore
|
||||
CloudregionId string
|
||||
|
||||
// swagger:ignore
|
||||
VpcId string
|
||||
|
||||
// swagger:ignore
|
||||
ManagerId string
|
||||
|
||||
// swagger:ignore
|
||||
NetworkExternalId string
|
||||
BillingType string
|
||||
BillingCycle string
|
||||
InstanceType string
|
||||
Engine string
|
||||
EngineVersion string
|
||||
Category string
|
||||
StorageType string
|
||||
DiskSizeGB int
|
||||
Password string
|
||||
|
||||
VcpuCount int
|
||||
VmemSizeMb int
|
||||
Provider string
|
||||
// 包年包月时间周期
|
||||
Duration string `json:"duration"`
|
||||
|
||||
// swagger:ignore
|
||||
BillingType string
|
||||
// swagger:ignore
|
||||
BillingCycle string
|
||||
|
||||
// 套餐名称, 若此参数不填, 则必须有vmem_size_mb及vcpu_count参数
|
||||
// 套餐列表可以通过 dbinstancesku 获取
|
||||
InstanceType string `json:"instance_type"`
|
||||
|
||||
// rds引擎
|
||||
// enum: MySQL, SQLServer, PostgreSQL, MariaDB, Oracle, PPAS
|
||||
// required: true
|
||||
Engine string `json:"engine"`
|
||||
|
||||
// rds引擎版本
|
||||
// 根据各个引擎版本各不相同
|
||||
// required: true
|
||||
EngineVersion string `json:"engine_version"`
|
||||
|
||||
// rds类型
|
||||
//
|
||||
//
|
||||
//
|
||||
// | 平台 | 支持类型 |
|
||||
// | ----- | ------ |
|
||||
// | 华为云 |ha, single, replica|
|
||||
// | 阿里云 |basic, high_availability, always_on, finance|
|
||||
// 翻译:
|
||||
// basic: 基础版
|
||||
// high_availability: 高可用
|
||||
// always_on: 集群版
|
||||
// finance: 金融版, 三节点
|
||||
// ha: 高可用
|
||||
// single: 单机
|
||||
// replica: 只读
|
||||
// required: true
|
||||
Category string `json:"category"`
|
||||
|
||||
// rds存储类型
|
||||
//
|
||||
//
|
||||
//
|
||||
// | 平台 | 支持类型 |
|
||||
// | 华为云 |SSD, SAS, SATA|
|
||||
// | 阿里云 |local_ssd, cloud_essd, cloud_ssd|
|
||||
// required: true
|
||||
StorageType string `json:"storage_type"`
|
||||
|
||||
// rds存储大小
|
||||
// 可参考rds套餐的大小范围和步长情况
|
||||
// required: true
|
||||
DiskSizeGB int `json:"disk_size_gb"`
|
||||
|
||||
// rds初始化密码
|
||||
// 阿里云不需要此参数
|
||||
// 华为云会默认创建一个用户,若不传此参数, 则为随机密码
|
||||
Password string `json:"password"`
|
||||
|
||||
// rds实例cpu大小
|
||||
// 若指定实例套餐,此参数将根据套餐设置
|
||||
VcpuCount int `json:"vcpu_count"`
|
||||
|
||||
// rds实例内存大小
|
||||
// 若指定实例套餐,此参数将根据套餐设置
|
||||
VmemSizeMb int `json:"vmem_size_mb"`
|
||||
|
||||
// swagger:ignore
|
||||
Provider string
|
||||
}
|
||||
|
||||
type SDBInstanceChangeConfigInput struct {
|
||||
@@ -66,5 +159,79 @@ type SDBInstanceRecoveryConfigInput struct {
|
||||
|
||||
DBInstancebackup string
|
||||
DBInstancebackupId string `json:"dbinstancebackup_id"`
|
||||
Databases map[string]string `json:"allowempty"`
|
||||
Databases map[string]string `json:"databases,allowempty"`
|
||||
}
|
||||
|
||||
type DBInstanceListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ZonalFilterListInput
|
||||
ManagedResourceListInput
|
||||
VpcFilterListInput
|
||||
}
|
||||
|
||||
type DBInstanceBackupListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
RegionalFilterListInput
|
||||
|
||||
DbinstanceFilterListInput
|
||||
}
|
||||
|
||||
type DBInstancePrivilegeListInput struct {
|
||||
apis.ResourceBaseListInput
|
||||
|
||||
// filter by dbinstanceaccount
|
||||
Dbinstanceaccount string `json:"dbinstanceaccount"`
|
||||
// filter by dbinstancedatabase
|
||||
Dbinstancedatabase string `json:"dbinstancedatabase"`
|
||||
}
|
||||
|
||||
type DBInstanceParameterListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
|
||||
DbinstanceFilterListInput
|
||||
}
|
||||
|
||||
type DBInstanceDatabaseListInput struct {
|
||||
apis.StatusStandaloneResourceListInput
|
||||
|
||||
DbinstanceFilterListInput
|
||||
}
|
||||
|
||||
type DBInstanceAccountListInput struct {
|
||||
apis.StatusStandaloneResourceListInput
|
||||
|
||||
DbinstanceFilterListInput
|
||||
}
|
||||
|
||||
type DbinstanceFilterListInput struct {
|
||||
// filter by dbinstance
|
||||
Dbinstance string `json:"dbinstance"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by dbinstance_id
|
||||
DbinstanceId string `json:"dbinstance_id" deprecated-by:"dbinstance"`
|
||||
}
|
||||
|
||||
type DBInstanceDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SDBInstance
|
||||
|
||||
CloudproviderInfo
|
||||
// 虚拟私有网络名称
|
||||
// example: test-vpc
|
||||
Vpc string `json:"vpc"`
|
||||
// 安全组名称
|
||||
// example: Default
|
||||
Secgroup string `json:"secgroup"`
|
||||
// iops
|
||||
// example: 0
|
||||
Iops int `json:"iops"`
|
||||
// IP子网名称
|
||||
// example: test-network
|
||||
Network string `json:"network"`
|
||||
// 标签信息
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
}
|
||||
|
||||
@@ -17,21 +17,72 @@ package compute
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type SDBInstanceAccountPrivilege struct {
|
||||
Database string
|
||||
// 数据库名称或Id
|
||||
// required: true
|
||||
Database string `json:"database"`
|
||||
// swagger:ignore
|
||||
DBInstancedatabaseId string
|
||||
Privilege string
|
||||
|
||||
// 权限类型
|
||||
//
|
||||
//
|
||||
//
|
||||
// | 平台 |Rds引擎 | 支持类型 |
|
||||
// | ---- |------- | -------- |
|
||||
// | Aliyun |MySQL, MariaBD | rw, r, ddl, dml |
|
||||
// | Aliyun |SQLServer | rw, r, owner |
|
||||
// | Huawei |MySQL, MariaDB | rw, r |
|
||||
// 同一平台不同的rds类型支持的权限不尽相同
|
||||
// required: true
|
||||
Privilege string `json:"privilege"`
|
||||
}
|
||||
|
||||
type SDBInstanceAccountCreateInput struct {
|
||||
apis.Meta
|
||||
type DBInstanceAccountCreateInput struct {
|
||||
apis.StatusStandaloneResourceCreateInput
|
||||
|
||||
// rds实例名称或Id,建议使用Id
|
||||
//
|
||||
//
|
||||
//
|
||||
// | 平台 |支持Rds引擎 |
|
||||
// | ---- |------- |
|
||||
// | Aliyun |MySQL, MariaBD, SQLServer |
|
||||
// | 华为云 |MySQL, MariaBD |
|
||||
// required: true
|
||||
// 阿里云SQL Server 2017集群版不支持创建账号
|
||||
// 实例状态必须是运行中
|
||||
DBInstance string `json:"dbinstance"`
|
||||
// swagger:ignore
|
||||
DBInstanceId string `json:"dbinstance_id"`
|
||||
Name string
|
||||
Description string
|
||||
Password string
|
||||
Privileges []SDBInstanceAccountPrivilege
|
||||
|
||||
// 账号密码,若不指定,则会随机生成
|
||||
// required: false
|
||||
Password string `json:"password"`
|
||||
|
||||
// 账号权限
|
||||
// required: false
|
||||
Privileges []SDBInstanceAccountPrivilege `json:"privileges"`
|
||||
}
|
||||
|
||||
type SDBInstanceSetPrivilegesInput struct {
|
||||
Privileges []SDBInstanceAccountPrivilege
|
||||
Privileges []SDBInstanceAccountPrivilege `json:"privileges"`
|
||||
}
|
||||
|
||||
type DBInstancePrivilege struct {
|
||||
// 数据库名称
|
||||
Database string
|
||||
// 账号名称
|
||||
Account string
|
||||
// 数据库Id
|
||||
DBInstancedatabaseId string
|
||||
// 权限
|
||||
Privileges string
|
||||
}
|
||||
|
||||
type DBInstanceAccountDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SDBInstanceAccount
|
||||
|
||||
// 账号权限列表
|
||||
DBInstanceprivileges []DBInstancePrivilege `json:"dbinstanceprivileges,allowempty"`
|
||||
}
|
||||
|
||||
@@ -16,17 +16,39 @@ package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type SDBInstanceBackupCreateInput struct {
|
||||
apis.Meta
|
||||
type DBInstanceBackupCreateInput struct {
|
||||
apis.VirtualResourceCreateInput
|
||||
|
||||
DBInstanceId string `json:"dbinstance_id"`
|
||||
Name string
|
||||
Description string
|
||||
DBNames string
|
||||
Databases []string
|
||||
Engine string
|
||||
// Rds实例名称或Id, 建议使用Id
|
||||
// required: true
|
||||
DBInstance string `json:"dbinstance"`
|
||||
// swagger:ignore
|
||||
DBInstanceId string `json:"dbinstance_id"`
|
||||
|
||||
// 需要备份的Rds数据库列表
|
||||
// required: false
|
||||
Databases []string `json:"databases"`
|
||||
// swagger:ignore
|
||||
DBNames string
|
||||
|
||||
// swagger:ignore
|
||||
Engine string
|
||||
// swagger:ignore
|
||||
EngineVersion string
|
||||
// swagger:ignore
|
||||
CloudregionId string
|
||||
BackupMode string
|
||||
ManagerId string
|
||||
// swagger:ignore
|
||||
BackupMode string
|
||||
// swagger:ignore
|
||||
ManagerId string
|
||||
}
|
||||
|
||||
type DBInstanceBackupDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SDBInstanceBackup
|
||||
|
||||
// RDS实例名称
|
||||
DBInstance string `json:"dbinstance"`
|
||||
|
||||
CloudproviderInfo
|
||||
}
|
||||
|
||||
@@ -108,10 +108,10 @@ const (
|
||||
ALIYUN_DBINSTANCE_STORAGE_TYPE_CLOUD_SSD = "cloud_ssd" //SSD云盘
|
||||
|
||||
//华为云存储类型
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_ULTRAHIGH = "ULTRAHIGH" //超高IO云硬盘
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_ULTRAHIGHPRO = "ULTRAHIGHPRO"
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_COMMON = "COMMON"
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_HIGH = "HIGH"
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_SSD = "SSD" //超高IO云硬盘
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_SAS = "SAS" //高IO云硬盘
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_SATA = "SATA" //普通IO云硬盘
|
||||
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -17,18 +17,54 @@ package compute
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type SDBInstanceDatabasePrivilege struct {
|
||||
Account string
|
||||
// 数据库账号名称或Id
|
||||
// required: true
|
||||
Account string `json:"account"`
|
||||
// swagger:ignore
|
||||
DBInstanceaccountId string
|
||||
Privilege string
|
||||
// 权限
|
||||
// | 平台 |Rds引擎 | 支持类型 |
|
||||
// | ---- |------- | -------- |
|
||||
// | Aliyun |MySQL, MariaBD | rw, r, ddl, dml |
|
||||
// | Aliyun |SQLServer | rw, r, owner |
|
||||
// | Huawei |MySQL, MariaDB | rw, r |
|
||||
// 同一平台不同的rds类型支持的权限不尽相同
|
||||
// required: true
|
||||
Privilege string `json:"privilege"`
|
||||
}
|
||||
|
||||
type SDBInstanceDatabaseCreateInput struct {
|
||||
apis.Meta
|
||||
type DBInstanceDatabaseCreateInput struct {
|
||||
apis.StatusStandaloneResourceCreateInput
|
||||
|
||||
DBInstanceId string `json:"dbinstance_id"`
|
||||
CharacterSet string
|
||||
Name string
|
||||
Description string
|
||||
Accounts []SDBInstanceDatabasePrivilege
|
||||
DBInstanceaccountId string
|
||||
// rds实例名称或Id,建议使用Id
|
||||
//
|
||||
//
|
||||
//
|
||||
// | 平台 |支持Rds引擎 |
|
||||
// | ---- |------- |
|
||||
// | Aliyun |MySQL, MariaBD, SQLServer |
|
||||
// | 华为云 |MySQL, MariaBD |
|
||||
// required: true
|
||||
// 阿里云SQL Server 2017集群版不支持创建数据库
|
||||
// 阿里云只读实例不支持创建数据库
|
||||
// 实例状态必须是运行中
|
||||
DBInstance string `json:"dbinstance"`
|
||||
// swagger:ignore
|
||||
DBInstanceId string `json:"dbinstance_id"`
|
||||
|
||||
// 数据库字符集
|
||||
// required: true
|
||||
CharacterSet string `json:"character_set"`
|
||||
|
||||
// 赋予账号权限
|
||||
// required: false
|
||||
Accounts []SDBInstanceDatabasePrivilege `json:"accounts"`
|
||||
}
|
||||
|
||||
type DBInstancedatabaseDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SDBInstanceDatabase
|
||||
|
||||
// 数据库权限
|
||||
DBInstanceprivileges []DBInstancePrivilege `json:"dbinstanceprivileges"`
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
@@ -23,15 +25,25 @@ type DiskCreateInput struct {
|
||||
|
||||
*DiskConfig
|
||||
|
||||
// prefer options
|
||||
// 此参数仅适用于未指定storage时进行调度到指定区域创建磁盘
|
||||
// required: false
|
||||
PreferRegion string `json:"prefer_region_id"`
|
||||
PreferZone string `json:"prefer_zone_id"`
|
||||
PreferWire string `json:"prefer_wire_id"`
|
||||
PreferHost string `json:"prefer_host_id"`
|
||||
|
||||
// 此参数仅适用于未指定storage时进行调度到指定可用区区创建磁盘
|
||||
// required: false
|
||||
PreferZone string `json:"prefer_zone_id"`
|
||||
|
||||
// swagger:ignore
|
||||
PreferWire string `json:"prefer_wire_id"`
|
||||
|
||||
// 此参数仅适用于未指定storage时进行调度到指定可用区区创建磁盘
|
||||
// required: false
|
||||
PreferHost string `json:"prefer_host_id"`
|
||||
|
||||
// 此参数仅适用于未指定storage时进行调度到指定平台创建磁盘
|
||||
// default: kvm
|
||||
// enum: kvm, openstack, esxi, aliyun, aws, qcloud, azure, huawei, openstack, ucloud, zstack google, ctyun
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
// Project string `json:"project"`
|
||||
// Domain string `json:"domain_id"`
|
||||
}
|
||||
|
||||
// ToServerCreateInput used by disk schedule
|
||||
@@ -70,3 +82,99 @@ func (req *ServerCreateInput) ToDiskCreateInput() *DiskCreateInput {
|
||||
input.Domain = req.Domain
|
||||
return &input
|
||||
}
|
||||
|
||||
type SnapshotPolicyFilterListInput struct {
|
||||
// filter disk by snapshotpolicy
|
||||
Snapshotpolicy string `json:"snapshotpolicy"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter disk by snapshotpolicy_id
|
||||
SnapshotpolicyId string `json:"snapshotpolicy_id" deprecated-by:"snapshotpolicy"`
|
||||
}
|
||||
|
||||
type DiskListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
|
||||
BillingFilterListInput
|
||||
StorageFilterListInput
|
||||
StorageShareFilterListInput
|
||||
SnapshotPolicyFilterListInput
|
||||
ServerFilterListInput
|
||||
|
||||
// filter disk by whether it is being used
|
||||
Unused *bool `json:"unused"`
|
||||
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by disk type
|
||||
Type string `json:"type" deprecated-by:"disk_type"`
|
||||
// 过滤指定disk_type的磁盘列表,可能的值为:sys, data, swap. volume
|
||||
//
|
||||
// | disk_type值 | 说明 |
|
||||
// |-------------|----------|
|
||||
// | sys | 虚拟机系统盘 |
|
||||
// | data | 虚拟机数据盘 |
|
||||
// | swap | 虚拟机内存交换盘 |
|
||||
// | volume | 容器volumn盘 |
|
||||
//
|
||||
DiskType string `json:"disk_type"`
|
||||
}
|
||||
|
||||
type DiskFilterListInput struct {
|
||||
// 以指定虚拟磁盘(ID或Name)过滤列表结果
|
||||
Disk string `json:"disk"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by disk_id
|
||||
DiskId string `json:"disk_id" deprecated-by:"disk"`
|
||||
}
|
||||
|
||||
type SimpleGuest struct {
|
||||
Name string `json:"name"`
|
||||
Id string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type SimpleSnapshotPolicy struct {
|
||||
RepeatWeekdays []int `json:"repeat_weekdays"`
|
||||
TimePoints []int `json:"time_points"`
|
||||
}
|
||||
|
||||
type DiskDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SDisk
|
||||
CloudproviderInfo
|
||||
|
||||
// 云平台
|
||||
Provider string `json:"provider"`
|
||||
// 存储名称
|
||||
Storage string `json:"storage"`
|
||||
// 存储类型
|
||||
StorageType string `json:"storage_type"`
|
||||
// 介质类型
|
||||
MediumType string `json:"medium_type"`
|
||||
|
||||
// 所挂载的虚拟机
|
||||
Guests []SimpleGuest `json:"guests"`
|
||||
// 所挂载的虚拟机
|
||||
Guest string `json:"guest"`
|
||||
// 所挂载虚拟机的数量
|
||||
GuestCount int `json:"guest_count"`
|
||||
// 所挂载虚拟机状态
|
||||
GuestStatus string `json:"guest_status"`
|
||||
|
||||
// 自动清理时间
|
||||
AutoDeleteAt time.Time `json:"auto_delete_at"`
|
||||
// 自动快照策略状态
|
||||
SnapshotpolicyStatus string `json:"snapshotpolicy_status,allowempty"`
|
||||
|
||||
// 自动快照策略
|
||||
Snapshotpolicies []SimpleSnapshotPolicy `json:"snapshotpolicies"`
|
||||
|
||||
// 手动快照数量
|
||||
ManualSnapshotCount int `json:"manual_snapshot_count"`
|
||||
// 最多可创建手动快照数量
|
||||
MaxManualSnapshotCount int `json:"max_manual_snapshot_count"`
|
||||
}
|
||||
|
||||
25
pkg/apis/compute/dynamicschedtag.go
Normal file
25
pkg/apis/compute/dynamicschedtag.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type DynamicschedtagDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SDynamicschedtag
|
||||
|
||||
Schedtag string `json:"schedtag"`
|
||||
ResourceType string `json:"resource_type"`
|
||||
}
|
||||
@@ -12,23 +12,19 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package apis
|
||||
package compute
|
||||
|
||||
type StandaloneResourceShortDescDetail struct {
|
||||
ModelBaseShortDescDetail
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type STag struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
type StandaloneResourceListInput struct {
|
||||
ModelBaseListInput
|
||||
|
||||
Tags []STag `json:"tags"`
|
||||
WithoutUserMeta bool `json:"without_user_meta"`
|
||||
type ElasticcacheDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
|
||||
SElasticcache
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
// 虚拟私有网络名称
|
||||
Vpc string `json:"vpc"`
|
||||
// IP子网名称
|
||||
Network string `json:"network"`
|
||||
}
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
ELASTIC_CACHE_STATUS_RUNNING = "running" //(正常)
|
||||
ELASTIC_CACHE_STATUS_RESTARTING = "restarting" //(重启中)
|
||||
@@ -102,3 +106,28 @@ const (
|
||||
ELASTIC_CACHE_ARCH_TYPE_CLUSTER = "cluster" // 集群
|
||||
ELASTIC_CACHE_ARCH_TYPE_RWSPLIT = "rwsplit" // 读写分离
|
||||
)
|
||||
|
||||
type ElasticcacheListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ZonalFilterListInput
|
||||
VpcFilterListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
}
|
||||
|
||||
type ElasticcacheAccountListInput struct {
|
||||
apis.StatusStandaloneResourceListInput
|
||||
}
|
||||
|
||||
type ElasticcacheAclListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
}
|
||||
|
||||
type ElasticcacheBackupListInput struct {
|
||||
apis.StatusStandaloneResourceListInput
|
||||
}
|
||||
|
||||
type ElasticcacheParameterListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
}
|
||||
|
||||
29
pkg/apis/compute/elasticcachebackup.go
Normal file
29
pkg/apis/compute/elasticcachebackup.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ElasticcacheBackupDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SElasticcacheBackup
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
// 引擎
|
||||
Engine string `json:"engine"`
|
||||
// 引擎版本
|
||||
EngineVersion string `json:"engine_version"`
|
||||
}
|
||||
22
pkg/apis/compute/elasticcachesku.go
Normal file
22
pkg/apis/compute/elasticcachesku.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ElasticcacheSkuDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SElasticcacheSku
|
||||
}
|
||||
79
pkg/apis/compute/elasticip.go
Normal file
79
pkg/apis/compute/elasticip.go
Normal file
@@ -0,0 +1,79 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type SElasticipCreateInput struct {
|
||||
apis.VirtualResourceCreateInput
|
||||
|
||||
// 区域名称或Id, 建议使用Id
|
||||
// 在指定区域内创建弹性公网ip
|
||||
Cloudregion string `json:"cloudregion"`
|
||||
|
||||
// swagger:ignore
|
||||
Region string
|
||||
// swagger:ignore
|
||||
RegionId string
|
||||
// swagger:ignore
|
||||
CloudregionId string
|
||||
|
||||
// 子订阅Id, 建议使用Id
|
||||
// 使用指定子订阅创建弹性公网ip
|
||||
// 弹性公网ip和虚拟机在同一区域同一子订阅底下,才可以进行绑定操作
|
||||
Cloudprovider string `json:"cloudprovider"`
|
||||
// swagger:ignore
|
||||
Manager string
|
||||
// swagger:ignore
|
||||
ManagerId string
|
||||
|
||||
// 计费类型: 流量或带宽
|
||||
//
|
||||
//
|
||||
//
|
||||
// | 平台 | 支持类型 |
|
||||
// | --- | -------- |
|
||||
// |Aliyun | traffic, bandwidth |
|
||||
// |腾讯云 | traffic |
|
||||
// |Azure | traffic |
|
||||
// |Google | traffic, bandwidth |
|
||||
// |Ucloud | traffic |
|
||||
// |Aws | traffic |
|
||||
// |华为云 | traffic, bandwidth |
|
||||
// |天翼云 | traffic, bandwidth |
|
||||
// |KVM | 不支持创建 |
|
||||
// |VMware | 不支持创建 |
|
||||
// |ZStack | traffic |
|
||||
// |OpenStack | traffic |
|
||||
// default: traffic
|
||||
// enum: traffic, bandwidth
|
||||
ChargeType string `json:"charge_type"`
|
||||
|
||||
// 子网名称或Id
|
||||
// 私有云创建此参数必传,例如Openstack, ZStack
|
||||
Network string `json:"network"`
|
||||
// swagger:ignore
|
||||
NetworkId string
|
||||
}
|
||||
|
||||
type ElasticipDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SElasticip
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
// 绑定资源名称
|
||||
AssociateName string `json:"associate_name"`
|
||||
}
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
EIP_MODE_INSTANCE_PUBLICIP = "public_ip"
|
||||
EIP_MODE_STANDALONE_EIP = "elastic_ip"
|
||||
@@ -39,8 +43,25 @@ const (
|
||||
EIP_CHARGE_TYPE_BY_TRAFFIC = "traffic"
|
||||
EIP_CHARGE_TYPE_BY_BANDWIDTH = "bandwidth"
|
||||
EIP_CHARGE_TYPE_DEFAULT = EIP_CHARGE_TYPE_BY_TRAFFIC
|
||||
|
||||
// EIP associate resource type
|
||||
EIP_ASSOCIATE_TYPE_VM = "server"
|
||||
EIP_ASSOCIATE_TYPE_ELB = "elb"
|
||||
)
|
||||
|
||||
var (
|
||||
EIP_ASSOCIATE_VALID_TYPES = []string{EIP_ASSOCIATE_TYPE_SERVER, EIP_ASSOCIATE_TYPE_NAT_GATEWAY}
|
||||
)
|
||||
|
||||
type ElasticipListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
RegionalFilterListInput
|
||||
UsableResourceListInput
|
||||
|
||||
// filter usable eip for given associate type
|
||||
UsableEipForAssociateType string `json:"usable_eip_for_associate_type"`
|
||||
// filter usable eip for given associate id
|
||||
UsableEipForAssociateId string `json:"usable_eip_for_associate_id"`
|
||||
}
|
||||
|
||||
26
pkg/apis/compute/externalproject.go
Normal file
26
pkg/apis/compute/externalproject.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ExternalProjectDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
|
||||
SExternalProject
|
||||
CloudproviderInfo
|
||||
|
||||
Tenant string `json:"tenant"`
|
||||
}
|
||||
100
pkg/apis/compute/geo_input.go
Normal file
100
pkg/apis/compute/geo_input.go
Normal file
@@ -0,0 +1,100 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type RegionalFilterListInput struct {
|
||||
// 过滤位于指定城市区域的资源
|
||||
City string `json:"city"`
|
||||
|
||||
// 过滤处于指定区域内的资源
|
||||
Cloudregion string `json:"cloudregion"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudregionId string `json:"cloudregion_id" deprecated-by:"cloudregion"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
Region string `json:"region" deprecated-by:"cloudregion"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
RegionId string `json:"region_id" deprecated-by:"cloudregion"`
|
||||
}
|
||||
|
||||
type ZonalFilterListInput struct {
|
||||
RegionalFilterListInput
|
||||
|
||||
// 过滤处于指定可用区内的资源
|
||||
Zone string `json:"zone"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by zone_id
|
||||
ZoneId string `json:"zone_id" deprecated-by:"zone"`
|
||||
// 过滤处于多个指定可用区内的资源
|
||||
Zones []string `json:"zones"`
|
||||
}
|
||||
|
||||
func (input ZonalFilterListInput) ZoneList() []string {
|
||||
zoneStr := input.Zone
|
||||
if len(zoneStr) > 0 {
|
||||
input.Zones = append(input.Zones, zoneStr)
|
||||
}
|
||||
return input.Zones
|
||||
}
|
||||
|
||||
type HostFilterListInput struct {
|
||||
ZonalFilterListInput
|
||||
|
||||
// 过滤关联指定宿主机(ID或Name)的列表结果
|
||||
Host string `json:"host"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by host_id
|
||||
HostId string `json:"host_id" deprecated-by:"host"`
|
||||
}
|
||||
|
||||
type CloudregionListInput struct {
|
||||
apis.EnabledStatusStandaloneResourceListInput
|
||||
apis.DomainizedResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
UsableResourceListInput
|
||||
UsableVpcResourceListInput
|
||||
|
||||
// 过滤位于指定城市的区域
|
||||
City string `json:"city"`
|
||||
// 过滤提供特定服务的区域
|
||||
Service string `json:"service"`
|
||||
}
|
||||
|
||||
type ZoneListInput struct {
|
||||
apis.StatusStandaloneResourceListInput
|
||||
apis.DomainizedResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
|
||||
RegionalFilterListInput
|
||||
|
||||
UsableResourceListInput
|
||||
UsableVpcResourceListInput
|
||||
|
||||
// 过滤提供特定服务的可用区
|
||||
Service string `json:"service"`
|
||||
}
|
||||
@@ -21,3 +21,8 @@ import (
|
||||
type GlobalVpcCreateInput struct {
|
||||
apis.EnabledStatusStandaloneResourceCreateInput
|
||||
}
|
||||
|
||||
type GlobalVpcDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SGlobalVpc
|
||||
}
|
||||
|
||||
29
pkg/apis/compute/groupguest.go
Normal file
29
pkg/apis/compute/groupguest.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type GroupguestDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
|
||||
Instancegroup string
|
||||
Server string
|
||||
Guest string
|
||||
|
||||
SGroupguest
|
||||
}
|
||||
29
pkg/apis/compute/groupnetwork.go
Normal file
29
pkg/apis/compute/groupnetwork.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type GroupnetworkDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
SGroupnetwork
|
||||
|
||||
// 主机组名称
|
||||
Instancegroup string
|
||||
// IP子网名称
|
||||
Network string
|
||||
}
|
||||
@@ -150,13 +150,7 @@ const (
|
||||
HYPERVISOR_DEFAULT = HYPERVISOR_KVM
|
||||
)
|
||||
|
||||
const (
|
||||
CPU_MODE_QEMU = "qemu"
|
||||
CPU_MODE_HOST = "host"
|
||||
)
|
||||
|
||||
var VM_RUNNING_STATUS = []string{VM_START_START, VM_STARTING, VM_RUNNING, VM_BLOCK_STREAM}
|
||||
|
||||
var VM_RUNNING_STATUS = []string{VM_START_START, VM_STARTING, VM_RUNNING, VM_BLOCK_STREAM, VM_BLOCK_STREAM_FAIL}
|
||||
var VM_CREATING_STATUS = []string{VM_CREATE_NETWORK, VM_CREATE_DISK, VM_START_DEPLOY, VM_DEPLOYING}
|
||||
|
||||
var HYPERVISORS = []string{
|
||||
@@ -235,9 +229,10 @@ var HOSTTYPE_HYPERVISOR = map[string]string{
|
||||
}
|
||||
|
||||
const (
|
||||
VM_AWS_DEFAULT_LOGIN_USER = "ec2user"
|
||||
VM_AZURE_DEFAULT_LOGIN_USER = "toor"
|
||||
VM_ZSTACK_DEFAULT_LOGIN_USER = "root"
|
||||
VM_AWS_DEFAULT_LOGIN_USER = "ec2user"
|
||||
VM_AWS_DEFAULT_WINDOWS_LOGIN_USER = "Administrator"
|
||||
VM_AZURE_DEFAULT_LOGIN_USER = "toor"
|
||||
VM_ZSTACK_DEFAULT_LOGIN_USER = "root"
|
||||
|
||||
VM_METADATA_APP_TAGS = "app_tags"
|
||||
VM_METADATA_CREATE_PARAMS = "create_params"
|
||||
|
||||
45
pkg/apis/compute/guest_disk.go
Normal file
45
pkg/apis/compute/guest_disk.go
Normal file
@@ -0,0 +1,45 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type GuestDiskDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
SGuestdisk
|
||||
|
||||
// 云主机名称
|
||||
Guest string
|
||||
// 云主机名称
|
||||
Server string
|
||||
// 磁盘名称
|
||||
Disk string
|
||||
|
||||
// 存储类型
|
||||
// example: local
|
||||
StorageType string `json:"storage_type"`
|
||||
// 磁盘大小, 单位Mb
|
||||
// example: 10240
|
||||
DiskSize int `json:"disk_size"`
|
||||
// 磁盘状态
|
||||
// example: ready
|
||||
Status string `json:"status"`
|
||||
// 磁盘类型
|
||||
// example: data
|
||||
DiskType string `json:"disk_type"`
|
||||
// 介质类型
|
||||
// example: ssd
|
||||
MediumType string `json:"medium_type"`
|
||||
}
|
||||
29
pkg/apis/compute/guestnetwork.go
Normal file
29
pkg/apis/compute/guestnetwork.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type GuestnetworkDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
SGuestnetwork
|
||||
|
||||
// 云主机名称
|
||||
Guest string
|
||||
// 云主机名称
|
||||
Server string
|
||||
// IP子网名称
|
||||
Network string
|
||||
}
|
||||
@@ -15,60 +15,81 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type ServerListInput struct {
|
||||
apis.BaseListInput
|
||||
type ServerFilterListInput struct {
|
||||
// 以关联主机(ID或Name)过滤列表
|
||||
Server string `json:"server"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by guest Id
|
||||
ServerId string `json:"server_id" deprecated-by:"server"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by guest Id
|
||||
Guest string `json:"guest" deprecated-by:"server"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by guest Id
|
||||
GuestId string `json:"guest_id" deprecated-by:"server"`
|
||||
}
|
||||
|
||||
// 过滤可用区底下的资源
|
||||
Zone string `json:"zone"`
|
||||
// 过滤连接此二层网络的资源
|
||||
Wire string `json:"wire"`
|
||||
// 过滤关联此网络的资源
|
||||
Network string `json:"network"`
|
||||
// Disk ID or Name
|
||||
Disk string `json:"disk"`
|
||||
// Host ID or Name
|
||||
Host string `json:"host"`
|
||||
// Show baremetal servers
|
||||
type ServerListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
HostFilterListInput
|
||||
NetworkFilterListInput
|
||||
BillingFilterListInput
|
||||
GroupFilterListInput
|
||||
SecgroupFilterListInput
|
||||
DiskFilterListInput
|
||||
|
||||
// 只列出裸金属主机
|
||||
Baremetal *bool `json:"baremetal"`
|
||||
// Show gpu servers
|
||||
// 只列出GPU主机
|
||||
Gpu *bool `json:"gpu"`
|
||||
// Secgroup ID or Name
|
||||
Secgroup string `json:"secgroup"`
|
||||
// AdminSecgroup ID or Name
|
||||
// 列出管理安全组为指定安全组的主机
|
||||
AdminSecgroup string `json:"admin_security"`
|
||||
// Show server of hypervisor choices:"kvm|esxi|container|baremetal|aliyun|azure|aws|huawei|ucloud|zstack|openstack"`
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
// Show servers in cloudregion
|
||||
Region string `json:"region"`
|
||||
// Show Servers with EIP
|
||||
// 列出Hypervisor为指定值的主机
|
||||
// enum: kvm,esxi,baremetal,aliyun,azure,aws,huawei,ucloud,zstack,openstack,google,ctyun"`
|
||||
Hypervisor []string `json:"hypervisor"`
|
||||
// 列出绑定了弹性IP(EIP)的主机
|
||||
WithEip *bool `json:"with_eip"`
|
||||
// Show Servers without EIP
|
||||
// 列出未绑定弹性IP(EIO)的主机
|
||||
WithoutEip *bool `json:"without_eip"`
|
||||
// OS Type choices:"linux|windows|vmware"`
|
||||
// 列出操作系统为指定值的主机
|
||||
// enum: linux,windows,vmware
|
||||
OsType string `json:"os_type"`
|
||||
// Order by disk size choices:"asc|desc"
|
||||
// 对列表结果按照磁盘进行排序
|
||||
// enum: asc,desc
|
||||
OrderByDisk string `json:"order_by_disk"`
|
||||
// Order by host name choices:"asc|desc"
|
||||
// 对主机列表结果按照宿主机名称进行排序
|
||||
// enum: asc,desc
|
||||
OrderByHost string `json:"order_by_host"`
|
||||
// Vpc id or name
|
||||
Vpc string `json:"vpc"`
|
||||
// Eip id or name
|
||||
// 列出可以挂载指定EIP的主机
|
||||
UsableServerForEip string `json:"usable_server_for_eip"`
|
||||
// Show Servers without user metadata
|
||||
WithoutUserMeta *bool `json:"without_user_meta"`
|
||||
// Instance Group ID or Name
|
||||
Group string `json:"group"`
|
||||
// Resource type choices:"shared|prepaid|dedicated"
|
||||
|
||||
// 按主机资源类型进行排序
|
||||
// enum: shared,prepaid,dedicated
|
||||
ResourceType string `json:"resource_type"`
|
||||
// Billing type choices:"postpaid|prepaid"
|
||||
BillingType string `json:"billing_type"`
|
||||
// 返回开启主备机功能的主机
|
||||
GetBackupGuestsOnHost *bool `json:"get_backup_guests_on_host"`
|
||||
// 根据宿主机 SN 过滤
|
||||
HostSn string `json:"host_sn"`
|
||||
}
|
||||
|
||||
func (input *ServerListInput) AfterUnmarshal() {
|
||||
if input.Baremetal != nil && *input.Baremetal {
|
||||
input.Hypervisor = append(input.Hypervisor, HYPERVISOR_BAREMETAL)
|
||||
}
|
||||
}
|
||||
|
||||
type ServerRebuildRootInput struct {
|
||||
apis.Meta
|
||||
|
||||
@@ -108,3 +129,51 @@ func (i ServerRebuildRootInput) GetKeypairName() string {
|
||||
type ServerResumeInput struct {
|
||||
apis.Meta
|
||||
}
|
||||
|
||||
type ServerDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SGuest
|
||||
CloudproviderInfo
|
||||
|
||||
// details
|
||||
// 网络概要
|
||||
Networks string `json:"networks"`
|
||||
// 磁盘概要
|
||||
Disks string `json:"disks"`
|
||||
// 磁盘详情
|
||||
DisksInfo *jsonutils.JSONArray `json:"disks_info"`
|
||||
// 虚拟机Ip列表
|
||||
VirtualIps string `json:"virtual_ips"`
|
||||
// 安全组规则
|
||||
SecurityRules string `json:"security_rules"`
|
||||
// 操作系统名称
|
||||
OsName string `json:"os_name"`
|
||||
// 操作系统类型
|
||||
OsType string `json:"os_type"`
|
||||
// 系统管理员可见的安全组规则
|
||||
AdminSecurityRules string `json:"admin_security_rules"`
|
||||
|
||||
// list
|
||||
AttachTime time.Time `attach_time`
|
||||
|
||||
// common
|
||||
IsPrepaidRecycle bool `json:"is_prepaid_recycle"`
|
||||
|
||||
// 备机所在宿主机名称
|
||||
BackupHostName string `json:"backup_host_name"`
|
||||
// 北京所在宿主机状态
|
||||
BackupHostStatus string `json:"backup_host_status"`
|
||||
// 宿主机名称
|
||||
Host string `json:"host"`
|
||||
// 宿主机SN
|
||||
HostSN string `json:"host_sn"`
|
||||
CanRecycle bool `json:"can_recycle"`
|
||||
// 自动释放时间
|
||||
AutoDeleteAt time.Time `json:"auto_delete_at"`
|
||||
// 标签
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
// 磁盘数量
|
||||
DiskCount int `json:"disk_count"`
|
||||
// 是否支持ISO启动
|
||||
CdromSupport bool `json:"cdrom_support"`
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ type GuesttemplateCreateInput struct {
|
||||
}
|
||||
|
||||
type GuesttemplateDetails struct {
|
||||
apis.Meta
|
||||
apis.SharableVirtualResourceDetails
|
||||
SGuestTemplate
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
@@ -43,3 +45,82 @@ type DiskSpec struct {
|
||||
EndIndex int `json:"end_index"`
|
||||
Count int `json:"count"`
|
||||
}
|
||||
|
||||
type HostListInput struct {
|
||||
apis.EnabledStatusStandaloneResourceListInput
|
||||
apis.DomainizedResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
ZonalFilterListInput
|
||||
WireFilterListInput
|
||||
SchedtagFilterListInput
|
||||
|
||||
StorageFilterListInput
|
||||
UsableResourceListInput
|
||||
|
||||
// filter by ResourceType
|
||||
ResourceType string `json:"resource_type"`
|
||||
// filter by mac of any network interface
|
||||
AnyMac string `json:"any_mac"`
|
||||
// filter storages not attached to this host
|
||||
StorageNotAttached *bool `json:"storage_not_attached"`
|
||||
// filter by Hypervisor
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
// filter host that is empty
|
||||
IsEmpty *bool `json:"is_empty"`
|
||||
// filter host that is baremetal
|
||||
Baremetal *bool `json:"baremetal"`
|
||||
}
|
||||
|
||||
type HostDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SHost
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
Schedtags []SchedtagShortDescDetails `json:"schedtags"`
|
||||
|
||||
ServerId string `json:"server_id"`
|
||||
Server string `json:"server"`
|
||||
ServerIps string `json:"server_ips"`
|
||||
// 网卡数量
|
||||
NicCount int `json:"nic_count"`
|
||||
// 网卡详情
|
||||
NicInfo []jsonutils.JSONObject `json:"nic_info"`
|
||||
// CPU超分比
|
||||
CpuCommit int `json:"cpu_commit"`
|
||||
// 内存超分比
|
||||
MemCommit int `json:"mem_commit"`
|
||||
// 云主机数量
|
||||
// example: 10
|
||||
Guests int `json:"guests"`
|
||||
// 非系统云主机数量
|
||||
// example: 0
|
||||
NonsystemGuests int `json:"nonsystem_guests"`
|
||||
// 运行中云主机数量
|
||||
// example: 2
|
||||
RunningGuests int `json:"running_geusts"`
|
||||
// CPU超分率
|
||||
CpuCommitRate float64 `json:"cpu_commit_rate"`
|
||||
// 内存超分率
|
||||
MemCommitRate float64 `json:"mem_commit_rate"`
|
||||
// 存储大小
|
||||
Storage int64 `json:"storage"`
|
||||
// 已使用存储大小
|
||||
StorageUsed int64 `json:"storage_used"`
|
||||
// 浪费存储大小(异常磁盘存储大小)
|
||||
StorageWaste int64 `json:"storage_waste"`
|
||||
// 虚拟存储大小
|
||||
StorageVirtual int64 `json:"storage_virtual"`
|
||||
// 可用存储大小
|
||||
StorageFree int64 `json:"storage_free"`
|
||||
// 存储超分率
|
||||
StorageCommitRate float64 `json:"storage_commit_rate"`
|
||||
Spec *jsonutils.JSONDict `json:"spec"`
|
||||
IsPrepaidRecycle bool `json:"is_prepaid_recycle"`
|
||||
CanPrepare bool `json:"can_prepare"`
|
||||
PrepareFailReason string `json:"prepare_fail_reason"`
|
||||
|
||||
// 标签
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ var HOST_TYPES = []string{
|
||||
HOST_TYPE_UCLOUD,
|
||||
HOST_TYPE_ZSTACK,
|
||||
HOST_TYPE_CTYUN,
|
||||
HOST_TYPE_GOOGLE,
|
||||
}
|
||||
|
||||
var NIC_TYPES = []string{NIC_TYPE_IPMI, NIC_TYPE_ADMIN}
|
||||
|
||||
22
pkg/apis/compute/hostjoin.go
Normal file
22
pkg/apis/compute/hostjoin.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
type HostJointsDetails struct {
|
||||
// 宿主机名称
|
||||
Host string `json:"host"`
|
||||
// 裸金属服务器名称
|
||||
Baremetal string `json:"baremetal"`
|
||||
}
|
||||
28
pkg/apis/compute/hostnetwork.go
Normal file
28
pkg/apis/compute/hostnetwork.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type HostnetworkDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
HostJointsDetails
|
||||
SHostwire
|
||||
|
||||
// IP子网名称
|
||||
Network string `json:"network"`
|
||||
|
||||
NicType string `json:"nic_type"`
|
||||
}
|
||||
25
pkg/apis/compute/hostschedtag.go
Normal file
25
pkg/apis/compute/hostschedtag.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type HostschedtagDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
HostJointsDetails
|
||||
SHostschedtag
|
||||
|
||||
Schedtag string `json:"string"`
|
||||
}
|
||||
57
pkg/apis/compute/hoststorage.go
Normal file
57
pkg/apis/compute/hoststorage.go
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type HoststorageDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
HostJointsDetails
|
||||
|
||||
SHoststorage
|
||||
|
||||
// 存储名称
|
||||
Storage string `json:"storage"`
|
||||
// 存储大小
|
||||
Capacity int64 `json:"capacity"`
|
||||
// 存储配置信息
|
||||
StorageConf jsonutils.JSONObject `json:"storage_conf"`
|
||||
// 已使用存储大小
|
||||
UsedCapacity int64 `json:"used_capacity"`
|
||||
// 浪费存储大小(异常磁盘总大小)
|
||||
WasteCapacity int64 `json:"waste_capacity"`
|
||||
// 可用存储大小
|
||||
FreeCapacity int64 `json:"free_capacity"`
|
||||
// 存储类型
|
||||
// example: local
|
||||
StorageType string `json:"storage_type"`
|
||||
// 介质类型
|
||||
// example: ssd
|
||||
MediumType string `json:"medium_type"`
|
||||
// 是否启用
|
||||
Enabled bool `json:"enabled"`
|
||||
// 超售比
|
||||
Cmtbound float32 `json:"cmtbound"`
|
||||
// 镜像缓存路径
|
||||
ImagecachePath string `json:"imagecache_path"`
|
||||
// 存储缓存Id
|
||||
StoragecacheId string `json:"storagecached_id"`
|
||||
|
||||
GuestDiskCount int `json:"guest_disk_count,allowempty"`
|
||||
}
|
||||
29
pkg/apis/compute/hostwire.go
Normal file
29
pkg/apis/compute/hostwire.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type HostwireDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
HostJointsDetails
|
||||
SHostwire
|
||||
|
||||
// 二层网络名称
|
||||
Wire string `json:"wire"`
|
||||
|
||||
// 带宽大小
|
||||
Bandwidth int `json:"bandwidth"`
|
||||
}
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type RegionalResourceCreateInput struct {
|
||||
Cloudregion string `json:"cloudregion"`
|
||||
CloudregionId string `json:"cloudregion_id"`
|
||||
@@ -25,5 +29,83 @@ type ManagedResourceCreateInput struct {
|
||||
}
|
||||
|
||||
type DeletePreventableCreateInput struct {
|
||||
//删除保护,创建的资源默认不允许删除
|
||||
//default: true
|
||||
DisableDelete *bool `json:"disable_delete"`
|
||||
}
|
||||
|
||||
type KeypairListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
|
||||
apis.UserResourceListInput
|
||||
|
||||
// list in admin mode
|
||||
Admin *bool `json:"admin"`
|
||||
}
|
||||
|
||||
type CachedimageListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
ZonalFilterListInput
|
||||
}
|
||||
|
||||
type ExternalProjectListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
}
|
||||
|
||||
type RouteTableListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
RegionalFilterListInput
|
||||
VpcFilterListInput
|
||||
}
|
||||
|
||||
type SnapshotPolicyCacheListInput struct {
|
||||
apis.ResourceBaseListInput
|
||||
|
||||
// filter by snapshotpolicy Id or Name
|
||||
Snapshotpolicy string `json:"snapshotpolicy"`
|
||||
}
|
||||
|
||||
type BillingFilterListInput struct {
|
||||
// filter by billing_type
|
||||
BillingType string `json:"billing_type"`
|
||||
}
|
||||
|
||||
type NetworkInterfaceListInput struct {
|
||||
apis.StatusStandaloneResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
}
|
||||
|
||||
type BaremetalagentListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
}
|
||||
|
||||
type DnsRecordListInput struct {
|
||||
apis.AdminSharableVirtualResourceListInput
|
||||
}
|
||||
|
||||
type DynamicschedtagListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
}
|
||||
|
||||
type GuestTemplateListInput struct {
|
||||
apis.SharableVirtualResourceListInput
|
||||
}
|
||||
|
||||
type SchedpolicyListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
}
|
||||
|
||||
type ServiceCatalogListInput struct {
|
||||
apis.SharableVirtualResourceListInput
|
||||
}
|
||||
|
||||
type SnapshotPolicyListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
}
|
||||
|
||||
@@ -17,20 +17,29 @@ package compute
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type InstanceGroupListInput struct {
|
||||
apis.BaseListInput
|
||||
apis.VirtualResourceListInput
|
||||
ZonalFilterListInput
|
||||
ServerFilterListInput
|
||||
|
||||
// Filter by service type
|
||||
// 以service_type过滤列表结果
|
||||
ServiceType string `json:"service_type"`
|
||||
// Filter by parent id
|
||||
// 以parent_id过滤列表结果
|
||||
ParentId string `json:"parent_id"`
|
||||
// Filter by zone id
|
||||
ZoneId string `json:"zone_id"`
|
||||
// Filter by guest id or name
|
||||
Server string `json:"server"`
|
||||
}
|
||||
|
||||
type InstanceGroupDetail struct {
|
||||
apis.Meta
|
||||
apis.VirtualResourceDetails
|
||||
SGroup
|
||||
GuestCount int64 `json:"guest_count"`
|
||||
|
||||
// 云主机数量
|
||||
GuestCount int `json:"guest_count"`
|
||||
}
|
||||
|
||||
type GroupFilterListInput struct {
|
||||
// 以指定实例组(ID或Name)过滤列表结果
|
||||
Group string `json:"group"`
|
||||
// swagger:ignore
|
||||
// deprecated: true
|
||||
// Filter by instance group Id
|
||||
GroupId string `json:"group_id" deprecated-by:"group"`
|
||||
}
|
||||
|
||||
49
pkg/apis/compute/instance_snapshot.go
Normal file
49
pkg/apis/compute/instance_snapshot.go
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type SimpleSnapshot struct {
|
||||
// 快照Id
|
||||
Id string `json:"id"`
|
||||
// 快照名称
|
||||
Name string `json:"name"`
|
||||
// 存储Id
|
||||
StorageId string `json:"storage_id"`
|
||||
// 磁盘类型
|
||||
DiskType string `json:"disk_type"`
|
||||
// 区域Id
|
||||
CloudregionId string `json:"cloudregion_id"`
|
||||
// 快照大小
|
||||
Size int `json:"size"`
|
||||
}
|
||||
|
||||
type InstnaceSnapshotDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SInstanceSnapshot
|
||||
|
||||
// 云主机状态
|
||||
GuestStatus string `json:"guest_status"`
|
||||
// 云主机名称
|
||||
Guest string `json:"guest"`
|
||||
|
||||
// 存储类型
|
||||
StorageType string `json:"storage_type"`
|
||||
|
||||
// 快照列表
|
||||
Snapshots []SimpleSnapshot `json:"snapshots"`
|
||||
Properties map[string]string `json:"properties"`
|
||||
}
|
||||
29
pkg/apis/compute/isolated_device.go
Normal file
29
pkg/apis/compute/isolated_device.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type IsolateDeviceDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SIsolatedDevice
|
||||
|
||||
// 宿主机名称
|
||||
Host string `json:"host"`
|
||||
// 云主机名称
|
||||
Guest string `json:"guest"`
|
||||
// 云主机状态
|
||||
GuestStatus string `json:"guest_status"`
|
||||
}
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
DIRECT_PCI_TYPE = "PCI"
|
||||
GPU_HPC_TYPE = "GPU-HPC" // # for compute
|
||||
@@ -38,3 +42,17 @@ var VENDOR_ID_MAP = map[string]string{
|
||||
"NVIDIA": NVIDIA_VENDOR_ID,
|
||||
"AMD": AMD_VENDOR_ID,
|
||||
}
|
||||
|
||||
type IsolatedDeviceListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
apis.DomainizedResourceListInput
|
||||
|
||||
HostFilterListInput
|
||||
|
||||
// 只列出GPU直通设备
|
||||
Gpu *bool `json:"gpu"`
|
||||
// 只列出USB直通设备
|
||||
Usb *bool `json:"usb"`
|
||||
// 只列出未使用的直通设备
|
||||
Unused *bool `json:"unused"`
|
||||
}
|
||||
|
||||
57
pkg/apis/compute/keypair.go
Normal file
57
pkg/apis/compute/keypair.go
Normal file
@@ -0,0 +1,57 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
var KEYPAIR_SCHEMAS = []string{
|
||||
KEYPAIRE_SCHEME_RSA,
|
||||
}
|
||||
|
||||
type KeypairCreateInput struct {
|
||||
apis.StandaloneResourceCreateInput
|
||||
|
||||
// 公钥内容,若为空则自动生成公钥
|
||||
PublicKey string `json:"public_key"`
|
||||
|
||||
// swagger:ignore
|
||||
PrivateKey string
|
||||
|
||||
// swagger:ignore
|
||||
Fingerprint string
|
||||
|
||||
// swagger:ignore
|
||||
OwnerId string
|
||||
|
||||
// 秘钥类型
|
||||
// enum: RSA
|
||||
// default: RSA
|
||||
Scheme string `json:"scheme"`
|
||||
}
|
||||
|
||||
type KeypairDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SKeypair
|
||||
|
||||
// 私钥长度
|
||||
PrivateKeyLen int `json:"private_key_len"`
|
||||
// 关联云主机次数
|
||||
LinkedGuestCount int `json:"linked_guest_count"`
|
||||
|
||||
// 用户Id
|
||||
OwnerId string `json:"owner_id"`
|
||||
// 用户名称
|
||||
OwnerName string `json:"owner_name"`
|
||||
}
|
||||
20
pkg/apis/compute/keypair_const.go
Normal file
20
pkg/apis/compute/keypair_const.go
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
const (
|
||||
KEYPAIRE_SCHEME_RSA = "RSA"
|
||||
KEYPAIRE_SCHEME_DSA = "DSA"
|
||||
)
|
||||
@@ -30,3 +30,104 @@ const (
|
||||
DeployMethodYum = "yum"
|
||||
DeployMethodCopy = "copy"
|
||||
)
|
||||
|
||||
type LoadbalancerListenerListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
RegionalFilterListInput
|
||||
|
||||
// filter by loadbalancer
|
||||
Loadbalancer string `json:"loadbalancer"`
|
||||
// filter by backend_group
|
||||
BackendGroup string `json:"backend_group"`
|
||||
// filter by acl
|
||||
Acl string `json:"acl"`
|
||||
}
|
||||
|
||||
type LoadbalancerListenerRuleListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
// filter by listener
|
||||
Listener string `json:"listener"`
|
||||
// filter by backend_group
|
||||
BackendGroup string `json:"backend_group"`
|
||||
}
|
||||
|
||||
type LoadbalancerListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
ZonalFilterListInput
|
||||
NetworkFilterListInput
|
||||
|
||||
// filter by cluster
|
||||
Cluster string `json:"cluster"`
|
||||
}
|
||||
|
||||
type LoadbalancerAgentListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
|
||||
// filter by loadbalancercluster
|
||||
Cluster string `json:"cluster"`
|
||||
}
|
||||
|
||||
type LoadbalancerCertificateListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
UsableResourceListInput
|
||||
RegionalFilterListInput
|
||||
ManagedResourceListInput
|
||||
}
|
||||
|
||||
type LoadbalancerBackendListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
RegionalFilterListInput
|
||||
|
||||
// filter by backend server
|
||||
Backend string `json:"backend"`
|
||||
// filter by backend group
|
||||
BackendGroup string `json:"backend_group"`
|
||||
}
|
||||
|
||||
type LoadbalancerBackendGroupListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
RegionalFilterListInput
|
||||
ManagedResourceListInput
|
||||
|
||||
// filter by loadbalancer
|
||||
Loadbalancer string `json:"loadbalancer"`
|
||||
// filter LoadbalancerBackendGroup with no reference
|
||||
NoRef *bool `json:"no_ref"`
|
||||
}
|
||||
|
||||
type LoadbalancerClusterListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
|
||||
ZonalFilterListInput
|
||||
WireFilterListInput
|
||||
}
|
||||
|
||||
type LoadbalancerAclListInput struct {
|
||||
apis.SharableVirtualResourceListInput
|
||||
}
|
||||
|
||||
type LoadbalancerDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SLoadbalancer
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
// 公网IP地址
|
||||
Eip string `json:"eip"`
|
||||
// 公网IP地址类型: 弹性、非弹性
|
||||
// example: public_ip
|
||||
EipMode string `json:"eip_mode"`
|
||||
// 虚拟私有网络名称
|
||||
Vpc string `json:"vpc"`
|
||||
// 后端服务器组名称
|
||||
BackendGroup string `json:"backend_group"`
|
||||
}
|
||||
|
||||
22
pkg/apis/compute/loadbalanceracl.go
Normal file
22
pkg/apis/compute/loadbalanceracl.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type LoadbalancerAclDetails struct {
|
||||
apis.SharableVirtualResourceDetails
|
||||
SLoadbalancerAcl
|
||||
}
|
||||
25
pkg/apis/compute/loadbalanceragent.go
Normal file
25
pkg/apis/compute/loadbalanceragent.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type LoadbalancerAgentDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SLoadbalancerAgent
|
||||
|
||||
ZoneInfo ZoneInfo
|
||||
Cluster string `json:"cluster"`
|
||||
}
|
||||
26
pkg/apis/compute/loadbalancerbackend.go
Normal file
26
pkg/apis/compute/loadbalancerbackend.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type LoadbalancerBackendDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SLoadbalancerBackend
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
VpcId string `json:"vpc_id"`
|
||||
}
|
||||
25
pkg/apis/compute/loadbalancerbackendgroup.go
Normal file
25
pkg/apis/compute/loadbalancerbackendgroup.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type LoadbalancerBackendGroupDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SLoadbalancerBackendGroup
|
||||
|
||||
Loadbalancer string `json:"loadbalancer"`
|
||||
CloudregionInfo
|
||||
}
|
||||
22
pkg/apis/compute/loadbalancercertificate.go
Normal file
22
pkg/apis/compute/loadbalancercertificate.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type LoadbalancerCertificateDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SLoadbalancerCertificate
|
||||
}
|
||||
24
pkg/apis/compute/loadbalancercluster.go
Normal file
24
pkg/apis/compute/loadbalancercluster.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type LoadbalancerCusterDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SLoadbalancerCluster
|
||||
|
||||
ZoneInfo
|
||||
}
|
||||
30
pkg/apis/compute/loadbalancerlistener.go
Normal file
30
pkg/apis/compute/loadbalancerlistener.go
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type LoadbalancerListenerDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SLoadbalancerListener
|
||||
|
||||
BackendGroup string `json:"backend_group"`
|
||||
Loadbalancer string `json:"loadbalancer"`
|
||||
AclName string `json:"acl_name"`
|
||||
CertificateName string `json:"certificate_name"`
|
||||
OriginCertificateId string `json:"origin_certificate_id"`
|
||||
|
||||
CloudregionInfo
|
||||
}
|
||||
26
pkg/apis/compute/loadbalancerlistenerrule.go
Normal file
26
pkg/apis/compute/loadbalancerlistenerrule.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type LoadbalancerListenerRuleDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SLoadbalancerListenerRule
|
||||
|
||||
BackendGroup string `json:"backend_group"`
|
||||
|
||||
CloudregionInfo
|
||||
}
|
||||
27
pkg/apis/compute/loadbalancernetwork.go
Normal file
27
pkg/apis/compute/loadbalancernetwork.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type LoadbalancernetworkDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
SLoadbalancerNetwork
|
||||
|
||||
// 负载均衡器名称
|
||||
Loadbalancer string `json:"loadbalancer"`
|
||||
// IP子网名称
|
||||
Network string `json:"network"`
|
||||
}
|
||||
@@ -39,3 +39,40 @@ type SNatDCreateInput struct {
|
||||
ExternalPort int
|
||||
IpProtocol string
|
||||
}
|
||||
|
||||
type NatDEntryDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
// SNatDEntry
|
||||
|
||||
Natgateway string `json:"natgateway"`
|
||||
RealName string `json:"real_name"`
|
||||
}
|
||||
|
||||
type NatSEntryDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
// SNatSEntry
|
||||
|
||||
Natgateway string `json:"natgateway"`
|
||||
// RealName identifies the local name of SNAT record
|
||||
RealName string `json:"real_name"`
|
||||
Network SimpleNetwork `json:"network"`
|
||||
}
|
||||
|
||||
type SimpleNetwork struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
GuestIpStart string `json:"guest_ip_start"`
|
||||
GuestIpEnd string `json:"guest_ip_end"`
|
||||
GuestIp6Start string `json:"guest_ip6_start"`
|
||||
GuestIp6End string `json:"guest_ip6_end"`
|
||||
}
|
||||
|
||||
type NatgatewayDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SNatGateway
|
||||
|
||||
CloudproviderInfo
|
||||
Vpc string `json:"vpc"`
|
||||
|
||||
NatSpec string `json:"nat_spec"`
|
||||
}
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
NAT_STAUTS_AVAILABLE = "available" //可用
|
||||
NAT_STATUS_ALLOCATE = "allocate" //创建中
|
||||
@@ -33,3 +37,33 @@ const (
|
||||
QCLOUD_NAT_SPEC_MIDDLE = "middle"
|
||||
QCLOUD_NAT_SPEC_LARGE = "large"
|
||||
)
|
||||
|
||||
type NatGetewayListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
|
||||
VpcFilterListInput
|
||||
RegionalFilterListInput
|
||||
ManagedResourceListInput
|
||||
}
|
||||
|
||||
type NatEntryListInput struct {
|
||||
apis.StandaloneResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
}
|
||||
|
||||
type NatDEntryListInput struct {
|
||||
NatEntryListInput
|
||||
|
||||
// filter by natgateway
|
||||
Natgateway string `json:"natgateway"`
|
||||
}
|
||||
|
||||
type NatSEntryListInput struct {
|
||||
NatEntryListInput
|
||||
|
||||
// filter by natgateway
|
||||
Natgateway string `json:"natgateway"`
|
||||
// filter by network
|
||||
Network string `json:"network"`
|
||||
}
|
||||
|
||||
@@ -18,33 +18,51 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type NetworkListInput struct {
|
||||
apis.BaseListInput
|
||||
type VpcFilterListInput struct {
|
||||
// 过滤关联此VPC(ID或Name)的资源
|
||||
Vpc string `json:"vpc"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by vpc Id
|
||||
VpcId string `json:"vpc_id" deprecated-by:"vpc"`
|
||||
}
|
||||
|
||||
type WireFilterListInput struct {
|
||||
VpcFilterListInput
|
||||
|
||||
// 过滤连接此二层网络(ID或Name)的资源
|
||||
Wire string `json:"wire"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// fitler by wire id
|
||||
WireId string `json:"wire_id" deprecated-by:"wire"`
|
||||
}
|
||||
|
||||
type NetworkFilterListInput struct {
|
||||
WireFilterListInput
|
||||
|
||||
// 过滤关联此网络(ID或Name)的资源
|
||||
Network string `json:"network"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by networkId
|
||||
NetworkId string `json:"network_id" deprecated-by:"network"`
|
||||
}
|
||||
|
||||
type NetworkListInput struct {
|
||||
apis.SharableVirtualResourceListInput
|
||||
|
||||
CloudaccountListInput
|
||||
CloudTypeListInput
|
||||
HostFilterListInput
|
||||
|
||||
Zone string `json:"zone"`
|
||||
Zones []string `json:"zones"`
|
||||
ManagedResourceListInput
|
||||
|
||||
Vpc string `json:"vpc"`
|
||||
UsableResourceListInput
|
||||
|
||||
Cloudregion string `json:"cloudregion"`
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudregionId string `json:"cloudregion_id"`
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
Region string `json:"region"`
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
RegionId string `json:"region_id"`
|
||||
WireFilterListInput
|
||||
|
||||
Usable bool `json:"usable"`
|
||||
Host string `json:"host"`
|
||||
City string `json:"city"`
|
||||
// description: search ip address in network.
|
||||
// example: 10.168.222.1
|
||||
Ip string `json:"ip"`
|
||||
}
|
||||
|
||||
type NetworkCreateInput struct {
|
||||
@@ -101,25 +119,38 @@ type NetworkCreateInput struct {
|
||||
}
|
||||
|
||||
type NetworkDetails struct {
|
||||
apis.Meta
|
||||
apis.SharableVirtualResourceDetails
|
||||
|
||||
CloudproviderDetails
|
||||
CloudproviderInfo
|
||||
SNetwork
|
||||
Wire string `json:"wire"`
|
||||
Exit bool `json:"exit"`
|
||||
Ports int `json:"ports"`
|
||||
PortsUsed int `json:"ports_used"`
|
||||
Vnics int `json:"vnics"`
|
||||
BmVnics int `json:"bm_nics"`
|
||||
LbVnics int `json:"lb_vnics"`
|
||||
EipVnics int `json:"eip_vnics"`
|
||||
GroupVnics int `json:"group_vnics"`
|
||||
ReserveVnics int `json:"reserve_vnics"`
|
||||
Vpc string `json:"vpc"`
|
||||
VpcId string `json:"vpc_id"`
|
||||
VpcExtId string `json:"vpc_ext_id"`
|
||||
|
||||
// 二层网络名称
|
||||
Wire string `json:"wire"`
|
||||
// 是否是内网
|
||||
Exit bool `json:"exit"`
|
||||
// 端口数量
|
||||
Ports int `json:"ports"`
|
||||
// 已使用端口数量
|
||||
PortsUsed int `json:"ports_used"`
|
||||
// 网卡数量
|
||||
Vnics int `json:"vnics"`
|
||||
// 裸金属网卡数量
|
||||
BmVnics int `json:"bm_nics"`
|
||||
// 负载均衡网卡数量
|
||||
LbVnics int `json:"lb_vnics"`
|
||||
// 浮动Ip网卡数量
|
||||
EipVnics int `json:"eip_vnics"`
|
||||
GroupVnics int `json:"group_vnics"`
|
||||
// 预留IP数量
|
||||
ReserveVnics int `json:"reserve_vnics"`
|
||||
// 虚拟私有网络名称
|
||||
Vpc string `json:"vpc"`
|
||||
// 虚拟私有网络Id
|
||||
VpcId string `json:"vpc_id"`
|
||||
// 虚拟私有网络外部Id
|
||||
VpcExtId string `json:"vpc_ext_id"`
|
||||
|
||||
// 路由信息
|
||||
Routes [][]string `json:"routes"`
|
||||
Schedtags []SchedtagShortDescDetails `json:"schedtags"`
|
||||
}
|
||||
|
||||
40
pkg/apis/compute/networkinterface.go
Normal file
40
pkg/apis/compute/networkinterface.go
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// 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.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type NetworkInterfaceNetworkInfo struct {
|
||||
// Ip子网Id
|
||||
NetworkId string `json:"network_id"`
|
||||
// IP地址
|
||||
IpAddr string `json:"ip_addr"`
|
||||
// 是否是主ip地址
|
||||
Primary bool `json:"primary"`
|
||||
// 弹性网卡id
|
||||
NetworkinterfaceId string `json:"networkinterface_id"`
|
||||
// IP子网名称
|
||||
Network string `json:"network"`
|
||||
}
|
||||
|
||||
type NetworkInterfaceDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SNetworkInterface
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
// 弹性网卡网络信息
|
||||
Networks []NetworkInterfaceNetworkInfo `json:"networks"`
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user