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
| 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
|
||||
|
||||
10
.github/pull_request_template.md
vendored
10
.github/pull_request_template.md
vendored
@@ -1,15 +1,9 @@
|
||||
**这个 PR 实现什么功能/修复什么问题**:
|
||||
|
||||
<!--
|
||||
- [ ] 功能、bugfix描述
|
||||
- [ ] 冒烟测试
|
||||
- [ ] 单元测试编写
|
||||
-->
|
||||
|
||||
**是否需要 backport 到之前的 release 分支**:
|
||||
|
||||
<!--
|
||||
如果不需要,填写 "NONE".
|
||||
如果需要,就以下面 item 的格式写 release 分支名,并提交对应的 cherry-pick PR:
|
||||
- release/3.1
|
||||
- release/2.8.0
|
||||
- release/2.6.0
|
||||
-->
|
||||
|
||||
84
.github/workflows/docker.yml
vendored
84
.github/workflows/docker.yml
vendored
@@ -29,47 +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 region
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/region
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.region
|
||||
|
||||
- name: Image host
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/host
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.host
|
||||
|
||||
- name: Image host-deployer
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/host-deployer
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.host-deployer
|
||||
|
||||
- name: Image baremetal-agent
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
@@ -91,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:
|
||||
@@ -131,6 +91,16 @@ jobs:
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.logger
|
||||
|
||||
- name: Image region
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/region
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.region
|
||||
|
||||
- name: Image scheduler
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
@@ -201,6 +171,26 @@ jobs:
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.notify
|
||||
|
||||
- name: Image host
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/host
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.host
|
||||
|
||||
- name: Image host-deployer
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/host-deployer
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.host-deployer
|
||||
|
||||
- name: Image cloudevent
|
||||
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
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,7 +30,6 @@ _output
|
||||
/relay
|
||||
/structargtest
|
||||
.idea
|
||||
.vscode
|
||||
GPATH
|
||||
GRTAGS
|
||||
GTAGS
|
||||
|
||||
82
Makefile
82
Makefile
@@ -10,7 +10,7 @@ BUILD_SCRIPT := $(ROOT_DIR)/build/build.sh
|
||||
ifeq ($(ONECLOUD_CI_BUILD),)
|
||||
GIT_COMMIT := $(shell git rev-parse --short HEAD)
|
||||
GIT_BRANCH := $(shell git name-rev --name-only HEAD)
|
||||
GIT_VERSION := $(shell git describe --always --tags --abbrev=14 $(GIT_COMMIT)^{commit})
|
||||
GIT_VERSION := $(shell git describe --tags --abbrev=14 $(GIT_COMMIT)^{commit})
|
||||
GIT_TREE_STATE := $(shell s=`git status --porcelain 2>/dev/null`; if [ -z "$$s" ]; then echo "clean"; else echo "dirty"; fi)
|
||||
BUILD_DATE := $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||
else
|
||||
@@ -51,7 +51,6 @@ ifdef LIBQEMUIO_PATH
|
||||
X_CGO_LDFLAGS := ${CGO_LDFLAGS_ENV} -laio -lqemuio -lpthread -L ${LIBQEMUIO_PATH}/src
|
||||
endif
|
||||
|
||||
export GOOS ?= linux
|
||||
export GO111MODULE:=on
|
||||
export CGO_CFLAGS = ${X_CGO_CFLAGS}
|
||||
export CGO_LDFLAGS = ${X_CGO_LDFLAGS}
|
||||
@@ -76,7 +75,7 @@ install: prepare_dir
|
||||
|
||||
|
||||
gencopyright:
|
||||
@bash scripts/gencopyright.sh pkg cmd
|
||||
@sh scripts/gencopyright.sh pkg cmd
|
||||
|
||||
test:
|
||||
@go test $(GO_BUILD_FLAGS) $(shell go list ./... | egrep -v 'host-image|hostimage')
|
||||
@@ -188,82 +187,48 @@ dep:
|
||||
@$(MAKE) mod
|
||||
|
||||
mod:
|
||||
go get -d $(patsubst %,%@master,$(shell GO111MODULE=on go mod edit -print | sed -n -e 's|.*\(yunion.io/x/[a-z].*\) v.*|\1|p'))
|
||||
go get $(patsubst %,%@master,$(shell GO111MODULE=on go mod edit -print | sed -n -e 's|.*\(yunion.io/x/[a-z].*\) v.*|\1|p'))
|
||||
go mod tidy
|
||||
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
|
||||
|
||||
@@ -291,15 +256,10 @@ gen-swagger: gen-swagger-check
|
||||
$(ROOT_DIR)/scripts/codegen.py swagger-code
|
||||
$(ROOT_DIR)/scripts/codegen.py swagger-yaml
|
||||
|
||||
swagger-serve-only:
|
||||
swagger-serve: gen-swagger
|
||||
$(ROOT_DIR)/scripts/codegen.py swagger-serve
|
||||
|
||||
swagger-serve: gen-model-api gen-swagger swagger-serve-only
|
||||
|
||||
swagger-site: gen-model-api gen-swagger
|
||||
$(ROOT_DIR)/scripts/codegen.py swagger-site
|
||||
|
||||
.PHONY: gen-model-api-check gen-model-api gen-swagger-check gen-swagger swagger-serve swagger-site
|
||||
.PHONY: gen-model-api-check gen-model-api gen-swagger-check gen-swagger swagger-serve
|
||||
|
||||
REGISTRY ?= "registry.cn-beijing.aliyuncs.com/yunionio"
|
||||
VERSION ?= $(shell git describe --exact-match 2> /dev/null || \
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/ansibleserver-base:1.0.0
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/ansibleserver-base:latest
|
||||
|
||||
ADD ./_output/alpine-build/bin/ansibleserver /opt/yunion/bin/ansibleserver
|
||||
ADD ./_output/bin/ansibleserver /opt/yunion/bin/ansibleserver
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
FROM alpine:3.11.6
|
||||
FROM frolvlad/alpine-glibc:glibc-2.28
|
||||
|
||||
MAINTAINER "Yousong Zhou <zhouyousong@yunionyun.com>"
|
||||
MAINTAINER "Zexi Li <lizexi@yunionyun.com>"
|
||||
|
||||
# openssh-client, for ansible ssh connection
|
||||
RUN set -x \
|
||||
&& apk update \
|
||||
&& apk add openssh-client \
|
||||
&& apk add ansible \
|
||||
&& apk add tzdata ca-certificates \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
|
||||
RUN apk update && \
|
||||
apk add --no-cache tzdata ansible ca-certificates && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
@@ -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,4 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:v0.0.3
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:v0.0.2
|
||||
|
||||
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"
|
||||
|
||||
|
||||
@@ -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"
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
|
||||
{{.os_type}} 镜像 {{.name}} 上传完成
|
||||
@@ -1,66 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<table style="width: 650px; margin-bottom: 20px;" border="0" cellpadding="0" cellspacing="0" align="center">
|
||||
<tr style="height: 50px; background: #333; overflow: hidden;">
|
||||
<td>
|
||||
<table style="margin-left: 20px;">
|
||||
<tr>
|
||||
<td>
|
||||
<img src="data:{{.login_logo_format}};base64,{{.login_logo}}" alt="" style="color: #fff; height: 32px; vertical-align: middle;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<table style="float: right;">
|
||||
<tr>
|
||||
<td style="padding-left: 20px; padding-right: 20px;">
|
||||
<a href="" style="text-decoration: none; color: #20A0FF; font-size: 12px; display: none;">产品</a>
|
||||
</td>
|
||||
<td style="padding-left: 20px; padding-right: 20px;">
|
||||
<a href="" style="text-decoration: none; color: #20A0FF; font-size: 12px; display: none;">解决方案</a>
|
||||
</td>
|
||||
<td style="padding-left: 20px; padding-right: 20px;">
|
||||
<a href="" style="text-decoration: none; color: #20A0FF; font-size: 12px; display: none;">服务</a>
|
||||
</td>
|
||||
<td style="padding-left: 20px; padding-right: 20px;">
|
||||
<a href="" style="text-decoration: none; color: #20A0FF; font-size: 12px; display: none;">帮助与文档</a>
|
||||
</td>
|
||||
<td style="padding-left: 20px; padding-right: 20px;">
|
||||
<a href="" style="text-decoration: none; color: #20A0FF; font-size: 12px; display: none;">关于我们</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 100%;" colspan="2">
|
||||
<table style="padding: 20px 10px; width: 100%;">
|
||||
<tr>
|
||||
<td style="padding-bottom: 20px;">
|
||||
亲爱的{{.name}},您好:
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-bottom: 10px;">请点击下面的链接,完成用户邮箱的激活:</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-bottom: 30px;"><a href="{{.link}}">{{.link}}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="width: 96%;">
|
||||
<td colspan="2" style="border-top: 1px dashed #ccc; color: #333; font-size: 12px; padding-bottom: 10px; font-weight: 100;">*为了确保您的帐号安全,该链接仅48小时内访问有效,请勿直接回复此邮件。</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="background: #333; text-align: right; padding-right: 20px; font-size: 12px; color: #fff; height: 50px;">版权所有 © {{.copyright}} 保留一切权利</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
镜像 {{.name}} 上传完成
|
||||
@@ -1 +0,0 @@
|
||||
Yunion Verify
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type BillTasksCreateOptions struct {
|
||||
options.BaseListOptions
|
||||
CloudaccountId string `help:"cloudaccount Id" required:"true"`
|
||||
StartDay int `help:"start day of billing cycle, example: 20060102"`
|
||||
EndDay int `help:"end day of billing cycle, example: 20060102"`
|
||||
}
|
||||
R(&BillTasksCreateOptions{}, "bill-tasks-create", "create bill task",
|
||||
func(s *mcclient.ClientSession, args *BillTasksCreateOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.BillTasks.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -32,22 +32,12 @@ import (
|
||||
func init() {
|
||||
type BucketListOptions struct {
|
||||
options.BaseListOptions
|
||||
DistinctField string `help:"query specified distinct field"`
|
||||
}
|
||||
R(&BucketListOptions{}, "bucket-list", "List all buckets", func(s *mcclient.ClientSession, args *BucketListOptions) error {
|
||||
params, err := options.ListStructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(args.DistinctField) > 0 {
|
||||
params.Add(jsonutils.NewString(args.DistinctField), "extra_field")
|
||||
result, err := modules.Buckets.Get(s, "distinct-field", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(result)
|
||||
return nil
|
||||
}
|
||||
result, err := modules.Buckets.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -56,10 +46,10 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type BucketIdOptions struct {
|
||||
type BucketShowOptions struct {
|
||||
ID string `help:"ID or name of bucket"`
|
||||
}
|
||||
R(&BucketIdOptions{}, "bucket-show", "Id details of bucket", func(s *mcclient.ClientSession, args *BucketIdOptions) error {
|
||||
R(&BucketShowOptions{}, "bucket-show", "Show details of bucket", func(s *mcclient.ClientSession, args *BucketShowOptions) error {
|
||||
result, err := modules.Buckets.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -68,15 +58,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&BucketIdOptions{}, "bucket-syncstatus", "Sync bucket statust", func(s *mcclient.ClientSession, args *BucketIdOptions) error {
|
||||
result, err := modules.Buckets.PerformAction(s, args.ID, "syncstatus", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type BucketUpdateOptions struct {
|
||||
ID string `help:"ID or name of bucket" json:"-"`
|
||||
Name string `help:"new name of bucket" json:"name"`
|
||||
|
||||
@@ -26,36 +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"`
|
||||
|
||||
DistinctField string `help:"distinct field"`
|
||||
ProxySetting string `help:"Proxy setting id or name"`
|
||||
}
|
||||
R(&CloudaccountListOptions{}, "cloud-account-list", "List cloud accounts", func(s *mcclient.ClientSession, args *CloudaccountListOptions) error {
|
||||
var params *jsonutils.JSONDict
|
||||
@@ -65,21 +39,6 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(args.Capability) > 0 {
|
||||
params.Add(jsonutils.NewStringArray(args.Capability), "capability")
|
||||
}
|
||||
if len(args.ProxySetting) > 0 {
|
||||
params.Add(jsonutils.NewString(args.ProxySetting), "proxy_setting")
|
||||
}
|
||||
}
|
||||
if len(args.DistinctField) > 0 {
|
||||
params.Add(jsonutils.NewString(args.DistinctField), "extra_field")
|
||||
result, err := modules.Cloudaccounts.Get(s, "distinct-field", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(result)
|
||||
return nil
|
||||
}
|
||||
result, err := modules.Cloudaccounts.List(s, params)
|
||||
if err != nil {
|
||||
@@ -175,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
|
||||
}
|
||||
@@ -414,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)
|
||||
|
||||
@@ -468,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()
|
||||
@@ -720,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)
|
||||
@@ -753,129 +690,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SVMwareCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-vmware", "Update credential of a VMware cloud account", func(s *mcclient.ClientSession, args *options.SVMwareCloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SAliyunCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-aliyun", "Update credential of an Aliyun cloud account", func(s *mcclient.ClientSession, args *options.SAliyunCloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SAzureCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-azure", "Update credential of an Azure cloud account", func(s *mcclient.ClientSession, args *options.SAzureCloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SQcloudCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-qcloud", "Update credential of a Qcloud cloud account", func(s *mcclient.ClientSession, args *options.SQcloudCloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SAWSCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-aws", "Update credential of an AWS cloud account", func(s *mcclient.ClientSession, args *options.SAWSCloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SOpenStackCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-openstack", "Update credential of an OpenStack cloud account", func(s *mcclient.ClientSession, args *options.SOpenStackCloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SHuaweiCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-huawei", "Update credential of an Huawei cloud account", func(s *mcclient.ClientSession, args *options.SHuaweiCloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SUcloudCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-ucloud", "Update credential of a Ucloud cloud account", func(s *mcclient.ClientSession, args *options.SUcloudCloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SZStackCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-zstack", "Update credential of a ZStack cloud account", func(s *mcclient.ClientSession, args *options.SZStackCloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SGoogleCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-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, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SS3CloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-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, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SCtyunCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-ctyun", "Update credential of an Ctyun cloud account", func(s *mcclient.ClientSession, args *options.SCtyunCloudAccountUpdateCredentialOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type CloudaccountSyncOptions struct {
|
||||
ID string `help:"ID or Name of cloud account"`
|
||||
Force bool `help:"Force sync no matter what"`
|
||||
@@ -939,14 +753,10 @@ func init() {
|
||||
})
|
||||
|
||||
type CloudaccountPublicOptions struct {
|
||||
ID string `help:"ID or name of cloud account" json:"-"`
|
||||
Scope string `help:"public_sccope" choices:"domain|system" json:"scope"`
|
||||
SharedDomains []string `help:"shared domains" json:"shared_domains"`
|
||||
ShareMode string `help:"share_mode" choices:"account_domain|provider_domain|system"`
|
||||
ID string `help:"ID or name of cloud account"`
|
||||
}
|
||||
R(&CloudaccountPublicOptions{}, "cloud-account-public", "Mark this cloud account public ", func(s *mcclient.ClientSession, args *CloudaccountPublicOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "public", params)
|
||||
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "public", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1006,47 +816,4 @@ func init() {
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type ClouaccountChangeOwnerOptions struct {
|
||||
ID string `help:"ID or name of cloudaccount" json:"-"`
|
||||
ProjectDomain string `json:"project_domain" help:"target domain"`
|
||||
}
|
||||
R(&ClouaccountChangeOwnerOptions{}, "cloud-account-change-owner", "Change owner domain of cloudaccount", func(s *mcclient.ClientSession, args *ClouaccountChangeOwnerOptions) error {
|
||||
if len(args.ProjectDomain) == 0 {
|
||||
return fmt.Errorf("empty project_domain")
|
||||
}
|
||||
params := jsonutils.Marshal(args)
|
||||
ret, err := modules.Cloudaccounts.PerformAction(s, args.ID, "change-owner", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
type ClouaccountChangeProjectOptions struct {
|
||||
ID string `help:"ID or name of cloudaccount" json:"-"`
|
||||
PROJECT string `json:"project" help:"target domain"`
|
||||
}
|
||||
R(&ClouaccountChangeProjectOptions{}, "cloud-account-change-project", "Change domain/project of cloudaccount", func(s *mcclient.ClientSession, args *ClouaccountChangeProjectOptions) error {
|
||||
if len(args.PROJECT) == 0 {
|
||||
return fmt.Errorf("empty project")
|
||||
}
|
||||
params := jsonutils.Marshal(args)
|
||||
ret, err := modules.Cloudaccounts.PerformAction(s, args.ID, "change-project", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&CloudaccountShowOptions{}, "cloud-account-change-owner-candidate-domains", "Show candiate domains of a cloud account changing project", func(s *mcclient.ClientSession, args *CloudaccountShowOptions) error {
|
||||
result, err := modules.Cloudaccounts.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type CloudproviderQuotaListOptions struct {
|
||||
options.BaseListOptions
|
||||
Cloudregion string `help:"ID or Name of Cloudregion"`
|
||||
QuotaType string `help:"Quota type"`
|
||||
QuotaRange string `help:"Quota range" choices:"cloudregion|cloudprovider"`
|
||||
}
|
||||
|
||||
R(&CloudproviderQuotaListOptions{}, "cloud-provider-quota-list", "List cloudprovider quota", func(s *mcclient.ClientSession, args *CloudproviderQuotaListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(args.QuotaType) > 0 {
|
||||
params.Add(jsonutils.NewString(args.QuotaType), "quota_type")
|
||||
}
|
||||
|
||||
if len(args.QuotaRange) > 0 {
|
||||
params.Add(jsonutils.NewString(args.QuotaRange), "quota_range")
|
||||
}
|
||||
|
||||
if len(args.Cloudregion) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Cloudregion), "cloudregion")
|
||||
}
|
||||
|
||||
result, err := modules.CloudproviderQuotas.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printList(result, modules.CloudproviderQuotas.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
@@ -27,8 +27,6 @@ func init() {
|
||||
type CloudproviderRegionListOptions struct {
|
||||
options.BaseListOptions
|
||||
Region string `help:"ID or Name of Host"`
|
||||
|
||||
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
|
||||
}
|
||||
R(&CloudproviderRegionListOptions{}, "cloud-provider-region-list", "List cloudprovider region synchronization status", func(s *mcclient.ClientSession, args *CloudproviderRegionListOptions) error {
|
||||
var params *jsonutils.JSONDict
|
||||
|
||||
@@ -31,10 +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"`
|
||||
Cloudregion string `help:"filter cloudproviders by cloudregion"`
|
||||
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
|
||||
@@ -54,14 +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")
|
||||
}
|
||||
|
||||
if len(args.Cloudregion) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Cloudregion), "cloudregion")
|
||||
}
|
||||
}
|
||||
result, err := modules.Cloudproviders.List(s, params)
|
||||
if err != nil {
|
||||
@@ -250,13 +240,4 @@ func init() {
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&CloudproviderShowOptions{}, "cloud-provider-change-owner-candidate-domains", "Show candiate domains of a cloud provider changing owner", func(s *mcclient.ClientSession, args *CloudproviderShowOptions) error {
|
||||
result, err := modules.Cloudproviders.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
@@ -34,25 +32,12 @@ func init() {
|
||||
Service string `help:"List regions which service has available skus" choices:"dbinstances|servers"`
|
||||
|
||||
City string `help:"List regions in the specified city"`
|
||||
|
||||
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
|
||||
|
||||
DistinctField string `help:"list the specified distinct field, e.g. city, region"`
|
||||
}
|
||||
R(&CloudregionListOptions{}, "cloud-region-list", "List cloud regions", func(s *mcclient.ClientSession, opts *CloudregionListOptions) error {
|
||||
params, err := options.ListStructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(opts.DistinctField) > 0 {
|
||||
params.Add(jsonutils.NewString(opts.DistinctField), "extra_field")
|
||||
result, err := modules.Cloudregions.Get(s, "distinct-field", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(result)
|
||||
return nil
|
||||
}
|
||||
result, err := modules.Cloudregions.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -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
|
||||
})
|
||||
}
|
||||
|
||||
@@ -38,11 +38,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(opts.ExportFile) > 0 {
|
||||
exportList(result, opts.ExportFile, opts.ExportKeys, opts.ExportTexts, modules.DBInstanceBackups.GetColumns(s))
|
||||
} else {
|
||||
printList(result, modules.DBInstanceBackups.GetColumns(s))
|
||||
}
|
||||
printList(result, modules.DBInstanceBackups.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -84,15 +80,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&DBInstanceBackupIdOptions{}, "dbinstance-backup-syncstatus", "Sync DB instance backup status", func(s *mcclient.ClientSession, opts *DBInstanceBackupIdOptions) error {
|
||||
result, err := modules.DBInstanceBackups.PerformAction(s, opts.ID, "syncstatus", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&DBInstanceBackupIdOptions{}, "dbinstance-backup-delete", "Delete DB instance backup", func(s *mcclient.ClientSession, opts *DBInstanceBackupIdOptions) error {
|
||||
result, err := modules.DBInstanceBackups.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
|
||||
@@ -41,12 +41,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(opts.ExportFile) > 0 {
|
||||
exportList(result, opts.ExportFile, opts.ExportKeys, opts.ExportTexts, modules.DBInstance.GetColumns(s))
|
||||
} else {
|
||||
printList(result, modules.DBInstance.GetColumns(s))
|
||||
}
|
||||
printList(result, modules.DBInstance.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -263,24 +258,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&DBInstanceIdOptions{}, "dbinstance-syncstatus", "Sync status for DB instance", func(s *mcclient.ClientSession, opts *DBInstanceIdOptions) error {
|
||||
result, err := modules.DBInstance.PerformAction(s, opts.ID, "syncstatus", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&DBInstanceIdOptions{}, "dbinstance-sync", "Sync conf from cloud dbinstance", func(s *mcclient.ClientSession, opts *DBInstanceIdOptions) error {
|
||||
result, err := modules.DBInstance.PerformAction(s, opts.ID, "sync", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&DBInstanceIdOptions{}, "dbinstance-sync-status", "Sync status for DB instance", func(s *mcclient.ClientSession, opts *DBInstanceIdOptions) error {
|
||||
result, err := modules.DBInstance.PerformAction(s, opts.ID, "sync-status", nil)
|
||||
if err != nil {
|
||||
|
||||
@@ -107,7 +107,7 @@ func init() {
|
||||
R(
|
||||
&options.DevtoolTemplateBindingOptions{},
|
||||
"devtooltemplate-unbind",
|
||||
"UnBinding devtool template to a host/vm",
|
||||
"Binding devtool template to a host/vm",
|
||||
func(s *mcclient.ClientSession, opts *options.DevtoolTemplateBindingOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Set("server_id", jsonutils.NewString(opts.ServerID))
|
||||
|
||||
@@ -133,15 +133,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&DiskDetailOptions{}, "disk-syncstatus", "Sync status for disk", func(s *mcclient.ClientSession, args *DiskDetailOptions) error {
|
||||
ret, e := modules.Disks.PerformAction(s, args.ID, "syncstatus", nil)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
type DiskUpdateOptions struct {
|
||||
ID string `help:"ID or name of disk"`
|
||||
Name string `help:"New name of disk"`
|
||||
@@ -291,14 +282,4 @@ func init() {
|
||||
printObject(srv)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&DiskDetailOptions{}, "disk-change-owner-candidate-domains", "Get change owner candidate domain list", func(s *mcclient.ClientSession, args *DiskDetailOptions) error {
|
||||
result, err := modules.Disks.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -1,48 +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 (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type DistinctFieldOption struct {
|
||||
MODULE string `help:"module name"`
|
||||
FIELD string `help:"distinct field name to query"`
|
||||
}
|
||||
R(&DistinctFieldOption{}, "distinct-field", "Query values of a distinct field for a module", func(s *mcclient.ClientSession, args *DistinctFieldOption) error {
|
||||
mod, err := modulebase.GetModule(s, args.MODULE)
|
||||
if err != nil || mod == nil {
|
||||
if err != nil {
|
||||
return fmt.Errorf("module %s not found %s", args.MODULE, err)
|
||||
}
|
||||
return fmt.Errorf("No module %s found", args.MODULE)
|
||||
}
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.FIELD), "extra_field")
|
||||
result, err := mod.Get(s, "distinct-field", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -83,8 +83,6 @@ func init() {
|
||||
Desc string `help:"Description"`
|
||||
Enabled bool `help:"Set the domain enabled"`
|
||||
Disabled bool `help:"Set the domain disabled"`
|
||||
|
||||
Displayname string `help:"display name"`
|
||||
}
|
||||
R(&DomainCreateOptions{}, "domain-create", "Create a new domain", func(s *mcclient.ClientSession, args *DomainCreateOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
@@ -97,9 +95,6 @@ func init() {
|
||||
} else if !args.Enabled && args.Disabled {
|
||||
params.Add(jsonutils.JSONFalse, "enabled")
|
||||
}
|
||||
if len(args.Displayname) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Displayname), "displayname")
|
||||
}
|
||||
result, err := modules.Domains.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -115,8 +110,6 @@ func init() {
|
||||
Enabled bool `help:"Set the domain enabled"`
|
||||
Disabled bool `help:"Set the domain disabled"`
|
||||
Driver string `help:"Set the domain Driver"`
|
||||
|
||||
Displayname string `help:"display name"`
|
||||
}
|
||||
R(&DomainUpdateOptions{}, "domain-update", "Update a domain", func(s *mcclient.ClientSession, args *DomainUpdateOptions) error {
|
||||
obj, err := modules.Domains.Get(s, args.ID, nil)
|
||||
@@ -143,9 +136,6 @@ func init() {
|
||||
} else if !args.Enabled && args.Disabled {
|
||||
params.Add(jsonutils.JSONFalse, "enabled")
|
||||
}
|
||||
if len(args.Displayname) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Displayname), "displayname")
|
||||
}
|
||||
result, err := modules.Domains.Patch(s, objId, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -75,16 +75,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ElasticCacheIdOptions{}, "elastic-cache-syncstatus", "Sync elastisc cache instance status", func(s *mcclient.ClientSession, opts *options.ElasticCacheIdOptions) error {
|
||||
result, err := modules.ElasticCache.PerformAction(s, opts.ID, "syncstatus", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ElasticCacheIdOptions{}, "elastic-cache-delete", "Delete elastisc cache instance", func(s *mcclient.ClientSession, opts *options.ElasticCacheIdOptions) error {
|
||||
result, err := modules.ElasticCache.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
|
||||
@@ -170,15 +170,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&EipSingleOptions{}, "eip-syncstatus", "Synchronize status of an EIP", func(s *mcclient.ClientSession, args *EipSingleOptions) error {
|
||||
result, err := modules.Elasticips.PerformAction(s, args.ID, "syncstatus", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type ServerCreateEipOptions struct {
|
||||
ID string `help:"server ID or name"`
|
||||
BW int `help:"EIP bandwidth in Mbps"`
|
||||
|
||||
@@ -64,15 +64,14 @@ func init() {
|
||||
})
|
||||
|
||||
type EndpointCreateOptions struct {
|
||||
SERVICE string `help:"Service ID or Name"`
|
||||
REGION string `help:"Region"`
|
||||
INTERFACE string `help:"Interface types" choices:"internal|public|admin|console"`
|
||||
URL string `help:"URL"`
|
||||
Zone string `help:"Zone"`
|
||||
Name string `help:"Name"`
|
||||
Enabled bool `help:"Enabled"`
|
||||
Disabled bool `help:"Disabled"`
|
||||
ServiceCertificate string `help:"Service certificate id or name"`
|
||||
SERVICE string `help:"Service ID or Name"`
|
||||
REGION string `help:"Region"`
|
||||
INTERFACE string `help:"Interface types" choices:"internal|public|admin|console"`
|
||||
URL string `help:"URL"`
|
||||
Zone string `help:"Zone"`
|
||||
Name string `help:"Name"`
|
||||
Enabled bool `help:"Enabled"`
|
||||
Disabled bool `help:"Disabled"`
|
||||
}
|
||||
R(&EndpointCreateOptions{}, "endpoint-create", "Create endpoint", func(s *mcclient.ClientSession, args *EndpointCreateOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
@@ -96,9 +95,6 @@ func init() {
|
||||
} else if !args.Enabled && args.Disabled {
|
||||
params.Add(jsonutils.JSONFalse, "enabled")
|
||||
}
|
||||
if len(args.ServiceCertificate) > 0 {
|
||||
params.Add(jsonutils.NewString(args.ServiceCertificate), "service_certificate")
|
||||
}
|
||||
ep, err := modules.EndpointsV3.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -108,12 +104,11 @@ func init() {
|
||||
})
|
||||
|
||||
type EndpointUpdateOptions struct {
|
||||
ID string `help:"ID or name of endpoint"`
|
||||
Url string `help:"URL"`
|
||||
Name string `help:"Name"`
|
||||
Enabled bool `help:"Enabled"`
|
||||
Disabled bool `help:"Disabled"`
|
||||
ServiceCertificate string `help:"Service certificate id or name"`
|
||||
ID string `help:"ID or name of endpoint"`
|
||||
Url string `help:"URL"`
|
||||
Name string `help:"Name"`
|
||||
Enabled bool `help:"Enabled"`
|
||||
Disabled bool `help:"Disabled"`
|
||||
}
|
||||
R(&EndpointUpdateOptions{}, "endpoint-update", "Update a endpoint", func(s *mcclient.ClientSession, args *EndpointUpdateOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
@@ -128,9 +123,6 @@ func init() {
|
||||
} else if !args.Enabled && args.Disabled {
|
||||
params.Add(jsonutils.JSONFalse, "enabled")
|
||||
}
|
||||
if len(args.ServiceCertificate) > 0 {
|
||||
params.Add(jsonutils.NewString(args.ServiceCertificate), "service_certificate")
|
||||
}
|
||||
ep, err := modules.EndpointsV3.Patch(s, args.ID, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -34,11 +34,8 @@ type BaseEventListOptions struct {
|
||||
OrderBy string `help:"order by specific field"`
|
||||
Action []string `help:"Log action"`
|
||||
|
||||
User string `help:"filter by operator user"`
|
||||
Project string `help:"filter by operator user's project"`
|
||||
|
||||
OwnerProjectIds []string `help:"filter by owner project ids"`
|
||||
OwnerDomainIds []string `help:"filter by owner domain ids"`
|
||||
User []string `help:"filter by operator user"`
|
||||
Project []string `help:"filter by owner project"`
|
||||
|
||||
PagingMarker string `help:"marker for pagination"`
|
||||
}
|
||||
@@ -102,20 +99,14 @@ func doEventList(man modulebase.ResourceManager, s *mcclient.ClientSession, args
|
||||
params.Add(jsonutils.NewStringArray(args.Action), "action")
|
||||
}
|
||||
if len(args.User) > 0 {
|
||||
params.Add(jsonutils.NewString(args.User), "user")
|
||||
params.Add(jsonutils.NewStringArray(args.User), "user")
|
||||
}
|
||||
if len(args.Project) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Project), "project")
|
||||
params.Add(jsonutils.NewStringArray(args.Project), "project")
|
||||
}
|
||||
if len(args.Scope) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Scope), "scope")
|
||||
}
|
||||
if len(args.OwnerProjectIds) > 0 {
|
||||
params.Add(jsonutils.NewStringArray(args.OwnerProjectIds), "owner_project_ids")
|
||||
}
|
||||
if len(args.OwnerDomainIds) > 0 {
|
||||
params.Add(jsonutils.NewStringArray(args.OwnerDomainIds), "owner_domain_ids")
|
||||
}
|
||||
if len(args.PagingMarker) > 0 {
|
||||
params.Add(jsonutils.NewString(args.PagingMarker), "paging_marker")
|
||||
}
|
||||
@@ -225,11 +216,6 @@ func init() {
|
||||
return doIdentityEventList(s, &nargs)
|
||||
})
|
||||
|
||||
R(&TypeEventListOptions{}, "idp-event", "Show operation event logs of keystone identity provider", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
|
||||
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"identity_provider"}}
|
||||
return doIdentityEventList(s, &nargs)
|
||||
})
|
||||
|
||||
R(&TypeEventListOptions{}, "project-event", "Show operation event logs of keystone projects", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
|
||||
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"project"}}
|
||||
return doIdentityEventList(s, &nargs)
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
@@ -52,58 +48,4 @@ func init() {
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type GlobalVpcPublicOptions struct {
|
||||
ID string `help:"ID or name of global vpc" json:"-"`
|
||||
Scope string `help:"sharing scope" choices:"system|domain"`
|
||||
SharedDomains []string `help:"share to domains"`
|
||||
}
|
||||
R(&GlobalVpcPublicOptions{}, "global-vpc-public", "Make global vpc public", func(s *mcclient.ClientSession, args *GlobalVpcPublicOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.GlobalVpcs.PerformAction(s, args.ID, "public", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type GlobalVpcPrivateOptions struct {
|
||||
ID string `help:"ID or name of global vpc" json:"-"`
|
||||
}
|
||||
R(&GlobalVpcPrivateOptions{}, "global-vpc-private", "Make global vpc private", func(s *mcclient.ClientSession, args *GlobalVpcPrivateOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.GlobalVpcs.PerformAction(s, args.ID, "private", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&GlobalVpcShowOptions{}, "global-vpc-change-owner-candidate-domains", "Show candiate domains of a global vpc for changing owner", func(s *mcclient.ClientSession, args *GlobalVpcShowOptions) error {
|
||||
result, err := modules.GlobalVpcs.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type GlobalVpcChangeOwnerOptions struct {
|
||||
ID string `help:"ID or name of vpc" json:"-"`
|
||||
ProjectDomain string `json:"project_domain" help:"target domain"`
|
||||
}
|
||||
R(&GlobalVpcChangeOwnerOptions{}, "global-vpc-change-owner", "Change owner domain of a global vpc", func(s *mcclient.ClientSession, args *GlobalVpcChangeOwnerOptions) error {
|
||||
if len(args.ProjectDomain) == 0 {
|
||||
return fmt.Errorf("empty project_domain")
|
||||
}
|
||||
params := jsonutils.Marshal(args)
|
||||
ret, err := modules.GlobalVpcs.PerformAction(s, args.ID, "change-owner", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -224,29 +224,4 @@ func init() {
|
||||
printObject(sp)
|
||||
return nil
|
||||
})
|
||||
|
||||
type GroupAddUsersOptions struct {
|
||||
GROUP string `help:"group Id or Name" json:"-"`
|
||||
USER []string `help:"list of user id or name" json:"user"`
|
||||
}
|
||||
R(&GroupAddUsersOptions{}, "group-add-users", "Add users into group",
|
||||
func(s *mcclient.ClientSession, args *GroupAddUsersOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Groups.PerformAction(s, args.GROUP, "add-users", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
R(&GroupAddUsersOptions{}, "group-remove-users", "Add users into group",
|
||||
func(s *mcclient.ClientSession, args *GroupAddUsersOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Groups.PerformAction(s, args.GROUP, "remove-users", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
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() {
|
||||
@@ -203,36 +201,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&HostListOptions{}, "host-node-count", "Get host node count", func(s *mcclient.ClientSession, opts *HostListOptions) error {
|
||||
params, err := options.ListStructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if opts.Empty {
|
||||
params.Add(jsonutils.JSONTrue, "is_empty")
|
||||
} else if opts.Occupied {
|
||||
params.Add(jsonutils.JSONFalse, "is_empty")
|
||||
}
|
||||
if opts.Enabled {
|
||||
params.Add(jsonutils.NewInt(1), "enabled")
|
||||
} else if opts.Disabled {
|
||||
params.Add(jsonutils.NewInt(0), "enabled")
|
||||
}
|
||||
if len(opts.Uuid) > 0 {
|
||||
params.Add(jsonutils.NewString(opts.Uuid), "uuid")
|
||||
}
|
||||
if len(opts.Sn) > 0 {
|
||||
params.Add(jsonutils.NewString(opts.Sn), "sn")
|
||||
}
|
||||
result, err := modules.Hosts.Get(s, "node-count", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type HostUpdateOptions struct {
|
||||
ID string `help:"ID or Name of Host"`
|
||||
Name string `help:"New name of the host"`
|
||||
@@ -696,123 +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
|
||||
})
|
||||
|
||||
type HostChangeOwnerOptions struct {
|
||||
ID string `help:"ID or name of host" json:"-"`
|
||||
ProjectDomain string `json:"project_domain" help:"target domain"`
|
||||
}
|
||||
R(&HostChangeOwnerOptions{}, "host-change-owner", "Change owner domain of host", func(s *mcclient.ClientSession, args *HostChangeOwnerOptions) error {
|
||||
if len(args.ProjectDomain) == 0 {
|
||||
return fmt.Errorf("empty project_domain")
|
||||
}
|
||||
params := jsonutils.Marshal(args)
|
||||
ret, err := modules.Hosts.PerformAction(s, args.ID, "change-owner", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
type HostPublicOptions struct {
|
||||
ID string `help:"ID or name of host" json:"-"`
|
||||
Scope string `help:"sharing scope" choices:"system|domain"`
|
||||
SharedDomains []string `help:"share to domains"`
|
||||
}
|
||||
R(&HostPublicOptions{}, "host-public", "Make a host public", func(s *mcclient.ClientSession, args *HostPublicOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Hosts.PerformAction(s, args.ID, "public", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type HostPrivateOptions struct {
|
||||
ID string `help:"ID or name of host" json:"-"`
|
||||
}
|
||||
R(&HostPrivateOptions{}, "host-private", "Make a host private", func(s *mcclient.ClientSession, args *HostPrivateOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Hosts.PerformAction(s, args.ID, "private", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type HostChangeOwnerCandidateDomainsOptions struct {
|
||||
ID string `help:"ID or name of host"`
|
||||
}
|
||||
R(&HostChangeOwnerCandidateDomainsOptions{}, "host-change-owner-candidate-domains", "Get change owner candidate domain list", func(s *mcclient.ClientSession, args *HostChangeOwnerCandidateDomainsOptions) error {
|
||||
result, err := modules.Hosts.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type HostAutoMigrateOnHostDownOptions struct {
|
||||
ID string `help:"ID or name of host"`
|
||||
Enable bool `help:"enable auto migrate"`
|
||||
Disable bool `help:"disable auto migrate"`
|
||||
}
|
||||
R(&HostAutoMigrateOnHostDownOptions{}, "host-auto-migrate-on-host-down", "Get change owner candidate domain list", func(s *mcclient.ClientSession, args *HostAutoMigrateOnHostDownOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
if args.Disable {
|
||||
params.Set("auto_migrate_on_host_down", jsonutils.NewString("disable"))
|
||||
} else if args.Enable {
|
||||
params.Set("auto_migrate_on_host_down", jsonutils.NewString("enable"))
|
||||
} else {
|
||||
return fmt.Errorf("missing input enable or disable")
|
||||
}
|
||||
result, err := modules.Hosts.PerformAction(s, args.ID, "auto-migrate-on-host-down", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
"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/shellutils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -295,36 +294,4 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type IdentityProviderConfigEditOptions struct {
|
||||
IDP string `help:"identity provider name or ID"`
|
||||
}
|
||||
R(&IdentityProviderConfigEditOptions{}, "idp-config-edit", "Edit config yaml of an identity provider", func(s *mcclient.ClientSession, args *IdentityProviderConfigEditOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.JSONTrue, "sensitive")
|
||||
conf, err := modules.IdentityProviders.GetSpecific(s, args.IDP, "config", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
confJson, err := conf.Get("config")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
content, err := shellutils.Edit(confJson.YAMLString())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
yamlJson, err := jsonutils.ParseYAML(content)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
config := jsonutils.NewDict()
|
||||
config.Add(yamlJson, "config")
|
||||
nconf, err := modules.IdentityProviders.PerformAction(s, args.IDP, "config", config)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(nconf.PrettyString())
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ type ImageOptionalOptions struct {
|
||||
Unprotected bool `help:"Allow image to be deleted"`
|
||||
Standard bool `help:"Mark image as a standard image"`
|
||||
Nonstandard bool `help:"Mark image as a non-standard image"`
|
||||
Public bool `help:"make image public"`
|
||||
MinDisk int64 `help:"Disk size after expanded, in MB" metavar:"MIN_DISK_SIZE_MB"`
|
||||
MinRam int64 `help:"Minimal memory size required" metavar:"MIN_RAM_MB"`
|
||||
VirtualSize int64 `help:"Disk size after expanded, in MB"`
|
||||
@@ -51,14 +50,14 @@ 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"`
|
||||
DisableUsbKbd bool `help:"Disable usb keyboard on this image(for hypervisor kvm)"`
|
||||
}
|
||||
|
||||
func addImageOptionalOptions(s *mcclient.ClientSession, params *jsonutils.JSONDict, args ImageOptionalOptions) error {
|
||||
if len(args.Format) > 0 {
|
||||
params.Add(jsonutils.NewString("bare"), "container-format")
|
||||
params.Add(jsonutils.NewString(args.Format), "disk-format")
|
||||
}
|
||||
if args.Protected && !args.Unprotected {
|
||||
@@ -71,9 +70,6 @@ func addImageOptionalOptions(s *mcclient.ClientSession, params *jsonutils.JSONDi
|
||||
} else if !args.Standard && args.Nonstandard {
|
||||
params.Add(jsonutils.JSONFalse, "is_standard")
|
||||
}
|
||||
if args.Public {
|
||||
params.Add(jsonutils.JSONTrue, "is_public")
|
||||
}
|
||||
if args.MinDisk > 0 {
|
||||
params.Add(jsonutils.NewString(fmt.Sprintf("%d", args.MinDisk)), "min_disk")
|
||||
}
|
||||
@@ -132,9 +128,6 @@ func addImageOptionalOptions(s *mcclient.ClientSession, params *jsonutils.JSONDi
|
||||
if len(args.Hypervisor) > 0 {
|
||||
params.Add(jsonutils.NewString(strings.Join(args.Hypervisor, ",")), "properties", "hypervisor")
|
||||
}
|
||||
if args.DisableUsbKbd {
|
||||
params.Add(jsonutils.NewString("true"), "properties", "disable_usb_kbd")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -147,7 +140,6 @@ func init() {
|
||||
Protected string `help:"filter images by protected" choices:"true|false"`
|
||||
IsUefi bool `help:"list uefi image"`
|
||||
Format []string `help:"Disk formats"`
|
||||
SubFormats []string `help:"Sub formats"`
|
||||
Name string `help:"Name filter"`
|
||||
}
|
||||
R(&ImageListOptions{}, "image-list", "List images", func(s *mcclient.ClientSession, args *ImageListOptions) error {
|
||||
@@ -178,14 +170,15 @@ func init() {
|
||||
params.Add(jsonutils.NewString(args.Name), "name")
|
||||
}
|
||||
if len(args.Format) > 0 {
|
||||
fs := jsonutils.NewArray()
|
||||
for _, f := range args.Format {
|
||||
fs.Add(jsonutils.NewString(f))
|
||||
if len(args.Format) == 1 {
|
||||
params.Add(jsonutils.NewString(args.Format[0]), "disk_format")
|
||||
} else {
|
||||
fs := jsonutils.NewArray()
|
||||
for _, f := range args.Format {
|
||||
fs.Add(jsonutils.NewString(f))
|
||||
}
|
||||
params.Add(fs, "disk_formats")
|
||||
}
|
||||
params.Add(fs, "disk_formats")
|
||||
}
|
||||
if len(args.SubFormats) > 0 {
|
||||
params.Add(jsonutils.Marshal(args.SubFormats), "sub_formats")
|
||||
}
|
||||
result, err := modules.Images.List(s, params)
|
||||
if err != nil {
|
||||
@@ -251,12 +244,28 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type ImageMembershipOptions struct {
|
||||
IMAGE string `help:"ID or name of image to share"`
|
||||
PROJECT string `help:"ID or name of project to share image with"`
|
||||
}
|
||||
type ImageMembershipAddOptions struct {
|
||||
ImageMembershipOptions
|
||||
CanShare bool `help:"Indicating whether the project can share the image with others"`
|
||||
}
|
||||
R(&ImageMembershipAddOptions{}, "image-add-project", "Add a project to private image's membership list", func(s *mcclient.ClientSession, args *ImageMembershipAddOptions) error {
|
||||
return modules.Images.AddMembership(s, args.IMAGE, args.PROJECT, args.CanShare)
|
||||
})
|
||||
|
||||
R(&ImageMembershipOptions{}, "image-remove-project", "Remove a project from private image's membership list", func(s *mcclient.ClientSession, args *ImageMembershipOptions) error {
|
||||
return modules.Images.RemoveMembership(s, args.IMAGE, args.PROJECT)
|
||||
})
|
||||
|
||||
type ImageDetailOptions struct {
|
||||
ID string `help:"Image ID or name"`
|
||||
}
|
||||
|
||||
type ImageDeleteOptions struct {
|
||||
ID []string `help:"Image ID or name" json:"-"`
|
||||
ID []string `help:"Image ID or name"`
|
||||
OverridePendingDelete *bool `help:"Delete image directly instead of pending delete" short-token:"f"`
|
||||
}
|
||||
R(&ImageDeleteOptions{}, "image-delete", "Delete a image", func(s *mcclient.ClientSession, args *ImageDeleteOptions) error {
|
||||
@@ -269,6 +278,19 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&ImageDetailOptions{}, "image-list-project", "List image members", func(s *mcclient.ClientSession, args *ImageDetailOptions) error {
|
||||
imgId, e := modules.Images.GetId(s, args.ID, nil)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
result, e := modules.Images.ListMemberProjects(s, imgId)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
printList(result, modules.Projects.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
type ImageCancelDeleteOptions struct {
|
||||
ID string `help:"Image id or name" metavar:"IMAGE"`
|
||||
}
|
||||
@@ -394,12 +416,14 @@ func init() {
|
||||
|
||||
type ImagePublicOptions struct {
|
||||
ID []string `help:"ID or name of image" json:"-"`
|
||||
Scope string `help:"sharing scope" choices:"system|domain|project"`
|
||||
SharedProjects []string `help:"Share to projects"`
|
||||
SharedDomains []string `help:"Share to domains"`
|
||||
Scope string `help:"sharing scope" choices:"system|domain"`
|
||||
ShareToProject []string `help:"Share to prject"`
|
||||
}
|
||||
R(&ImagePublicOptions{}, "image-public", "Make a image public", func(s *mcclient.ClientSession, args *ImagePublicOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
params, err := options.StructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(args.ID) == 0 {
|
||||
return fmt.Errorf("No image ID provided")
|
||||
} else if len(args.ID) == 1 {
|
||||
|
||||
@@ -68,7 +68,7 @@ func init() {
|
||||
type HistoricProcessInstanceStaticticsOptions struct {
|
||||
ID string `help:"ID of user"`
|
||||
}
|
||||
R(&HistoricProcessInstanceStaticticsOptions{}, "historic-process-instance-statistics", "Show statistics for historic process instance", func(s *mcclient.ClientSession, args *HistoricProcessInstanceStaticticsOptions) error {
|
||||
R(&HistoricProcessInstanceStaticticsOptions{}, "historic-process-instance-statistics", "Delete all contacts for the user", func(s *mcclient.ClientSession, args *HistoricProcessInstanceStaticticsOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.ID), "user_id")
|
||||
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ func init() {
|
||||
printList(result, modules.LoadbalancerClusters.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
R(&options.LoadbalancerClusterDeleteOptions{}, "lbcluster-delete", "Delete lbcluster", func(s *mcclient.ClientSession, opts *options.LoadbalancerClusterDeleteOptions) error {
|
||||
R(&options.LoadbalancerClusterDeleteOptions{}, "lbcluster-delete", "Show lbcluster", func(s *mcclient.ClientSession, opts *options.LoadbalancerClusterDeleteOptions) error {
|
||||
lbagent, err := modules.LoadbalancerClusters.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -99,13 +99,4 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.LoadbalancerGetOptions{}, "lb-change-owner-candidate-domains", "Get change owner candidate domain list", func(s *mcclient.ClientSession, args *options.LoadbalancerGetOptions) error {
|
||||
result, err := modules.Loadbalancers.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
@@ -44,12 +43,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
listResult := modulebase.ListResult{}
|
||||
err = result.Unmarshal(&listResult)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(&listResult, []string{})
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -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,74 +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 (
|
||||
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
|
||||
})
|
||||
}
|
||||
@@ -1,53 +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/jsonutils"
|
||||
|
||||
"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("suggestsysalert")
|
||||
R(&options.SuggestSysAlertListOptions{}, aN("list"), "List all suggestsysrules",
|
||||
func(s *mcclient.ClientSession, args *options.SuggestSysAlertListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(args.Type) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Type), "type")
|
||||
}
|
||||
ret, err := monitor.SuggestSysAlertManager.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(ret, monitor.SuggestSysAlertManager.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SSuggestAlertShowOptions{}, aN("show"), "Show details of a alert rule",
|
||||
func(s *mcclient.ClientSession, args *options.SSuggestAlertShowOptions) error {
|
||||
ret, err := monitor.SuggestSysAlertManager.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -1,84 +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() {
|
||||
aN := cmdN("suggestsysrule")
|
||||
R(&options.SuggestRuleListOptions{}, aN("list"), "List all suggestsysrules",
|
||||
func(s *mcclient.ClientSession, args *options.SuggestRuleListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.SuggestSysRuleManager.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(ret, monitor.SuggestSysRuleManager.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SuggestRuleCreateOptions{}, aN("create"), "Create suggestsys rule",
|
||||
func(s *mcclient.ClientSession, args *options.SuggestRuleCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.SuggestSysRuleManager.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SuggestRuleShowOptions{}, aN("show"), "Show details of a alert rule",
|
||||
func(s *mcclient.ClientSession, args *options.SuggestRuleShowOptions) error {
|
||||
ret, err := monitor.SuggestSysRuleManager.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SuggestRuleUpdateOptions{}, aN("update"), "Update a alert rule",
|
||||
func(s *mcclient.ClientSession, args *options.SuggestRuleUpdateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.SuggestSysRuleManager.Update(s, args.ID, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SuggestRuleDeleteOptions{}, aN("delete"), "Delete alerts",
|
||||
func(s *mcclient.ClientSession, args *options.SuggestRuleDeleteOptions) error {
|
||||
ret := monitor.SuggestSysRuleManager.BatchDelete(s, args.ID, nil)
|
||||
printBatchResults(ret, monitor.SuggestSysRuleManager.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
@@ -35,7 +35,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NatGatewayIdOptions{}, "natgateway-show", "Show a NAT gateway", func(s *mcclient.ClientSession, args *options.NatGatewayIdOptions) error {
|
||||
R(&options.NatGatewayShowOptions{}, "natgateway-show", "Show a NAT gateway", func(s *mcclient.ClientSession, args *options.NatGatewayShowOptions) error {
|
||||
results, err := modules.NatGateways.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -44,15 +44,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NatGatewayIdOptions{}, "natgateway-syncstatus", "Sync NAT gateway status", func(s *mcclient.ClientSession, args *options.NatGatewayIdOptions) error {
|
||||
result, err := modules.NatGateways.PerformAction(s, args.ID, "syncstatus", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NatGatewayListEipOptions struct {
|
||||
ID string `help:"ID"`
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ func init() {
|
||||
City string `help:"search networks belongs to a city"`
|
||||
Usable *bool `help:"search usable networks"`
|
||||
ServerType string `help:"search networks belongs to a ServerType" choices:"guest|baremetal|container|pxe|ipmi"`
|
||||
Schedtag string `help:"filter networks by schedtag"`
|
||||
|
||||
Status string `help:"filter by network status"`
|
||||
}
|
||||
@@ -56,11 +55,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(opts.ExportFile) > 0 {
|
||||
exportList(result, opts.ExportFile, opts.ExportKeys, opts.ExportTexts, modules.Networks.GetColumns(s))
|
||||
} else {
|
||||
printList(result, modules.Networks.GetColumns(s))
|
||||
}
|
||||
printList(result, modules.Networks.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -144,10 +139,10 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkIdOptions struct {
|
||||
type NetworkShowOptions struct {
|
||||
ID string `help:"ID or Name of the zone to show"`
|
||||
}
|
||||
R(&NetworkIdOptions{}, "network-show", "Show network details", func(s *mcclient.ClientSession, args *NetworkIdOptions) error {
|
||||
R(&NetworkShowOptions{}, "network-show", "Show network details", func(s *mcclient.ClientSession, args *NetworkShowOptions) error {
|
||||
result, err := modules.Networks.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -156,7 +151,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&NetworkIdOptions{}, "network-metadata", "Show metadata of a network", func(s *mcclient.ClientSession, args *NetworkIdOptions) error {
|
||||
R(&NetworkShowOptions{}, "network-metadata", "Show metadata of a network", func(s *mcclient.ClientSession, args *NetworkShowOptions) error {
|
||||
result, err := modules.Networks.GetMetadata(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -165,7 +160,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&NetworkIdOptions{}, "network-private", "Make a network private", func(s *mcclient.ClientSession, args *NetworkIdOptions) error {
|
||||
R(&NetworkShowOptions{}, "network-private", "Make a network private", func(s *mcclient.ClientSession, args *NetworkShowOptions) error {
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "private", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -174,23 +169,16 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&NetworkIdOptions{}, "network-syncstatus", "Sync network status", func(s *mcclient.ClientSession, args *NetworkIdOptions) error {
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "syncstatus", nil)
|
||||
type NetworkShareOptions struct {
|
||||
NetworkShowOptions
|
||||
Scope string `help:"sharing scope" choices:"system|domain"`
|
||||
ShareToProject []string `help:"Share to prject"`
|
||||
}
|
||||
R(&NetworkShareOptions{}, "network-public", "Make a network public", func(s *mcclient.ClientSession, args *NetworkShareOptions) error {
|
||||
params, err := options.StructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkShareOptions struct {
|
||||
NetworkIdOptions
|
||||
Scope string `help:"sharing scope" choices:"system|domain|project"`
|
||||
SharedProjects []string `help:"Share to prjects"`
|
||||
SharedDomains []string `help:"share to domains"`
|
||||
}
|
||||
R(&NetworkShareOptions{}, "network-public", "Make a network public", func(s *mcclient.ClientSession, args *NetworkShareOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "public", params)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -199,7 +187,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&NetworkIdOptions{}, "network-delete", "Delete a network", func(s *mcclient.ClientSession, args *NetworkIdOptions) error {
|
||||
R(&NetworkShowOptions{}, "network-delete", "Delete a network", func(s *mcclient.ClientSession, args *NetworkShowOptions) error {
|
||||
result, err := modules.Networks.Delete(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -208,7 +196,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&NetworkIdOptions{}, "network-purge", "Purge a managed network, not delete the remote entity", func(s *mcclient.ClientSession, args *NetworkIdOptions) error {
|
||||
R(&NetworkShowOptions{}, "network-purge", "Purge a managed network, not delete the remote entity", func(s *mcclient.ClientSession, args *NetworkShowOptions) error {
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "purge", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -358,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"`
|
||||
}
|
||||
@@ -401,30 +460,4 @@ func init() {
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&NetworkIdOptions{}, "network-change-owner-candidate-domains", "Show candiate domains of a network for changing owner", func(s *mcclient.ClientSession, args *NetworkIdOptions) error {
|
||||
result, err := modules.Networks.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkChangeOwnerOptions struct {
|
||||
ID string `help:"Network to change owner" json:"-"`
|
||||
PROJECT string `help:"Project ID or change" json:"tenant"`
|
||||
}
|
||||
R(&NetworkChangeOwnerOptions{}, "network-change-owner", "Change owner project of a network", func(s *mcclient.ClientSession, args *NetworkChangeOwnerOptions) error {
|
||||
params, err := options.StructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
net, err := modules.Networks.PerformAction(s, args.ID, "change-owner", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(net)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -59,18 +59,18 @@ func init() {
|
||||
* 修改指定的报警规则
|
||||
*/
|
||||
type NodealertUpdateOptions struct {
|
||||
ID string `help:"ID of the alert rule" required:"true" positional:"true"`
|
||||
Type string `help:"Alert rule type" choices:"guest|host"`
|
||||
Metric string `help:"Metric name, include measurement and field, such as vm_cpu.usage_active"`
|
||||
NodeName string `help:"Name of the guest or host"`
|
||||
NodeID string `help:"ID of the guest or host"`
|
||||
Period string `help:"Specify the query time period for the data"`
|
||||
Window string `help:"Specify the query interval for the data"`
|
||||
Threshold *float64 `help:"Threshold value of the metric"`
|
||||
Comparator string `help:"Comparison operator for join expressions" choices:">|<|>=|<=|=|!="`
|
||||
Recipients string `help:"Comma separated recipient ID"`
|
||||
Level string `help:"Alert level" choices:"normal|important|fatal"`
|
||||
Channel string `help:"Ways to send an alarm" choices:"email|mobile"`
|
||||
ID string `help:"ID of the alert rule" required:"true" positional:"true"`
|
||||
Type string `help:"Alert rule type" choices:"guest|host"`
|
||||
Metric string `help:"Metric name, include measurement and field, such as vm_cpu.usage_active"`
|
||||
NodeName string `help:"Name of the guest or host"`
|
||||
NodeID string `help:"ID of the guest or host"`
|
||||
Period string `help:"Specify the query time period for the data"`
|
||||
Window string `help:"Specify the query interval for the data"`
|
||||
Threshold float64 `help:"Threshold value of the metric"`
|
||||
Comparator string `help:"Comparison operator for join expressions" choices:">|<|>=|<=|=|!="`
|
||||
Recipients string `help:"Comma separated recipient ID"`
|
||||
Level string `help:"Alert level" choices:"normal|important|fatal"`
|
||||
Channel string `help:"Ways to send an alarm" choices:"email|mobile"`
|
||||
}
|
||||
R(&NodealertUpdateOptions{}, "nodealert-update", "Update the node alert rule", func(s *mcclient.ClientSession, args *NodealertUpdateOptions) error {
|
||||
params, err := options.StructToParams(args)
|
||||
@@ -92,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
|
||||
})
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ func init() {
|
||||
NAME string `help:"The name of parameter"`
|
||||
}
|
||||
|
||||
R(&ParametersDeleteOptions{}, "parameter-delete", "delete parameter", func(s *mcclient.ClientSession, args *ParametersDeleteOptions) error {
|
||||
R(&ParametersDeleteOptions{}, "parameter-delete", "delete notice", func(s *mcclient.ClientSession, args *ParametersDeleteOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
|
||||
var parameter jsonutils.JSONObject
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
@@ -135,16 +134,13 @@ 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 PolicyPublicOptions struct {
|
||||
ID string `help:"ID of policy to update" json:"-"`
|
||||
Scope string `help:"sharing scope" choices:"system|domain"`
|
||||
SharedDomains []string `help:"share to domains"`
|
||||
type PolicyPerformOptions struct {
|
||||
ID string `help:"ID of policy to update"`
|
||||
}
|
||||
R(&PolicyPublicOptions{}, "policy-public", "Mark a policy public", func(s *mcclient.ClientSession, args *PolicyPublicOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Policies.PerformAction(s, args.ID, "public", params)
|
||||
R(&PolicyPerformOptions{}, "policy-public", "Mark a policy public", func(s *mcclient.ClientSession, args *PolicyPerformOptions) error {
|
||||
result, err := modules.Policies.PerformAction(s, args.ID, "public", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -152,10 +148,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type PolicyPrivateOptions struct {
|
||||
ID string `help:"ID of policy to update" json:"-"`
|
||||
}
|
||||
R(&PolicyPrivateOptions{}, "policy-private", "Mark a policy private", func(s *mcclient.ClientSession, args *PolicyPrivateOptions) error {
|
||||
R(&PolicyPerformOptions{}, "policy-private", "Mark a policy private", func(s *mcclient.ClientSession, args *PolicyPerformOptions) error {
|
||||
result, err := modules.Policies.PerformAction(s, args.ID, "private", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -191,7 +184,11 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
yaml, err := result.GetString("policy")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println(yaml)
|
||||
return nil
|
||||
})
|
||||
|
||||
@@ -288,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], ":")
|
||||
@@ -377,22 +356,17 @@ func init() {
|
||||
Context: mcclient.SAuthContext{
|
||||
Ip: args.Ip,
|
||||
},
|
||||
Token: "faketoken",
|
||||
}
|
||||
} else {
|
||||
token = s.GetToken()
|
||||
}
|
||||
|
||||
result, err := policy.ExplainRpc(context.Background(), token, req, args.Name)
|
||||
result, err := policy.PolicyManager.ExplainRpc(token, req, args.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
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,
|
||||
@@ -401,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,59 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type PolicyListOptions struct {
|
||||
options.BaseListOptions
|
||||
Policydefinition string `help:"filter by policydefinition"`
|
||||
}
|
||||
R(&PolicyListOptions{}, "policy-assignment-list", "List policy assignments", func(s *mcclient.ClientSession, args *PolicyListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(args.Policydefinition) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Policydefinition), "policydefinition")
|
||||
}
|
||||
result, err := modules.PolicyAssignment.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.PolicyAssignment.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
type PolicyIdOptions struct {
|
||||
ID string `help:"policy assignment id or name"`
|
||||
}
|
||||
|
||||
R(&PolicyIdOptions{}, "policy-assignment-show", "Show policy assignment details", func(s *mcclient.ClientSession, args *PolicyIdOptions) error {
|
||||
result, err := modules.PolicyAssignment.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
|
||||
})
|
||||
}
|
||||
@@ -1,62 +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() {
|
||||
type PolicyListOptions struct {
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&PolicyListOptions{}, "policy-definition-list", "List policy definitions", func(s *mcclient.ClientSession, args *PolicyListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := modules.PolicyDefinition.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.PolicyDefinition.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
type PolicyIdOptions struct {
|
||||
ID string `help:"policy definition name or id"`
|
||||
}
|
||||
|
||||
R(&PolicyIdOptions{}, "policy-definition-show", "Show policy definition", func(s *mcclient.ClientSession, args *PolicyIdOptions) error {
|
||||
result, err := modules.PolicyDefinition.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&PolicyIdOptions{}, "policy-definition-syncstatus", "Sync policy definition status", func(s *mcclient.ClientSession, args *PolicyIdOptions) error {
|
||||
result, err := modules.PolicyDefinition.PerformAction(s, args.ID, "syncstatus", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
@@ -82,12 +82,11 @@ func init() {
|
||||
})
|
||||
|
||||
type ProjectCreateOptions struct {
|
||||
NAME string `help:"Name of new project"`
|
||||
Displayname string `help:"display name"`
|
||||
Domain string `help:"Domain"`
|
||||
Desc string `help:"Description"`
|
||||
Enabled bool `help:"Project is enabled"`
|
||||
Disabled bool `help:"Project is disabled"`
|
||||
NAME string `help:"Name of new project"`
|
||||
Domain string `help:"Domain"`
|
||||
Desc string `help:"Description"`
|
||||
Enabled bool `help:"Project is enabled"`
|
||||
Disabled bool `help:"Project is disabled"`
|
||||
}
|
||||
R(&ProjectCreateOptions{}, "project-create", "Create a project", func(s *mcclient.ClientSession, args *ProjectCreateOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
@@ -107,9 +106,6 @@ func init() {
|
||||
if len(args.Desc) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Desc), "description")
|
||||
}
|
||||
if len(args.Displayname) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Displayname), "displayname")
|
||||
}
|
||||
result, err := modules.Projects.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
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
|
||||
})
|
||||
R(&options.ProxySettingPublicOptions{}, "proxysetting-public", "Make proxysetting public", func(s *mcclient.ClientSession, opts *options.ProxySettingPublicOptions) error {
|
||||
params := jsonutils.Marshal(opts)
|
||||
result, err := modules.ProxySettings.PerformAction(s, opts.ID, "public", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingPrivateOptions{}, "proxysetting-private", "Make proxysetting private", func(s *mcclient.ClientSession, opts *options.ProxySettingPrivateOptions) error {
|
||||
params := jsonutils.Marshal(opts)
|
||||
result, err := modules.ProxySettings.PerformAction(s, opts.ID, "private", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -94,25 +94,6 @@ type ImageQuotaOptions struct {
|
||||
Image int64 `help:"Template count" json:"image,omitzero"`
|
||||
}
|
||||
|
||||
type DomainQuotaOptions struct {
|
||||
Cloudaccount int64 `help:"cloudaccount count" json:"cloudaccount,omitzero"`
|
||||
}
|
||||
|
||||
type InfrasQuotaOptions struct {
|
||||
RegionQuotaKeys
|
||||
|
||||
Host int64 `help:"host count" json:"host,omitzero"`
|
||||
Vpc int64 `help:"vpc count" json:"vpc,omitzero"`
|
||||
}
|
||||
|
||||
type IdentityQuotaOptions struct {
|
||||
User int64 `help:"user count" json:"user,omitzero"`
|
||||
Group int64 `help:"group count" json:"group,omitzero"`
|
||||
Project int64 `help:"project count" json:"project,omitzero"`
|
||||
Role int64 `help:"role count" json:"role,omitzero"`
|
||||
Policy int64 `help:"policy count" json:"policy,omitzero"`
|
||||
}
|
||||
|
||||
type QuotaSetBaseOptions struct {
|
||||
Project string `help:"Tenant name or ID to set quota" json:"tenant,omitempty"`
|
||||
Domain string `help:"Domain name or ID to set quota" json:"domain,omitempty"`
|
||||
@@ -186,33 +167,6 @@ func init() {
|
||||
printQuotaList(quotas)
|
||||
return nil
|
||||
})
|
||||
R(&QuotaOptions{}, "domain-quota", "Show domain-quota for current domain", func(s *mcclient.ClientSession, args *QuotaOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.DomainQuotas.GetQuota(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printQuotaList(result)
|
||||
return nil
|
||||
})
|
||||
R(&QuotaOptions{}, "infras-quota", "Show infras-quota for current domain", func(s *mcclient.ClientSession, args *QuotaOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.InfrasQuotas.GetQuota(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printQuotaList(result)
|
||||
return nil
|
||||
})
|
||||
R(&QuotaOptions{}, "identity-quota", "Show identity-quota for current domain", func(s *mcclient.ClientSession, args *QuotaOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.IdentityQuotas.GetQuota(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printQuotaList(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type ComputeQuotaSetOptions struct {
|
||||
QuotaSetBaseOptions
|
||||
@@ -284,48 +238,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type DomainQuotaSetOptions struct {
|
||||
QuotaSetBaseOptions
|
||||
DomainQuotaOptions
|
||||
}
|
||||
R(&DomainQuotaSetOptions{}, "domain-quota-set", "Set domain quota for domain", func(s *mcclient.ClientSession, args *DomainQuotaSetOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
quotas, e := modules.DomainQuotas.DoQuotaSet(s, params)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
printQuotaList(quotas)
|
||||
return nil
|
||||
})
|
||||
|
||||
type InfrasQuotaSetOptions struct {
|
||||
QuotaSetBaseOptions
|
||||
InfrasQuotaOptions
|
||||
}
|
||||
R(&InfrasQuotaSetOptions{}, "infras-quota-set", "Set infrastructure quota for domain", func(s *mcclient.ClientSession, args *InfrasQuotaSetOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
quotas, e := modules.InfrasQuotas.DoQuotaSet(s, params)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
printQuotaList(quotas)
|
||||
return nil
|
||||
})
|
||||
|
||||
type IdentityQuotaSetOptions struct {
|
||||
QuotaSetBaseOptions
|
||||
IdentityQuotaOptions
|
||||
}
|
||||
R(&IdentityQuotaSetOptions{}, "identity-quota-set", "Set identity quota for domain", func(s *mcclient.ClientSession, args *InfrasQuotaSetOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
quotas, e := modules.IdentityQuotas.DoQuotaSet(s, params)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
printQuotaList(quotas)
|
||||
return nil
|
||||
})
|
||||
|
||||
type QuotaListOptions struct {
|
||||
ProjectDomain string `help:"domain name or ID to query project quotas"`
|
||||
Refresh bool `help:"refresh" json:"refresh,omitfalse"`
|
||||
@@ -381,36 +293,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&QuotaListOptions{}, "domain-quota-list", "List domain quota of domains", func(s *mcclient.ClientSession, args *QuotaListOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, e := modules.DomainQuotas.GetQuotaList(s, params)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
printQuotaList(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&QuotaListOptions{}, "infras-quota-list", "List infrastructure quota of domains", func(s *mcclient.ClientSession, args *QuotaListOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, e := modules.InfrasQuotas.GetQuotaList(s, params)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
printQuotaList(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&QuotaListOptions{}, "identity-quota-list", "List identity quota of domains", func(s *mcclient.ClientSession, args *QuotaListOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, e := modules.IdentityQuotas.GetQuotaList(s, params)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
printQuotaList(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type CleanPendingUsageOptions struct {
|
||||
Scope string `help:"scope" choices:"domain|project"`
|
||||
Project string `help:"Tenant name or ID" json:"tenant"`
|
||||
@@ -461,30 +343,4 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&CleanPendingUsageOptions{}, "clean-domain-pending-usage", "Clean pending usage for project or domain", func(s *mcclient.ClientSession, args *CleanPendingUsageOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
_, err := modules.DomainQuotas.DoCleanPendingUsage(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&CleanPendingUsageOptions{}, "clean-infras-pending-usage", "Clean pending usage for project or domain", func(s *mcclient.ClientSession, args *CleanPendingUsageOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
_, err := modules.InfrasQuotas.DoCleanPendingUsage(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&CleanPendingUsageOptions{}, "clean-identity-pending-usage", "Clean pending usage for project or domain", func(s *mcclient.ClientSession, args *CleanPendingUsageOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
_, err := modules.IdentityQuotas.DoCleanPendingUsage(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -85,8 +85,6 @@ func init() {
|
||||
NAME string `help:"Role name"`
|
||||
Domain string `help:"Domain"`
|
||||
Desc string `help:"Description"`
|
||||
|
||||
PublicScope string `help:"public scope" choices:"none|system"`
|
||||
}
|
||||
R(&RoleCreateOptions{}, "role-create", "Create a new role", func(s *mcclient.ClientSession, args *RoleCreateOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
@@ -101,9 +99,6 @@ func init() {
|
||||
if len(args.Desc) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Desc), "description")
|
||||
}
|
||||
if len(args.PublicScope) > 0 {
|
||||
params.Add(jsonutils.NewString(args.PublicScope), "public_scope")
|
||||
}
|
||||
role, err := modules.RolesV3.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -121,7 +121,7 @@ func init() {
|
||||
printObjectRecursive(routetable)
|
||||
return nil
|
||||
})
|
||||
R(&options.RouteTableDeleteOptions{}, "routetable-delete", "Delete routetable", func(s *mcclient.ClientSession, opts *options.RouteTableDeleteOptions) error {
|
||||
R(&options.RouteTableDeleteOptions{}, "routetable-delete", "Show routetable", func(s *mcclient.ClientSession, opts *options.RouteTableDeleteOptions) error {
|
||||
routetable, err := modules.RouteTables.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -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 shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type ScalingActivityListOptions struct {
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&ScalingActivityListOptions{}, "scaling-activity-list", "List Scaling Activity",
|
||||
func(s *mcclient.ClientSession, args *ScalingActivityListOptions) error {
|
||||
params, err := options.ListStructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
list, err := modules.ScalingActivity.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(list, modules.ScalingActivity.GetColumns(s))
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type ScalingGroupListOptions struct {
|
||||
options.BaseListOptions
|
||||
Hypervisor string `help:"Hypervisor"`
|
||||
Cloudregion string `help:"Cloudregion"`
|
||||
Network string `help:"network"`
|
||||
}
|
||||
R(&ScalingGroupListOptions{}, "scaling-group-list", "List scaling group", func(s *mcclient.ClientSession, args *ScalingGroupListOptions) error {
|
||||
params, err := options.ListStructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := modules.ScalingGroup.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.ScalingGroup.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
type ScalingGroupShowOptions struct {
|
||||
ID string
|
||||
}
|
||||
R(&ScalingGroupShowOptions{}, "scaling-group-show", "Show scaling group", func(s *mcclient.ClientSession,
|
||||
args *ScalingGroupShowOptions) error {
|
||||
result, err := modules.ScalingGroup.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type ScalingGroupCreateOptions struct {
|
||||
NAME string
|
||||
|
||||
Hypervisor string
|
||||
Cloudregion string
|
||||
Network string
|
||||
GuestTemplate string
|
||||
MinInstanceNumber string
|
||||
MaxInstanceNumber string
|
||||
DesireInstanceNumber string
|
||||
Loadbalance string
|
||||
}
|
||||
R(&ScalingGroupCreateOptions{}, "scaling-group-create", "Create scaling group", func(s *mcclient.ClientSession, args *ScalingGroupCreateOptions) error {
|
||||
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
|
||||
scalingGroup, err := modules.ScalingGroup.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(scalingGroup)
|
||||
return nil
|
||||
})
|
||||
type ScalingGroupDeleteOptions struct {
|
||||
ID string `help:"ScalingGroup ID or Name"`
|
||||
}
|
||||
R(&ScalingGroupDeleteOptions{}, "scaling-group-delete", "Delete Scaling Group", func(s *mcclient.ClientSession,
|
||||
args *ScalingGroupDeleteOptions) error {
|
||||
scalingGroup, err := modules.ScalingGroup.Delete(s, args.ID, jsonutils.NewDict())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(scalingGroup)
|
||||
return nil
|
||||
})
|
||||
type ScalingGroupListInstanceOptions struct {
|
||||
ID string `help:"ScalingGroup ID or Name"`
|
||||
}
|
||||
R(&ScalingGroupListInstanceOptions{}, "scaling-group-list-instance", "List all instance of Scaling Group",
|
||||
func(s *mcclient.ClientSession, args *ScalingGroupListInstanceOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Set("scaling_group", jsonutils.NewString(args.ID))
|
||||
servers, err := modules.Servers.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(servers, modules.Servers.GetColumns(s))
|
||||
return nil
|
||||
},
|
||||
)
|
||||
type ScalingGroupRemoveInstanceOptions struct {
|
||||
ID string `help:"ScalingGroup ID or Name"`
|
||||
SERVER string `help:"Server ID or Name"`
|
||||
Delete bool `help:"If delete the server"`
|
||||
}
|
||||
R(&ScalingGroupRemoveInstanceOptions{}, "scaling-group-remove-instance", "Remove instance of ScalingGroup",
|
||||
func(s *mcclient.ClientSession, args *ScalingGroupRemoveInstanceOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Set("scaling_group", jsonutils.NewString(args.ID))
|
||||
params.Set("delete_server", jsonutils.NewBool(args.Delete))
|
||||
server, err := modules.Servers.PerformAction(s, args.SERVER, "detach-scaling-group", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(server)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
type ScalingGroupEnableOptions struct {
|
||||
ID string `help:"ScalingGroup ID or Name"`
|
||||
}
|
||||
R(&ScalingGroupEnableOptions{}, "scaling-group-enable", "Enable ScalingGroup", func(s *mcclient.ClientSession,
|
||||
args *ScalingGroupEnableOptions) error {
|
||||
ret, err := modules.ScalingGroup.PerformAction(s, args.ID, "enable", jsonutils.NewDict())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
R(&ScalingGroupEnableOptions{}, "scaling-group-disable", "Disable ScalingGroup", func(s *mcclient.ClientSession,
|
||||
args *ScalingGroupEnableOptions) error {
|
||||
ret, err := modules.ScalingGroup.PerformAction(s, args.ID, "disable", jsonutils.NewDict())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -1,188 +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 (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type ScalingPolicyListOptions struct {
|
||||
options.BaseListOptions
|
||||
ScalingGroup string `help:"ScalingGroup ID or Name"`
|
||||
TriggerType string `help:"Trigger type" choices:"alarm|timing|cycle"`
|
||||
}
|
||||
R(&ScalingPolicyListOptions{}, "scaling-policy-list", "List Scaling Policy", func(s *mcclient.ClientSession,
|
||||
args *ScalingPolicyListOptions) error {
|
||||
params, err := options.ListStructToParams(args)
|
||||
policies, err := modules.ScalingPolicy.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(policies, modules.ScalingPolicy.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
type ScalingPolicyShowOptions struct {
|
||||
ID string `help:"ScalingPolicy ID or Name"`
|
||||
}
|
||||
R(&ScalingPolicyShowOptions{}, "scaling-policy-show", "Show Scaling Policy", func(s *mcclient.ClientSession,
|
||||
args *ScalingPolicyShowOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Set("details", jsonutils.JSONTrue)
|
||||
policy, err := modules.ScalingPolicy.Get(s, args.ID, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(policy)
|
||||
return nil
|
||||
})
|
||||
|
||||
type ScalingTimer struct {
|
||||
TimingExecTime time.Time `help:"Exectime for 'timing' type trigger" json:"exec_time"`
|
||||
}
|
||||
|
||||
type ScalingCycleTimer struct {
|
||||
CycleCycleType string `help:"Cycle type for 'cycle' type trigger" json:"cycle_type"`
|
||||
CycleMinute int `help:"Minute of 'cycle' type trigger" json:"minute"`
|
||||
CycleHour int `help:"Hour of 'cycle' type trigger" json:"hour"`
|
||||
CycleWeekdays []int `help:"Weekdays for 'cycle' type trigger" json:"weekdays"`
|
||||
CycleMonthDays []int `help:"Month days for 'cycle' type trigger" json:"month_days"`
|
||||
CycleStartTime time.Time `help:"Start time for 'cycle' type trigger" json:"start_time"`
|
||||
CycleEndTime time.Time `help:"End time for 'cycle' type trigger" json:"end_time"`
|
||||
}
|
||||
|
||||
type ScalingAlarm struct {
|
||||
AlarmCumulate int `help:"Cumulate times alarm will trigger, for 'alarm' trigger" json:"cumulate"`
|
||||
AlarmCycle int `help:"Monitoring cycle for indicators, for 'alarm' trigger" json:"cycle"`
|
||||
AlarmIndicator string `help:"Indicator for 'alarm' trigger" json:"indicator"`
|
||||
AlarmWrapper string `help:"Wrapper for Indicators" choices:"max|min|average" json:"wrapper"`
|
||||
AlarmOperator string `help:"Operator between Indicator and Operator" json:"operator"`
|
||||
AlarmValue float64 `help:"Value of Indicator" json:"value"`
|
||||
}
|
||||
|
||||
type ScalingPolicyCreateOptions struct {
|
||||
NAME string `help:"ScalingPolicy Name" json:"name"`
|
||||
ScalingGroup string `help:"ScalingGroup ID or Name" json:"scaling_group"`
|
||||
TriggerType string `help:"Trigger type" choices:"alarm|timing|cycle" json:"trigger_type"`
|
||||
|
||||
ScalingTimer
|
||||
ScalingCycleTimer
|
||||
ScalingAlarm
|
||||
|
||||
Action string `help:"Action for scaling policy" choices:"add|remove|set" json:"action"`
|
||||
Number int `help:"Instance number for action" json:"number"`
|
||||
Unit string `help:"Unit for Number" choices:"s|%" json:"unit"`
|
||||
CoolingTime int `help:"Cooling time, unit: s" json:"cooling_time"`
|
||||
}
|
||||
|
||||
R(&ScalingPolicyCreateOptions{}, "scaling-policy-create", "Create Scaling Policy",
|
||||
func(s *mcclient.ClientSession, args *ScalingPolicyCreateOptions) error {
|
||||
spCreateInput := api.ScalingPolicyCreateInput{
|
||||
ScalingGroup: args.ScalingGroup,
|
||||
TriggerType: args.TriggerType,
|
||||
Timer: api.ScalingTimerCreateInput{
|
||||
args.TimingExecTime,
|
||||
},
|
||||
CycleTimer: api.ScalingCycleTimerCreateInput{
|
||||
CycleType: args.CycleCycleType,
|
||||
Minute: args.CycleMinute,
|
||||
Hour: args.CycleHour,
|
||||
WeekDays: args.CycleWeekdays,
|
||||
MonthDays: args.CycleMonthDays,
|
||||
StartTime: args.CycleStartTime,
|
||||
EndTime: args.CycleEndTime,
|
||||
},
|
||||
Alarm: api.ScalingAlarmCreateInput{
|
||||
Cumulate: args.AlarmCumulate,
|
||||
Cycle: args.AlarmCycle,
|
||||
Indicator: args.AlarmIndicator,
|
||||
Wrapper: args.AlarmWrapper,
|
||||
Operator: args.AlarmOperator,
|
||||
Value: args.AlarmValue,
|
||||
},
|
||||
Action: args.Action,
|
||||
Number: args.Number,
|
||||
Unit: args.Unit,
|
||||
CoolingTime: args.CoolingTime,
|
||||
}
|
||||
spCreateInput.Name = args.NAME
|
||||
ret, err := modules.ScalingPolicy.Create(s, jsonutils.Marshal(spCreateInput))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
type ScalingPolicyEnableOptions struct {
|
||||
ID string `help:"ScalingPolicy ID or Name"`
|
||||
}
|
||||
R(&ScalingPolicyEnableOptions{}, "scaling-policy-enable", "Enable ScalingPolicy", func(s *mcclient.ClientSession,
|
||||
args *ScalingPolicyEnableOptions) error {
|
||||
ret, err := modules.ScalingPolicy.PerformAction(s, args.ID, "enable", jsonutils.NewDict())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
R(&ScalingPolicyEnableOptions{}, "scaling-policy-disable", "Disable ScalingPolicy",
|
||||
func(s *mcclient.ClientSession, args *ScalingPolicyEnableOptions) error {
|
||||
ret, err := modules.ScalingPolicy.PerformAction(s, args.ID, "disable", jsonutils.NewDict())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
type ScalingPolicyTriggerOptions struct {
|
||||
ID string `help:"ScalingPolicy ID or Name"`
|
||||
}
|
||||
R(&ScalingPolicyTriggerOptions{}, "scaling-policy-trigger", "Trigger ScalingPolicy's action",
|
||||
func(s *mcclient.ClientSession, args *ScalingPolicyTriggerOptions) error {
|
||||
ret, err := modules.ScalingPolicy.PerformAction(s, args.ID, "trigger", jsonutils.NewDict())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
type ScalingPolicyDeleteOptions struct {
|
||||
ID string `help:"ScalingPolicy ID or Name"`
|
||||
}
|
||||
R(&ScalingPolicyDeleteOptions{}, "scaling-policy-delete", "Delete SclaingPolicy",
|
||||
func(s *mcclient.ClientSession, args *ScalingPolicyDeleteOptions) error {
|
||||
ret, err := modules.ScalingPolicy.Delete(s, args.ID, jsonutils.NewDict())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
@@ -25,20 +25,33 @@ import (
|
||||
func init() {
|
||||
type SecGroupRulesListOptions struct {
|
||||
options.BaseListOptions
|
||||
Secgroup string `help:"Secgroup ID or Name"`
|
||||
SecgroupName string `help:"Search rules by fuzzy secgroup name"`
|
||||
Projects []string `help:"Filter rules by project"`
|
||||
Direction string `help:"filter Direction of rule" choices:"in|out"`
|
||||
Protocol string `help:"filter Protocol of rule" choices:"any|tcp|udp|icmp"`
|
||||
Action string `help:"filter Actin of rule" choices:"allow|deny"`
|
||||
Ports string `help:"filter Ports of rule"`
|
||||
Ip string `help:"filter cidr of rule"`
|
||||
Secgroup string `help:"Secgroup ID or Name"`
|
||||
Direction string `help:"filter Direction of rule" choices:"in|out"`
|
||||
Protocol string `help:"filter Protocol of rule" choices:"any|tcp|udp|icmp"`
|
||||
Action string `help:"filter Actin of rule" choices:"allow|deny"`
|
||||
}
|
||||
|
||||
R(&SecGroupRulesListOptions{}, "secgroup-rule-list", "List all security group", func(s *mcclient.ClientSession, args *SecGroupRulesListOptions) error {
|
||||
params, err := options.ListStructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Secgroup) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Secgroup), "secgroup")
|
||||
}
|
||||
if len(args.Direction) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Direction), "direction")
|
||||
}
|
||||
if len(args.Protocol) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Protocol), "protocol")
|
||||
}
|
||||
if len(args.Action) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Action), "action")
|
||||
}
|
||||
result, err := modules.SecGroupRules.List(s, params)
|
||||
if err != nil {
|
||||
@@ -60,7 +73,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&SecGroupRuleDetailOptions{}, "secgroup-rule-delete", "Delete a secgroup rule", func(s *mcclient.ClientSession, args *SecGroupRuleDetailOptions) error {
|
||||
R(&SecGroupRuleDetailOptions{}, "secgroup-rule-delete", "Delete a disk", func(s *mcclient.ClientSession, args *SecGroupRuleDetailOptions) error {
|
||||
if rule, e := modules.SecGroupRules.Delete(s, args.ID, nil); e != nil {
|
||||
return e
|
||||
} else {
|
||||
|
||||
@@ -29,15 +29,23 @@ func init() {
|
||||
Equals string `help:"Secgroup ID or Name, filter secgroups whose rules equals the specified one"`
|
||||
Server string `help:"Filter secgroups bound to specified server"`
|
||||
options.BaseListOptions
|
||||
Ip string `help:"Filter secgroup by ip"`
|
||||
Ports string `help:"Filter secgroup by ports"`
|
||||
Direction string `help:"Filter secgroup by ports" choices:"all|in|out"`
|
||||
}
|
||||
|
||||
R(&SecGroupsListOptions{}, "secgroup-list", "List all security group", func(s *mcclient.ClientSession, args *SecGroupsListOptions) error {
|
||||
params, err := options.ListStructToParams(args)
|
||||
if err != nil {
|
||||
return err
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
if len(args.Equals) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Equals), "equals")
|
||||
}
|
||||
if len(args.Server) > 0 {
|
||||
params.Add(jsonutils.NewString(args.Server), "server")
|
||||
}
|
||||
result, err := modules.SecGroups.List(s, params)
|
||||
if err != 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))
|
||||
@@ -1146,7 +1144,6 @@ func init() {
|
||||
ID string `help:"ID or name of VM"`
|
||||
DisableIsaSerial string `help:"disable isa serial device" choices:"true|false"`
|
||||
DisablePvpanic string `help:"disable pvpanic device" choices:"true|false"`
|
||||
DisableUsbKbd string `help:"disable usb kbd" choices:"true|false"`
|
||||
}
|
||||
|
||||
R(&ServerQemuParams{}, "server-set-qemu-params", "config qemu params", func(s *mcclient.ClientSession,
|
||||
@@ -1158,9 +1155,6 @@ func init() {
|
||||
if len(opts.DisablePvpanic) > 0 {
|
||||
params.Set("disable_pvpanic", jsonutils.NewString(opts.DisablePvpanic))
|
||||
}
|
||||
if len(opts.DisableUsbKbd) > 0 {
|
||||
params.Set("disable_usb_kbd", jsonutils.NewString(opts.DisableUsbKbd))
|
||||
}
|
||||
result, err := modules.Servers.PerformAction(s, opts.ID, "set-qemu-params", params)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -1237,131 +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
|
||||
})
|
||||
|
||||
type ServerPublicipToEip struct {
|
||||
ID string `help:"ID or name of VM" json:"-"`
|
||||
AutoStart bool `help:"Auto start new guest"`
|
||||
}
|
||||
|
||||
R(&ServerPublicipToEip{}, "server-publicip-to-eip", "Convert PublicIp to Eip for server", func(s *mcclient.ClientSession, opts *ServerPublicipToEip) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Set("auto_start", jsonutils.NewBool(opts.AutoStart))
|
||||
result, err := modules.Servers.PerformAction(s, opts.ID, "publicip-to-eip", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type ServerSetAutoRenew struct {
|
||||
ID string `help:"ID or name of VM" json:"-"`
|
||||
AutoRenew bool `help:"Set server auto renew or manual renew"`
|
||||
}
|
||||
|
||||
R(&ServerSetAutoRenew{}, "server-set-auto-renew", "Set autorenew for server", func(s *mcclient.ClientSession, opts *ServerSetAutoRenew) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Set("auto_renew", jsonutils.NewBool(opts.AutoRenew))
|
||||
result, err := modules.Servers.PerformAction(s, opts.ID, "set-auto-renew", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ServerConvertToKvmOptions{}, "server-convert-to-kvm", "Convert esxi server to kvm", func(s *mcclient.ClientSession, opts *options.ServerConvertToKvmOptions) error {
|
||||
params := jsonutils.Marshal(opts)
|
||||
dict := params.(*jsonutils.JSONDict)
|
||||
dict.Set("target_hypervisor", jsonutils.NewString("kvm"))
|
||||
result, err := modules.Servers.PerformAction(s, opts.ID, "convert", dict)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ServerShowOptions{}, "server-change-owner-candidate-domains", "Get change owner candidate domain list", func(s *mcclient.ClientSession, args *options.ServerShowOptions) error {
|
||||
result, err := modules.Servers.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type ServerSecgroupListOptions struct {
|
||||
options.BaseListOptions
|
||||
Server string `help:"ID or Name of Server"`
|
||||
Secgroup string `help:"Secgroup ID or name"`
|
||||
}
|
||||
R(&ServerSecgroupListOptions{}, "server-secgroup-list", "List server secgroup pairs", func(s *mcclient.ClientSession, args *ServerSecgroupListOptions) error {
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = args.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
var result *modulebase.ListResult
|
||||
var err error
|
||||
if len(args.Server) > 0 {
|
||||
result, err = modules.Serversecgroups.ListDescendent(s, args.Server, params)
|
||||
} else if len(args.Secgroup) > 0 {
|
||||
result, err = modules.Serversecgroups.ListDescendent2(s, args.Secgroup, params)
|
||||
} else {
|
||||
result, err = modules.Serversecgroups.List(s, params)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.Serversecgroups.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
type ServerSecgroupDetailOptions struct {
|
||||
SERVER string `help:"ID or Name of Server"`
|
||||
SECGROUP string `help:"ID or Name of Security Group"`
|
||||
}
|
||||
R(&ServerSecgroupDetailOptions{}, "server-secgroup-show", "Show server security group details", func(s *mcclient.ClientSession, args *ServerSecgroupDetailOptions) error {
|
||||
query := jsonutils.NewDict()
|
||||
result, err := modules.Serversecgroups.Get(s, args.SERVER, args.SECGROUP, query)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
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.ServiceCertificateCreateOptions{}, "service-cert-create", "Create service cert", func(s *mcclient.ClientSession, opts *options.ServiceCertificateCreateOptions) error {
|
||||
params, err := opts.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
cert, err := modules.ServiceCertificatesV3.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(cert)
|
||||
return nil
|
||||
})
|
||||
type ServiceCertificateGetOptions struct {
|
||||
ID string `json:"-"`
|
||||
}
|
||||
R(&ServiceCertificateGetOptions{}, "service-cert-show", "Show service cert", func(s *mcclient.ClientSession, opts *ServiceCertificateGetOptions) error {
|
||||
cert, err := modules.ServiceCertificatesV3.Get(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(cert)
|
||||
return nil
|
||||
})
|
||||
|
||||
type ServiceCertificateListOptions struct {
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&ServiceCertificateListOptions{}, "service-cert-list", "List service certs", func(s *mcclient.ClientSession, opts *ServiceCertificateListOptions) error {
|
||||
params, err := options.ListStructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := modules.ServiceCertificatesV3.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.ServiceCertificatesV3.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
type ServiceCertificateDeleteOptions struct {
|
||||
ID string `json:"-"`
|
||||
}
|
||||
R(&ServiceCertificateDeleteOptions{}, "service-cert-delete", "Delete service cert", func(s *mcclient.ClientSession, opts *ServiceCertificateDeleteOptions) error {
|
||||
cert, err := modules.ServiceCertificatesV3.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(cert)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -43,10 +43,10 @@ func init() {
|
||||
query.Add(jsonutils.NewInt(args.Offset), "offset")
|
||||
}
|
||||
if len(args.Name) > 0 {
|
||||
query.Add(jsonutils.NewString(args.Name), "name")
|
||||
query.Add(jsonutils.NewString(args.Name), "name__icontains")
|
||||
}
|
||||
if len(args.Type) > 0 {
|
||||
query.Add(jsonutils.NewString(args.Type), "type")
|
||||
query.Add(jsonutils.NewString(args.Type), "type__icontains")
|
||||
}
|
||||
if len(args.Search) > 0 {
|
||||
query.Add(jsonutils.NewString(args.Search), "search")
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user