mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 16:13:56 +08:00
Compare commits
545 Commits
release/3.
...
v3.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fcabafc742 | ||
|
|
e19c91788c | ||
|
|
5b9a89d81b | ||
|
|
f685c1b391 | ||
|
|
089fa77540 | ||
|
|
bf6b6e3f2d | ||
|
|
a53e4d0220 | ||
|
|
fc7240469c | ||
|
|
f3e89cc91a | ||
|
|
ac14001b1d | ||
|
|
7451e9cadb | ||
|
|
b0774713a1 | ||
|
|
dde3fd44bf | ||
|
|
d08bb2700c | ||
|
|
517bca61c0 | ||
|
|
8465defe65 | ||
|
|
129c2195e9 | ||
|
|
cebee78ee5 | ||
|
|
c84f5730df | ||
|
|
0219383e8d | ||
|
|
f4cf25d3e5 | ||
|
|
28c5dbd1ab | ||
|
|
dcc7f2ba5c | ||
|
|
3c4e953843 | ||
|
|
bee1582654 | ||
|
|
f0a6c20c43 | ||
|
|
3dfce69dbc | ||
|
|
8c4f18b11f | ||
|
|
69c2de1fd9 | ||
|
|
c5ecdd6a42 | ||
|
|
a79aaaedc7 | ||
|
|
b58f78a0c9 | ||
|
|
8d9a76e3b3 | ||
|
|
173a8d6d4f | ||
|
|
08bf822d17 | ||
|
|
2bd5b61b61 | ||
|
|
41d61a77ce | ||
|
|
ce86a155f8 | ||
|
|
503b6f0a2a | ||
|
|
a5dc903c13 | ||
|
|
f8dcc93262 | ||
|
|
8085764f20 | ||
|
|
e8b342dfb2 | ||
|
|
1a58515573 | ||
|
|
439a02d9c8 | ||
|
|
8e767cc984 | ||
|
|
e444d5e797 | ||
|
|
6022e2da2e | ||
|
|
dc51ab2ee0 | ||
|
|
105c0a1714 | ||
|
|
69029c088a | ||
|
|
cd996659ac | ||
|
|
439e9c23f8 | ||
|
|
a259eb1112 | ||
|
|
c76ca51af5 | ||
|
|
286e001dac | ||
|
|
1eb3abf5a1 | ||
|
|
f51e7d0c7f | ||
|
|
b927fa5708 | ||
|
|
9211beb905 | ||
|
|
8d60b07d80 | ||
|
|
39b5d08f14 | ||
|
|
5b4ab09678 | ||
|
|
26802683ce | ||
|
|
25a537c743 | ||
|
|
4538ee2487 | ||
|
|
e2e33ef7af | ||
|
|
5e3270b7f4 | ||
|
|
f282022f9e | ||
|
|
d02dae88f2 | ||
|
|
650745ef1f | ||
|
|
40cdc198c8 | ||
|
|
a4ef41c5bb | ||
|
|
698fc0e1cb | ||
|
|
2c35de74c8 | ||
|
|
f70d781f0d | ||
|
|
a8ea730823 | ||
|
|
f4f34c1c3d | ||
|
|
05ea4797d8 | ||
|
|
494c540ac1 | ||
|
|
e0838efff8 | ||
|
|
f3f449f27a | ||
|
|
ce74310ca1 | ||
|
|
4ee1079d95 | ||
|
|
3dbaa6daba | ||
|
|
64b9bac4a9 | ||
|
|
75410934fe | ||
|
|
fae4cf63e2 | ||
|
|
0cd71ca469 | ||
|
|
2326f8e397 | ||
|
|
5e39414807 | ||
|
|
2c3340db6d | ||
|
|
54aff23fd2 | ||
|
|
c500036b1a | ||
|
|
51fdaed08c | ||
|
|
1e58907468 | ||
|
|
4e7202af40 | ||
|
|
444c2bc56e | ||
|
|
ae5f1e308b | ||
|
|
12ce1a0056 | ||
|
|
90008ff727 | ||
|
|
565696ca54 | ||
|
|
ae0de12280 | ||
|
|
bf4ca9c7f4 | ||
|
|
f50ffc31a7 | ||
|
|
9a7cad2507 | ||
|
|
4efe569446 | ||
|
|
ed512d2881 | ||
|
|
61d9bd3da9 | ||
|
|
8e9cd48302 | ||
|
|
897410d87f | ||
|
|
cf1ae4cac3 | ||
|
|
f8358cdde2 | ||
|
|
2e51e8d7e8 | ||
|
|
7b7d197939 | ||
|
|
d019dded59 | ||
|
|
6ee9a428d4 | ||
|
|
fe096bc117 | ||
|
|
bf9bcb191d | ||
|
|
cc0377dafb | ||
|
|
dce85ee9ee | ||
|
|
bc3ce3d2a1 | ||
|
|
27bb5eaa2b | ||
|
|
c630607066 | ||
|
|
e2762d75ca | ||
|
|
03f4cf19ed | ||
|
|
c4bbd519bc | ||
|
|
79b03d99c6 | ||
|
|
32da0918ba | ||
|
|
e6128db1a4 | ||
|
|
fe5a701849 | ||
|
|
9d2bf8556c | ||
|
|
90ee7c2934 | ||
|
|
bff54a22fd | ||
|
|
a166467f75 | ||
|
|
87377deee7 | ||
|
|
1ade0a645f | ||
|
|
ad79f8a557 | ||
|
|
4b1e038ac6 | ||
|
|
cf8426fad0 | ||
|
|
3cf9b22ae4 | ||
|
|
bb8b474b59 | ||
|
|
1a2826d37b | ||
|
|
02758cf5e2 | ||
|
|
5ebf23518d | ||
|
|
90a6b15c79 | ||
|
|
ac6a4169c3 | ||
|
|
9082f913c2 | ||
|
|
c05188ef50 | ||
|
|
b69f4b50fb | ||
|
|
b3b80fbeef | ||
|
|
9bd0d49baa | ||
|
|
23bfba422d | ||
|
|
6fa93c25ad | ||
|
|
12f3df951e | ||
|
|
eabed8d47d | ||
|
|
09e63478c6 | ||
|
|
3590253480 | ||
|
|
cd02610f23 | ||
|
|
d2d551e6cd | ||
|
|
0d5dbf62b8 | ||
|
|
de59d8895a | ||
|
|
f9573c4cbf | ||
|
|
b3d1bfea0c | ||
|
|
7667ed425e | ||
|
|
20ce2ca01f | ||
|
|
32cdc3e2cd | ||
|
|
9fb1f6c224 | ||
|
|
4d44569f40 | ||
|
|
5a14e40ba4 | ||
|
|
1081410846 | ||
|
|
942ff1d661 | ||
|
|
ef6e90f9cb | ||
|
|
8bdf8807de | ||
|
|
81eab50f3b | ||
|
|
8c21e3313e | ||
|
|
91d09aeba4 | ||
|
|
c040ed5d74 | ||
|
|
8b8f57e0f7 | ||
|
|
5c098c6445 | ||
|
|
f4673ee5fc | ||
|
|
410e575d8a | ||
|
|
16b053349b | ||
|
|
4937dec5f3 | ||
|
|
19b98799a0 | ||
|
|
ce44e085f8 | ||
|
|
349c26f39a | ||
|
|
76d40b0ceb | ||
|
|
095b70af37 | ||
|
|
d090073168 | ||
|
|
19fda5387f | ||
|
|
617cd67b1c | ||
|
|
ae63c797d4 | ||
|
|
51e2c1114a | ||
|
|
518405e0ca | ||
|
|
e75c0e0fbf | ||
|
|
0c8fc8cf77 | ||
|
|
5a2ecc2a1e | ||
|
|
8437d918de | ||
|
|
ad9f85ede8 | ||
|
|
e21994d9eb | ||
|
|
8eca54f6a7 | ||
|
|
7db5fe8ef7 | ||
|
|
320a233155 | ||
|
|
60861d4983 | ||
|
|
599345c5f0 | ||
|
|
9159eae068 | ||
|
|
8dc56cd712 | ||
|
|
06ef435ffc | ||
|
|
af4cab0d4e | ||
|
|
1d4ea408a5 | ||
|
|
b8f05c4ead | ||
|
|
5c587212bc | ||
|
|
133fe47634 | ||
|
|
8efe1c5b45 | ||
|
|
91ca20d540 | ||
|
|
4d320a22db | ||
|
|
16702ba2f6 | ||
|
|
e227380071 | ||
|
|
b5aa5f3682 | ||
|
|
7a56e6b74b | ||
|
|
4fd186a0c0 | ||
|
|
88e4de7b52 | ||
|
|
8bcbd08741 | ||
|
|
3dc838d47d | ||
|
|
abb954c6c9 | ||
|
|
b70a1e5a05 | ||
|
|
5afb250467 | ||
|
|
394a6f061c | ||
|
|
fa0cb45ea3 | ||
|
|
1113dfe17b | ||
|
|
81c31c8c1c | ||
|
|
8dfad23c2c | ||
|
|
019287b16a | ||
|
|
ff1dc42c47 | ||
|
|
a3faf13ce7 | ||
|
|
78d7317daa | ||
|
|
dc6eab6cd1 | ||
|
|
48008e1a41 | ||
|
|
8f971c9ce4 | ||
|
|
dbb4912325 | ||
|
|
9fdb7cf895 | ||
|
|
05465b9cbb | ||
|
|
e0ee61b94e | ||
|
|
6032301cb8 | ||
|
|
3894d23991 | ||
|
|
ae01139c37 | ||
|
|
cb9e156628 | ||
|
|
57c266e977 | ||
|
|
b1b9c08ea2 | ||
|
|
cc3f382cb8 | ||
|
|
f2380b293e | ||
|
|
46a7e670b2 | ||
|
|
af7aaff4c9 | ||
|
|
7c5f0727b3 | ||
|
|
c4f6199890 | ||
|
|
5f3faf8cb8 | ||
|
|
d7becf89e8 | ||
|
|
d35e6f8fea | ||
|
|
a3332344a0 | ||
|
|
5826a36de4 | ||
|
|
b61befef30 | ||
|
|
4bdf3e8404 | ||
|
|
00e1911d30 | ||
|
|
d26c428b68 | ||
|
|
dc634ad9d0 | ||
|
|
e691d63910 | ||
|
|
5c325bc6b7 | ||
|
|
00f07f128f | ||
|
|
fdc1bef92e | ||
|
|
181c1099fe | ||
|
|
e20a6a35df | ||
|
|
a4db9de855 | ||
|
|
4e9ca42347 | ||
|
|
10a04b0005 | ||
|
|
f36f275dc6 | ||
|
|
4f644f1d80 | ||
|
|
e1020530e2 | ||
|
|
a94f55ba91 | ||
|
|
b769399a79 | ||
|
|
0ba856004f | ||
|
|
afefb9464d | ||
|
|
039d7b43f6 | ||
|
|
6a4b39085c | ||
|
|
db75a24f73 | ||
|
|
ff0e50cce0 | ||
|
|
217670326b | ||
|
|
a655afbbde | ||
|
|
e276ba9582 | ||
|
|
93c5a79afa | ||
|
|
53f95f775d | ||
|
|
b9bab969cb | ||
|
|
7835ee1063 | ||
|
|
675f111084 | ||
|
|
9ccd97a236 | ||
|
|
2ea614d38d | ||
|
|
8028577a0b | ||
|
|
7c60fbf66c | ||
|
|
bd560a07b6 | ||
|
|
a4507e169a | ||
|
|
a71292cabc | ||
|
|
b8d93a0db7 | ||
|
|
352800c78d | ||
|
|
a5ace62220 | ||
|
|
7f20eed8ef | ||
|
|
e2b1b53e3e | ||
|
|
089652074e | ||
|
|
77494e5889 | ||
|
|
ba8142559c | ||
|
|
23515d0c87 | ||
|
|
3a853545ca | ||
|
|
45d1c3c7dd | ||
|
|
277a1066cd | ||
|
|
cb29e4f045 | ||
|
|
753566d3a9 | ||
|
|
4008c25b0a | ||
|
|
dad753aaf5 | ||
|
|
6672c2357e | ||
|
|
5865e393f5 | ||
|
|
3d6a14b89b | ||
|
|
3af6da558f | ||
|
|
1e1811c0de | ||
|
|
5b09a45437 | ||
|
|
c72322cd5b | ||
|
|
bf5f1f524e | ||
|
|
e910967798 | ||
|
|
aa27f4eeca | ||
|
|
232df7b869 | ||
|
|
88def49fcc | ||
|
|
fc3aa2acbf | ||
|
|
7bb8f0f968 | ||
|
|
79d8abd1ab | ||
|
|
101d5de95a | ||
|
|
11ccfdd5c9 | ||
|
|
05c85e898d | ||
|
|
30a4d16628 | ||
|
|
f9b9856768 | ||
|
|
60b0634e27 | ||
|
|
8f574c255d | ||
|
|
37ece22817 | ||
|
|
e25142ed70 | ||
|
|
e59189d0f5 | ||
|
|
5e166849ef | ||
|
|
f5af866b39 | ||
|
|
5773663e5d | ||
|
|
b65ab0361a | ||
|
|
eb30360856 | ||
|
|
08b7a96309 | ||
|
|
fe99ec0649 | ||
|
|
f885cfcc4a | ||
|
|
9b3491cc4e | ||
|
|
5317b43e13 | ||
|
|
633c2c9439 | ||
|
|
3f15fa2c58 | ||
|
|
b822c58fc2 | ||
|
|
5171eca046 | ||
|
|
bec1776d7e | ||
|
|
5ba580878d | ||
|
|
7ee21d12ce | ||
|
|
abef1a9f9b | ||
|
|
ccd187220c | ||
|
|
40a211144c | ||
|
|
7648c26d75 | ||
|
|
2ee7dca684 | ||
|
|
f764e5b394 | ||
|
|
c260d81610 | ||
|
|
ef813e062a | ||
|
|
2062489bec | ||
|
|
0ae98e64ea | ||
|
|
a1ccae2e23 | ||
|
|
0b4a141199 | ||
|
|
25f8c71d18 | ||
|
|
1a0df04c83 | ||
|
|
f5c534cb71 | ||
|
|
7d1174efad | ||
|
|
e3f654994a | ||
|
|
0dbd73b60b | ||
|
|
f75ef27fe0 | ||
|
|
dca8b8a9f5 | ||
|
|
9df932505c | ||
|
|
423777c775 | ||
|
|
52f2a1f3b4 | ||
|
|
dd0ced571d | ||
|
|
dbd959d040 | ||
|
|
9be50f0007 | ||
|
|
840b6e9a16 | ||
|
|
ec83f583c2 | ||
|
|
2983659c53 | ||
|
|
af20c84a50 | ||
|
|
5cee576fc4 | ||
|
|
ba89e19f3e | ||
|
|
73faf76bbb | ||
|
|
17bd125542 | ||
|
|
3b14136705 | ||
|
|
a968e3544c | ||
|
|
9d20a58a85 | ||
|
|
a719ad6d82 | ||
|
|
2f9e3f7da0 | ||
|
|
5f8758e5c4 | ||
|
|
ae2369befd | ||
|
|
a4a7d004c8 | ||
|
|
9a7d223311 | ||
|
|
d9910a0364 | ||
|
|
6ad8ff188d | ||
|
|
641cd05a9a | ||
|
|
570a6bbab7 | ||
|
|
01a466b989 | ||
|
|
4fd7e6fcf0 | ||
|
|
8a2841f672 | ||
|
|
0adccb5c8b | ||
|
|
a712df096a | ||
|
|
ed75a7262b | ||
|
|
adea5e3441 | ||
|
|
64f29934f0 | ||
|
|
6cc5c4d942 | ||
|
|
e817fb0920 | ||
|
|
2c412db6c8 | ||
|
|
d08761095c | ||
|
|
03cf19f1db | ||
|
|
3c77aa38ff | ||
|
|
d3a2ebeacb | ||
|
|
d868952b0d | ||
|
|
9ac505c907 | ||
|
|
05ee08e411 | ||
|
|
ef39ed3d0c | ||
|
|
85ac87b7c9 | ||
|
|
3b3480b29b | ||
|
|
6628f15ab0 | ||
|
|
9f55497161 | ||
|
|
9e96e4f7e4 | ||
|
|
12c87f630a | ||
|
|
5d2fb3bf56 | ||
|
|
af5b218377 | ||
|
|
802197f161 | ||
|
|
45f3ee7989 | ||
|
|
d9a43ae92a | ||
|
|
8ae4e5bcec | ||
|
|
67dd167835 | ||
|
|
2d1d8db96a | ||
|
|
9e42b83406 | ||
|
|
1a16fbd9cf | ||
|
|
77d19d2ec3 | ||
|
|
5391943537 | ||
|
|
5c1044a1f6 | ||
|
|
6e87e25b38 | ||
|
|
95565e4b6d | ||
|
|
6c0bdeac49 | ||
|
|
5100ced74c | ||
|
|
f022f4138e | ||
|
|
6ecf644277 | ||
|
|
ee34fbdafe | ||
|
|
61ff4ddbc8 | ||
|
|
ec7bc017dd | ||
|
|
a96d17efcc | ||
|
|
ac1d08d619 | ||
|
|
d032dccd91 | ||
|
|
987495c463 | ||
|
|
dc2fd237f0 | ||
|
|
03cca94b0c | ||
|
|
3365161fa5 | ||
|
|
e810d4567e | ||
|
|
954341e4ab | ||
|
|
becfe078d5 | ||
|
|
8915b934b1 | ||
|
|
b67da6996f | ||
|
|
ce40f6378f | ||
|
|
2c2b1544c6 | ||
|
|
44114e8d94 | ||
|
|
b9405e72e7 | ||
|
|
3a5b32fc60 | ||
|
|
9bbba1a3cc | ||
|
|
25277900d4 | ||
|
|
4cdf779700 | ||
|
|
dc09cb88c4 | ||
|
|
155ef44d8f | ||
|
|
e08b7ff91d | ||
|
|
fa544dbdc7 | ||
|
|
67f0dc3f8b | ||
|
|
d333e30d52 | ||
|
|
94068ce53e | ||
|
|
7a0b6fd2ee | ||
|
|
c0115d5a9c | ||
|
|
50ea8fc5a8 | ||
|
|
fec4cb1804 | ||
|
|
49b3bf2dce | ||
|
|
b89a445451 | ||
|
|
d3a0e345d9 | ||
|
|
0542deef75 | ||
|
|
0db77fc304 | ||
|
|
c6a8eae499 | ||
|
|
62f0a84a83 | ||
|
|
aa6e9a8107 | ||
|
|
8528410bf8 | ||
|
|
d2f33742a0 | ||
|
|
b4b1494e1c | ||
|
|
bb8c9d1b47 | ||
|
|
ab1d2c0c24 | ||
|
|
ef1b8f5245 | ||
|
|
8d1f755b4e | ||
|
|
ad32d9063a | ||
|
|
7ca467e35b | ||
|
|
8270238116 | ||
|
|
ac4f897510 | ||
|
|
0eef43bb0a | ||
|
|
5096ee9de3 | ||
|
|
34e0d8dd27 | ||
|
|
975154b98a | ||
|
|
1b23d6c755 | ||
|
|
cdbc49a1a8 | ||
|
|
86df323603 | ||
|
|
422dcf8020 | ||
|
|
a47bdf3566 | ||
|
|
275832f438 | ||
|
|
dbbe173e51 | ||
|
|
f0276d1a01 | ||
|
|
0cfb8dbd5a | ||
|
|
ad0ddf6dd9 | ||
|
|
3b1c4dc2e5 | ||
|
|
4d907584e2 | ||
|
|
2b9a995b13 | ||
|
|
6dc2ccee60 | ||
|
|
2bd77ec202 | ||
|
|
30fab89baa | ||
|
|
8d47608e4e | ||
|
|
eeeb81bf3f | ||
|
|
78d68a023b | ||
|
|
6534a7c6a5 | ||
|
|
9d60403817 | ||
|
|
6ba7cbbb37 | ||
|
|
047bf47534 | ||
|
|
243590995f | ||
|
|
53a9c010cb | ||
|
|
9a6d9df76d | ||
|
|
8870fe2d1f | ||
|
|
d2d8a7eeaa | ||
|
|
56be0bb3c5 | ||
|
|
d9956a9445 | ||
|
|
0702803b52 | ||
|
|
f12c77ca4c | ||
|
|
e0e72f4dc2 | ||
|
|
1cd4472073 | ||
|
|
71c877428e | ||
|
|
20a2dc5bf3 | ||
|
|
e00f4a1f7d | ||
|
|
72c489140d |
38
.circleci/Dockerfile
Normal file
38
.circleci/Dockerfile
Normal file
@@ -0,0 +1,38 @@
|
||||
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/centos-build:1.0-1
|
||||
- image: yunionio/onecloud-ci:v1.0.3
|
||||
environment:
|
||||
ONECLOUD_CI_BUILD: "1"
|
||||
working_directory: /root/go/onecloud
|
||||
working_directory: /home/build/go/src/yunion.io/x/onecloud
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
requires:
|
||||
- check
|
||||
docker:
|
||||
- image: yunionio/centos-build:1.0-1
|
||||
- image: yunionio/onecloud-ci:v1.0.2
|
||||
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: /root/go/onecloud
|
||||
working_directory: /home/build/go/src/yunion.io/x/onecloud
|
||||
parallelism: 4
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: onecloud-build-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
|
||||
paths:
|
||||
- /root/.cache/go-build
|
||||
- /home/build/.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:
|
||||
- /root/.cache/go-build
|
||||
- /home/build/.cache/go-build
|
||||
- store_artifacts:
|
||||
path: _output/
|
||||
|
||||
@@ -51,16 +51,16 @@ jobs:
|
||||
requires:
|
||||
- check
|
||||
docker:
|
||||
- image: yunionio/centos-build:1.0-1
|
||||
- image: yunionio/onecloud-ci:v1.0.2
|
||||
environment:
|
||||
GO111MODULE: "on"
|
||||
working_directory: /root/go/onecloud
|
||||
working_directory: /home/build/go/src/yunion.io/x/onecloud
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: onecloud-test-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
|
||||
paths:
|
||||
- /root/.cache/go-build
|
||||
- /home/build/.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:
|
||||
- /root/.cache/go-build
|
||||
- /home/build/.cache/go-build
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
|
||||
24
.github/workflows/docker.yml
vendored
24
.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 # baremetal-agent needs this
|
||||
sudo apt-get install librados-dev librbd-dev
|
||||
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 cmd/region-dns'
|
||||
|
||||
- name: Image baremetal-agent
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
@@ -61,16 +61,6 @@ 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:
|
||||
@@ -220,13 +210,3 @@ jobs:
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.devtool
|
||||
|
||||
- name: Image region DNS
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/region-dns
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.region-dns
|
||||
|
||||
66
Makefile
66
Makefile
@@ -192,77 +192,43 @@ mod:
|
||||
go mod vendor -v
|
||||
|
||||
|
||||
DOCKER_BUILD_IMAGE_VERSION?=1.0-1
|
||||
DOCKER_BUILD_IMAGE_VERSION?=latest
|
||||
|
||||
define dockerCentOSBuildCmd
|
||||
set -o xtrace
|
||||
define dockerBuildCmd
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
cd /root/onecloud
|
||||
cd /home/build/onecloud
|
||||
export GOFLAGS=-mod=vendor
|
||||
make $(1)
|
||||
chown -R $(shell id -u):$(shell id -g) _output
|
||||
endef
|
||||
|
||||
docker-centos-build: export dockerCentOSBuildCmd:=$(call dockerCentOSBuildCmd,$(F))
|
||||
docker-centos-build:
|
||||
docker-build: export dockerBuildCmd:=$(call dockerBuildCmd,$(F))
|
||||
docker-build:
|
||||
echo "$$dockerBuildCmd"
|
||||
docker rm --force onecloud-ci-build &>/dev/null || true
|
||||
docker run \
|
||||
--name onecloud-ci-build \
|
||||
--rm \
|
||||
--volume $(CURDIR):/root/onecloud \
|
||||
--volume $(CURDIR)/_output/_cache:/root/.cache \
|
||||
registry.cn-beijing.aliyuncs.com/yunionio/centos-build:$(DOCKER_BUILD_IMAGE_VERSION) \
|
||||
/bin/bash -c "$$dockerCentOSBuildCmd"
|
||||
--volume $(CURDIR):/home/build/onecloud \
|
||||
yunionio/onecloud-ci:$(DOCKER_BUILD_IMAGE_VERSION) \
|
||||
/bin/bash -c "$$dockerBuildCmd"
|
||||
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-centos-build-stop:
|
||||
docker-centos stop --time 0 onecloud-ci-build || true
|
||||
docker-build-stop:
|
||||
docker stop --time 0 onecloud-ci-build || true
|
||||
|
||||
.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 \
|
||||
-v $(CURDIR)/_output/alpine-build/_cache:/root/.cache \
|
||||
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
|
||||
.PHONY: docker-build
|
||||
.PHONY: docker-build-stop
|
||||
|
||||
define helpText
|
||||
Build with docker
|
||||
|
||||
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
|
||||
make docker-build F='-j4'
|
||||
make docker-build F='-j4 cmd/region cmd/climc'
|
||||
make docker-build-stop
|
||||
|
||||
Tidy up go modules and vendor directory
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/apigateway /opt/yunion/bin/apigateway
|
||||
|
||||
@@ -32,8 +32,3 @@ 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,3 +1,3 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/cloudevent /opt/yunion/bin/cloudevent
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/cloudnet /opt/yunion/bin/cloudnet
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/devtool /opt/yunion/bin/devtool
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
COPY ./build/esxi-agent/root/opt/ /opt/
|
||||
ADD ./_output/bin/esxi-agent /opt/yunion/bin/esxi-agent
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-base:v0.1.0
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-base:v0.0.1
|
||||
|
||||
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"
|
||||
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
RUN apk add librados librbd
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
ADD ./_output/alpine-build/bin/host /opt/yunion/bin/host
|
||||
|
||||
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
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/keystone /opt/yunion/bin/keystone
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/logger /opt/yunion/bin/logger
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
|
||||
ADD ./_output/bin/monitor /opt/yunion/bin/monitor
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
COPY ./build/notify/root/opt/ /opt/
|
||||
ADD ./_output/bin/notify /opt/yunion/bin/notify
|
||||
|
||||
@@ -7,7 +7,7 @@ ENV TZ Asia/Shanghai
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
|
||||
RUN apk update && \
|
||||
apk add --no-cache tzdata curl busybox-extras tcpdump strace ca-certificates && \
|
||||
apk add --no-cache tzdata ca-certificates && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
COPY ./build/region/root/opt/ /opt/
|
||||
ADD ./_output/bin/region /opt/yunion/bin/region
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
FROM alpine:3.11.3
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
ADD ./_output/alpine-build/bin/region-dns /opt/yunion/bin/region-dns
|
||||
ADD ./_output/bin/region-dns /opt/yunion/bin/region-dns
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/s3gateway /opt/yunion/bin/s3gateway
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/scheduler /opt/yunion/bin/scheduler
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
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
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/yunionconf /opt/yunion/bin/yunionconf
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
[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
|
||||
@@ -1,2 +0,0 @@
|
||||
DESCRIPTION="Yunion Host Image Server"
|
||||
SERVICE="yes"
|
||||
@@ -84,11 +84,7 @@ func newClient(options *BaseOptions) (*aliyun.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := aliyun.NewAliyunClient(
|
||||
aliyun.NewAliyunClientConfig(
|
||||
options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
cli, err := aliyun.NewAliyunClient("", "", options.AccessKey, options.Secret, options.Debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -85,13 +85,7 @@ func newClient(options *BaseOptions) (*aws.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := aws.NewAwsClient(
|
||||
aws.NewAwsClientConfig(
|
||||
options.AccessUrl,
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
cli, err := aws.NewAwsClient("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -100,17 +100,11 @@ func newClient(options *BaseOptions) (*azure.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Cloud Environment")
|
||||
}
|
||||
|
||||
cli, err := azure.NewAzureClient(
|
||||
azure.NewAzureClientConfig(
|
||||
options.CloudEnv,
|
||||
options.DirectoryID,
|
||||
options.ApplicationID,
|
||||
options.ApplicationKey,
|
||||
).
|
||||
SubscriptionId(options.SubscriptionID).
|
||||
Debug(options.Debug),
|
||||
)
|
||||
|
||||
cli, err := azure.NewAzureClient("", "", options.CloudEnv,
|
||||
options.DirectoryID,
|
||||
options.ApplicationID, options.ApplicationKey,
|
||||
options.SubscriptionID,
|
||||
options.Debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ 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"
|
||||
)
|
||||
|
||||
|
||||
@@ -26,33 +26,10 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func parseGcpCredential(filename string) (jsonutils.JSONObject, error) {
|
||||
data, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authParams, err := jsonutils.Parse(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ret := jsonutils.NewDict()
|
||||
for _, k := range []string{
|
||||
"client_email",
|
||||
"project_id",
|
||||
"private_key_id",
|
||||
"private_key",
|
||||
} {
|
||||
v, _ := authParams.Get(k)
|
||||
ret.Add(v, fmt.Sprintf("gcp_%s", k))
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
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
|
||||
@@ -62,9 +39,6 @@ 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 {
|
||||
@@ -160,7 +134,11 @@ func init() {
|
||||
R(&options.SGoogleCloudAccountCreateOptions{}, "cloud-account-create-google", "Create a Google cloud account", func(s *mcclient.ClientSession, args *options.SGoogleCloudAccountCreateOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Google"), "provider")
|
||||
authParams, err := parseGcpCredential(args.GoogleJsonFile)
|
||||
data, err := ioutil.ReadFile(args.GoogleJsonFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
authParams, err := jsonutils.Parse(data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -399,19 +377,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SGoogleCloudAccountUpdateOptions{}, "cloud-account-update-google", "update a google cloud account", func(s *mcclient.ClientSession, args *options.SGoogleCloudAccountUpdateOptions) error {
|
||||
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
|
||||
if params.Size() == 0 {
|
||||
return InvalidUpdateError()
|
||||
}
|
||||
result, err := modules.Cloudaccounts.Update(s, args.ID, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SAWSCloudAccountUpdateOptions{}, "cloud-account-update-aws", "update an AWS cloud account", func(s *mcclient.ClientSession, args *options.SAWSCloudAccountUpdateOptions) error {
|
||||
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
|
||||
|
||||
@@ -453,7 +418,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SOpenStackCloudAccountUpdateOptions{}, "cloud-account-update-openstack", "update an OpenStack cloud account", func(s *mcclient.ClientSession, args *options.SOpenStackCloudAccountUpdateOptions) error {
|
||||
R(&options.SOpenStackCloudAccountUpdateOptions{}, "cloud-account-update-openstack", "update an AWS cloud account", func(s *mcclient.ClientSession, args *options.SOpenStackCloudAccountUpdateOptions) error {
|
||||
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
|
||||
if params.Size() == 0 {
|
||||
return InvalidUpdateError()
|
||||
@@ -705,19 +670,6 @@ 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 {
|
||||
params, err := parseGcpCredential(args.GoogleJsonFile)
|
||||
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)
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
R(&options.RouteCreateOptions{}, "router-route-create", "Create router route", func(s *mcclient.ClientSession, opts *options.RouteCreateOptions) error {
|
||||
R(&options.RouteCreateOptions{}, "router-route-create", "Create router", func(s *mcclient.ClientSession, opts *options.RouteCreateOptions) error {
|
||||
params, err := base_options.StructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -34,7 +34,7 @@ func init() {
|
||||
printObject(router)
|
||||
return nil
|
||||
})
|
||||
R(&options.RouteGetOptions{}, "router-route-show", "Show router route", func(s *mcclient.ClientSession, opts *options.RouteGetOptions) error {
|
||||
R(&options.RouteGetOptions{}, "router-route-show", "Show router", func(s *mcclient.ClientSession, opts *options.RouteGetOptions) error {
|
||||
router, err := modules.Routes.Get(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -42,7 +42,7 @@ func init() {
|
||||
printObject(router)
|
||||
return nil
|
||||
})
|
||||
R(&options.RouteListOptions{}, "router-route-list", "List router routes", func(s *mcclient.ClientSession, opts *options.RouteListOptions) error {
|
||||
R(&options.RouteListOptions{}, "router-route-list", "List routers", func(s *mcclient.ClientSession, opts *options.RouteListOptions) error {
|
||||
params, err := base_options.ListStructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -54,7 +54,7 @@ func init() {
|
||||
printList(result, modules.Routes.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
R(&options.RouteUpdateOptions{}, "router-route-update", "Update router route", func(s *mcclient.ClientSession, opts *options.RouteUpdateOptions) error {
|
||||
R(&options.RouteUpdateOptions{}, "router-route-update", "Update router", func(s *mcclient.ClientSession, opts *options.RouteUpdateOptions) error {
|
||||
params, err := base_options.StructToParams(opts)
|
||||
router, err := modules.Routes.Update(s, opts.ID, params)
|
||||
if err != nil {
|
||||
@@ -63,7 +63,7 @@ func init() {
|
||||
printObject(router)
|
||||
return nil
|
||||
})
|
||||
R(&options.RouteDeleteOptions{}, "router-route-delete", "Delete router route", func(s *mcclient.ClientSession, opts *options.RouteDeleteOptions) error {
|
||||
R(&options.RouteDeleteOptions{}, "router-route-delete", "Delete router", func(s *mcclient.ClientSession, opts *options.RouteDeleteOptions) error {
|
||||
router, err := modules.Routes.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -31,9 +31,8 @@ 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"`
|
||||
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
|
||||
HasObjectStorage bool `help:"filter cloudproviders that has object storage"`
|
||||
NoObjectStorage bool `help:"filter cloudproviders that has no object storage"`
|
||||
}
|
||||
R(&CloudproviderListOptions{}, "cloud-provider-list", "List cloud providers", func(s *mcclient.ClientSession, args *CloudproviderListOptions) error {
|
||||
var params *jsonutils.JSONDict
|
||||
@@ -53,10 +52,6 @@ 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 {
|
||||
|
||||
@@ -15,14 +15,7 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
@@ -63,78 +56,4 @@ func init() {
|
||||
printObject(r)
|
||||
return nil
|
||||
})
|
||||
|
||||
type EnterpriseUpdateOptions struct {
|
||||
Name string `help:"Enterprise name"`
|
||||
Copyright string `help:"The Email"`
|
||||
Logo string `help:"logo file path"`
|
||||
LoginLogo string `help:"login page logo file path"`
|
||||
Favicon string `help:"favicon path"`
|
||||
}
|
||||
|
||||
R(&EnterpriseUpdateOptions{}, "infos-update", "update enterprise info", func(s *mcclient.ClientSession, args *EnterpriseUpdateOptions) error {
|
||||
var b bytes.Buffer
|
||||
w := multipart.NewWriter(&b)
|
||||
if len(args.Name) > 0 {
|
||||
w.WriteField("name", args.Name)
|
||||
}
|
||||
|
||||
if len(args.Copyright) > 0 {
|
||||
w.WriteField("copyright", args.Copyright)
|
||||
}
|
||||
|
||||
writeFile := func(filedName, filePath string) error {
|
||||
if len(filePath) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
c, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var v string
|
||||
c64 := base64.StdEncoding.EncodeToString(c)
|
||||
ext := filepath.Ext(filePath)
|
||||
switch ext {
|
||||
case ".png":
|
||||
v = fmt.Sprintf("data:image/png;base64,%s", c64)
|
||||
case ".jpg":
|
||||
v = fmt.Sprintf("data:image/jpg;base64,%s", c64)
|
||||
default:
|
||||
return fmt.Errorf("only support png/jpg image")
|
||||
}
|
||||
|
||||
err = w.WriteField(filedName, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := writeFile("logo", args.Logo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := writeFile("login_logo", args.LoginLogo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := writeFile("favicon", args.Favicon); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
header := make(http.Header)
|
||||
header.Set("content-type", fmt.Sprintf("multipart/form-data; boundary=%s", w.Boundary()))
|
||||
w.Close()
|
||||
|
||||
ret, err := modules.Info.Update(s, header, bufio.NewReader(&b))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -18,13 +18,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/util/fileutils2"
|
||||
"yunion.io/x/onecloud/pkg/util/ssh"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -666,44 +664,4 @@ func init() {
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type HostSSHLoginOptions struct {
|
||||
ID string `help:"ID or name of host"`
|
||||
Port int `help:"SSH service port" default:"22"`
|
||||
}
|
||||
R(&HostSSHLoginOptions{}, "host-ssh", "SSH login of a host", func(s *mcclient.ClientSession, args *HostSSHLoginOptions) error {
|
||||
srvid, e := modules.Hosts.GetId(s, args.ID, nil)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
i, e := modules.Hosts.GetLoginInfo(s, srvid, nil)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
host, err := i.GetString("ip")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
user, err := i.GetString("username")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
passwd, err := i.GetString("password")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
port := 22
|
||||
if args.Port != 22 {
|
||||
port = args.Port
|
||||
}
|
||||
sshCli, err := ssh.NewClient(host, port, user, passwd, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Infof("ssh %s:%d", host, port)
|
||||
if err := sshCli.RunTerminal(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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|ctyun"`
|
||||
Hypervisor []string `help:"Prefer hypervisor type" choices:"kvm|esxi|baremetal|container|openstack"`
|
||||
DiskDriver string `help:"Perfer disk driver" choices:"virtio|scsi|pvscsi|ide|sata"`
|
||||
NetDriver string `help:"Preferred network driver" choices:"virtio|e1000|vmxnet3"`
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package k8s
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
)
|
||||
|
||||
func initEvent() {
|
||||
initK8sNamespaceResource("event", k8s.Events)
|
||||
}
|
||||
@@ -16,11 +16,6 @@ package k8s
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
@@ -62,7 +57,7 @@ func init() {
|
||||
initPVC()
|
||||
initJob()
|
||||
initCronJob()
|
||||
initEvent()
|
||||
|
||||
initRbac()
|
||||
|
||||
initApp()
|
||||
@@ -222,71 +217,6 @@ func NewK8sNsResourceGetCmd(cmdN CmdNameFactory, manager modulebase.Manager) *Cm
|
||||
)
|
||||
}
|
||||
|
||||
func NewK8sNsResourceGetRawCmd(cmdN CmdNameFactory, manager k8s.IClusterResourceManager) *Cmd {
|
||||
return NewCommand(
|
||||
&o.NamespaceResourceGetOptions{},
|
||||
cmdN.Do("show-raw"),
|
||||
fmt.Sprintf("Show k8s %s raw data", cmdN.Kind),
|
||||
func(s *mcclient.ClientSession, args *o.NamespaceResourceGetOptions) error {
|
||||
ret, err := manager.GetRaw(s, args.NAME, args.Params())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObjectYAML(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func NewK8sResourceEditRawCmd(cmdN CmdNameFactory, manager k8s.IClusterResourceManager) *Cmd {
|
||||
return NewCommand(
|
||||
&o.NamespaceResourceGetOptions{},
|
||||
cmdN.Do("edit-raw"),
|
||||
fmt.Sprintf("Edit and update k8s %s raw data", cmdN.Kind),
|
||||
func(s *mcclient.ClientSession, args *o.NamespaceResourceGetOptions) error {
|
||||
rawData, err := manager.GetRaw(s, args.NAME, args.Params())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
yamlBytes := rawData.YAMLString()
|
||||
tempfile, err := ioutil.TempFile("", fmt.Sprintf("k8s-%s-%s*.yaml", cmdN.Kind, args.NAME))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer os.Remove(tempfile.Name())
|
||||
if _, err := tempfile.Write([]byte(yamlBytes)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tempfile.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd := exec.Command("vim", tempfile.Name())
|
||||
cmd.Stdin = os.Stdin
|
||||
cmd.Stdout = os.Stdout
|
||||
if err := cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
content, err := ioutil.ReadFile(tempfile.Name())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
jsonBytes, err := yaml.YAMLToJSON(content)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
body, err := jsonutils.Parse(jsonBytes)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := manager.UpdateRaw(s, args.NAME, args.Params(), body.(*jsonutils.JSONDict)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func NewK8sResourceDeleteCmd(cmdN CmdNameFactory, manager modulebase.Manager) *Cmd {
|
||||
return NewCommand(
|
||||
&o.ResourceDeleteOptions{},
|
||||
@@ -314,13 +244,11 @@ func NewK8sNsResourceDeleteCmd(cmdN CmdNameFactory, manager modulebase.Manager)
|
||||
return deleteCmd
|
||||
}
|
||||
|
||||
func initK8sNamespaceResource(kind string, manager k8s.IClusterResourceManager) *ShellCommands {
|
||||
func initK8sNamespaceResource(kind string, manager modulebase.Manager) *ShellCommands {
|
||||
cmdN := NewCmdNameFactory(kind)
|
||||
return NewShellCommands(cmdN.Do).AddR(
|
||||
NewK8sNsResourceListCmd(cmdN, manager),
|
||||
NewK8sNsResourceGetCmd(cmdN, manager),
|
||||
NewK8sNsResourceDeleteCmd(cmdN, manager),
|
||||
NewK8sNsResourceGetRawCmd(cmdN, manager),
|
||||
NewK8sResourceEditRawCmd(cmdN, manager),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -40,23 +40,24 @@ func initSecret() {
|
||||
})
|
||||
secretCmd.AddR(listCmd)
|
||||
|
||||
registryCmd := NewCmdNameFactory("secret-registry")
|
||||
registryCreateCmd := NewCommand(
|
||||
registryCmd := initK8sNamespaceResource("registrysecret", k8s.RegistrySecrets)
|
||||
createCmd := NewCommand(
|
||||
&o.RegistrySecretCreateOptions{},
|
||||
registryCmd.Do("create"),
|
||||
"Create docker registry secret secret",
|
||||
registryCmd.CommandNameFactory("create"),
|
||||
"Create docker registry secret resource",
|
||||
func(s *mcclient.ClientSession, args *o.RegistrySecretCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Secrets.Create(s, params)
|
||||
ret, err := k8s.RegistrySecrets.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
registryCmd.AddR(createCmd)
|
||||
|
||||
cephCSICmd := NewCmdNameFactory("secret-ceph-csi")
|
||||
cephCSICreateCmd := NewCommand(
|
||||
@@ -75,5 +76,5 @@ func initSecret() {
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
secretCmd.AddR(cephCSICreateCmd, registryCreateCmd)
|
||||
secretCmd.AddR(cephCSICreateCmd)
|
||||
}
|
||||
|
||||
@@ -51,10 +51,9 @@ 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" default:"RSA"`
|
||||
PublicKey string `help:"Publickey of keypair"`
|
||||
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|DSA" default:"RSA"`
|
||||
Desc string `help:"Short description of keypair"`
|
||||
}
|
||||
|
||||
R(&KeypairCreate{}, "keypair-create", "Create a new keypair", func(s *mcclient.ClientSession, args *KeypairCreate) error {
|
||||
@@ -64,10 +63,6 @@ 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")
|
||||
}
|
||||
|
||||
@@ -1,116 +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 monitor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
monitorapi "yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
"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.AlertCreateOptions{}, aN("create"), "Create alert rule",
|
||||
func(s *mcclient.ClientSession, args *options.AlertCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Alerts.DoCreate(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
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
|
||||
})
|
||||
|
||||
R(&options.AlertTestRunOptions{}, aN("test-run"), "Test run alert",
|
||||
func(s *mcclient.ClientSession, args *options.AlertTestRunOptions) error {
|
||||
data := new(monitorapi.AlertTestRunInput)
|
||||
if args.Debug {
|
||||
data.IsDebug = true
|
||||
}
|
||||
ret, err := monitor.Alerts.DoTestRun(s, args.ID, data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(ret.JSON(ret).YAMLString())
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertPauseOptions{}, aN("pause"), "Pause or unpause alert",
|
||||
func(s *mcclient.ClientSession, args *options.AlertPauseOptions) error {
|
||||
data := new(monitorapi.AlertPauseInput)
|
||||
if args.UnPause {
|
||||
data.Paused = false
|
||||
} else {
|
||||
data.Paused = true
|
||||
}
|
||||
ret, err := monitor.Alerts.PerformAction(s, args.ID, "pause", data.JSON(data))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
monitorapi "yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
|
||||
func init() {
|
||||
initAlertNotification()
|
||||
}
|
||||
|
||||
func initAlertNotification() {
|
||||
aN := cmdN("alert-notification")
|
||||
R(&options.AlertNotificationListOptions{}, aN("list"), "List alert notification pairs",
|
||||
func(s *mcclient.ClientSession, args *options.AlertNotificationListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
if len(args.Alert) > 0 {
|
||||
result, err = monitor.Alertnotification.ListDescendent(s, args.Alert, params)
|
||||
} else if len(args.Notification) > 0 {
|
||||
result, err = monitor.Alertnotification.ListDescendent2(s, args.Notification, params)
|
||||
} else {
|
||||
result, err = monitor.Alertnotification.List(s, params)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, monitor.Alertnotification.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertNotificationAttachOptions{}, aN("attach"), "Attach a notification to a alert",
|
||||
func(s *mcclient.ClientSession, args *options.AlertNotificationAttachOptions) error {
|
||||
input := &monitorapi.AlertnotificationCreateInput{
|
||||
UsedBy: args.UsedBy,
|
||||
}
|
||||
ret, err := monitor.Alertnotification.Attach(s, args.ALERT, args.NOTIFICATION, input.JSON(input))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.AlertNotificationAttachOptions{}, aN("detach"), "Detach a notification to a alert",
|
||||
func(s *mcclient.ClientSession, args *options.AlertNotificationAttachOptions) error {
|
||||
ret, err := monitor.Alertnotification.Detach(s, args.ALERT, args.NOTIFICATION, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -1,27 +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 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
|
||||
)
|
||||
@@ -1,56 +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 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
|
||||
})
|
||||
}
|
||||
@@ -1,99 +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 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
|
||||
})
|
||||
}
|
||||
@@ -346,6 +346,77 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkAddDnsUpdateTargetOptions struct {
|
||||
ID string `help:"Network ID or name"`
|
||||
DNS string `help:"DNS server address" metavar:"DNS_SERVER"`
|
||||
KEY string `help:"DNS update key name" metavar:"DNS_UPDATE_KEY"`
|
||||
SECRET string `help:"DNS update key secret" metavar:"DNS_UPDATE_SECRET"`
|
||||
}
|
||||
R(&NetworkAddDnsUpdateTargetOptions{}, "network-add-dns-update-target", "Add a dns update target to a network", func(s *mcclient.ClientSession, args *NetworkAddDnsUpdateTargetOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.DNS), "server")
|
||||
params.Add(jsonutils.NewString(args.KEY), "key")
|
||||
params.Add(jsonutils.NewString(args.SECRET), "secret")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "add-dns-update-target", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkRemoveDnsUpdateTargetOptions struct {
|
||||
ID string `help:"Network ID or name"`
|
||||
DNS string `help:"DNS server address" metavar:"DNS_SERVER"`
|
||||
KEY string `help:"DNS update key name" metavar:"DNS_UPDATE_KEY"`
|
||||
}
|
||||
R(&NetworkRemoveDnsUpdateTargetOptions{}, "network-remove-dns-update-target", "Remove a dns update target from a network", func(s *mcclient.ClientSession, args *NetworkRemoveDnsUpdateTargetOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.DNS), "server")
|
||||
params.Add(jsonutils.NewString(args.KEY), "key")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "remove-dns-update-target", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkSetDnsUpdateKeyOptions struct {
|
||||
ID string `help:"ID of virtual network to update"`
|
||||
KEY string `help:"Key name of secret" metavar:"KEYNAME"`
|
||||
SECRET string `help:"Key secret"`
|
||||
SERVER string `help:"Alternate DNS update server"`
|
||||
}
|
||||
R(&NetworkSetDnsUpdateKeyOptions{}, "network-set-dns-update-key", "Set DNS update key info for a virtual network", func(s *mcclient.ClientSession, args *NetworkSetDnsUpdateKeyOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.KEY), "dns_update_key_name")
|
||||
params.Add(jsonutils.NewString(args.SECRET), "dns_update_key_secret")
|
||||
params.Add(jsonutils.NewString(args.SERVER), "dns_update_server")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "metadata", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkRemoveDnsUpdateKeyOptions struct {
|
||||
ID string `help:"ID of virtual network"`
|
||||
}
|
||||
R(&NetworkRemoveDnsUpdateKeyOptions{}, "network-remove-dns-update-key", "Set DNS update key info for a virtual network", func(s *mcclient.ClientSession, args *NetworkRemoveDnsUpdateKeyOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.JSONNull, "dns_update_key_name")
|
||||
params.Add(jsonutils.JSONNull, "dns_update_key_secret")
|
||||
params.Add(jsonutils.JSONNull, "dns_update_server")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "metadata", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkAddressOptions struct {
|
||||
NETWORK string `help:"id or name of network to query"`
|
||||
}
|
||||
|
||||
@@ -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,11 +92,14 @@ 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 {
|
||||
ret := modules.NodeAlert.BatchDelete(s, args.ID, nil)
|
||||
printBatchResults(ret, modules.NodeAlert.GetColumns(s))
|
||||
alarm, err := modules.NodeAlert.Delete(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(alarm)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ func init() {
|
||||
return nil
|
||||
}
|
||||
R(&PolicyPatchOptions{}, "policy-patch", "Patch policy", updateFunc)
|
||||
R(&PolicyPatchOptions{}, "policy-update", "Update policy", updateFunc)
|
||||
R(&PolicyPatchOptions{}, "policy-update", "Patch policy", updateFunc)
|
||||
|
||||
type PolicyPerformOptions struct {
|
||||
ID string `help:"ID of policy to update"`
|
||||
@@ -285,30 +285,12 @@ func init() {
|
||||
if err != nil {
|
||||
log.Fatalf("Set log level %q: %v", "debug", err)
|
||||
}
|
||||
if args.Debug {
|
||||
rbacutils.ShowMatchRuleDebug = true
|
||||
}
|
||||
auth.InitFromClientSession(s)
|
||||
policy.EnableGlobalRbac(15*time.Second, 15*time.Second, false)
|
||||
if args.Debug {
|
||||
consts.EnableRbacDebug()
|
||||
}
|
||||
|
||||
findPolicy := false
|
||||
for !findPolicy {
|
||||
all := policy.PolicyManager.AllPolicies()
|
||||
for _, allP := range all {
|
||||
if len(allP) > 0 {
|
||||
findPolicy = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if findPolicy {
|
||||
break
|
||||
}
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
|
||||
req := jsonutils.NewDict()
|
||||
for i := 0; i < len(args.Request); i += 1 {
|
||||
parts := strings.Split(args.Request[i], ":")
|
||||
@@ -374,7 +356,6 @@ func init() {
|
||||
Context: mcclient.SAuthContext{
|
||||
Ip: args.Ip,
|
||||
},
|
||||
Token: "faketoken",
|
||||
}
|
||||
} else {
|
||||
token = s.GetToken()
|
||||
@@ -386,10 +367,6 @@ func init() {
|
||||
}
|
||||
printObject(result)
|
||||
|
||||
for _, r := range args.Role {
|
||||
fmt.Println("role", r, "matched policies:", policy.PolicyManager.RoleMatchPolicies(r))
|
||||
}
|
||||
|
||||
fmt.Println("userCred:", token)
|
||||
for _, scope := range []rbacutils.TRbacScope{
|
||||
rbacutils.ScopeSystem,
|
||||
@@ -398,7 +375,7 @@ func init() {
|
||||
rbacutils.ScopeUser,
|
||||
rbacutils.ScopeNone,
|
||||
} {
|
||||
m := policy.PolicyManager.MatchedPolicyNames(scope, token)
|
||||
m := policy.PolicyManager.MatchedPolicies(scope, token)
|
||||
fmt.Println("matched", scope, "policies:", m)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,81 +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/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
R(&options.ProxySettingCreateOptions{}, "proxysetting-create", "Create proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingCreateOptions) error {
|
||||
params, err := options.StructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
proxysetting, err := modules.ProxySettings.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingGetOptions{}, "proxysetting-show", "Show proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingGetOptions) error {
|
||||
proxysetting, err := modules.ProxySettings.Get(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingListOptions{}, "proxysetting-list", "List proxysettings", func(s *mcclient.ClientSession, opts *options.ProxySettingListOptions) error {
|
||||
params, err := options.ListStructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := modules.ProxySettings.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.ProxySettings.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingUpdateOptions{}, "proxysetting-update", "Update proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingUpdateOptions) error {
|
||||
params, err := options.StructToParams(opts)
|
||||
proxysetting, err := modules.ProxySettings.Update(s, opts.ID, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingDeleteOptions{}, "proxysetting-delete", "Delete proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingDeleteOptions) error {
|
||||
proxysetting, err := modules.ProxySettings.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingTestOptions{}, "proxysetting-test", "Test proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingTestOptions) error {
|
||||
proxysetting, err := modules.ProxySettings.PerformAction(s, opts.ID, "test", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -21,7 +21,6 @@ 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"
|
||||
@@ -151,19 +150,12 @@ 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 {
|
||||
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)
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.NETDESC), "net_desc")
|
||||
srv, err := modules.Servers.PerformAction(s, args.SERVER, "attachnetwork", params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -34,7 +34,6 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
"yunion.io/x/onecloud/pkg/util/fileutils2"
|
||||
"yunion.io/x/onecloud/pkg/util/ssh"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -988,7 +987,6 @@ func init() {
|
||||
config.Hosts[i].HostIp = yamlConfig.Hosts[i].HostIp
|
||||
config.Hosts[i].XmlFilePath = yamlConfig.Hosts[i].XmlFilePath
|
||||
config.Hosts[i].Servers = make([]compute.SLibvirtServerConfig, len(yamlConfig.Hosts[i].Servers))
|
||||
config.Hosts[i].MonitorPath = yamlConfig.Hosts[i].MonitorPath
|
||||
for j := 0; j < len(yamlConfig.Hosts[i].Servers); j++ {
|
||||
config.Hosts[i].Servers[j].MacIp = make(map[string]string)
|
||||
mac := yamlConfig.Hosts[i].Servers[j].Mac
|
||||
@@ -1011,11 +1009,11 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//for i := 0; i < len(params); i++ {
|
||||
// val := jsonutils.NewDict()
|
||||
// val.Set(modules.Servers.KeywordPlural, params[i])
|
||||
// params[i] = val
|
||||
//}
|
||||
for i := 0; i < len(params); i++ {
|
||||
val := jsonutils.NewDict()
|
||||
val.Set(modules.Servers.KeywordPlural, params[i])
|
||||
params[i] = val
|
||||
}
|
||||
|
||||
results := modules.Servers.BatchPerformClassAction(s, "import-from-libvirt", params)
|
||||
printBatchResults(results, modules.Servers.GetColumns(s))
|
||||
@@ -1233,77 +1231,4 @@ func init() {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ServerSSHLoginOptions{}, "server-ssh", "Use SSH login a server", func(s *mcclient.ClientSession, opts *options.ServerSSHLoginOptions) error {
|
||||
srv, err := modules.Servers.Get(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
srvid, err := srv.GetString("id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
address := make([]string, 0)
|
||||
nics, err := srv.GetArray("nics")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, nic := range nics {
|
||||
if addr, err := nic.GetString("ip_addr"); err == nil {
|
||||
address = append(address, addr)
|
||||
}
|
||||
}
|
||||
if len(address) == 0 {
|
||||
return fmt.Errorf("Not found ip address from server %s", opts.ID)
|
||||
}
|
||||
|
||||
params := jsonutils.NewDict()
|
||||
if len(opts.Key) > 0 {
|
||||
privateKey, e := ioutil.ReadFile(opts.Key)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
params.Add(jsonutils.NewString(string(privateKey)), "private_key")
|
||||
}
|
||||
|
||||
i, e := modules.Servers.GetLoginInfo(s, srvid, params)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
passwd, err := i.GetString("password")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if opts.Password != "" {
|
||||
passwd = opts.Password
|
||||
}
|
||||
user, err := i.GetString("username")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if opts.User != "" {
|
||||
user = opts.User
|
||||
}
|
||||
|
||||
host := address[0]
|
||||
if opts.Host != "" {
|
||||
host = opts.Host
|
||||
}
|
||||
port := 22
|
||||
if opts.Port != 22 {
|
||||
port = opts.Port
|
||||
}
|
||||
|
||||
sshCli, err := ssh.NewClient(host, port, user, passwd, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Infof("ssh %s:%d", host, port)
|
||||
if err := sshCli.RunTerminal(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
@@ -46,9 +45,6 @@ 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 {
|
||||
@@ -68,9 +64,7 @@ func init() {
|
||||
return nil
|
||||
}
|
||||
|
||||
newQuery := url.Values(make(map[string][]string))
|
||||
newQuery.Set("data", base64.StdEncoding.EncodeToString([]byte(connParams)))
|
||||
u.RawQuery = newQuery.Encode()
|
||||
u.RawQuery = connParams
|
||||
fmt.Println(u.String())
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -84,11 +84,8 @@ func newClient(options *BaseOptions) (*ctyun.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := ctyun.NewSCtyunClient(
|
||||
ctyun.NewSCtyunClientConfig(
|
||||
options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
cli, err := ctyun.NewSCtyunClient("", "", "",
|
||||
options.AccessKey, options.Secret, options.Debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -88,14 +88,7 @@ func newClient(options *BaseOptions) (*esxi.SESXiClient, error) {
|
||||
return nil, fmt.Errorf("Missing password")
|
||||
}
|
||||
|
||||
return esxi.NewESXiClient2(
|
||||
esxi.NewESXiClientConfig(
|
||||
options.Host,
|
||||
options.Port,
|
||||
options.Account,
|
||||
options.Password,
|
||||
),
|
||||
)
|
||||
return esxi.NewESXiClient2("", "", options.Host, options.Port, options.Account, options.Password, false)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -94,14 +94,7 @@ func newClient(options *BaseOptions) (*google.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing ProjectID")
|
||||
}
|
||||
|
||||
cli, err := google.NewGoogleClient(
|
||||
google.NewGoogleClientConfig(
|
||||
options.ProjectID,
|
||||
options.ClientEmail,
|
||||
options.PrivateKeyID,
|
||||
options.PrivateKey,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
cli, err := google.NewGoogleClient("", "", options.ProjectID, options.ClientEmail, options.PrivateKeyID, options.PrivateKey, options.Debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -86,14 +86,9 @@ func newClient(options *BaseOptions) (*huawei.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := huawei.NewHuaweiClient(
|
||||
huawei.NewHuaweiClientConfig(
|
||||
options.CloudEnv,
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.ProjectId,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
cli, err := huawei.NewHuaweiClient("", "", options.CloudEnv,
|
||||
options.AccessKey, options.Secret, options.ProjectId,
|
||||
options.Debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -93,18 +93,7 @@ func newClient(options *BaseOptions) (*openstack.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Password")
|
||||
}
|
||||
|
||||
cli, err := openstack.NewOpenStackClient(
|
||||
openstack.NewOpenstackClientConfig(
|
||||
options.AuthURL,
|
||||
options.Username,
|
||||
options.Password,
|
||||
options.Project,
|
||||
options.ProjectDomain,
|
||||
).
|
||||
EndpointType(options.EndpointType).
|
||||
DomainName(options.DomainName).
|
||||
Debug(options.Debug),
|
||||
)
|
||||
cli, err := openstack.NewOpenStackClient("", "", options.AuthURL, options.Username, options.Password, options.Project, options.EndpointType, options.DomainName, options.ProjectDomain, options.Debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -85,12 +85,11 @@ func newClient(options *BaseOptions) (*qcloud.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing SecretID")
|
||||
}
|
||||
|
||||
if cli, err := qcloud.NewQcloudClient(
|
||||
qcloud.NewQcloudClientConfig(
|
||||
options.SecretID,
|
||||
options.SecretKey,
|
||||
).AppId(options.AppID).Debug(options.Debug),
|
||||
); err != nil {
|
||||
if cli, err := qcloud.NewQcloudClient("", "",
|
||||
options.SecretID,
|
||||
options.SecretKey,
|
||||
options.AppID,
|
||||
options.Debug); err != nil {
|
||||
return nil, err
|
||||
} else if region := cli.GetRegion(options.RegionId); region == nil {
|
||||
return nil, fmt.Errorf("No such region %s", options.RegionId)
|
||||
|
||||
@@ -94,23 +94,11 @@ func newClient(options *BaseOptions) (cloudprovider.ICloudRegion, error) {
|
||||
}
|
||||
|
||||
if options.Backend == api.CLOUD_PROVIDER_CEPH {
|
||||
return ceph.NewCephRados(
|
||||
objectstore.NewObjectStoreClientConfig(
|
||||
options.AccessUrl, options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
return ceph.NewCephRados("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
} else if options.Backend == api.CLOUD_PROVIDER_XSKY {
|
||||
return xsky.NewXskyClient(
|
||||
objectstore.NewObjectStoreClientConfig(
|
||||
options.AccessUrl, options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
return xsky.NewXskyClient("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
}
|
||||
return objectstore.NewObjectStoreClient(
|
||||
objectstore.NewObjectStoreClientConfig(
|
||||
options.AccessUrl, options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
return objectstore.NewObjectStoreClient("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -86,12 +86,11 @@ func newClient(options *BaseOptions) (*ucloud.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := ucloud.NewUcloudClient(
|
||||
ucloud.NewUcloudClientConfig(
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
).ProjectId(options.ProjectId).Debug(options.Debug),
|
||||
)
|
||||
cli, err := ucloud.NewUcloudClient("", "",
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.ProjectId,
|
||||
options.Debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -1,71 +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 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()
|
||||
}
|
||||
}
|
||||
@@ -89,13 +89,7 @@ func newClient(options *BaseOptions) (*zstack.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Password")
|
||||
}
|
||||
|
||||
cli, err := zstack.NewZStackClient(
|
||||
zstack.NewZstackClientConfig(
|
||||
options.AuthURL,
|
||||
options.Username,
|
||||
options.Password,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
cli, err := zstack.NewZStackClient("", "", options.AuthURL, options.Username, options.Password, options.Debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
90
go.mod
90
go.mod
@@ -3,10 +3,10 @@ module yunion.io/x/onecloud
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.38.0
|
||||
github.com/360EntSecGroup-Skylar/excelize v1.4.0
|
||||
github.com/Azure/azure-sdk-for-go v36.1.0+incompatible
|
||||
github.com/Azure/go-autorest/autorest v0.9.3
|
||||
github.com/Azure/go-autorest/autorest/azure/auth v0.4.2
|
||||
github.com/Azure/go-autorest v10.15.5+incompatible
|
||||
github.com/DataDog/dd-trace-go v0.6.1 // indirect
|
||||
github.com/DataDog/zstd v1.3.4 // indirect
|
||||
github.com/Microsoft/azure-vhd-utils v0.0.0-20181115010904-44cbada2ece3
|
||||
@@ -23,24 +23,28 @@ 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
|
||||
github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94
|
||||
github.com/coredns/coredns v1.3.0
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a // indirect
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20190806190131-db2462fef53b // indirect
|
||||
github.com/dimchansky/utfbom v1.1.0 // indirect
|
||||
github.com/dnaeon/go-vcr v1.0.1 // indirect
|
||||
github.com/dnstap/golang-dnstap v0.0.0-20170829151710-2cf77a2b5e11 // indirect
|
||||
github.com/edsrzf/mmap-go v1.0.0 // indirect
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
|
||||
github.com/farsightsec/golang-framestream v0.0.0-20181102145529-8a0cb8ba8710 // indirect
|
||||
github.com/fatih/color v1.7.0
|
||||
github.com/fernet/fernet-go v0.0.0-20180830025343-9eac43b88a5e
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.7
|
||||
github.com/ghodss/yaml v1.0.0
|
||||
github.com/gin-gonic/gin v1.5.0
|
||||
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 // indirect
|
||||
github.com/gin-gonic/gin v1.3.0
|
||||
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 // indirect
|
||||
github.com/go-logfmt/logfmt v0.4.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.2 // indirect
|
||||
@@ -53,12 +57,14 @@ require (
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
|
||||
github.com/golang/protobuf v1.3.2
|
||||
github.com/google/gopacket v1.1.17
|
||||
github.com/google/uuid v1.1.0 // indirect
|
||||
github.com/googleapis/gnostic v0.2.0 // indirect
|
||||
github.com/googollee/go-engine.io v0.0.0-20180829091931-e2f255711dcb // indirect
|
||||
github.com/googollee/go-socket.io v0.0.0-20181214084611-0ad7206c347a
|
||||
github.com/gorilla/mux v1.7.0
|
||||
github.com/gorilla/mux v1.6.2
|
||||
github.com/gorilla/websocket v1.4.0
|
||||
github.com/gosuri/uitable v0.0.0-20160404203958-36ee7e946282
|
||||
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f // indirect
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
|
||||
github.com/hako/durafmt v0.0.0-20180520121703-7b7ae1e72ead
|
||||
github.com/huandu/xstrings v1.2.0 // indirect
|
||||
@@ -67,7 +73,7 @@ require (
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.0.1 // indirect
|
||||
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c
|
||||
github.com/kr/pty v1.1.5
|
||||
github.com/kr/pty v1.1.3
|
||||
github.com/lib/pq v1.2.0 // indirect
|
||||
github.com/libvirt/libvirt-go-xml v5.2.0+incompatible
|
||||
github.com/mattn/go-runewidth v0.0.4 // indirect
|
||||
@@ -77,7 +83,7 @@ require (
|
||||
github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7
|
||||
github.com/mdlayher/raw v0.0.0-20190606144222-a54781e5f38f
|
||||
github.com/mholt/caddy v0.10.11
|
||||
github.com/miekg/dns v1.1.4
|
||||
github.com/miekg/dns v1.1.1
|
||||
github.com/minio/minio-go v6.0.14+incompatible
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||
github.com/moul/http2curl v1.0.0
|
||||
@@ -85,81 +91,59 @@ require (
|
||||
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 // indirect
|
||||
github.com/opentracing/opentracing-go v1.0.2 // indirect
|
||||
github.com/openzipkin/zipkin-go-opentracing v0.3.4 // indirect
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/pkg/term v0.0.0-20181116001808-27bbf2edb814 // indirect
|
||||
github.com/pquerna/otp v1.2.0
|
||||
github.com/satori/go.uuid v1.2.0 // indirect
|
||||
github.com/serialx/hashring v0.0.0-20180504054112-49a4782e9908
|
||||
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
|
||||
github.com/tencentcloud/tencentcloud-sdk-go v3.0.135+incompatible
|
||||
github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181108132626-805d01dd0e2e
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20191108095731-8ca4b370cde4
|
||||
github.com/tinylib/msgp v1.1.0 // indirect
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
|
||||
github.com/tredoe/osutil v0.0.0-20161130133508-7d3ee1afa71c
|
||||
github.com/ugorji/go v0.0.0-20161130061742-9c7f9b7a2bc3 // indirect
|
||||
github.com/vishvananda/netlink v1.0.0
|
||||
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df // indirect
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible
|
||||
github.com/vmware/govmomi v0.20.1
|
||||
github.com/vmware/govmomi v0.19.0
|
||||
go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738
|
||||
go.uber.org/atomic v1.4.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
|
||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc
|
||||
golang.org/x/net v0.0.0-20191007182048-72f939374954
|
||||
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.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
|
||||
google.golang.org/grpc v1.23.1
|
||||
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
|
||||
gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.44.0 // indirect
|
||||
gopkg.in/ldap.v3 v3.0.3
|
||||
gopkg.in/yaml.v2 v2.2.8
|
||||
k8s.io/api v0.17.3
|
||||
k8s.io/apimachinery v0.17.3
|
||||
gopkg.in/yaml.v2 v2.2.2
|
||||
k8s.io/api v0.0.0-20181004124137-fd83cbc87e76
|
||||
k8s.io/apimachinery v0.0.0-20181215012845-4d029f033399
|
||||
k8s.io/client-go v9.0.0+incompatible
|
||||
k8s.io/cluster-bootstrap v0.17.3
|
||||
k8s.io/kubernetes v1.16.0
|
||||
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-20200415132054-2bf8a5e94501
|
||||
yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3
|
||||
yunion.io/x/pkg v0.0.0-20200516092703-0a53bc9270aa
|
||||
yunion.io/x/jsonutils v0.0.0-20200303051356-aa609aba0cda
|
||||
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d
|
||||
yunion.io/x/pkg v0.0.0-20200304112442-9dae9351325e
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57
|
||||
yunion.io/x/structarg v0.0.0-20200423163001-168d0687be7e
|
||||
yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3
|
||||
)
|
||||
|
||||
replace (
|
||||
github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94 => github.com/yunionio/go-ceph v0.0.0-20190912101231-6f05a06b3859
|
||||
|
||||
k8s.io/api => k8s.io/api v0.0.0-20190918155943-95b840bb6a1f
|
||||
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655
|
||||
k8s.io/apiserver => k8s.io/apiserver v0.0.0-20190918160949-bfa5e2e684ad
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20190918162238-f783a3654da8
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90
|
||||
k8s.io/cloud-provider => k8s.io/cloud-provider v0.0.0-20190918163234-a9c1f33e9fb9
|
||||
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.0.0-20190918163108-da9fdfce26bb
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20190912054826-cd179ad6a269
|
||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20190918160511-547f6c5d7090
|
||||
k8s.io/cri-api => k8s.io/cri-api v0.0.0-20190828162817-608eb1dad4ac
|
||||
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.0.0-20190918163402-db86a8c7bb21
|
||||
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.0.0-20190918161219-8c8f079fddc3
|
||||
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.0.0-20190918162944-7a93a0ddadd8
|
||||
k8s.io/kube-proxy => k8s.io/kube-proxy v0.0.0-20190918162534-de037b596c1e
|
||||
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.0.0-20190918162820-3b5c1246eb18
|
||||
k8s.io/kubectl => k8s.io/kubectl v0.0.0-20190918164019-21692a0861df
|
||||
k8s.io/kubelet => k8s.io/kubelet v0.0.0-20190918162654-250a1838aa2c
|
||||
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.0.0-20190918163543-cfa506e53441
|
||||
k8s.io/metrics => k8s.io/metrics v0.0.0-20190918162108-227c654b2546
|
||||
k8s.io/node-api => k8s.io/node-api v0.0.0-20190918163711-2299658ad911
|
||||
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.0.0-20190918161442-d4c9c65c82af
|
||||
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.0.0-20190918162410-e45c26d066f2
|
||||
k8s.io/sample-controller => k8s.io/sample-controller v0.0.0-20190918161628-92eb3cb7496c
|
||||
)
|
||||
replace github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94 => github.com/yunionio/go-ceph v0.0.0-20190912101231-6f05a06b3859
|
||||
|
||||
@@ -29,7 +29,6 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/apigateway/constants"
|
||||
"yunion.io/x/onecloud/pkg/apigateway/options"
|
||||
policytool "yunion.io/x/onecloud/pkg/apigateway/policy"
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/appctx"
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/policy"
|
||||
@@ -361,7 +360,7 @@ func isUserAllowWebconsole(ctx context.Context, w http.ResponseWriter, req *http
|
||||
return false
|
||||
}
|
||||
if !jsonutils.QueryBoolean(usr, "allow_web_console", true) {
|
||||
httperrors.ForbiddenError(w, "user forbidden login from web")
|
||||
httperrors.ForbiddenError(w, "forbidden user %q login from web", usr.String())
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -570,7 +569,6 @@ func (this *projectRoles) add(roleId, roleName string) {
|
||||
|
||||
func (this *projectRoles) getToken(scope rbacutils.TRbacScope, user, userId, domain, domainId string, ip string) mcclient.TokenCredential {
|
||||
return &mcclient.SSimpleToken{
|
||||
Token: "faketoken",
|
||||
Domain: domain,
|
||||
DomainId: domainId,
|
||||
User: user,
|
||||
@@ -610,12 +608,12 @@ func (this *projectRoles) json(user, userId, domain, domainId string, ip string)
|
||||
}
|
||||
obj.Add(roles, "roles")
|
||||
for _, scope := range []rbacutils.TRbacScope{
|
||||
rbacutils.ScopeProject,
|
||||
rbacutils.ScopeDomain,
|
||||
rbacutils.ScopeSystem,
|
||||
rbacutils.ScopeDomain,
|
||||
rbacutils.ScopeProject,
|
||||
} {
|
||||
token := this.getToken(scope, user, userId, domain, domainId, ip)
|
||||
matches := policy.PolicyManager.MatchedPolicyNames(scope, token)
|
||||
matches := policy.PolicyManager.MatchedPolicies(scope, token)
|
||||
obj.Add(jsonutils.NewStringArray(matches), fmt.Sprintf("%s_policies", scope))
|
||||
if len(matches) > 0 {
|
||||
obj.Add(jsonutils.JSONTrue, fmt.Sprintf("%s_capable", scope))
|
||||
@@ -648,11 +646,8 @@ func getUserAuthCookie(ctx context.Context, s *mcclient.ClientSession, token mcc
|
||||
}
|
||||
|
||||
func getLBAgentInfo(s *mcclient.ClientSession, token mcclient.TokenCredential) (*jsonutils.JSONDict, error) {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("hb_last_seen.isnotempty()"), "filter.0")
|
||||
params.Add(jsonutils.NewInt(1), "limit")
|
||||
params.Add(jsonutils.JSONFalse, "details")
|
||||
lbagents, err := modules.LoadbalancerAgents.List(s, params)
|
||||
|
||||
lbagents, err := modules.LoadbalancerAgents.List(s, nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "user %s get lbagent", token.GetUserName())
|
||||
}
|
||||
@@ -670,7 +665,6 @@ func getLBAgentInfo(s *mcclient.ClientSession, token mcclient.TokenCredential) (
|
||||
}
|
||||
|
||||
func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.TokenCredential, req *http.Request) (*jsonutils.JSONDict, error) {
|
||||
log.Infof("getUserInfo modules.UsersV3.Get")
|
||||
usr, err := modules.UsersV3.Get(s, token.GetUserId(), nil)
|
||||
if err != nil {
|
||||
log.Errorf("modules.UsersV3.Get fail %s", err)
|
||||
@@ -699,7 +693,6 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
data.Add(jsonutils.NewString(token.GetProjectDomain()), "projectDomain")
|
||||
data.Add(jsonutils.NewString(token.GetProjectDomainId()), "projectDomainId")
|
||||
|
||||
log.Infof("getUserInfo modules.RoleAssignments.List")
|
||||
query := jsonutils.NewDict()
|
||||
query.Add(jsonutils.JSONNull, "effective")
|
||||
query.Add(jsonutils.JSONNull, "include_names")
|
||||
@@ -742,7 +735,7 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
rbacutils.ScopeDomain,
|
||||
rbacutils.ScopeProject,
|
||||
} {
|
||||
p := policy.PolicyManager.MatchedPolicyNames(scope, token)
|
||||
p := policy.PolicyManager.MatchedPolicies(scope, token)
|
||||
data.Add(jsonutils.NewStringArray(p), fmt.Sprintf("%s_policies", scope))
|
||||
if scope == rbacutils.ScopeSystem {
|
||||
data.Add(jsonutils.NewStringArray(p), "admin_policies")
|
||||
@@ -779,7 +772,6 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
log.Errorf("fail to find services????: %#v %s", adminToken, curReg)
|
||||
}
|
||||
|
||||
log.Infof("getUserInfo getLBAgentInfo")
|
||||
lb, err := getLBAgentInfo(s, adminToken)
|
||||
if err != nil {
|
||||
log.Errorf("getLBAgentInfo fail %s", err)
|
||||
@@ -796,23 +788,13 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
}
|
||||
}
|
||||
|
||||
log.Infof("getUserInfo modules.Hosts.Get")
|
||||
s2 := auth.GetSession(ctx, token, FetchRegion(req), "v2")
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("host_type"), "field")
|
||||
params.Add(jsonutils.NewString("system"), "scope")
|
||||
params.Add(jsonutils.JSONTrue, "usable")
|
||||
params.Add(jsonutils.JSONTrue, "show_emulated")
|
||||
cap, err := modules.Hosts.Get(s2, "distinct-field", params)
|
||||
cap, err := modules.Capabilities.List(s2, nil)
|
||||
if err != nil {
|
||||
log.Errorf("modules.Servers.Get distinct-field fail %s", err)
|
||||
log.Errorf("modules.Capabilities.List fail %s", err)
|
||||
} else {
|
||||
hostTypes, _ := jsonutils.GetStringArray(cap, "host_type")
|
||||
hypervisors := make([]string, len(hostTypes))
|
||||
for i, hostType := range hostTypes {
|
||||
hypervisors[i] = compute.HOSTTYPE_HYPERVISOR[hostType]
|
||||
}
|
||||
data.Add(jsonutils.NewStringArray(hypervisors), "hypervisors")
|
||||
hypervisors, _ := cap.Data[0].Get("hypervisors")
|
||||
data.Add(hypervisors, "hypervisors")
|
||||
}
|
||||
|
||||
data.Add(menus, "menus")
|
||||
|
||||
@@ -1,19 +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 handler
|
||||
|
||||
import (
|
||||
_ "yunion.io/x/onecloud/pkg/mcclient/modules/cloudnet"
|
||||
)
|
||||
@@ -28,7 +28,6 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apigateway/options"
|
||||
"yunion.io/x/onecloud/pkg/appctx"
|
||||
@@ -38,7 +37,6 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient/auth"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/util/httputils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -173,23 +171,19 @@ func (mh *MiscHandler) DoBatchHostRegister(ctx context.Context, w http.ResponseW
|
||||
}
|
||||
|
||||
paramKeys := []string{}
|
||||
i1 := -1
|
||||
i2 := -1
|
||||
for i, title := range rows[0] {
|
||||
for _, title := range rows[0] {
|
||||
switch title {
|
||||
case HOST_MAC:
|
||||
paramKeys = append(paramKeys, "access_mac")
|
||||
case HOST_NAME:
|
||||
paramKeys = append(paramKeys, "name")
|
||||
case HOST_IPMI_ADDR, HOST_IPMI_ADDR_OPTIONAL:
|
||||
i1 = i
|
||||
paramKeys = append(paramKeys, "ipmi_ip_addr")
|
||||
case HOST_IPMI_USERNAME, HOST_IPMI_USERNAME_OPTIONAL:
|
||||
paramKeys = append(paramKeys, "ipmi_username")
|
||||
case HOST_IPMI_PASSWORD, HOST_IPMI_PASSWORD_OPTIONAL:
|
||||
paramKeys = append(paramKeys, "ipmi_password")
|
||||
case HOST_MNG_IP_ADDR, HOST_MNG_IP_ADDR_OPTIONAL:
|
||||
i2 = i
|
||||
paramKeys = append(paramKeys, "access_ip")
|
||||
default:
|
||||
e := httperrors.NewInternalServerError("empty file content")
|
||||
@@ -205,33 +199,8 @@ func (mh *MiscHandler) DoBatchHostRegister(ctx context.Context, w http.ResponseW
|
||||
return
|
||||
}
|
||||
|
||||
ips := []string{}
|
||||
hosts := bytes.Buffer{}
|
||||
for _, row := range rows[1:] {
|
||||
var e *httputils.JSONClientError
|
||||
if i1 >= 0 && len(row[i1]) > 0 {
|
||||
i1Ip := fmt.Sprintf("%d-%s", i1, row[i1])
|
||||
if utils.IsInStringArray(i1Ip, ips) {
|
||||
e = httperrors.NewDuplicateIdError("ip", row[i1])
|
||||
} else {
|
||||
ips = append(ips, i1Ip)
|
||||
}
|
||||
}
|
||||
|
||||
if i2 >= 0 && len(row[i2]) > 0 {
|
||||
i2Ip := fmt.Sprintf("%d-%s", i2, row[i2])
|
||||
if utils.IsInStringArray(i2Ip, ips) {
|
||||
e = httperrors.NewDuplicateIdError("ip", row[i2])
|
||||
} else {
|
||||
ips = append(ips, i2Ip)
|
||||
}
|
||||
}
|
||||
|
||||
if e != nil {
|
||||
httperrors.JsonClientError(w, e)
|
||||
return
|
||||
}
|
||||
|
||||
hosts.WriteString(strings.Join(row, ",") + "\n")
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ func (f *ResourceHandlers) listHandler(ctx context.Context, w http.ResponseWrite
|
||||
}
|
||||
}
|
||||
|
||||
func (f *ResourceHandlers) doList(session *mcclient.ClientSession, module modulebase.IBaseManager, query jsonutils.JSONObject, w http.ResponseWriter, r *http.Request) {
|
||||
func (f *ResourceHandlers) doList(session *mcclient.ClientSession, module modulebase.BaseManagerInterface, query jsonutils.JSONObject, w http.ResponseWriter, r *http.Request) {
|
||||
var exportKeys []string
|
||||
var exportTexts []string
|
||||
exportFormat, _ := query.GetString("export")
|
||||
@@ -606,45 +606,28 @@ func (f *ResourceHandlers) patchJointHandler(ctx context.Context, w http.Respons
|
||||
}
|
||||
}
|
||||
|
||||
// * batch update Joint
|
||||
// * put specific
|
||||
// /<resname>/<resid>/<resname2>
|
||||
// /<resname>/<resid>/<spec>
|
||||
// batch update Joint
|
||||
func (f *ResourceHandlers) batchUpdateJointHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) {
|
||||
req := newRequest(ctx, w, r).WithMod1()
|
||||
req := newRequest(ctx, w, r).WithMod1().WithMod2()
|
||||
if err := req.Error(); err != nil {
|
||||
httperrors.GeneralServerError(w, err)
|
||||
return
|
||||
}
|
||||
session := req.Session()
|
||||
module := req.Mod1()
|
||||
module2 := req.Mod2()
|
||||
body := req.Body()
|
||||
query := req.Query()
|
||||
|
||||
if idlist, _ := query.GetArray("id"); len(idlist) == 0 {
|
||||
// do put specific
|
||||
spec := req.ResName2()
|
||||
obj, e := module.PutSpecific(session, req.ResID(), spec, query, body)
|
||||
if e != nil {
|
||||
httperrors.GeneralServerError(w, e)
|
||||
} else {
|
||||
appsrv.SendJSON(w, obj)
|
||||
}
|
||||
idlist := fetchIdList(query, w)
|
||||
if idlist == nil {
|
||||
return
|
||||
}
|
||||
|
||||
req = req.WithMod2()
|
||||
if err := req.Error(); err != nil {
|
||||
httperrors.GeneralServerError(w, err)
|
||||
return
|
||||
}
|
||||
module2 := req.Mod2()
|
||||
jmod, e := modulebase.GetJointModule2(session, module, module2)
|
||||
if e != nil { // update joint
|
||||
httperrors.GeneralServerError(w, e)
|
||||
return
|
||||
}
|
||||
idlist := fetchIdList(query, w)
|
||||
ret := jmod.BatchUpdate(session, req.ResID(), idlist, query, body)
|
||||
w.WriteHeader(207)
|
||||
appsrv.SendJSON(w, modulebase.SubmitResults2JSON(ret))
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
package proxy // import "yunion.io/x/onecloud/pkg/apis/cloudcommon/proxy"
|
||||
@@ -1,55 +0,0 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
ProxySettingId_DIRECT = "DIRECT"
|
||||
)
|
||||
|
||||
type ProxySettingCreateInput struct {
|
||||
apis.StandaloneResourceCreateInput
|
||||
|
||||
ProxySetting
|
||||
}
|
||||
|
||||
type ProxySettingUpdateInput struct {
|
||||
// 资源名称
|
||||
Name string `json:"name"`
|
||||
// 资源描述
|
||||
Description string `json:"description"`
|
||||
|
||||
ProxySetting
|
||||
}
|
||||
|
||||
// String implements ISerializable interface
|
||||
func (ps *SProxySetting) String() string {
|
||||
return jsonutils.Marshal(ps).String()
|
||||
}
|
||||
|
||||
// IsZero implements ISerializable interface
|
||||
func (ps *SProxySetting) IsZero() bool {
|
||||
if ps.HTTPProxy == "" &&
|
||||
ps.HTTPSProxy == "" &&
|
||||
ps.NoProxy == "" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ProxySettingResourceInput struct {
|
||||
// 代理配置
|
||||
ProxySetting string `json:"proxy_setting"`
|
||||
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
ProxySettingId string `json:"proxy_setting_id" "yunion:deprecated-by":"proxy_setting"`
|
||||
}
|
||||
|
||||
type ProxySettingTestInput struct {
|
||||
HttpProxy string
|
||||
HttpsProxy string
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/pkg/errors"
|
||||
)
|
||||
|
||||
type ProxySetting struct {
|
||||
HttpProxy string
|
||||
HttpsProxy string
|
||||
NoProxy string
|
||||
}
|
||||
|
||||
func (v *ProxySetting) Sanitize() error {
|
||||
v.HttpProxy = strings.TrimSpace(v.HttpProxy)
|
||||
if u, err := parseProxy(v.HttpProxy); err != nil {
|
||||
return errors.Wrap(err, "invalid https_proxy url")
|
||||
} else if u != nil {
|
||||
v.HttpProxy = u.String()
|
||||
}
|
||||
|
||||
v.HttpsProxy = strings.TrimSpace(v.HttpsProxy)
|
||||
if u, err := parseProxy(v.HttpsProxy); err != nil {
|
||||
return errors.Wrap(err, "invalid http_proxy url")
|
||||
} else if u != nil {
|
||||
v.HttpsProxy = u.String()
|
||||
}
|
||||
|
||||
if noProxy, err := parseNoProxy(v.NoProxy); err == nil {
|
||||
v.NoProxy = strings.Join(noProxy, ",")
|
||||
} else {
|
||||
return errors.Wrap(err, "invalid no_proxy")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseProxy(proxy string) (*url.URL, error) {
|
||||
if proxy == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
proxyURL, err := url.Parse(proxy)
|
||||
if err != nil ||
|
||||
(proxyURL.Scheme != "http" &&
|
||||
proxyURL.Scheme != "https" &&
|
||||
proxyURL.Scheme != "socks5") {
|
||||
// proxy was bogus. Try prepending "http://" to it and
|
||||
// see if that parses correctly. If not, we fall
|
||||
// through and complain about the original one.
|
||||
if proxyURL, err := url.Parse("http://" + proxy); err == nil {
|
||||
return proxyURL, nil
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "invalid proxy address %q", proxy)
|
||||
}
|
||||
return proxyURL, nil
|
||||
}
|
||||
|
||||
func parseNoProxy(noProxy string) ([]string, error) {
|
||||
var r []string
|
||||
for _, p := range strings.Split(noProxy, ",") {
|
||||
p = strings.ToLower(strings.TrimSpace(p))
|
||||
if len(p) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
if p == "*" {
|
||||
r = append(r, p)
|
||||
// let it go
|
||||
//return r, nil
|
||||
}
|
||||
|
||||
// IPv4/CIDR, IPv6/CIDR
|
||||
if _, _, err := net.ParseCIDR(p); err == nil {
|
||||
r = append(r, p)
|
||||
continue
|
||||
}
|
||||
|
||||
// IPv4:port, [IPv6]:port
|
||||
phost, _, err := net.SplitHostPort(p)
|
||||
if err == nil {
|
||||
if len(phost) == 0 {
|
||||
// There is no host part, likely the entry is malformed; ignore.
|
||||
return nil, fmt.Errorf("host part must not be empty: %s", p)
|
||||
}
|
||||
if phost[0] == '[' && phost[len(phost)-1] == ']' {
|
||||
phost = phost[1 : len(phost)-1]
|
||||
}
|
||||
} else {
|
||||
phost = p
|
||||
}
|
||||
// IPv4, IPv6
|
||||
if pip := net.ParseIP(phost); pip != nil {
|
||||
r = append(r, p)
|
||||
continue
|
||||
}
|
||||
|
||||
if len(phost) == 0 {
|
||||
// There is no host part, likely the entry is malformed; ignore.
|
||||
continue
|
||||
}
|
||||
|
||||
r = append(r, p)
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
// 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.
|
||||
|
||||
// Code generated by model-api-gen. DO NOT EDIT.
|
||||
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
// SProxySetting is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudcommon/db/proxy.SProxySetting.
|
||||
type SProxySetting struct {
|
||||
apis.SStandaloneResourceBase
|
||||
HTTPProxy string `json:"http_proxy"`
|
||||
HTTPSProxy string `json:"https_proxy"`
|
||||
NoProxy string `json:"no_proxy"`
|
||||
}
|
||||
@@ -21,59 +21,18 @@ import (
|
||||
)
|
||||
|
||||
type CloudeventListInput struct {
|
||||
apis.ModelBaseListInput
|
||||
apis.BaseListInput
|
||||
|
||||
// 列出指定云平台的资源,支持的云平台如下
|
||||
//
|
||||
// | 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" "yunion:deprecated-by":"providers"`
|
||||
|
||||
// 列出指定云平台品牌的资源,一般来说brand和provider相同,除了以上支持的provider之外,还支持以下band
|
||||
//
|
||||
// | Brand | Provider | 说明 |
|
||||
// |----------|----------|------------|
|
||||
// | DStack | ZStack | 滴滴云私有云 |
|
||||
//
|
||||
// 根据品牌过滤
|
||||
Brands []string `json:"brands"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Brand []string `json:"brand" "yunion:deprecated-by":"brands"`
|
||||
Brand []string `json:"brand" deprecated-by:"brands"`
|
||||
|
||||
// 服务类型
|
||||
Service []string `json:"service"`
|
||||
|
||||
// 订阅
|
||||
Manager []string `json:"manager"`
|
||||
|
||||
// 账号
|
||||
Account []string `json:"account"`
|
||||
|
||||
// 操作类型
|
||||
Action []string `json:"action"`
|
||||
|
||||
// 操作日志起始时间
|
||||
// 操作日志起始日期
|
||||
Since time.Time `json:"since"`
|
||||
// 操作日志截止时间
|
||||
// 操作日志截止日期
|
||||
Until time.Time `json:"until"`
|
||||
}
|
||||
|
||||
@@ -16,16 +16,8 @@ package cloudprovider
|
||||
|
||||
// SGeographicInfo is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudprovider.SGeographicInfo.
|
||||
type SGeographicInfo struct {
|
||||
// 纬度
|
||||
// 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"`
|
||||
Latitude float32 `json:"latitude"`
|
||||
Longitude float32 `json:"longitude"`
|
||||
City string `json:"city"`
|
||||
CountryCode string `json:"country_code"`
|
||||
}
|
||||
|
||||
@@ -31,36 +31,14 @@ type SchedtagConfig struct {
|
||||
type NetworkConfig struct {
|
||||
apis.Meta
|
||||
|
||||
// 网卡序号, 从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
|
||||
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"`
|
||||
Address6 string `json:"address6"`
|
||||
|
||||
// 驱动方式
|
||||
// 若指定镜像的网络驱动方式,此参数会被覆盖
|
||||
Driver string `json:"driver"`
|
||||
BwLimit int `json:"bw_limit"`
|
||||
Vip bool `json:"vip"`
|
||||
@@ -75,132 +53,33 @@ type NetworkConfig struct {
|
||||
StandbyPortCount int `json:"standby_port_count"`
|
||||
StandbyAddrCount int `json:"standby_addr_count"`
|
||||
|
||||
// swagger:ignore
|
||||
Project string `json:"project_id"`
|
||||
|
||||
// swagger:ignore
|
||||
Project string `json:"project_id"`
|
||||
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
|
||||
|
||||
// 挂载到虚拟机的磁盘顺序, -1代表不挂载任何虚拟机
|
||||
// default: -1
|
||||
Index int `json:"index"`
|
||||
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"`
|
||||
|
||||
// 镜像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
|
||||
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"`
|
||||
ImageProperties map[string]string `json:"image_properties"`
|
||||
|
||||
//存储ID, 指定存储后,磁盘会在此存储上创建
|
||||
//存储列表可以参数 storage 列表API
|
||||
//required: false
|
||||
Storage string `json:"storage_id"`
|
||||
|
||||
//swagger:ignore
|
||||
DiskId string `json:"disk_id"`
|
||||
DiskId string `json:"disk_id"`
|
||||
}
|
||||
|
||||
type IsolatedDeviceConfig struct {
|
||||
@@ -231,92 +110,26 @@ type BaremetalDiskConfig struct {
|
||||
}
|
||||
|
||||
type ServerConfigs struct {
|
||||
// 调度使用指定的云账号
|
||||
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生效
|
||||
// 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"`
|
||||
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"`
|
||||
|
||||
// 包年包月资源池
|
||||
// swagger:ignore
|
||||
// emum: shared, prepaid, dedicated
|
||||
// ResourceType "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"`
|
||||
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// alias for InstanceType
|
||||
Sku string `json:"sku" "yunion:deprecated-by":"instance_type"`
|
||||
Disks []*DiskConfig `json:"disks"`
|
||||
Networks []*NetworkConfig `json:"nets"`
|
||||
Schedtags []*SchedtagConfig `json:"schedtags"`
|
||||
IsolatedDevices []*IsolatedDeviceConfig `json:"isolated_devices"`
|
||||
BaremetalDiskConfigs []*BaremetalDiskConfig `json:"baremetal_disk_configs"`
|
||||
|
||||
// 虚拟机高可用(创建备机)
|
||||
// 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
|
||||
@@ -346,150 +159,53 @@ type ServerCreateInput struct {
|
||||
|
||||
*ServerConfigs
|
||||
|
||||
// 虚拟机内存大小,单位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"`
|
||||
|
||||
// Deprecated
|
||||
// swagger:ignore
|
||||
KeypairId string `json:"keypair_id" "yunion:deprecated-by":"keypair"`
|
||||
|
||||
// 秘钥对Id
|
||||
// required: false
|
||||
Keypair string `json:"keypair"`
|
||||
|
||||
// 密码
|
||||
// 要求: 密码长度 >= 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"`
|
||||
VmemSize int `json:"vmem_size"`
|
||||
VcpuCount int `json:"vcpu_count"`
|
||||
UserData string `json:"user_data"`
|
||||
Metadata map[string]string `json:"__meta__"`
|
||||
|
||||
// swagger:ignore
|
||||
AutoPrepaidRecycle bool `json:"auto_prepaid_recycle,omitfalse"`
|
||||
Keypair string `json:"keypair" deprecated-by:"keypair_id"`
|
||||
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"`
|
||||
|
||||
// 弹性公网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"`
|
||||
|
||||
// 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
|
||||
// DEPRECATE or not used fields
|
||||
Baremetal bool `json:"baremetal"`
|
||||
|
||||
// Used to store BaremetalConvertHypervisorTaskId
|
||||
ParentTaskId string `json:"__parent_task_id,omitempty"`
|
||||
|
||||
// 指定系统盘默认存储类型, 如果指定宿主机
|
||||
// swagger:ignore
|
||||
// default stroage type if host is given
|
||||
DefaultStorageType string `json:"default_storage_type,omitempty"`
|
||||
|
||||
// 指定用于新建主机的主机镜像ID
|
||||
GuestImageID string `json:"guest_image_id"`
|
||||
}
|
||||
|
||||
func (input *ServerCreateInput) AfterUnmarshal() {
|
||||
if input.Baremetal {
|
||||
input.Hypervisor = HYPERVISOR_BAREMETAL
|
||||
}
|
||||
// Guest Image ID
|
||||
GuestImageID string
|
||||
}
|
||||
|
||||
type ServerCloneInput struct {
|
||||
|
||||
@@ -49,13 +49,10 @@ type BucketCreateInput struct {
|
||||
StorageClass string `json:"storage_class"`
|
||||
}
|
||||
|
||||
type BucketDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
type BucketDetail struct {
|
||||
apis.Meta
|
||||
SBucket
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
AccessUrls []cloudprovider.SBucketAccessUrl `json:"access_urls"`
|
||||
CloudproviderDetails
|
||||
}
|
||||
|
||||
type BucketObjectsActionInput struct {
|
||||
@@ -93,9 +90,3 @@ func (input *BucketMetadataInput) Validate() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type BucketListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
}
|
||||
|
||||
@@ -1,55 +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 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"`
|
||||
}
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
proxyapi "yunion.io/x/onecloud/pkg/apis/cloudcommon/proxy"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
)
|
||||
@@ -27,60 +26,17 @@ import (
|
||||
type CloudaccountCreateInput struct {
|
||||
apis.EnabledStatusStandaloneResourceCreateInput
|
||||
|
||||
// 指定云平台
|
||||
// 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"`
|
||||
|
||||
proxyapi.ProxySettingResourceInput
|
||||
Provider string
|
||||
AccountId string
|
||||
Brand string
|
||||
IsPublicCloud bool
|
||||
IsOnPremise bool
|
||||
Tenant string
|
||||
TenantId string
|
||||
EnableAutoSync bool
|
||||
SyncIntervalSeconds int
|
||||
AutoCreateProject bool
|
||||
Options *jsonutils.JSONObject
|
||||
|
||||
cloudprovider.SCloudaccount
|
||||
cloudprovider.SCloudaccountCredential
|
||||
@@ -101,85 +57,3 @@ 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"`
|
||||
|
||||
ProxySetting proxyapi.SProxySetting `json:"proxy_setting"`
|
||||
}
|
||||
|
||||
@@ -14,274 +14,85 @@
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
proxyapi "yunion.io/x/onecloud/pkg/apis/cloudcommon/proxy"
|
||||
"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"`
|
||||
|
||||
// 子订阅所在域名称
|
||||
// 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"`
|
||||
// 区域外部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 CloudproviderDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SCloudprovider
|
||||
|
||||
ProxySetting proxyapi.SProxySetting `json:"proxy_setting"`
|
||||
|
||||
// 云账号名称
|
||||
// example: google-account
|
||||
Cloudaccount string `json:"cloudaccount"`
|
||||
// 子订阅同步状态
|
||||
SyncStatus2 string `json:"sync_status2"`
|
||||
// 支持服务列表
|
||||
Capabilities []string `json:"capabilities"`
|
||||
|
||||
// 云主机数量
|
||||
// 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"`
|
||||
|
||||
// 子订阅品牌信息
|
||||
Brand string `json:"brand"`
|
||||
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"`
|
||||
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"`
|
||||
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"`
|
||||
}
|
||||
|
||||
type ManagedResourceListInput struct {
|
||||
// 列出关联指定云订阅(ID或Name)的资源
|
||||
Cloudprovider string `json:"cloudprovider"`
|
||||
type CloudaccountListInput struct {
|
||||
// List objects belonging to the cloud provider
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
Manager string `json:"manager" "yunion:deprecated-by":"cloudprovider"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
ManagerId string `json:"manager_id" "yunion:deprecated-by":"cloudprovider"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudproviderId string `json:"cloudprovider_id" "yunion:deprecated-by":"cloudprovider"`
|
||||
Cloudprovider string `json:"cloudprovider"`
|
||||
|
||||
// 列出关联指定云账号(ID或Name)的资源
|
||||
// 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
|
||||
Cloudaccount string `json:"cloudaccount"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
CloudaccountId string `json:"cloudaccount_id" "yunion:deprecated-by":"cloudaccount"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
CloudaccountId string `json:"cloudaccount_id"`
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
Account string `json:"account" "yunion:deprecated-by":"cloudaccount"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Account string `json:"account"`
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
AccountId string `json:"account_id" "yunion:deprecated-by":"cloudaccount"`
|
||||
AccountId string `json:"account_id"`
|
||||
|
||||
// 列出指定云平台的资源,支持的云平台如下
|
||||
//
|
||||
// | 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" "yunion:deprecated-by":"providers"`
|
||||
// List objects from the providers, choices:"OneCloud|VMware|Aliyun|Qcloud|Azure|Aws|Huawei|OpenStack|Ucloud|ZStack|Google"
|
||||
Providers []string `json:"provider"`
|
||||
|
||||
// 列出指定云平台品牌的资源,一般来说brand和provider相同,除了以上支持的provider之外,还支持以下band
|
||||
//
|
||||
// | Brand | Provider | 说明 |
|
||||
// |----------|----------|------------|
|
||||
// | DStack | ZStack | 滴滴云私有云 |
|
||||
//
|
||||
Brands []string `json:"brands"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
Brand []string `json:"brand" "yunion:deprecated-by":"brands"`
|
||||
// List objects belonging to brands
|
||||
Brands []string `json:"brand"`
|
||||
}
|
||||
|
||||
// 列出指定云环境的资源,支持云环境如下:
|
||||
//
|
||||
// | CloudEnv | 说明 |
|
||||
// |-----------|--------|
|
||||
// | public | 公有云 |
|
||||
// | private | 私有云 |
|
||||
// | onpremise | 本地IDC |
|
||||
//
|
||||
// enum: public,private,onpremise
|
||||
type CloudTypeListInput struct {
|
||||
// enum: public_cloud,private_cloud,on_premise
|
||||
CloudEnv string `json:"cloud_env"`
|
||||
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
PublicCloud bool `json:"public_cloud"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
IsPublic bool `json:"is_public"`
|
||||
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
PrivateCloud bool `json:"private_cloud"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
IsPrivate bool `json:"is_private"`
|
||||
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// deprecate:true
|
||||
// description: this param will be deprecate at 3.0
|
||||
IsOnPremise bool `json:"is_on_premise"`
|
||||
|
||||
// 过滤资源,是否为非OneCloud内置私有云管理的资源
|
||||
// List objects managed by external providers
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +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 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"`
|
||||
}
|
||||
@@ -1,56 +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 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"`
|
||||
}
|
||||
@@ -51,12 +51,11 @@ const (
|
||||
CITY_FU_ZHOU = "Fuzhou" //福州
|
||||
CITY_WU_HAN = "Wuhan" //武汉
|
||||
CITY_CHANG_SHA = "Changsha" //长沙
|
||||
CITY_SU_ZHOU = "Suzhou" //苏州
|
||||
CITY_SHU_ZHOU = "Shuzhou" //苏州
|
||||
CITY_BAO_DING = "Baoding" //保定
|
||||
CITY_NAN_JING = "Nanjing" //南京
|
||||
CITY_FO_SHAN = "Foshan" //佛山
|
||||
CITY_QUAN_ZHOU = "Quanzhou" //泉州
|
||||
CITY_NEI_MENG_GU = "Neimenggu" //内蒙古
|
||||
|
||||
// 日本
|
||||
CITY_TOKYO = "Tokyo" //东京
|
||||
@@ -112,7 +111,6 @@ const (
|
||||
CITY_US_GOV_WEST = "us-gov-west" //???
|
||||
CITY_SOUTH_CAROLINA = "South Carolina" //南卡罗来纳州
|
||||
CITY_SALT_LAKE_CITY = "Salt Lake City" //盐湖城
|
||||
CITY_LAS_VEGAS = "Las Vegas" //拉斯维加斯
|
||||
|
||||
// 英国
|
||||
CITY_LONDON = "London" //伦敦
|
||||
@@ -151,12 +149,6 @@ const (
|
||||
// 巴西
|
||||
CITY_SAO_PAULO = "Sao Paulo" //圣保罗
|
||||
|
||||
// 智利
|
||||
CITY_SANTIAGO = "Santiago" // 圣地亚哥
|
||||
|
||||
// 墨西哥
|
||||
CITY_MEXICO = "Mexico" // 墨西哥
|
||||
|
||||
// 荷兰
|
||||
CITY_HOLLAND = "Holland" //荷兰
|
||||
|
||||
@@ -202,6 +194,4 @@ const (
|
||||
COUNTRY_CODE_VN = "VN" //越南
|
||||
COUNTRY_CODE_CH = "CH" //瑞士
|
||||
COUNTRY_CODE_NO = "NO" //挪威
|
||||
COUNTRY_CODE_MX = "MX" //墨西哥
|
||||
COUNTRY_CODE_CL = "CL" //智利
|
||||
)
|
||||
|
||||
@@ -16,131 +16,38 @@ package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type DBInstanceCreateInput struct {
|
||||
apis.VirtualResourceCreateInput
|
||||
DeletePreventableCreateInput
|
||||
type SDBInstanceCreateInput struct {
|
||||
apis.Meta
|
||||
|
||||
// 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
|
||||
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
|
||||
NetworkExternalId string
|
||||
BillingType string
|
||||
BillingCycle string
|
||||
InstanceType string
|
||||
Engine string
|
||||
EngineVersion string
|
||||
Category string
|
||||
StorageType string
|
||||
DiskSizeGB int
|
||||
Password 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
|
||||
VcpuCount int
|
||||
VmemSizeMb int
|
||||
Provider string
|
||||
}
|
||||
|
||||
type SDBInstanceChangeConfigInput struct {
|
||||
@@ -159,79 +66,5 @@ type SDBInstanceRecoveryConfigInput struct {
|
||||
|
||||
DBInstancebackup string
|
||||
DBInstancebackupId string `json:"dbinstancebackup_id"`
|
||||
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" "yunion: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"`
|
||||
Databases map[string]string `json:"allowempty"`
|
||||
}
|
||||
|
||||
@@ -17,72 +17,21 @@ package compute
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type SDBInstanceAccountPrivilege struct {
|
||||
// 数据库名称或Id
|
||||
// required: true
|
||||
Database string `json:"database"`
|
||||
// swagger:ignore
|
||||
Database string
|
||||
DBInstancedatabaseId 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"`
|
||||
Privilege string
|
||||
}
|
||||
|
||||
type DBInstanceAccountCreateInput struct {
|
||||
apis.StatusStandaloneResourceCreateInput
|
||||
type SDBInstanceAccountCreateInput struct {
|
||||
apis.Meta
|
||||
|
||||
// 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: false
|
||||
Password string `json:"password"`
|
||||
|
||||
// 账号权限
|
||||
// required: false
|
||||
Privileges []SDBInstanceAccountPrivilege `json:"privileges"`
|
||||
Name string
|
||||
Description string
|
||||
Password string
|
||||
Privileges []SDBInstanceAccountPrivilege
|
||||
}
|
||||
|
||||
type SDBInstanceSetPrivilegesInput struct {
|
||||
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"`
|
||||
Privileges []SDBInstanceAccountPrivilege
|
||||
}
|
||||
|
||||
@@ -16,39 +16,17 @@ package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type DBInstanceBackupCreateInput struct {
|
||||
apis.VirtualResourceCreateInput
|
||||
type SDBInstanceBackupCreateInput struct {
|
||||
apis.Meta
|
||||
|
||||
// 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
|
||||
DBInstanceId string `json:"dbinstance_id"`
|
||||
Name string
|
||||
Description string
|
||||
DBNames string
|
||||
Databases []string
|
||||
Engine string
|
||||
EngineVersion string
|
||||
// swagger:ignore
|
||||
CloudregionId string
|
||||
// swagger:ignore
|
||||
BackupMode string
|
||||
// swagger:ignore
|
||||
ManagerId string
|
||||
}
|
||||
|
||||
type DBInstanceBackupDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SDBInstanceBackup
|
||||
|
||||
// RDS实例名称
|
||||
DBInstance string `json:"dbinstance"`
|
||||
|
||||
CloudproviderInfo
|
||||
BackupMode string
|
||||
ManagerId string
|
||||
}
|
||||
|
||||
@@ -17,54 +17,18 @@ package compute
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type SDBInstanceDatabasePrivilege struct {
|
||||
// 数据库账号名称或Id
|
||||
// required: true
|
||||
Account string `json:"account"`
|
||||
// swagger:ignore
|
||||
Account string
|
||||
DBInstanceaccountId 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"`
|
||||
Privilege string
|
||||
}
|
||||
|
||||
type DBInstanceDatabaseCreateInput struct {
|
||||
apis.StatusStandaloneResourceCreateInput
|
||||
type SDBInstanceDatabaseCreateInput struct {
|
||||
apis.Meta
|
||||
|
||||
// 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"`
|
||||
DBInstanceId string `json:"dbinstance_id"`
|
||||
CharacterSet string
|
||||
Name string
|
||||
Description string
|
||||
Accounts []SDBInstanceDatabasePrivilege
|
||||
DBInstanceaccountId string
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
@@ -25,25 +23,15 @@ type DiskCreateInput struct {
|
||||
|
||||
*DiskConfig
|
||||
|
||||
// 此参数仅适用于未指定storage时进行调度到指定区域创建磁盘
|
||||
// required: false
|
||||
// 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"`
|
||||
|
||||
// 此参数仅适用于未指定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
|
||||
@@ -82,101 +70,3 @@ 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" "yunion: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" "yunion: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" "yunion:deprecated-by":"disk"`
|
||||
}
|
||||
|
||||
type SimpleGuest struct {
|
||||
Name string `json:"name"`
|
||||
Id string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type SimpleSnapshotPolicy struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
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"`
|
||||
}
|
||||
|
||||
@@ -1,25 +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 compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type DynamicschedtagDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SDynamicschedtag
|
||||
|
||||
Schedtag string `json:"schedtag"`
|
||||
ResourceType string `json:"resource_type"`
|
||||
}
|
||||
@@ -14,10 +14,6 @@
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
ELASTIC_CACHE_STATUS_RUNNING = "running" //(正常)
|
||||
ELASTIC_CACHE_STATUS_RESTARTING = "restarting" //(重启中)
|
||||
@@ -106,28 +102,3 @@ 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
|
||||
}
|
||||
|
||||
@@ -1,29 +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 compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ElasticcacheBackupDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SElasticcacheBackup
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
// 引擎
|
||||
Engine string `json:"engine"`
|
||||
// 引擎版本
|
||||
EngineVersion string `json:"engine_version"`
|
||||
}
|
||||
@@ -1,22 +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 compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ElasticcacheSkuDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SElasticcacheSku
|
||||
}
|
||||
@@ -1,79 +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 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,10 +14,6 @@
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
EIP_MODE_INSTANCE_PUBLICIP = "public_ip"
|
||||
EIP_MODE_STANDALONE_EIP = "elastic_ip"
|
||||
@@ -48,16 +44,3 @@ const (
|
||||
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"`
|
||||
}
|
||||
|
||||
@@ -1,26 +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 compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ExternalProjectDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
|
||||
SExternalProject
|
||||
CloudproviderInfo
|
||||
|
||||
Tenant string `json:"tenant"`
|
||||
}
|
||||
@@ -1,100 +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 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" "yunion:deprecated-by":"cloudregion"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
Region string `json:"region" "yunion:deprecated-by":"cloudregion"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// description: this param will be deprecate at 3.0
|
||||
RegionId string `json:"region_id" "yunion:deprecated-by":"cloudregion"`
|
||||
}
|
||||
|
||||
type ZonalFilterListInput struct {
|
||||
RegionalFilterListInput
|
||||
|
||||
// 过滤处于指定可用区内的资源
|
||||
Zone string `json:"zone"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// filter by zone_id
|
||||
ZoneId string `json:"zone_id" "yunion: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" "yunion: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,8 +21,3 @@ import (
|
||||
type GlobalVpcCreateInput struct {
|
||||
apis.EnabledStatusStandaloneResourceCreateInput
|
||||
}
|
||||
|
||||
type GlobalVpcDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SGlobalVpc
|
||||
}
|
||||
|
||||
@@ -155,7 +155,8 @@ const (
|
||||
CPU_MODE_HOST = "host"
|
||||
)
|
||||
|
||||
var VM_RUNNING_STATUS = []string{VM_START_START, VM_STARTING, VM_RUNNING, VM_BLOCK_STREAM, VM_BLOCK_STREAM_FAIL}
|
||||
var VM_RUNNING_STATUS = []string{VM_START_START, VM_STARTING, VM_RUNNING, VM_BLOCK_STREAM}
|
||||
|
||||
var VM_CREATING_STATUS = []string{VM_CREATE_NETWORK, VM_CREATE_DISK, VM_START_DEPLOY, VM_DEPLOYING}
|
||||
|
||||
var HYPERVISORS = []string{
|
||||
@@ -234,10 +235,9 @@ var HOSTTYPE_HYPERVISOR = map[string]string{
|
||||
}
|
||||
|
||||
const (
|
||||
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_AWS_DEFAULT_LOGIN_USER = "ec2user"
|
||||
VM_AZURE_DEFAULT_LOGIN_USER = "toor"
|
||||
VM_ZSTACK_DEFAULT_LOGIN_USER = "root"
|
||||
|
||||
VM_METADATA_APP_TAGS = "app_tags"
|
||||
VM_METADATA_CREATE_PARAMS = "create_params"
|
||||
|
||||
@@ -1,45 +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 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"`
|
||||
}
|
||||
@@ -1,29 +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 compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type GuestnetworkDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
SGuestnetwork
|
||||
|
||||
// 云主机名称
|
||||
Guest string
|
||||
// 云主机名称
|
||||
Server string
|
||||
// IP子网名称
|
||||
Network string
|
||||
}
|
||||
@@ -15,81 +15,60 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type ServerFilterListInput struct {
|
||||
// 以关联主机(ID或Name)过滤列表
|
||||
Server string `json:"server"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by guest Id
|
||||
ServerId string `json:"server_id" "yunion:deprecated-by":"server"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by guest Id
|
||||
Guest string `json:"guest" "yunion:deprecated-by":"server"`
|
||||
// swagger:ignore
|
||||
// Deprecated
|
||||
// Filter by guest Id
|
||||
GuestId string `json:"guest_id" "yunion:deprecated-by":"server"`
|
||||
}
|
||||
|
||||
type ServerListInput struct {
|
||||
apis.VirtualResourceListInput
|
||||
apis.BaseListInput
|
||||
|
||||
ManagedResourceListInput
|
||||
HostFilterListInput
|
||||
NetworkFilterListInput
|
||||
BillingFilterListInput
|
||||
GroupFilterListInput
|
||||
SecgroupFilterListInput
|
||||
DiskFilterListInput
|
||||
|
||||
// 只列出裸金属主机
|
||||
// 过滤可用区底下的资源
|
||||
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
|
||||
Baremetal *bool `json:"baremetal"`
|
||||
// 只列出GPU主机
|
||||
// Show gpu servers
|
||||
Gpu *bool `json:"gpu"`
|
||||
// 列出管理安全组为指定安全组的主机
|
||||
// Secgroup ID or Name
|
||||
Secgroup string `json:"secgroup"`
|
||||
// AdminSecgroup ID or Name
|
||||
AdminSecgroup string `json:"admin_security"`
|
||||
// 列出Hypervisor为指定值的主机
|
||||
// enum: kvm,esxi,baremetal,aliyun,azure,aws,huawei,ucloud,zstack,openstack,google,ctyun"`
|
||||
Hypervisor []string `json:"hypervisor"`
|
||||
// 列出绑定了弹性IP(EIP)的主机
|
||||
// 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
|
||||
WithEip *bool `json:"with_eip"`
|
||||
// 列出未绑定弹性IP(EIO)的主机
|
||||
// Show Servers without EIP
|
||||
WithoutEip *bool `json:"without_eip"`
|
||||
// 列出操作系统为指定值的主机
|
||||
// enum: linux,windows,vmware
|
||||
// OS Type choices:"linux|windows|vmware"`
|
||||
OsType string `json:"os_type"`
|
||||
// 对列表结果按照磁盘进行排序
|
||||
// enum: asc,desc
|
||||
// Order by disk size choices:"asc|desc"
|
||||
OrderByDisk string `json:"order_by_disk"`
|
||||
// 对主机列表结果按照宿主机名称进行排序
|
||||
// enum: asc,desc
|
||||
// Order by host name choices:"asc|desc"
|
||||
OrderByHost string `json:"order_by_host"`
|
||||
// 列出可以挂载指定EIP的主机
|
||||
// Vpc id or name
|
||||
Vpc string `json:"vpc"`
|
||||
// Eip id or name
|
||||
UsableServerForEip string `json:"usable_server_for_eip"`
|
||||
|
||||
// 按主机资源类型进行排序
|
||||
// enum: shared,prepaid,dedicated
|
||||
// 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"
|
||||
ResourceType string `json:"resource_type"`
|
||||
// 返回开启主备机功能的主机
|
||||
GetBackupGuestsOnHost *bool `json:"get_backup_guests_on_host"`
|
||||
// Billing type choices:"postpaid|prepaid"
|
||||
BillingType string `json:"billing_type"`
|
||||
// 根据宿主机 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
|
||||
|
||||
@@ -129,51 +108,3 @@ 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,6 +36,7 @@ type GuesttemplateCreateInput struct {
|
||||
}
|
||||
|
||||
type GuesttemplateDetails struct {
|
||||
apis.Meta
|
||||
apis.SharableVirtualResourceDetails
|
||||
SGuestTemplate
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user