mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/yunionio/cloudpods.git
synced 2026-09-20 16:13:56 +08:00
Compare commits
477 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
affd6fb567 | ||
|
|
4a3ae9da7f | ||
|
|
d8d04512ba | ||
|
|
eac60b484b | ||
|
|
3e170f8a9b | ||
|
|
14f66686d9 | ||
|
|
a3b0b2193c | ||
|
|
af24cbfaa3 | ||
|
|
8ef6b60a42 | ||
|
|
df00cdbd04 | ||
|
|
df37a12fc2 | ||
|
|
afc653bb48 | ||
|
|
cae9564f29 | ||
|
|
2b45e26243 | ||
|
|
89f6f9985c | ||
|
|
daeb7bb144 | ||
|
|
4fc343f577 | ||
|
|
35e6f3992a | ||
|
|
b1f320bdd5 | ||
|
|
e843eecbd1 | ||
|
|
597a9d38ca | ||
|
|
03b1a0c0a1 | ||
|
|
168248ef97 | ||
|
|
a965ecf107 | ||
|
|
e46f6dc0e1 | ||
|
|
0659981e24 | ||
|
|
58db9ddf0f | ||
|
|
7e2a369fae | ||
|
|
d07d8f9652 | ||
|
|
367e92858f | ||
|
|
251639353d | ||
|
|
e8ef3ab74e | ||
|
|
6e8a97b995 | ||
|
|
721b80e2fe | ||
|
|
3d705eee3f | ||
|
|
799b7eacb7 | ||
|
|
7f9bb72ce3 | ||
|
|
860030929d | ||
|
|
1914e2b054 | ||
|
|
fdfe3bb374 | ||
|
|
b1c84895e5 | ||
|
|
e8ce6da148 | ||
|
|
b29d752647 | ||
|
|
ddda51d272 | ||
|
|
1574970148 | ||
|
|
f96e632384 | ||
|
|
41bf5a1c17 | ||
|
|
1f645f550a | ||
|
|
72bf32b8db | ||
|
|
93e7780d1d | ||
|
|
3ad7ac7e18 | ||
|
|
888c527fa9 | ||
|
|
f577998f60 | ||
|
|
57fe0a05af | ||
|
|
dcfe21a5ee | ||
|
|
0c3fe7e440 | ||
|
|
1452c4d817 | ||
|
|
d9c7f08c74 | ||
|
|
f33b779c24 | ||
|
|
05405def86 | ||
|
|
644d1a0056 | ||
|
|
5b50b77c13 | ||
|
|
9a836d37b5 | ||
|
|
cc8ca3656d | ||
|
|
6a7e1ccaf4 | ||
|
|
2423107c23 | ||
|
|
f80a0c2a2e | ||
|
|
5c38e6935e | ||
|
|
908c7c2d81 | ||
|
|
fd8ee54deb | ||
|
|
1b98d99905 | ||
|
|
f423eb9011 | ||
|
|
0ee58ec243 | ||
|
|
a3318a87c0 | ||
|
|
40bc2e3ae1 | ||
|
|
ef7674af30 | ||
|
|
fa8e8e555e | ||
|
|
2e167d8599 | ||
|
|
19f4328ed1 | ||
|
|
62d009f2f8 | ||
|
|
2718d7bf4e | ||
|
|
007566c4b5 | ||
|
|
5bcc2a4298 | ||
|
|
3913a71f5c | ||
|
|
f4fb2b55a2 | ||
|
|
071f919d1e | ||
|
|
59309efd8c | ||
|
|
7a64637e14 | ||
|
|
f4baf1761a | ||
|
|
f8dc741763 | ||
|
|
1739d4f805 | ||
|
|
c681805629 | ||
|
|
2f4e7d585e | ||
|
|
d3c3a201b8 | ||
|
|
9933db70a3 | ||
|
|
624acc21f9 | ||
|
|
f361618f06 | ||
|
|
790f9fc1a3 | ||
|
|
e86909c43a | ||
|
|
9085ee9775 | ||
|
|
34c7a31106 | ||
|
|
52bbe4d74e | ||
|
|
2190de3e77 | ||
|
|
d58e8f3b67 | ||
|
|
a431d7ca20 | ||
|
|
8fed2fc64b | ||
|
|
68900b3fab | ||
|
|
4ddb4e14a5 | ||
|
|
1c9a926247 | ||
|
|
0ac45d9ff7 | ||
|
|
45a4848808 | ||
|
|
0fb6de4d80 | ||
|
|
1bcd3dcab6 | ||
|
|
291230694d | ||
|
|
140ac46e67 | ||
|
|
0e5f5221f0 | ||
|
|
5813d64a7d | ||
|
|
6444825331 | ||
|
|
adfad567f6 | ||
|
|
cf7c63be3f | ||
|
|
1d78192a36 | ||
|
|
462b832e1a | ||
|
|
06fad05278 | ||
|
|
1695947221 | ||
|
|
4c40e3bf40 | ||
|
|
4f270a3ff0 | ||
|
|
6a7382f5be | ||
|
|
a7cff31e3c | ||
|
|
874699a1d7 | ||
|
|
c3c5b0b156 | ||
|
|
22bc479420 | ||
|
|
64387f83d8 | ||
|
|
b4438122f9 | ||
|
|
11ee270911 | ||
|
|
70b78835d3 | ||
|
|
0faa2bfb9c | ||
|
|
991b3bb5cf | ||
|
|
608a18eed4 | ||
|
|
292ca54153 | ||
|
|
a157596973 | ||
|
|
23bc582407 | ||
|
|
cfe5b990f9 | ||
|
|
58f6f37891 | ||
|
|
5ab5fbdf92 | ||
|
|
374d15b701 | ||
|
|
e57dcee3e4 | ||
|
|
01ca954399 | ||
|
|
7da2fa556c | ||
|
|
4c50f40771 | ||
|
|
85a9d51e58 | ||
|
|
8009857c8a | ||
|
|
e2826b1338 | ||
|
|
7e88a79a8d | ||
|
|
51f0ff4d9c | ||
|
|
bd922dfe14 | ||
|
|
096ce97503 | ||
|
|
336b8fa6f9 | ||
|
|
499be25fc0 | ||
|
|
4ec48d5a66 | ||
|
|
b7861f5341 | ||
|
|
c2a82bd9cd | ||
|
|
ee8b23bdc7 | ||
|
|
1b3979fb97 | ||
|
|
26ac56c1a6 | ||
|
|
1833456c45 | ||
|
|
50dc428692 | ||
|
|
d403d6d62f | ||
|
|
8fca2c7c8f | ||
|
|
5dac5a465b | ||
|
|
f3c9ad15da | ||
|
|
12040bd5aa | ||
|
|
6367d20757 | ||
|
|
4dbbb2b1b5 | ||
|
|
7a756c5766 | ||
|
|
ce7212a798 | ||
|
|
e0c6ea920d | ||
|
|
892b769d3a | ||
|
|
0f31a7d479 | ||
|
|
cafc8dedc7 | ||
|
|
5f168a76af | ||
|
|
985b56353b | ||
|
|
0570476c5c | ||
|
|
2d641b4e30 | ||
|
|
3bc58d2c8e | ||
|
|
4b472cfd30 | ||
|
|
04e79b5140 | ||
|
|
7435c8bc29 | ||
|
|
8031105ea2 | ||
|
|
d7fd2b7d8c | ||
|
|
2f50aae082 | ||
|
|
4ec8b1f523 | ||
|
|
2c97fdaf46 | ||
|
|
ed06f6ed84 | ||
|
|
6e29509da4 | ||
|
|
9a3df26dc1 | ||
|
|
9b335e2afa | ||
|
|
8ebb409ef3 | ||
|
|
61757b8e8a | ||
|
|
67b8fa74f3 | ||
|
|
bc72a0c172 | ||
|
|
49d73df622 | ||
|
|
a9c1a9c5a4 | ||
|
|
653eaf019e | ||
|
|
df443d9593 | ||
|
|
51216bdc80 | ||
|
|
3c7917425b | ||
|
|
0dd7604d6a | ||
|
|
eb72141e52 | ||
|
|
235aba14f4 | ||
|
|
e81dc6c36d | ||
|
|
5edd07e805 | ||
|
|
7139672f63 | ||
|
|
926cabd695 | ||
|
|
e28cb2edcc | ||
|
|
bf9c9251f9 | ||
|
|
4fc93016dd | ||
|
|
3b29ecb087 | ||
|
|
6b6c965299 | ||
|
|
bdb9929628 | ||
|
|
4a04405b5d | ||
|
|
ff27373bb2 | ||
|
|
9bad7f3485 | ||
|
|
0eb4468c79 | ||
|
|
d8b614bbdf | ||
|
|
776438f682 | ||
|
|
321e54def0 | ||
|
|
0f0bb35170 | ||
|
|
7b0ceddd6b | ||
|
|
e2fafe2b46 | ||
|
|
f396592d2e | ||
|
|
18fca8d90b | ||
|
|
7c85b20733 | ||
|
|
48c0c536fc | ||
|
|
188662cd51 | ||
|
|
dd01e8cf49 | ||
|
|
ca7f5495fe | ||
|
|
34b7d1e9c3 | ||
|
|
13a3e1c778 | ||
|
|
603b3f8b8e | ||
|
|
2c1e0a4fe2 | ||
|
|
f9a9f92003 | ||
|
|
8d1c0ba9c9 | ||
|
|
845ba285fc | ||
|
|
72f1e58833 | ||
|
|
1cc1ff7213 | ||
|
|
6c15c80abb | ||
|
|
7869e3d134 | ||
|
|
2e0efc6c4a | ||
|
|
1d440b57ce | ||
|
|
e3c564bd56 | ||
|
|
45e04c4d50 | ||
|
|
ee0f6de3b0 | ||
|
|
608be69260 | ||
|
|
88fa459aac | ||
|
|
b4bb5d902f | ||
|
|
7f467ab3a7 | ||
|
|
5c1714d11d | ||
|
|
5f36cbb31c | ||
|
|
850544ee4d | ||
|
|
7ff8935abc | ||
|
|
874cf21b00 | ||
|
|
231fefed1f | ||
|
|
5dd591f1bb | ||
|
|
ab32057ab1 | ||
|
|
84fec885e8 | ||
|
|
8057b95ac2 | ||
|
|
9adac58590 | ||
|
|
f409fca66b | ||
|
|
edd7136d3e | ||
|
|
b1c80010cc | ||
|
|
5ff255d622 | ||
|
|
fb531b4d68 | ||
|
|
03cd5dc63a | ||
|
|
fa48381bd7 | ||
|
|
38a6decc25 | ||
|
|
627495d200 | ||
|
|
37b823a43c | ||
|
|
112eb0d7ae | ||
|
|
bee314a0e6 | ||
|
|
60ef016f42 | ||
|
|
da235de896 | ||
|
|
68a425ebd5 | ||
|
|
15f6b94bec | ||
|
|
d8dd372cb0 | ||
|
|
e14a596d9f | ||
|
|
a0ab40dbb8 | ||
|
|
75e49ac8c6 | ||
|
|
590ec32860 | ||
|
|
57fd313b43 | ||
|
|
86e4df54d9 | ||
|
|
a9f60a7b1a | ||
|
|
087de62171 | ||
|
|
8577cb096e | ||
|
|
2110057bac | ||
|
|
3c09ce17d0 | ||
|
|
dc870afaed | ||
|
|
fcb8bba00c | ||
|
|
7996a02a80 | ||
|
|
3349dc46c5 | ||
|
|
a85fd307d3 | ||
|
|
37f1906f72 | ||
|
|
d5096ad4ee | ||
|
|
24da237790 | ||
|
|
d34b00ddc4 | ||
|
|
2f47d93215 | ||
|
|
1bbf79528b | ||
|
|
0c0c4fc94d | ||
|
|
01de80ed09 | ||
|
|
3861bb6bc1 | ||
|
|
681fee1317 | ||
|
|
2496a12833 | ||
|
|
c76062406d | ||
|
|
df94352e00 | ||
|
|
5b9c7ba9f2 | ||
|
|
e8dc05084a | ||
|
|
0774a2ded0 | ||
|
|
50421b06b9 | ||
|
|
7e7825a681 | ||
|
|
45b8a7afd9 | ||
|
|
4ec1fc58d9 | ||
|
|
69564365b9 | ||
|
|
54caca2d04 | ||
|
|
ce3241d046 | ||
|
|
40773180fa | ||
|
|
32411bf2ec | ||
|
|
c99265e743 | ||
|
|
2d4cff4ef1 | ||
|
|
bb90b5e8a1 | ||
|
|
b1c4bc276f | ||
|
|
1923e36740 | ||
|
|
7bec5e6f7e | ||
|
|
b40be2608b | ||
|
|
46d2f6efb7 | ||
|
|
d55f1db7ff | ||
|
|
0bcc19d7c1 | ||
|
|
b395dc8cee | ||
|
|
c908e0c19a | ||
|
|
ce5a95607f | ||
|
|
d4ba5ca52e | ||
|
|
92129824c0 | ||
|
|
7326b1fb0d | ||
|
|
1b5756fe1c | ||
|
|
08f8ce1f7c | ||
|
|
2c5234b97e | ||
|
|
37049bd5f3 | ||
|
|
177ba6cf2c | ||
|
|
bf2bb9878f | ||
|
|
530b2a1422 | ||
|
|
1eba8b8a7e | ||
|
|
4829e0d285 | ||
|
|
b29d6d4f4e | ||
|
|
d41c3bfea7 | ||
|
|
907058464a | ||
|
|
c727334bc4 | ||
|
|
b7e2c462cb | ||
|
|
1efc0fe07b | ||
|
|
9d1b407c40 | ||
|
|
67c2435f4f | ||
|
|
c11c79ef71 | ||
|
|
c245013e59 | ||
|
|
83b4916646 | ||
|
|
f6d1ea7b25 | ||
|
|
c988fd1b1f | ||
|
|
f6df6d34e0 | ||
|
|
44183902f7 | ||
|
|
64fda24e76 | ||
|
|
0701512da9 | ||
|
|
71499e7e1b | ||
|
|
6f6cf7cd64 | ||
|
|
8f175ec326 | ||
|
|
c0c26c7c40 | ||
|
|
42cd5b1435 | ||
|
|
4fafb8ae75 | ||
|
|
8349dcbba3 | ||
|
|
85a792d2b1 | ||
|
|
71fee70283 | ||
|
|
456c5fb50e | ||
|
|
b706356ba9 | ||
|
|
ed2bba3dd5 | ||
|
|
b6e701a6b2 | ||
|
|
c21636b521 | ||
|
|
2e0f424c73 | ||
|
|
a2f30806cf | ||
|
|
0c0b4b43aa | ||
|
|
209bee4181 | ||
|
|
ba265a7b83 | ||
|
|
1a8f8dcb93 | ||
|
|
2a01c86428 | ||
|
|
dc75d93414 | ||
|
|
fe44564bf7 | ||
|
|
8cd23304ae | ||
|
|
4b8e13f171 | ||
|
|
b6739ba7e8 | ||
|
|
3db7b0c962 | ||
|
|
0d6480723d | ||
|
|
9a91bf244c | ||
|
|
b1a641ca4d | ||
|
|
c65e1e0855 | ||
|
|
d8fc57b217 | ||
|
|
f9a47d94c7 | ||
|
|
ac2c3697bf | ||
|
|
b1048baef3 | ||
|
|
bfc1f0125f | ||
|
|
4b6d0107b0 | ||
|
|
1948c12012 | ||
|
|
6345086c5b | ||
|
|
08d412669d | ||
|
|
c85a8d354e | ||
|
|
03be58f39a | ||
|
|
60cb619043 | ||
|
|
91c39cf8cd | ||
|
|
f73ac4844f | ||
|
|
e681f66aad | ||
|
|
d7bf41e173 | ||
|
|
ea3247eaba | ||
|
|
d91dbf5f47 | ||
|
|
52129c544b | ||
|
|
a3b3e9c627 | ||
|
|
04c73b189d | ||
|
|
f75dbefbfd | ||
|
|
a2e4490613 | ||
|
|
2c32832946 | ||
|
|
18239e30cc | ||
|
|
77d6e24ae7 | ||
|
|
d5f6473d57 | ||
|
|
f7d927cbdd | ||
|
|
56a3d9c05d | ||
|
|
a4b76036c5 | ||
|
|
9e20cce793 | ||
|
|
f7b3b0c1a0 | ||
|
|
6404e3c2a0 | ||
|
|
9a1b040933 | ||
|
|
b5468ca840 | ||
|
|
77bbb2bda8 | ||
|
|
562498da68 | ||
|
|
b91c19bcb5 | ||
|
|
e48c4d0bb2 | ||
|
|
8c3872000a | ||
|
|
7fde85b83f | ||
|
|
262096d99d | ||
|
|
60ba83b40f | ||
|
|
5834ec297e | ||
|
|
8701c6172e | ||
|
|
d912e29772 | ||
|
|
bf0adeb0e2 | ||
|
|
8857a6281e | ||
|
|
5537648dc7 | ||
|
|
158750373b | ||
|
|
8a719ffe1f | ||
|
|
c1278bf088 | ||
|
|
86d6a224cd | ||
|
|
6b6a15e6b8 | ||
|
|
4a2b10e842 | ||
|
|
38557f8bcd | ||
|
|
8739393e52 | ||
|
|
fdad1303bc | ||
|
|
bd2d11f964 | ||
|
|
01c962f1c6 | ||
|
|
d5ec862e26 | ||
|
|
1e04ddfe5e | ||
|
|
67a6f9687d | ||
|
|
9bfb6c0c8e | ||
|
|
b4fff49236 | ||
|
|
8536166426 | ||
|
|
4bd9051ae4 | ||
|
|
74c272cfae | ||
|
|
38aed0ca4a | ||
|
|
06eea75674 | ||
|
|
ad73aa590a | ||
|
|
4322981be4 | ||
|
|
655d3632fa | ||
|
|
cd34e0db95 | ||
|
|
aae5d0dc33 | ||
|
|
51b2f4d3af | ||
|
|
f7987dbf61 | ||
|
|
f1282345f1 | ||
|
|
9046117e00 |
@@ -1,38 +0,0 @@
|
||||
FROM centos:7
|
||||
MAINTAINER Yousong Zhou <zhouyousong@yunion.cn>
|
||||
|
||||
RUN true \
|
||||
&& yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
|
||||
&& yum install -y git wget \
|
||||
&& yum groupinstall -y "Development Tools" \
|
||||
&& : ceph for cmd/host \
|
||||
&& rpm --import 'https://download.ceph.com/keys/release.asc' \
|
||||
&& yum install -y https://download.ceph.com/rpm-luminous/el7/noarch/ceph-release-1-1.el7.noarch.rpm \
|
||||
&& yum install -y libcephfs-devel librbd-devel librados-devel \
|
||||
&& yum clean all
|
||||
|
||||
WORKDIR /opt
|
||||
RUN true \
|
||||
&& wget https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz \
|
||||
&& tar xzf go1.13.3.linux-amd64.tar.gz \
|
||||
&& rm -vf go1.13.3.linux-amd64.tar.gz \
|
||||
&& true
|
||||
ENV GOROOT="/opt/go"
|
||||
ENV PATH="/opt/go/bin:${PATH}"
|
||||
|
||||
RUN useradd -c "OneCloud Builder" --create-home --home-dir /home/build --shell /bin/bash build
|
||||
ENV HOME /home/build
|
||||
WORKDIR /home/build
|
||||
USER build
|
||||
|
||||
ENV GOPATH="/home/build/go"
|
||||
ENV PATH="${GOPATH}/bin:${PATH}"
|
||||
|
||||
RUN true \
|
||||
&& mkdir -p "$GOPATH" \
|
||||
&& d="$GOPATH/src/golang.org/x/tools" \
|
||||
&& mkdir -p "$d" \
|
||||
&& git clone --branch yun --depth 8 https://github.com/yousong/tools "$d" \
|
||||
&& cd "$d" \
|
||||
&& go install ./cmd/goimports \
|
||||
&& true
|
||||
@@ -5,10 +5,10 @@ version: 2
|
||||
jobs:
|
||||
check:
|
||||
docker:
|
||||
- image: yunionio/onecloud-ci:v1.0.3
|
||||
- image: yunionio/centos-build:1.0-1
|
||||
environment:
|
||||
ONECLOUD_CI_BUILD: "1"
|
||||
working_directory: /home/build/go/src/yunion.io/x/onecloud
|
||||
working_directory: /root/go/onecloud
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
requires:
|
||||
- check
|
||||
docker:
|
||||
- image: yunionio/onecloud-ci:v1.0.2
|
||||
- image: yunionio/centos-build:1.0-1
|
||||
environment:
|
||||
ONECLOUD_CI_BUILD: "1"
|
||||
|
||||
@@ -26,14 +26,14 @@ jobs:
|
||||
#### expecting it in the form of
|
||||
#### /go/src/github.com/circleci/go-tool
|
||||
#### /go/src/bitbucket.org/circleci/go-tool
|
||||
working_directory: /home/build/go/src/yunion.io/x/onecloud
|
||||
working_directory: /root/go/onecloud
|
||||
parallelism: 4
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: onecloud-build-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
|
||||
paths:
|
||||
- /home/build/.cache/go-build
|
||||
- /root/.cache/go-build
|
||||
- run:
|
||||
command: |
|
||||
targets="$(circleci tests glob "cmd/*" | grep -v cmd/host-image | circleci tests split)"
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
- save_cache:
|
||||
key: onecloud-build-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
|
||||
paths:
|
||||
- /home/build/.cache/go-build
|
||||
- /root/.cache/go-build
|
||||
- store_artifacts:
|
||||
path: _output/
|
||||
|
||||
@@ -51,16 +51,16 @@ jobs:
|
||||
requires:
|
||||
- check
|
||||
docker:
|
||||
- image: yunionio/onecloud-ci:v1.0.2
|
||||
- image: yunionio/centos-build:1.0-1
|
||||
environment:
|
||||
GO111MODULE: "on"
|
||||
working_directory: /home/build/go/src/yunion.io/x/onecloud
|
||||
working_directory: /root/go/onecloud
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: onecloud-test-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
|
||||
paths:
|
||||
- /home/build/.cache/go-build
|
||||
- /root/.cache/go-build
|
||||
- run:
|
||||
name: unit_test
|
||||
command: |
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
- save_cache:
|
||||
key: onecloud-test-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
|
||||
paths:
|
||||
- /home/build/.cache/go-build
|
||||
- /root/.cache/go-build
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
|
||||
24
.github/workflows/docker.yml
vendored
24
.github/workflows/docker.yml
vendored
@@ -29,17 +29,17 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install librados-dev librbd-dev
|
||||
sudo apt-get install librados-dev librbd-dev # baremetal-agent needs this
|
||||
make cmd/apigateway cmd/climc cmd/keystone
|
||||
make cmd/logger cmd/region cmd/scheduler cmd/webconsole
|
||||
make cmd/yunionconf cmd/glance cmd/torrent cmd/s3gateway
|
||||
make cmd/ansibleserver cmd/cloudnet cmd/notify
|
||||
make cmd/host && ./scripts/bundle_libraries.sh _output/bin/bundles/host _output/bin/host && ./scripts/host_find_libraries.sh _output/bin/bundles/host
|
||||
make cmd/host-deployer && ./scripts/bundle_libraries.sh _output/bin/bundles/host-deployer _output/bin/host-deployer
|
||||
make cmd/baremetal-agent && ./scripts/bundle_libraries.sh _output/bin/bundles/baremetal-agent _output/bin/baremetal-agent
|
||||
make cmd/cloudevent cmd/devtool
|
||||
make cmd/*cli
|
||||
make cmd/esxi-agent
|
||||
make docker-alpine-build F='-j4 cmd/host cmd/vpcagent cmd/region-dns'
|
||||
|
||||
- name: Image baremetal-agent
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
@@ -61,6 +61,16 @@ jobs:
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.esxi-agent
|
||||
|
||||
- name: Image vpcagent
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/vpcagent
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.vpcagent
|
||||
|
||||
- name: Image climc
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
@@ -210,3 +220,13 @@ jobs:
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.devtool
|
||||
|
||||
- name: Image region DNS
|
||||
uses: elgohr/Publish-Docker-Github-Action@master
|
||||
with:
|
||||
name: registry.cn-beijing.aliyuncs.com/yunionio/region-dns
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
snapshot: true
|
||||
dockerfile: build/docker/Dockerfile.region-dns
|
||||
|
||||
66
Makefile
66
Makefile
@@ -192,43 +192,77 @@ mod:
|
||||
go mod vendor -v
|
||||
|
||||
|
||||
DOCKER_BUILD_IMAGE_VERSION?=latest
|
||||
DOCKER_BUILD_IMAGE_VERSION?=1.0-1
|
||||
|
||||
define dockerBuildCmd
|
||||
define dockerCentOSBuildCmd
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
cd /home/build/onecloud
|
||||
cd /root/onecloud
|
||||
export GOFLAGS=-mod=vendor
|
||||
make $(1)
|
||||
chown -R $(shell id -u):$(shell id -g) _output
|
||||
endef
|
||||
|
||||
docker-build: export dockerBuildCmd:=$(call dockerBuildCmd,$(F))
|
||||
docker-build:
|
||||
echo "$$dockerBuildCmd"
|
||||
docker-centos-build: export dockerCentOSBuildCmd:=$(call dockerCentOSBuildCmd,$(F))
|
||||
docker-centos-build:
|
||||
docker rm --force onecloud-ci-build &>/dev/null || true
|
||||
docker run \
|
||||
--name onecloud-ci-build \
|
||||
--rm \
|
||||
--volume $(CURDIR):/home/build/onecloud \
|
||||
yunionio/onecloud-ci:$(DOCKER_BUILD_IMAGE_VERSION) \
|
||||
/bin/bash -c "$$dockerBuildCmd"
|
||||
--volume $(CURDIR):/root/onecloud \
|
||||
--volume $(CURDIR)/_output/_cache:/root/.cache \
|
||||
registry.cn-beijing.aliyuncs.com/yunionio/centos-build:$(DOCKER_BUILD_IMAGE_VERSION) \
|
||||
/bin/bash -c "$$dockerCentOSBuildCmd"
|
||||
chown -R $$(id -u):$$(id -g) _output
|
||||
ls -lh _output/bin
|
||||
|
||||
# NOTE we need a way to stop and remove the container started by docker-build.
|
||||
# No --tty, --stop-signal won't work
|
||||
docker-build-stop:
|
||||
docker stop --time 0 onecloud-ci-build || true
|
||||
docker-centos-build-stop:
|
||||
docker-centos stop --time 0 onecloud-ci-build || true
|
||||
|
||||
.PHONY: docker-build
|
||||
.PHONY: docker-build-stop
|
||||
.PHONY: docker-centos-build
|
||||
.PHONY: docker-centos-build-stop
|
||||
|
||||
define dockerAlpineBuildCmd
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
cd /root/go/src/yunion.io/x/onecloud
|
||||
export GOFLAGS=-mod=vendor
|
||||
make $(1)
|
||||
chown -R $(shell id -u):$(shell id -g) _output
|
||||
endef
|
||||
|
||||
docker-alpine-build: export dockerAlpineBuildCmd:=$(call dockerAlpineBuildCmd,$(F))
|
||||
docker-alpine-build:
|
||||
docker rm --force onecloud-docker-alpine-build &>/dev/null || true
|
||||
docker run --rm \
|
||||
--name onecloud-docker-alpine-build \
|
||||
-v $(CURDIR):/root/go/src/yunion.io/x/onecloud \
|
||||
-v $(CURDIR)/_output/alpine-build:/root/go/src/yunion.io/x/onecloud/_output \
|
||||
-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
|
||||
|
||||
define helpText
|
||||
Build with docker
|
||||
|
||||
make docker-build F='-j4'
|
||||
make docker-build F='-j4 cmd/region cmd/climc'
|
||||
make docker-build-stop
|
||||
make docker-centos-build F='-j4'
|
||||
make docker-centos-build F='-j4 cmd/region cmd/climc'
|
||||
make docker-centos-build-stop
|
||||
|
||||
make docker-alpine-build F='-j4'
|
||||
make docker-alpine-build F='-j4 cmd/host cmd/host-deployer'
|
||||
make docker-alpine-build-stop
|
||||
|
||||
Tidy up go modules and vendor directory
|
||||
|
||||
|
||||
42
build/climc/root/opt/yunion/scripts/tools/clean_account.sh
Executable file
42
build/climc/root/opt/yunion/scripts/tools/clean_account.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
pushd $(dirname $BASH_SOURCE) > /dev/null
|
||||
CUR_DIR=$(pwd -P)
|
||||
popd > /dev/null
|
||||
|
||||
|
||||
ACCOUNT=$1
|
||||
|
||||
if [ -z "$ACCOUNT" ]; then
|
||||
echo "Usage: $0 <cloud-acount-id-or-name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ACCOUNT_ID=$(climc cloud-account-show $ACCOUNT | grep -w " id " | awk '{print $4}')
|
||||
ACCOUNT_NAME=$(climc cloud-account-show $ACCOUNT | grep -w " name " | awk '{print $4}')
|
||||
|
||||
if [ -z "$ACCOUNT_ID" ]; then
|
||||
echo "Cloud account $ACCOUNT not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo "Ready to clean cloud account $ACCOUNT_NAME($ACCOUNT_ID)..."
|
||||
|
||||
echo "1. Disable cloud account $ACCOUNT_NAME($ACCOUNT_ID) ..."
|
||||
|
||||
climc cloud-account-disable $ACCOUNT_ID
|
||||
|
||||
echo "2. Clean all providers ..."
|
||||
|
||||
for provider_id in $(climc cloud-provider-list --account $ACCOUNT_ID --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
echo "### to clean cloud provider $provider_id ..."
|
||||
$CUR_DIR/clean_provider.sh $provider_id
|
||||
done
|
||||
|
||||
echo "3. Delete cloud account ..."
|
||||
|
||||
climc cloud-account-delete $ACCOUNT_ID
|
||||
27
build/climc/root/opt/yunion/scripts/tools/clean_eip.sh
Executable file
27
build/climc/root/opt/yunion/scripts/tools/clean_eip.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
EIP=$1
|
||||
|
||||
if [ -z "$EIP" ]; then
|
||||
echo "Usage: $0 <eip_id_or_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
EIP_NAME=$(climc eip-show $EIP | grep -w " name " | awk '{print $4}')
|
||||
EIP_ID=$(climc eip-show $EIP | grep -w " id " | awk '{print $4}')
|
||||
|
||||
if [ -z "$EIP_ID" ]; then
|
||||
echo "Cannot find eip $EIP_ID"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "To clean eip $EIP_NAME($EIP_ID)..."
|
||||
|
||||
clean_eip() {
|
||||
local EID=$1
|
||||
climc eip-purge $EID
|
||||
}
|
||||
|
||||
clean_eip $EIP_ID
|
||||
80
build/climc/root/opt/yunion/scripts/tools/clean_host.sh
Executable file
80
build/climc/root/opt/yunion/scripts/tools/clean_host.sh
Executable file
@@ -0,0 +1,80 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
HOST=$1
|
||||
|
||||
if [ -z "$HOST" ]; then
|
||||
echo "Usage: $0 <host_id_or_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
error_exit() {
|
||||
echo "Error: $1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
HOSTID=$(climc host-show $HOST | grep -w " id " | awk '{print $4}')
|
||||
|
||||
HOSTNAME=$(climc host-show $HOST | grep -w " name " | awk '{print $4}')
|
||||
|
||||
if [ -z "$HOSTNAME" ]; then
|
||||
error_exit "Cannot find host $HOST"
|
||||
fi
|
||||
|
||||
if [ -z "$HOSTID" ]; then
|
||||
error_exit "Cannot find host $HOST"
|
||||
fi
|
||||
|
||||
echo "Ready to purge host $HOSTNAME($HOSTID)..."
|
||||
|
||||
echo "1. Disable $HOSTNAME($HOSTID)"
|
||||
|
||||
if ! climc host-disable $HOSTID > /dev/null; then
|
||||
error_exit "Fail to disable $HOST"
|
||||
fi
|
||||
|
||||
echo "2. Clean servers on $HOSTNAME($HOSTID)"
|
||||
|
||||
for i in $(climc server-list --host $HOSTID --admin --limit 2048 --system | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
climc server-update --delete enable $i > /dev/null
|
||||
climc server-purge $i > /dev/null
|
||||
done
|
||||
|
||||
for i in $(climc server-list --host $HOSTID --admin --limit 2048 --pending-delete --system | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
climc server-purge $i > /dev/null
|
||||
done
|
||||
|
||||
echo "3. Clean disks on $HOSTNAME($HOSTID)"
|
||||
|
||||
for storageid in $(climc host-storage-list --host $HOSTID --show-emulated | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $4}')
|
||||
do
|
||||
STORAGENAME=$(climc storage-show $storageid | grep -w " name " | awk '{print $4}')
|
||||
STORAGE_TYPE=$(climc storage-show $storageid | grep -w " storage_type " | awk '{print $4}')
|
||||
if [ "$STORAGE_TYPE" == "local" ]; then
|
||||
for diskid in $(climc disk-list --admin --system --details --search $storageid --limit 2048 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
climc disk-purge $diskid > /dev/null
|
||||
done
|
||||
for diskid in $(climc disk-list --admin --system --details --search $storageid --pending-delete --limit 2048 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
climc disk-purge $diskid > /dev/null
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
echo "4. Remove host $HOSTNAME($HOSTID)"
|
||||
|
||||
BAREMETAL=$(climc host-show $HOSTID | grep -w " is_baremetal " | awk '{print $4}')
|
||||
|
||||
HOSTTYPE=$(climc host-show $HOSTID | grep -w " host_type " | awk '{print $4}')
|
||||
|
||||
if [ "$BAREMETAL" == "true" ] && [ "$HOSTTYPE" != "baremetal" ]; then
|
||||
climc host-update --host-type baremetal $HOSTID > /dev/null
|
||||
fi
|
||||
|
||||
climc host-delete $HOSTID > /dev/null
|
||||
|
||||
echo "DONE."
|
||||
27
build/climc/root/opt/yunion/scripts/tools/clean_loadbalancer.sh
Executable file
27
build/climc/root/opt/yunion/scripts/tools/clean_loadbalancer.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
LB=$1
|
||||
|
||||
if [ -z "$LB" ]; then
|
||||
echo "Usage: $0 <loadbalancer_id_or_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LB_ID=$(climc lb-show $LB | grep -w " id " | awk '{print $4}')
|
||||
LB_NAME=$(climc lb-show $LB | grep -w " name " | awk '{print $4}')
|
||||
|
||||
if [ -z "$LB_ID" ]; then
|
||||
echo "Loadbalancer $LB not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Ready to remove loadbalancer $LB_NAME($LB_ID) ..."
|
||||
|
||||
clean_loadbalancer() {
|
||||
local LID=$1
|
||||
climc lb-purge $LID
|
||||
}
|
||||
|
||||
clean_loadbalancer $LB_ID
|
||||
27
build/climc/root/opt/yunion/scripts/tools/clean_loadbalancer_acl.sh
Executable file
27
build/climc/root/opt/yunion/scripts/tools/clean_loadbalancer_acl.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
LB_ACL=$1
|
||||
|
||||
if [ -z "$LB_ACL" ]; then
|
||||
echo "Usage: $0 <loadbalancer_id_or_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LB_ACL_ID=$(climc lbacl-show $LB_ACL | grep -w " id " | awk '{print $4}')
|
||||
LB_ACL_NAME=$(climc lbacl-show $LB_ACL | grep -w " name " | awk '{print $4}')
|
||||
|
||||
if [ -z "$LB_ACL_ID" ]; then
|
||||
echo "Loadbalancer ACL $LB_ACL_ID not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Ready to remove loadbalancer acl $LB_ACL_NAME($LB_ACL_ID) ..."
|
||||
|
||||
clean_loadbalancer_acl() {
|
||||
local LID=$1
|
||||
climc lbacl-purge $LID
|
||||
}
|
||||
|
||||
clean_loadbalancer_acl $LB_ACL_ID
|
||||
27
build/climc/root/opt/yunion/scripts/tools/clean_loadbalancer_certificate.sh
Executable file
27
build/climc/root/opt/yunion/scripts/tools/clean_loadbalancer_certificate.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
LB_CERT=$1
|
||||
|
||||
if [ -z "$LB_CERT" ]; then
|
||||
echo "Usage: $0 <loadbalancer_id_or_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
LB_CERT_ID=$(climc lbcert-show $LB_CERT | grep -w " id " | awk '{print $4}')
|
||||
LB_CERT_NAME=$(climc lbcert-show $LB_CERT | grep -w " name " | awk '{print $4}')
|
||||
|
||||
if [ -z "$LB_CERT_ID" ]; then
|
||||
echo "Loadbalancer certificate $LB_CERT_ID not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Ready to remove loadbalancer certificate $LB_CERT_NAME($LB_CERT_ID) ..."
|
||||
|
||||
clean_loadbalancer_cert() {
|
||||
local LID=$1
|
||||
climc lbcert-purge $LID
|
||||
}
|
||||
|
||||
clean_loadbalancer_cert $LB_CERT_ID
|
||||
96
build/climc/root/opt/yunion/scripts/tools/clean_provider.sh
Executable file
96
build/climc/root/opt/yunion/scripts/tools/clean_provider.sh
Executable file
@@ -0,0 +1,96 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
pushd $(dirname $BASH_SOURCE) > /dev/null
|
||||
CUR_DIR=$(pwd -P)
|
||||
popd > /dev/null
|
||||
|
||||
|
||||
PROVIDER=$1
|
||||
|
||||
if [ -z "$PROVIDER" ]; then
|
||||
echo "Usage: $0 <cloud-provider-id-or-name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PROVIDER_ID=$(climc cloud-provider-show $PROVIDER | grep -w " id " | awk '{print $4}')
|
||||
PROVIDER_NAME=$(climc cloud-provider-show $PROVIDER | grep -w " name " | awk '{print $4}')
|
||||
|
||||
if [ -z "$PROVIDER_ID" ]; then
|
||||
echo "Cloud provider $PROVIDER not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
echo "Ready to clean cloud provider $PROVIDER_NAME($PROVIDER_ID)..."
|
||||
|
||||
echo "1. Disable cloud provider $PROVIDER_NAME($PROVIDER_ID) ..."
|
||||
|
||||
climc cloud-provider-disable $PROVIDER_ID
|
||||
|
||||
echo "2. Clean all hosts ..."
|
||||
|
||||
for hostid in $(climc host-list --manager $PROVIDER_ID --admin --show-emulated --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
$CUR_DIR/clean_host.sh $hostid
|
||||
done
|
||||
|
||||
echo "3. Clean all loadbalancer ..."
|
||||
|
||||
for lbid in $(climc lb-list --manager $PROVIDER_ID --admin --show-emulated --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
$CUR_DIR/clean_loadbalancer.sh $lbid
|
||||
done
|
||||
|
||||
echo "4. Clean all loadbalancer acl ..."
|
||||
|
||||
for lbaclid in $(climc lbacl-list --manager $PROVIDER_ID --admin --show-emulated --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
$CUR_DIR/clean_loadbalancer_acl.sh $lbaclid
|
||||
done
|
||||
|
||||
echo "5. Clean all loadbalancer certificate ..."
|
||||
|
||||
for lbcertid in $(climc lbcert-list --manager $PROVIDER_ID --admin --show-emulated --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
$CUR_DIR/clean_loadbalancer_certificate.sh $lbcertid
|
||||
done
|
||||
|
||||
echo "6. Clean all vpc ..."
|
||||
|
||||
for vpcid in $(climc vpc-list --manager $PROVIDER_ID --admin --show-emulated --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
$CUR_DIR/clean_vpc.sh $vpcid
|
||||
done
|
||||
|
||||
echo "7. Clean all eips ..."
|
||||
for eipid in $(climc eip-list --admin --manager $PROVIDER_ID --admin --show-emulated --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
$CUR_DIR/clean_eip.sh $eipid
|
||||
done
|
||||
|
||||
echo "8. Clean all snapshots ..."
|
||||
for snapid in $(climc snapshot-list --admin --manager $PROVIDER_ID --admin --show-emulated --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
echo "to clean snapshot $snapid ..."
|
||||
$CUR_DIR/clean_snapshot.sh $snapid
|
||||
done
|
||||
|
||||
echo "9. Clean all storagecache ..."
|
||||
|
||||
for cacheid in $(climc storage-cache-list --manager $PROVIDER_ID --admin --show-emulated --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
$CUR_DIR/clean_storagecache.sh $cacheid
|
||||
done
|
||||
|
||||
echo "10. Clean all storages ..."
|
||||
|
||||
for storeid in $(climc storage-list --manager $PROVIDER_ID --admin --show-emulated --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
$CUR_DIR/clean_storage.sh $storeid
|
||||
done
|
||||
|
||||
echo "Delete cloud provider ..."
|
||||
|
||||
climc cloud-provider-delete $PROVIDER_ID
|
||||
27
build/climc/root/opt/yunion/scripts/tools/clean_snapshot.sh
Executable file
27
build/climc/root/opt/yunion/scripts/tools/clean_snapshot.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
SNAPSHOT=$1
|
||||
|
||||
if [ -z "$SNAPSHOT" ]; then
|
||||
echo "Usage: $0 <snapshot_id_or_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SNAPSHOT_NAME=$(climc snapshot-show $SNAPSHOT | grep -w " name " | awk '{print $4}')
|
||||
SNAPSHOT_ID=$(climc snapshot-show $SNAPSHOT | grep -w " id " | awk '{print $4}')
|
||||
|
||||
if [ -z "$SNAPSHOT_ID" ]; then
|
||||
echo "Cannot find snapshot $SNAPSHOT_ID"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "To clean snapshot $SNAPSHOT_NAME($SNAPSHOT_ID)..."
|
||||
|
||||
clean_snapshot() {
|
||||
local SNAP_ID=$1
|
||||
climc snapshot-purge $SNAP_ID > /dev/null
|
||||
}
|
||||
|
||||
clean_snapshot $SNAPSHOT_ID
|
||||
34
build/climc/root/opt/yunion/scripts/tools/clean_storage.sh
Executable file
34
build/climc/root/opt/yunion/scripts/tools/clean_storage.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
STORAGE=$1
|
||||
|
||||
if [ -z "$STORAGE" ]; then
|
||||
echo "Usage: $0 <storage_id_or_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STORAGE_ID=$(climc storage-show $STORAGE | grep -w " id " | awk '{print $4}')
|
||||
STORAGE_NAME=$(climc storage-show $STORAGE | grep -w " name " | awk '{print $4}')
|
||||
|
||||
if [ -z "$STORAGE_ID" ]; then
|
||||
echo "Storage $STORAGE not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Clean disks on storage $STORAGE_NAME($STORAGE_ID) ..."
|
||||
|
||||
for disk_id in $(climc disk-list --admin --storage $STORAGE_ID --show-emulated --limit 2048 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
climc disk-purge $disk_id > /dev/null
|
||||
done
|
||||
|
||||
for disk_id in $(climc disk-list --admin --storage $STORAGE_ID --show-emulated --pending-delete --limit 2048 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
climc disk-purge $disk_id > /dev/null
|
||||
done
|
||||
|
||||
# CACHE_ID=$(climc storage-show $STORAGE_ID | grep -w " storagecache_id " | awk '{print $4}')
|
||||
|
||||
climc storage-delete $STORAGE_ID > /dev/null
|
||||
28
build/climc/root/opt/yunion/scripts/tools/clean_storagecache.sh
Executable file
28
build/climc/root/opt/yunion/scripts/tools/clean_storagecache.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
CACHE=$1
|
||||
|
||||
if [ -z "$CACHE" ]; then
|
||||
echo "Usage: $0 <storage_cache_id_or_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CACHE_ID=$(climc storage-cache-show $CACHE | grep -w " id " | awk '{print $4}')
|
||||
CACHE_NAME=$(climc storage-cache-show $CACHE | grep -w " name " | awk '{print $4}')
|
||||
|
||||
if [ -z "$CACHE_ID" ]; then
|
||||
echo "Storage cache $CACHE not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Ready to remove storagecache $CACHE_NAME($CACHE_ID) ..."
|
||||
|
||||
for imgid in $(climc storage-cached-image-list --storagecache $CACHE_ID --show-emulated --limit 0 | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $4}')
|
||||
do
|
||||
climc storagecache-uncache-image $CACHE_ID $imgid --force # > /dev/null
|
||||
done
|
||||
|
||||
climc storage-cache-delete $CACHE_ID > /dev/null
|
||||
|
||||
55
build/climc/root/opt/yunion/scripts/tools/clean_vpc.sh
Executable file
55
build/climc/root/opt/yunion/scripts/tools/clean_vpc.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
VPC=$1
|
||||
|
||||
if [ -z "$VPC" ]; then
|
||||
echo "Usage: $0 <vpc_id_or_name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VPC_NAME=$(climc vpc-show $VPC | grep -w " name " | awk '{print $4}')
|
||||
VPC_ID=$(climc vpc-show $VPC | grep -w " id " | awk '{print $4}')
|
||||
|
||||
if [ -z "$VPC_ID" ]; then
|
||||
echo "Cannot find vpc $VPC"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "To clean vpc $VPC_NAME($VPC_ID)..."
|
||||
|
||||
clean_network() {
|
||||
climc network-purge $1 > /dev/null
|
||||
}
|
||||
|
||||
|
||||
clean_wire() {
|
||||
local WIRE_ID=$1
|
||||
for net_id in $(climc network-list --admin --wire $WIRE_ID --show-emulated | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
clean_network $net_id
|
||||
done
|
||||
climc wire-delete $wire_id > /dev/null
|
||||
}
|
||||
|
||||
clean_vpc() {
|
||||
local VPC_ID=$1
|
||||
climc vpc-purge $VPC_ID > /dev/null
|
||||
}
|
||||
|
||||
echo "1. Clean wires ..."
|
||||
|
||||
for wire_id in $(climc wire-list --vpc $VPC_ID --show-emulated | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
clean_wire $wire_id
|
||||
done
|
||||
|
||||
echo "2. Clean route tables ..."
|
||||
for routetable_id in $(climc routetable-list --vpc $VPC_ID --show-emulated | egrep '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' | awk '{print $2}')
|
||||
do
|
||||
climc routetable-purge $routetable_id >/dev/null
|
||||
done
|
||||
|
||||
echo "3. clean vpc ..."
|
||||
clean_vpc $VPC_ID
|
||||
@@ -1,3 +1,5 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:latest
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:v20200308
|
||||
|
||||
ADD ./build/climc/root/opt /opt
|
||||
|
||||
ADD ./_output/bin/climc ./_output/bin/*cli /opt/yunion/bin/
|
||||
|
||||
@@ -6,7 +6,7 @@ ENV TZ Asia/Shanghai
|
||||
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
|
||||
RUN apk add --no-cache bash bash-completion tzdata ca-certificates && \
|
||||
RUN apk add --no-cache bash bash-completion tzdata ca-certificates vim && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-base:v0.0.1
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-base:v0.1.0
|
||||
|
||||
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"
|
||||
|
||||
ENV TZ Asia/Shanghai
|
||||
|
||||
RUN apk add librados librbd
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
|
||||
ADD ./_output/bin/host /opt/yunion/bin/host
|
||||
ADD ./_output/bin/.host.bin /opt/yunion/bin/.host.bin
|
||||
ADD ./_output/bin/bundles/host /opt/yunion/bin/bundles/host
|
||||
ADD ./_output/alpine-build/bin/host /opt/yunion/bin/host
|
||||
|
||||
4
build/docker/Dockerfile.monitor
Normal file
4
build/docker/Dockerfile.monitor
Normal file
@@ -0,0 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
|
||||
ADD ./_output/bin/monitor /opt/yunion/bin/monitor
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
|
||||
FROM alpine:3.11.3
|
||||
|
||||
ADD ./_output/bin/region-dns /opt/yunion/bin/region-dns
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
ADD ./_output/alpine-build/bin/region-dns /opt/yunion/bin/region-dns
|
||||
|
||||
6
build/docker/Dockerfile.vpcagent
Normal file
6
build/docker/Dockerfile.vpcagent
Normal file
@@ -0,0 +1,6 @@
|
||||
FROM registry.cn-beijing.aliyuncs.com/yunionio/openvswitch:2.9.6-1
|
||||
|
||||
MAINTAINER "Yousong Zhou <zhouyousong@yunion.cn>"
|
||||
|
||||
RUN mkdir -p /opt/yunion/bin
|
||||
ADD ./_output/alpine-build/bin/vpcagent /opt/yunion/bin/vpcagent
|
||||
@@ -84,7 +84,11 @@ func newClient(options *BaseOptions) (*aliyun.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := aliyun.NewAliyunClient("", "", options.AccessKey, options.Secret, options.Debug)
|
||||
cli, err := aliyun.NewAliyunClient(
|
||||
aliyun.NewAliyunClientConfig(
|
||||
options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -85,7 +85,13 @@ func newClient(options *BaseOptions) (*aws.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := aws.NewAwsClient("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
cli, err := aws.NewAwsClient(
|
||||
aws.NewAwsClientConfig(
|
||||
options.AccessUrl,
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -100,11 +100,17 @@ func newClient(options *BaseOptions) (*azure.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Cloud Environment")
|
||||
}
|
||||
|
||||
cli, err := azure.NewAzureClient("", "", options.CloudEnv,
|
||||
options.DirectoryID,
|
||||
options.ApplicationID, options.ApplicationKey,
|
||||
options.SubscriptionID,
|
||||
options.Debug)
|
||||
cli, err := azure.NewAzureClient(
|
||||
azure.NewAzureClientConfig(
|
||||
options.CloudEnv,
|
||||
options.DirectoryID,
|
||||
options.ApplicationID,
|
||||
options.ApplicationKey,
|
||||
).
|
||||
SubscriptionId(options.SubscriptionID).
|
||||
Debug(options.Debug),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import (
|
||||
_ "yunion.io/x/onecloud/cmd/climc/shell/cloudnet"
|
||||
_ "yunion.io/x/onecloud/cmd/climc/shell/etcd"
|
||||
_ "yunion.io/x/onecloud/cmd/climc/shell/k8s"
|
||||
_ "yunion.io/x/onecloud/cmd/climc/shell/monitor"
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
)
|
||||
|
||||
|
||||
46
cmd/climc/shell/bucket_options.go
Normal file
46
cmd/climc/shell/bucket_options.go
Normal file
@@ -0,0 +1,46 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
type BucketOptionsVerifyOptions struct {
|
||||
options.BaseListOptions
|
||||
CloudaccountId string `help:"cloudaccount Id" required:"true"`
|
||||
BillingReportBucket string `help:"S3 bucket that stores account billing report"`
|
||||
BillingFilePrefix string `help:"prefix of billing file name"`
|
||||
BillingBucketAccount string `help:"Id of cloudaccount that can access billing bucket"`
|
||||
UsageReportBucket string `help:"S3 bucket that stores account usage report"`
|
||||
UsageFilePrefix string `help:"prefix of usage file name"`
|
||||
UsageBucketAccount string `help:"Id of cloudaccount that can access usage bucket"`
|
||||
}
|
||||
R(&BucketOptionsVerifyOptions{}, "bucket-options-verify", "billing bucket connection test",
|
||||
func(s *mcclient.ClientSession, args *BucketOptionsVerifyOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.BucketOptions.PerformAction(s, args.CloudaccountId, "verify", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -99,6 +99,9 @@ func init() {
|
||||
if len(args.OptionsBillingBucketAccount) > 0 {
|
||||
options.Add(jsonutils.NewString(args.OptionsBillingBucketAccount), "billing_bucket_account")
|
||||
}
|
||||
if len(args.OptionsBillingFilePrefix) > 0 {
|
||||
options.Add(jsonutils.NewString(args.OptionsBillingFilePrefix), "billing_file_prefix")
|
||||
}
|
||||
if options.Size() > 0 {
|
||||
params.(*jsonutils.JSONDict).Add(options, "options")
|
||||
}
|
||||
@@ -164,8 +167,8 @@ func init() {
|
||||
if len(args.OptionsBillingBucketAccount) > 0 {
|
||||
options.Add(jsonutils.NewString(args.OptionsBillingBucketAccount), "billing_bucket_account")
|
||||
}
|
||||
if len(args.OptionsBillingFileAccount) > 0 {
|
||||
options.Add(jsonutils.NewString(args.OptionsBillingFileAccount), "billing_file_account")
|
||||
if len(args.OptionsBillingFilePrefix) > 0 {
|
||||
options.Add(jsonutils.NewString(args.OptionsBillingFilePrefix), "billing_file_prefix")
|
||||
}
|
||||
if options.Size() > 0 {
|
||||
params.Add(options, "options")
|
||||
@@ -308,6 +311,9 @@ func init() {
|
||||
if len(args.OptionsBillingBucketAccount) > 0 {
|
||||
options.Add(jsonutils.NewString(args.OptionsBillingBucketAccount), "billing_bucket_account")
|
||||
}
|
||||
if len(args.OptionsBillingFilePrefix) > 0 {
|
||||
options.Add(jsonutils.NewString(args.OptionsBillingFilePrefix), "billing_file_prefix")
|
||||
}
|
||||
if options.Size() > 0 {
|
||||
params.Add(options, "options")
|
||||
}
|
||||
@@ -318,6 +324,9 @@ func init() {
|
||||
if args.RemoveOptionsBillingBucketAccount {
|
||||
removeOptions = append(removeOptions, "billing_bucket_account")
|
||||
}
|
||||
if args.RemoveOptionsBillingFilePrefix {
|
||||
removeOptions = append(removeOptions, "billing_file_prefix")
|
||||
}
|
||||
if len(removeOptions) > 0 {
|
||||
params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
|
||||
}
|
||||
@@ -372,6 +381,19 @@ 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)
|
||||
|
||||
@@ -382,8 +404,8 @@ func init() {
|
||||
if len(args.OptionsBillingBucketAccount) > 0 {
|
||||
options.Add(jsonutils.NewString(args.OptionsBillingBucketAccount), "billing_bucket_account")
|
||||
}
|
||||
if len(args.OptionsBillingFileAccount) > 0 {
|
||||
options.Add(jsonutils.NewString(args.OptionsBillingFileAccount), "billing_file_account")
|
||||
if len(args.OptionsBillingFilePrefix) > 0 {
|
||||
options.Add(jsonutils.NewString(args.OptionsBillingFilePrefix), "billing_file_prefix")
|
||||
}
|
||||
if options.Size() > 0 {
|
||||
params.Add(options, "options")
|
||||
@@ -395,8 +417,8 @@ func init() {
|
||||
if args.RemoveOptionsBillingBucketAccount {
|
||||
removeOptions = append(removeOptions, "billing_bucket_account")
|
||||
}
|
||||
if args.RemoveOptionsBillingFileAccount {
|
||||
removeOptions = append(removeOptions, "billing_file_account")
|
||||
if args.RemoveOptionsBillingFilePrefix {
|
||||
removeOptions = append(removeOptions, "billing_file_prefix")
|
||||
}
|
||||
if len(removeOptions) > 0 {
|
||||
params.Add(jsonutils.NewStringArray(removeOptions), "remove_options")
|
||||
@@ -413,7 +435,7 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.SOpenStackCloudAccountUpdateOptions{}, "cloud-account-update-openstack", "update an AWS cloud account", func(s *mcclient.ClientSession, args *options.SOpenStackCloudAccountUpdateOptions) error {
|
||||
R(&options.SOpenStackCloudAccountUpdateOptions{}, "cloud-account-update-openstack", "update an OpenStack cloud account", func(s *mcclient.ClientSession, args *options.SOpenStackCloudAccountUpdateOptions) error {
|
||||
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
|
||||
if params.Size() == 0 {
|
||||
return InvalidUpdateError()
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
R(&options.RouteCreateOptions{}, "router-route-create", "Create router", func(s *mcclient.ClientSession, opts *options.RouteCreateOptions) error {
|
||||
R(&options.RouteCreateOptions{}, "router-route-create", "Create router route", 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", func(s *mcclient.ClientSession, opts *options.RouteGetOptions) error {
|
||||
R(&options.RouteGetOptions{}, "router-route-show", "Show router route", 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 routers", func(s *mcclient.ClientSession, opts *options.RouteListOptions) error {
|
||||
R(&options.RouteListOptions{}, "router-route-list", "List router routes", 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", func(s *mcclient.ClientSession, opts *options.RouteUpdateOptions) error {
|
||||
R(&options.RouteUpdateOptions{}, "router-route-update", "Update router route", 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", func(s *mcclient.ClientSession, opts *options.RouteDeleteOptions) error {
|
||||
R(&options.RouteDeleteOptions{}, "router-route-delete", "Delete router route", func(s *mcclient.ClientSession, opts *options.RouteDeleteOptions) error {
|
||||
router, err := modules.Routes.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -29,11 +29,11 @@ func init() {
|
||||
* 操作用户的通信地址(如果用户的通信地址不存在则进行添加;如果已存在则进行修改;如果设置空则进行删除。)
|
||||
*/
|
||||
type ContactsUpdateOptions struct {
|
||||
UID string `help:"The user you wanna add contact to (Keystone User ID)"`
|
||||
CONTACTTYPE string `help:"The contact type email|mobile" choices:"email|mobile|dingtalk"`
|
||||
CONTACT string `help:"The contacts details mobile number or email address or dingtalk's userid, if set it the empty str means delete"`
|
||||
Status string `help:"Enabled or disabled contact status" choices:"enable|disable"`
|
||||
UpdateDingtalk bool `help:"if update dingtalk"`
|
||||
UID string `help:"The user you wanna add contact to (Keystone User ID)"`
|
||||
CONTACTTYPE string `help:"The contact type email|mobile" choices:"email|mobile|dingtalk"`
|
||||
CONTACT string `help:"The contacts details mobile number or email address or dingtalk's userid, if set it the empty str means delete"`
|
||||
Status string `help:"Enabled or disabled contact status" choices:"enable|disable"`
|
||||
Pull []string `help:"pull some subcontacts(e.g., dingtalk, feishu, etc) related to mobile"`
|
||||
}
|
||||
R(&ContactsUpdateOptions{}, "contact-update", "Create, delete or update contact for user", func(s *mcclient.ClientSession, args *ContactsUpdateOptions) error {
|
||||
arr := jsonutils.NewArray()
|
||||
@@ -52,12 +52,14 @@ func init() {
|
||||
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(arr, "contacts")
|
||||
if args.UpdateDingtalk {
|
||||
params.Add(jsonutils.JSONTrue, "update_dingtalk")
|
||||
|
||||
pulls := jsonutils.NewArray()
|
||||
for _, pull := range args.Pull {
|
||||
pulls.Add(jsonutils.NewString(pull))
|
||||
}
|
||||
params.Add(pulls, "pull")
|
||||
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -66,6 +68,22 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type ContactsPullOptions struct {
|
||||
UID string `help:"The user you wanna pull contact"`
|
||||
CONTACTTYPE string `help:"The contact type"`
|
||||
}
|
||||
R(&ContactsPullOptions{}, "contact-pull", "Pull contact", func(s *mcclient.ClientSession, args *ContactsPullOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Set("contacts", jsonutils.NewArray())
|
||||
params.Set("pull", jsonutils.NewArray(jsonutils.NewString(args.CONTACTTYPE)))
|
||||
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(contact)
|
||||
return nil
|
||||
})
|
||||
|
||||
type ContactsDeleteOptions struct {
|
||||
UID string `help:"The user you wanna add contact to (Keystone User ID)"`
|
||||
CONTACTTYPE string `help:"The contact type email|mobile|dingtalk" choices:"email|mobile|dingtalk"`
|
||||
|
||||
@@ -79,7 +79,7 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
users, err := modules.Groups.GetUsers(s, grpId)
|
||||
users, err := modules.Groups.GetUsers(s, grpId, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -18,11 +18,13 @@ 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() {
|
||||
@@ -55,6 +57,8 @@ func init() {
|
||||
|
||||
CdromBoot *bool `help:"filter hosts list by cdrom_boot=true|false"`
|
||||
|
||||
Sn string `help:"find host by sn"`
|
||||
|
||||
options.BaseListOptions
|
||||
}
|
||||
R(&HostListOptions{}, "host-list", "List hosts", func(s *mcclient.ClientSession, opts *HostListOptions) error {
|
||||
@@ -76,6 +80,9 @@ func init() {
|
||||
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.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -659,4 +666,44 @@ 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
|
||||
})
|
||||
}
|
||||
|
||||
@@ -205,4 +205,70 @@ func initKubeCluster() {
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.IdentOptions{}, cmdN("components-status"), "Get cluster component status", func(s *mcclient.ClientSession, args *o.IdentOptions) error {
|
||||
ret, err := k8s.KubeClusters.GetSpecific(s, args.ID, "components-status", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterComponentTypeOptions{}, cmdN("component-setting"), "Get cluster component setting", func(s *mcclient.ClientSession, args *o.ClusterComponentTypeOptions) error {
|
||||
q := jsonutils.NewDict()
|
||||
q.Add(jsonutils.NewString(args.TYPE), "type")
|
||||
ret, err := k8s.KubeClusters.GetSpecific(s, args.ID, "component-setting", q)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterEnableComponentCephCSIOpt{}, cmdN("component-enable-ceph-csi"), "Enable cluster component", func(s *mcclient.ClientSession, args *o.ClusterEnableComponentCephCSIOpt) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "enable-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterDisableComponent{}, cmdN("component-disable"), "Enable cluster component", func(s *mcclient.ClientSession, args *o.ClusterDisableComponent) error {
|
||||
params := args.Params()
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "disable-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterDisableComponent{}, cmdN("component-delete"), "Delete cluster component", func(s *mcclient.ClientSession, args *o.ClusterDisableComponent) error {
|
||||
params := args.Params()
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "delete-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&o.ClusterUpdateComponentCephCSIOpt{}, cmdN("component-update-ceph-csi"), "Update cluster component", func(s *mcclient.ClientSession, args *o.ClusterUpdateComponentCephCSIOpt) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.KubeClusters.PerformAction(s, args.ID, "update-component", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -40,22 +40,40 @@ func initSecret() {
|
||||
})
|
||||
secretCmd.AddR(listCmd)
|
||||
|
||||
registryCmd := initK8sNamespaceResource("registrysecret", k8s.RegistrySecrets)
|
||||
createCmd := NewCommand(
|
||||
registryCmd := NewCmdNameFactory("secret-registry")
|
||||
registryCreateCmd := NewCommand(
|
||||
&o.RegistrySecretCreateOptions{},
|
||||
registryCmd.CommandNameFactory("create"),
|
||||
"Create docker registry secret resource",
|
||||
registryCmd.Do("create"),
|
||||
"Create docker registry secret secret",
|
||||
func(s *mcclient.ClientSession, args *o.RegistrySecretCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.RegistrySecrets.Create(s, params)
|
||||
ret, err := k8s.Secrets.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
registryCmd.AddR(createCmd)
|
||||
|
||||
cephCSICmd := NewCmdNameFactory("secret-ceph-csi")
|
||||
cephCSICreateCmd := NewCommand(
|
||||
&o.CephCSISecretCreateOptions{},
|
||||
cephCSICmd.Do("create"),
|
||||
"Create ceph csi user secret",
|
||||
func(s *mcclient.ClientSession, args *o.CephCSISecretCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Secrets.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
secretCmd.AddR(cephCSICreateCmd, registryCreateCmd)
|
||||
}
|
||||
|
||||
@@ -15,9 +15,70 @@
|
||||
package k8s
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
|
||||
o "yunion.io/x/onecloud/pkg/mcclient/options/k8s"
|
||||
)
|
||||
|
||||
func initStorageClass() {
|
||||
initK8sClusterResource("storageclass", k8s.Storageclass)
|
||||
cmdN := NewCmdNameFactory("storageclass")
|
||||
scCmd := initK8sClusterResource("storageclass", k8s.Storageclass)
|
||||
|
||||
setDefaultCmd := NewCommand(
|
||||
&o.ClusterResourceBaseOptions{},
|
||||
cmdN.Do("set-default"),
|
||||
"Set storageclass as default",
|
||||
func(s *mcclient.ClientSession, args *o.ClusterResourceBaseOptions) error {
|
||||
ret, err := k8s.Storageclass.PerformAction(s, args.NAME, "set-default", args.Params())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
scCmd.AddR(setDefaultCmd)
|
||||
|
||||
addStorageClassCephCSI(scCmd)
|
||||
}
|
||||
|
||||
func addStorageClassCephCSI(cmd *ShellCommands) {
|
||||
rbdN := NewCmdNameFactory("storageclass-ceph-csi-rbd")
|
||||
rbdCreateCmd := NewCommand(
|
||||
&o.StorageClassCephCSIRBDCreateOptions{},
|
||||
rbdN.Do("create"),
|
||||
"Create ceph csi rbd",
|
||||
func(s *mcclient.ClientSession, args *o.StorageClassCephCSIRBDCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Storageclass.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
testConnCmd := NewCommand(
|
||||
&o.StorageClassCephCSIRBDTestOptions{},
|
||||
rbdN.Do("connection-test"),
|
||||
"Test storageclass connection",
|
||||
func(s *mcclient.ClientSession, args *o.StorageClassCephCSIRBDTestOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := k8s.Storageclass.PerformClassAction(s, "connection-test", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
cmd.AddR(rbdCreateCmd, testConnCmd)
|
||||
}
|
||||
|
||||
116
cmd/climc/shell/monitor/alert.go
Normal file
116
cmd/climc/shell/monitor/alert.go
Normal file
@@ -0,0 +1,116 @@
|
||||
// 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
|
||||
})
|
||||
}
|
||||
60
cmd/climc/shell/monitor/alertnotification.go
Normal file
60
cmd/climc/shell/monitor/alertnotification.go
Normal file
@@ -0,0 +1,60 @@
|
||||
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
|
||||
})
|
||||
}
|
||||
27
cmd/climc/shell/monitor/common.go
Normal file
27
cmd/climc/shell/monitor/common.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/cmd/climc/shell"
|
||||
"yunion.io/x/onecloud/pkg/util/printutils"
|
||||
)
|
||||
|
||||
var (
|
||||
R = shell.R
|
||||
printList = printutils.PrintJSONList
|
||||
printObject = printutils.PrintJSONObject
|
||||
printBatchResults = printutils.PrintJSONBatchResults
|
||||
)
|
||||
56
cmd/climc/shell/monitor/monitor.go
Normal file
56
cmd/climc/shell/monitor/monitor.go
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
|
||||
func cmdN(suffix string) func(action string) string {
|
||||
return func(action string) string {
|
||||
return fmt.Sprintf("monitor-%s-%s", suffix, action)
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
dsN := cmdN("datasource")
|
||||
R(&options.DataSourceListOptions{}, dsN("list"), "List all monitor data source",
|
||||
func(s *mcclient.ClientSession, args *options.DataSourceListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.DataSources.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(ret, monitor.DataSources.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.DataSourceDeleteOptions{}, dsN("delete"), "Delete monitor data source",
|
||||
func(s *mcclient.ClientSession, args *options.DataSourceDeleteOptions) error {
|
||||
ret, err := monitor.DataSources.Delete(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
99
cmd/climc/shell/monitor/notification.go
Normal file
99
cmd/climc/shell/monitor/notification.go
Normal file
@@ -0,0 +1,99 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules/monitor"
|
||||
options "yunion.io/x/onecloud/pkg/mcclient/options/monitor"
|
||||
)
|
||||
|
||||
func init() {
|
||||
nN := cmdN("notification")
|
||||
R(&options.NotificationListOptions{}, nN("list"), "List all alert notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationListOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Notifications.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(ret, monitor.Notifications.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NotificationDingDingCreateOptions{}, nN("create-dingding"),
|
||||
"Create dingding alert notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationDingDingCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Notifications.Create(s, params.JSON(params))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NotificationFeishuCreateOptions{}, nN("create-feishu"),
|
||||
"Create feishu alert notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationFeishuCreateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Notifications.Create(s, params.JSON(params))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NotificationShowOptions{}, nN("show"), "Show alert notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationShowOptions) error {
|
||||
ret, err := monitor.Notifications.Get(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NotificationUpdateOptions{}, nN("update"), "Update alert notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationUpdateOptions) error {
|
||||
params, err := args.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ret, err := monitor.Notifications.Update(s, args.ID, params.JSON(params))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.NotificationDeleteOptions{}, nN("delete"), "Show delete notification",
|
||||
func(s *mcclient.ClientSession, args *options.NotificationDeleteOptions) error {
|
||||
ret := monitor.Notifications.BatchDelete(s, args.ID, nil)
|
||||
printBatchResults(ret, monitor.Notifications.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -346,77 +346,6 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkAddDnsUpdateTargetOptions struct {
|
||||
ID string `help:"Network ID or name"`
|
||||
DNS string `help:"DNS server address" metavar:"DNS_SERVER"`
|
||||
KEY string `help:"DNS update key name" metavar:"DNS_UPDATE_KEY"`
|
||||
SECRET string `help:"DNS update key secret" metavar:"DNS_UPDATE_SECRET"`
|
||||
}
|
||||
R(&NetworkAddDnsUpdateTargetOptions{}, "network-add-dns-update-target", "Add a dns update target to a network", func(s *mcclient.ClientSession, args *NetworkAddDnsUpdateTargetOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.DNS), "server")
|
||||
params.Add(jsonutils.NewString(args.KEY), "key")
|
||||
params.Add(jsonutils.NewString(args.SECRET), "secret")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "add-dns-update-target", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkRemoveDnsUpdateTargetOptions struct {
|
||||
ID string `help:"Network ID or name"`
|
||||
DNS string `help:"DNS server address" metavar:"DNS_SERVER"`
|
||||
KEY string `help:"DNS update key name" metavar:"DNS_UPDATE_KEY"`
|
||||
}
|
||||
R(&NetworkRemoveDnsUpdateTargetOptions{}, "network-remove-dns-update-target", "Remove a dns update target from a network", func(s *mcclient.ClientSession, args *NetworkRemoveDnsUpdateTargetOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.DNS), "server")
|
||||
params.Add(jsonutils.NewString(args.KEY), "key")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "remove-dns-update-target", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkSetDnsUpdateKeyOptions struct {
|
||||
ID string `help:"ID of virtual network to update"`
|
||||
KEY string `help:"Key name of secret" metavar:"KEYNAME"`
|
||||
SECRET string `help:"Key secret"`
|
||||
SERVER string `help:"Alternate DNS update server"`
|
||||
}
|
||||
R(&NetworkSetDnsUpdateKeyOptions{}, "network-set-dns-update-key", "Set DNS update key info for a virtual network", func(s *mcclient.ClientSession, args *NetworkSetDnsUpdateKeyOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.KEY), "dns_update_key_name")
|
||||
params.Add(jsonutils.NewString(args.SECRET), "dns_update_key_secret")
|
||||
params.Add(jsonutils.NewString(args.SERVER), "dns_update_server")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "metadata", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkRemoveDnsUpdateKeyOptions struct {
|
||||
ID string `help:"ID of virtual network"`
|
||||
}
|
||||
R(&NetworkRemoveDnsUpdateKeyOptions{}, "network-remove-dns-update-key", "Set DNS update key info for a virtual network", func(s *mcclient.ClientSession, args *NetworkRemoveDnsUpdateKeyOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.JSONNull, "dns_update_key_name")
|
||||
params.Add(jsonutils.JSONNull, "dns_update_key_secret")
|
||||
params.Add(jsonutils.JSONNull, "dns_update_server")
|
||||
result, err := modules.Networks.PerformAction(s, args.ID, "metadata", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkAddressOptions struct {
|
||||
NETWORK string `help:"id or name of network to query"`
|
||||
}
|
||||
|
||||
@@ -59,18 +59,18 @@ func init() {
|
||||
* 修改指定的报警规则
|
||||
*/
|
||||
type NodealertUpdateOptions struct {
|
||||
ID string `help:"ID of the alert rule" required:"true" positional:"true"`
|
||||
Type string `help:"Alert rule type" choices:"guest|host"`
|
||||
Metric string `help:"Metric name, include measurement and field, such as vm_cpu.usage_active"`
|
||||
NodeName string `help:"Name of the guest or host"`
|
||||
NodeID string `help:"ID of the guest or host"`
|
||||
Period string `help:"Specify the query time period for the data"`
|
||||
Window string `help:"Specify the query interval for the data"`
|
||||
Threshold float64 `help:"Threshold value of the metric"`
|
||||
Comparator string `help:"Comparison operator for join expressions" choices:">|<|>=|<=|=|!="`
|
||||
Recipients string `help:"Comma separated recipient ID"`
|
||||
Level string `help:"Alert level" choices:"normal|important|fatal"`
|
||||
Channel string `help:"Ways to send an alarm" choices:"email|mobile"`
|
||||
ID string `help:"ID of the alert rule" required:"true" positional:"true"`
|
||||
Type string `help:"Alert rule type" choices:"guest|host"`
|
||||
Metric string `help:"Metric name, include measurement and field, such as vm_cpu.usage_active"`
|
||||
NodeName string `help:"Name of the guest or host"`
|
||||
NodeID string `help:"ID of the guest or host"`
|
||||
Period string `help:"Specify the query time period for the data"`
|
||||
Window string `help:"Specify the query interval for the data"`
|
||||
Threshold *float64 `help:"Threshold value of the metric"`
|
||||
Comparator string `help:"Comparison operator for join expressions" choices:">|<|>=|<=|=|!="`
|
||||
Recipients string `help:"Comma separated recipient ID"`
|
||||
Level string `help:"Alert level" choices:"normal|important|fatal"`
|
||||
Channel string `help:"Ways to send an alarm" choices:"email|mobile"`
|
||||
}
|
||||
R(&NodealertUpdateOptions{}, "nodealert-update", "Update the node alert rule", func(s *mcclient.ClientSession, args *NodealertUpdateOptions) error {
|
||||
params, err := options.StructToParams(args)
|
||||
@@ -92,14 +92,11 @@ func init() {
|
||||
* 删除指定ID的报警规则
|
||||
*/
|
||||
type NodealertDeleteOptions struct {
|
||||
ID string `help:"ID of node alert" required:"true" positional:"true"`
|
||||
ID []string `help:"ID of node alert" required:"true" positional:"true"`
|
||||
}
|
||||
R(&NodealertDeleteOptions{}, "nodealert-delete", "Delete a node alert", func(s *mcclient.ClientSession, args *NodealertDeleteOptions) error {
|
||||
alarm, err := modules.NodeAlert.Delete(s, args.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(alarm)
|
||||
ret := modules.NodeAlert.BatchDelete(s, args.ID, nil)
|
||||
printBatchResults(ret, modules.NodeAlert.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ func init() {
|
||||
*/
|
||||
|
||||
type NotificationCreateOptions struct {
|
||||
CONTACTTYPE string `help:"User's contacts type" choices:"email|mobile|dingtalk|webconsole"`
|
||||
CONTACTTYPE string `help:"User's contacts type"`
|
||||
TOPIC string `help:"Title or topic of the notification"`
|
||||
PRIORITY string `help:"Priority of the notification" choices:"normal|important|fatal"`
|
||||
MSG string `help:"The content of the notification"`
|
||||
@@ -41,7 +41,7 @@ func init() {
|
||||
NotificationCreateOptions
|
||||
}
|
||||
|
||||
R(&NotificationCreateSingleOptions{}, "notify", "Send a notification to someones", func(s *mcclient.ClientSession,
|
||||
R(&NotificationCreateSingleOptions{}, "notify", "Send a notification to someone", func(s *mcclient.ClientSession,
|
||||
args *NotificationCreateSingleOptions) error {
|
||||
|
||||
msg := notify.SNotifyMessage{}
|
||||
|
||||
@@ -34,7 +34,24 @@ func init() {
|
||||
}
|
||||
body := jsonutils.NewDict()
|
||||
body.Add(tmp, args.CONTACTTYPE)
|
||||
modules.Configs.Create(s, body)
|
||||
ret, err := modules.Configs.Create(s, body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
R(&ConfigCreate2Options{}, "notify-config-validate", "config validate", func(s *mcclient.ClientSession,
|
||||
args *ConfigCreate2Options) error {
|
||||
tmp := jsonutils.NewDict()
|
||||
for i := 0; i+1 < len(args.CONFIGS); i += 2 {
|
||||
tmp.Add(jsonutils.NewString(args.CONFIGS[i+1]), args.CONFIGS[i])
|
||||
}
|
||||
ret, err := modules.Configs.PerformAction(s, args.CONTACTTYPE, "validate", tmp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(ret)
|
||||
return nil
|
||||
})
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ func init() {
|
||||
return nil
|
||||
}
|
||||
R(&PolicyPatchOptions{}, "policy-patch", "Patch policy", updateFunc)
|
||||
R(&PolicyPatchOptions{}, "policy-update", "Patch policy", updateFunc)
|
||||
R(&PolicyPatchOptions{}, "policy-update", "Update policy", updateFunc)
|
||||
|
||||
type PolicyPerformOptions struct {
|
||||
ID string `help:"ID of policy to update"`
|
||||
|
||||
81
cmd/climc/shell/proxysettings.go
Normal file
81
cmd/climc/shell/proxysettings.go
Normal file
@@ -0,0 +1,81 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package shell
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/mcclient"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/modules"
|
||||
"yunion.io/x/onecloud/pkg/mcclient/options"
|
||||
)
|
||||
|
||||
func init() {
|
||||
R(&options.ProxySettingCreateOptions{}, "proxysetting-create", "Create proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingCreateOptions) error {
|
||||
params, err := options.StructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
proxysetting, err := modules.ProxySettings.Create(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingGetOptions{}, "proxysetting-show", "Show proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingGetOptions) error {
|
||||
proxysetting, err := modules.ProxySettings.Get(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingListOptions{}, "proxysetting-list", "List proxysettings", func(s *mcclient.ClientSession, opts *options.ProxySettingListOptions) error {
|
||||
params, err := options.ListStructToParams(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
result, err := modules.ProxySettings.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printList(result, modules.ProxySettings.GetColumns(s))
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingUpdateOptions{}, "proxysetting-update", "Update proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingUpdateOptions) error {
|
||||
params, err := options.StructToParams(opts)
|
||||
proxysetting, err := modules.ProxySettings.Update(s, opts.ID, params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingDeleteOptions{}, "proxysetting-delete", "Delete proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingDeleteOptions) error {
|
||||
proxysetting, err := modules.ProxySettings.Delete(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
R(&options.ProxySettingTestOptions{}, "proxysetting-test", "Test proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingTestOptions) error {
|
||||
proxysetting, err := modules.ProxySettings.PerformAction(s, opts.ID, "test", nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(proxysetting)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
@@ -34,6 +34,7 @@ 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() {
|
||||
@@ -178,6 +179,19 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
R(&options.ServerCreateOptions{}, "server-check-create-data", "Check create server data", func(s *mcclient.ClientSession, opts *options.ServerCreateOptions) error {
|
||||
params, err := opts.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
server, err := modules.Servers.PerformClassAction(s, "check-create-data", params.JSON(params))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(server)
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ServerCreateOptions{}, "server-create", "Create a server", func(s *mcclient.ClientSession, opts *options.ServerCreateOptions) error {
|
||||
params, err := opts.Params()
|
||||
if err != nil {
|
||||
@@ -1218,4 +1232,77 @@ func init() {
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&options.ServerSSHLoginOptions{}, "server-ssh", "Use SSH login a server", func(s *mcclient.ClientSession, opts *options.ServerSSHLoginOptions) error {
|
||||
srv, err := modules.Servers.Get(s, opts.ID, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
srvid, err := srv.GetString("id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
address := make([]string, 0)
|
||||
nics, err := srv.GetArray("nics")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, nic := range nics {
|
||||
if addr, err := nic.GetString("ip_addr"); err == nil {
|
||||
address = append(address, addr)
|
||||
}
|
||||
}
|
||||
if len(address) == 0 {
|
||||
return fmt.Errorf("Not found ip address from server %s", opts.ID)
|
||||
}
|
||||
|
||||
params := jsonutils.NewDict()
|
||||
if len(opts.Key) > 0 {
|
||||
privateKey, e := ioutil.ReadFile(opts.Key)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
params.Add(jsonutils.NewString(string(privateKey)), "private_key")
|
||||
}
|
||||
|
||||
i, e := modules.Servers.GetLoginInfo(s, srvid, params)
|
||||
if e != nil {
|
||||
return e
|
||||
}
|
||||
passwd, err := i.GetString("password")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if opts.Password != "" {
|
||||
passwd = opts.Password
|
||||
}
|
||||
user, err := i.GetString("username")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if opts.User != "" {
|
||||
user = opts.User
|
||||
}
|
||||
|
||||
host := address[0]
|
||||
if opts.Host != "" {
|
||||
host = opts.Host
|
||||
}
|
||||
port := 22
|
||||
if opts.Port != 22 {
|
||||
port = opts.Port
|
||||
}
|
||||
|
||||
sshCli, err := ssh.NewClient(host, port, user, passwd, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Infof("ssh %s:%d", host, port)
|
||||
if err := sshCli.RunTerminal(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
@@ -45,6 +46,9 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if decodeStr, err := base64.StdEncoding.DecodeString(connParams); err == nil {
|
||||
connParams = string(decodeStr)
|
||||
}
|
||||
var query url.Values
|
||||
connUrl, err := url.ParseRequestURI(connParams)
|
||||
if err == nil {
|
||||
@@ -64,7 +68,9 @@ func init() {
|
||||
return nil
|
||||
}
|
||||
|
||||
u.RawQuery = connParams
|
||||
newQuery := url.Values(make(map[string][]string))
|
||||
newQuery.Set("data", base64.StdEncoding.EncodeToString([]byte(connParams)))
|
||||
u.RawQuery = newQuery.Encode()
|
||||
fmt.Println(u.String())
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -84,8 +84,11 @@ func newClient(options *BaseOptions) (*ctyun.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := ctyun.NewSCtyunClient("", "", "",
|
||||
options.AccessKey, options.Secret, options.Debug)
|
||||
cli, err := ctyun.NewSCtyunClient(
|
||||
ctyun.NewSCtyunClientConfig(
|
||||
options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -88,7 +88,14 @@ func newClient(options *BaseOptions) (*esxi.SESXiClient, error) {
|
||||
return nil, fmt.Errorf("Missing password")
|
||||
}
|
||||
|
||||
return esxi.NewESXiClient2("", "", options.Host, options.Port, options.Account, options.Password, false)
|
||||
return esxi.NewESXiClient2(
|
||||
esxi.NewESXiClientConfig(
|
||||
options.Host,
|
||||
options.Port,
|
||||
options.Account,
|
||||
options.Password,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -94,7 +94,14 @@ func newClient(options *BaseOptions) (*google.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing ProjectID")
|
||||
}
|
||||
|
||||
cli, err := google.NewGoogleClient("", "", options.ProjectID, options.ClientEmail, options.PrivateKeyID, options.PrivateKey, options.Debug)
|
||||
cli, err := google.NewGoogleClient(
|
||||
google.NewGoogleClientConfig(
|
||||
options.ProjectID,
|
||||
options.ClientEmail,
|
||||
options.PrivateKeyID,
|
||||
options.PrivateKey,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -86,9 +86,14 @@ func newClient(options *BaseOptions) (*huawei.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := huawei.NewHuaweiClient("", "", options.CloudEnv,
|
||||
options.AccessKey, options.Secret, options.ProjectId,
|
||||
options.Debug)
|
||||
cli, err := huawei.NewHuaweiClient(
|
||||
huawei.NewHuaweiClientConfig(
|
||||
options.CloudEnv,
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.ProjectId,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
23
cmd/monitor/main.go
Normal file
23
cmd/monitor/main.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/monitor/service"
|
||||
)
|
||||
|
||||
func main() {
|
||||
service.StartService()
|
||||
}
|
||||
@@ -93,7 +93,18 @@ func newClient(options *BaseOptions) (*openstack.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Password")
|
||||
}
|
||||
|
||||
cli, err := openstack.NewOpenStackClient("", "", options.AuthURL, options.Username, options.Password, options.Project, options.EndpointType, options.DomainName, options.ProjectDomain, options.Debug)
|
||||
cli, err := openstack.NewOpenStackClient(
|
||||
openstack.NewOpenstackClientConfig(
|
||||
options.AuthURL,
|
||||
options.Username,
|
||||
options.Password,
|
||||
options.Project,
|
||||
options.ProjectDomain,
|
||||
).
|
||||
EndpointType(options.EndpointType).
|
||||
DomainName(options.DomainName).
|
||||
Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -85,11 +85,12 @@ func newClient(options *BaseOptions) (*qcloud.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing SecretID")
|
||||
}
|
||||
|
||||
if cli, err := qcloud.NewQcloudClient("", "",
|
||||
options.SecretID,
|
||||
options.SecretKey,
|
||||
options.AppID,
|
||||
options.Debug); err != nil {
|
||||
if cli, err := qcloud.NewQcloudClient(
|
||||
qcloud.NewQcloudClientConfig(
|
||||
options.SecretID,
|
||||
options.SecretKey,
|
||||
).AppId(options.AppID).Debug(options.Debug),
|
||||
); err != nil {
|
||||
return nil, err
|
||||
} else if region := cli.GetRegion(options.RegionId); region == nil {
|
||||
return nil, fmt.Errorf("No such region %s", options.RegionId)
|
||||
|
||||
@@ -94,11 +94,23 @@ func newClient(options *BaseOptions) (cloudprovider.ICloudRegion, error) {
|
||||
}
|
||||
|
||||
if options.Backend == api.CLOUD_PROVIDER_CEPH {
|
||||
return ceph.NewCephRados("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
return ceph.NewCephRados(
|
||||
objectstore.NewObjectStoreClientConfig(
|
||||
options.AccessUrl, options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
} else if options.Backend == api.CLOUD_PROVIDER_XSKY {
|
||||
return xsky.NewXskyClient("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
return xsky.NewXskyClient(
|
||||
objectstore.NewObjectStoreClientConfig(
|
||||
options.AccessUrl, options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
}
|
||||
return objectstore.NewObjectStoreClient("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
|
||||
return objectstore.NewObjectStoreClient(
|
||||
objectstore.NewObjectStoreClientConfig(
|
||||
options.AccessUrl, options.AccessKey, options.Secret,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
@@ -86,11 +86,12 @@ func newClient(options *BaseOptions) (*ucloud.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing secret")
|
||||
}
|
||||
|
||||
cli, err := ucloud.NewUcloudClient("", "",
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
options.ProjectId,
|
||||
options.Debug)
|
||||
cli, err := ucloud.NewUcloudClient(
|
||||
ucloud.NewUcloudClientConfig(
|
||||
options.AccessKey,
|
||||
options.Secret,
|
||||
).ProjectId(options.ProjectId).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -89,7 +89,13 @@ func newClient(options *BaseOptions) (*zstack.SRegion, error) {
|
||||
return nil, fmt.Errorf("Missing Password")
|
||||
}
|
||||
|
||||
cli, err := zstack.NewZStackClient("", "", options.AuthURL, options.Username, options.Password, options.Debug)
|
||||
cli, err := zstack.NewZStackClient(
|
||||
zstack.NewZstackClientConfig(
|
||||
options.AuthURL,
|
||||
options.Username,
|
||||
options.Password,
|
||||
).Debug(options.Debug),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
93
go.mod
93
go.mod
@@ -3,9 +3,11 @@ module yunion.io/x/onecloud
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.38.0
|
||||
github.com/360EntSecGroup-Skylar/excelize v1.4.0
|
||||
github.com/Azure/azure-sdk-for-go v36.1.0+incompatible
|
||||
github.com/Azure/go-autorest v10.15.5+incompatible
|
||||
github.com/Azure/go-autorest/autorest v0.9.3
|
||||
github.com/Azure/go-autorest/autorest/azure/auth v0.4.2
|
||||
github.com/DataDog/dd-trace-go v0.6.1 // indirect
|
||||
github.com/DataDog/zstd v1.3.4 // indirect
|
||||
github.com/Microsoft/azure-vhd-utils v0.0.0-20181115010904-44cbada2ece3
|
||||
@@ -22,28 +24,24 @@ require (
|
||||
github.com/aokoli/goutils v1.0.1
|
||||
github.com/aws/aws-sdk-go v1.21.4
|
||||
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
|
||||
github.com/benbjohnson/clock v1.0.0
|
||||
github.com/bitly/go-simplejson v0.5.0
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 // indirect
|
||||
github.com/c-bata/go-prompt v0.2.1
|
||||
github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94
|
||||
github.com/coredns/coredns v1.3.0
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd v0.0.0-20190620071333-e64a0ec8b42a // indirect
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20190806190131-db2462fef53b // indirect
|
||||
github.com/dimchansky/utfbom v1.1.0 // indirect
|
||||
github.com/dnaeon/go-vcr v1.0.1 // indirect
|
||||
github.com/dnstap/golang-dnstap v0.0.0-20170829151710-2cf77a2b5e11 // indirect
|
||||
github.com/edsrzf/mmap-go v1.0.0 // indirect
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
|
||||
github.com/farsightsec/golang-framestream v0.0.0-20181102145529-8a0cb8ba8710 // indirect
|
||||
github.com/fatih/color v1.7.0
|
||||
github.com/fernet/fernet-go v0.0.0-20180830025343-9eac43b88a5e
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.7
|
||||
github.com/ghodss/yaml v1.0.0
|
||||
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 // indirect
|
||||
github.com/gin-gonic/gin v1.3.0
|
||||
github.com/gin-gonic/gin v1.5.0
|
||||
github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 // indirect
|
||||
github.com/go-logfmt/logfmt v0.4.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.2 // indirect
|
||||
@@ -56,14 +54,12 @@ require (
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
|
||||
github.com/golang/protobuf v1.3.2
|
||||
github.com/google/gopacket v1.1.17
|
||||
github.com/google/uuid v1.1.0 // indirect
|
||||
github.com/googleapis/gnostic v0.2.0 // indirect
|
||||
github.com/googollee/go-engine.io v0.0.0-20180829091931-e2f255711dcb // indirect
|
||||
github.com/googollee/go-socket.io v0.0.0-20181214084611-0ad7206c347a
|
||||
github.com/gorilla/mux v1.6.2
|
||||
github.com/gorilla/mux v1.7.0
|
||||
github.com/gorilla/websocket v1.4.0
|
||||
github.com/gosuri/uitable v0.0.0-20160404203958-36ee7e946282
|
||||
github.com/gregjones/httpcache v0.0.0-20181110185634-c63ab54fda8f // indirect
|
||||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect
|
||||
github.com/hako/durafmt v0.0.0-20180520121703-7b7ae1e72ead
|
||||
github.com/huandu/xstrings v1.2.0 // indirect
|
||||
@@ -72,7 +68,7 @@ require (
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.0.1 // indirect
|
||||
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c
|
||||
github.com/kr/pty v1.1.3
|
||||
github.com/kr/pty v1.1.5
|
||||
github.com/lib/pq v1.2.0 // indirect
|
||||
github.com/libvirt/libvirt-go-xml v5.2.0+incompatible
|
||||
github.com/mattn/go-runewidth v0.0.4 // indirect
|
||||
@@ -82,7 +78,7 @@ require (
|
||||
github.com/mdlayher/ethernet v0.0.0-20190606142754-0394541c37b7
|
||||
github.com/mdlayher/raw v0.0.0-20190606144222-a54781e5f38f
|
||||
github.com/mholt/caddy v0.10.11
|
||||
github.com/miekg/dns v1.1.1
|
||||
github.com/miekg/dns v1.1.4
|
||||
github.com/minio/minio-go v6.0.14+incompatible
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||
github.com/moul/http2curl v1.0.0
|
||||
@@ -90,57 +86,82 @@ require (
|
||||
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492 // indirect
|
||||
github.com/opentracing/opentracing-go v1.0.2 // indirect
|
||||
github.com/openzipkin/zipkin-go-opentracing v0.3.4 // indirect
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
||||
github.com/pierrec/lz4 v2.0.5+incompatible
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/pkg/term v0.0.0-20181116001808-27bbf2edb814 // indirect
|
||||
github.com/pquerna/otp v1.2.0
|
||||
github.com/satori/go.uuid v1.2.0 // indirect
|
||||
github.com/serialx/hashring v0.0.0-20180504054112-49a4782e9908
|
||||
github.com/shirou/gopsutil v2.18.10+incompatible
|
||||
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
|
||||
github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9
|
||||
github.com/smartystreets/goconvey v1.6.4
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.3 // indirect
|
||||
github.com/stretchr/testify v1.4.0
|
||||
github.com/tencentcloud/tencentcloud-sdk-go v0.0.0-20181108132626-805d01dd0e2e
|
||||
github.com/tencentcloud/tencentcloud-sdk-go v3.0.135+incompatible
|
||||
github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20191108095731-8ca4b370cde4
|
||||
github.com/tinylib/msgp v1.1.0 // indirect
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect
|
||||
github.com/tredoe/osutil v0.0.0-20161130133508-7d3ee1afa71c
|
||||
github.com/ugorji/go v0.0.0-20161130061742-9c7f9b7a2bc3 // indirect
|
||||
github.com/vishvananda/netlink v1.0.0
|
||||
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df // indirect
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible
|
||||
github.com/vmware/govmomi v0.19.0
|
||||
github.com/vmware/govmomi v0.20.1
|
||||
go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738
|
||||
go.uber.org/atomic v1.4.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20191002192127-34f69633bfdc
|
||||
golang.org/x/net v0.0.0-20191007182048-72f939374954
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be
|
||||
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
|
||||
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20191008142428-8d021180e987
|
||||
google.golang.org/api v0.13.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873
|
||||
google.golang.org/grpc v1.23.1
|
||||
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1 // indirect
|
||||
gopkg.in/go-playground/validator.v8 v8.18.2 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.44.0 // indirect
|
||||
gopkg.in/ldap.v3 v3.0.3
|
||||
gopkg.in/yaml.v2 v2.2.2
|
||||
k8s.io/api v0.0.0-20181004124137-fd83cbc87e76
|
||||
k8s.io/apimachinery v0.0.0-20181215012845-4d029f033399
|
||||
gopkg.in/yaml.v2 v2.2.8
|
||||
k8s.io/api v0.17.3
|
||||
k8s.io/apimachinery v0.17.3
|
||||
k8s.io/client-go v9.0.0+incompatible
|
||||
k8s.io/klog v0.1.0 // indirect
|
||||
k8s.io/kubernetes v1.12.3
|
||||
yunion.io/x/executor v0.0.0-20191202093616-92e2e6119257
|
||||
yunion.io/x/jsonutils v0.0.0-20200113074440-9297fd00ba07
|
||||
yunion.io/x/log v0.0.0-20190629062853-9f6483a7103d
|
||||
yunion.io/x/pkg v0.0.0-20200103043034-27c6f82160fa
|
||||
k8s.io/cluster-bootstrap v0.17.3
|
||||
k8s.io/kubernetes v1.16.0
|
||||
yunion.io/x/executor v0.0.0-20200227030256-a18417815e74
|
||||
yunion.io/x/jsonutils v0.0.0-20200330063846-589d9924bb8b
|
||||
yunion.io/x/log v0.0.0-20200313080802-57a4ce5966b3
|
||||
yunion.io/x/pkg v0.0.0-20200403115157-880d716ed624
|
||||
yunion.io/x/s3cli v0.0.0-20190917004522-13ac36d8687e
|
||||
yunion.io/x/sqlchemy v0.0.0-20200119074814-09089d67c78d
|
||||
yunion.io/x/sqlchemy v0.0.0-20200312002602-1177cd8fbc57
|
||||
yunion.io/x/structarg v0.0.0-20190809075558-115bed041de3
|
||||
)
|
||||
|
||||
replace github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94 => github.com/yunionio/go-ceph v0.0.0-20190912101231-6f05a06b3859
|
||||
replace (
|
||||
github.com/ceph/go-ceph v0.0.0-20181217221554-e32f9f0f2e94 => github.com/yunionio/go-ceph v0.0.0-20190912101231-6f05a06b3859
|
||||
|
||||
k8s.io/api => k8s.io/api v0.0.0-20190918155943-95b840bb6a1f
|
||||
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783
|
||||
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655
|
||||
k8s.io/apiserver => k8s.io/apiserver v0.0.0-20190918160949-bfa5e2e684ad
|
||||
k8s.io/cli-runtime => k8s.io/cli-runtime v0.0.0-20190918162238-f783a3654da8
|
||||
k8s.io/client-go => k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90
|
||||
k8s.io/cloud-provider => k8s.io/cloud-provider v0.0.0-20190918163234-a9c1f33e9fb9
|
||||
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.0.0-20190918163108-da9fdfce26bb
|
||||
k8s.io/code-generator => k8s.io/code-generator v0.0.0-20190912054826-cd179ad6a269
|
||||
k8s.io/component-base => k8s.io/component-base v0.0.0-20190918160511-547f6c5d7090
|
||||
k8s.io/cri-api => k8s.io/cri-api v0.0.0-20190828162817-608eb1dad4ac
|
||||
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.0.0-20190918163402-db86a8c7bb21
|
||||
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.0.0-20190918161219-8c8f079fddc3
|
||||
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.0.0-20190918162944-7a93a0ddadd8
|
||||
k8s.io/kube-proxy => k8s.io/kube-proxy v0.0.0-20190918162534-de037b596c1e
|
||||
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.0.0-20190918162820-3b5c1246eb18
|
||||
k8s.io/kubectl => k8s.io/kubectl v0.0.0-20190918164019-21692a0861df
|
||||
k8s.io/kubelet => k8s.io/kubelet v0.0.0-20190918162654-250a1838aa2c
|
||||
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.0.0-20190918163543-cfa506e53441
|
||||
k8s.io/metrics => k8s.io/metrics v0.0.0-20190918162108-227c654b2546
|
||||
k8s.io/node-api => k8s.io/node-api v0.0.0-20190918163711-2299658ad911
|
||||
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.0.0-20190918161442-d4c9c65c82af
|
||||
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.0.0-20190918162410-e45c26d066f2
|
||||
k8s.io/sample-controller => k8s.io/sample-controller v0.0.0-20190918161628-92eb3cb7496c
|
||||
)
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
"yunion.io/x/onecloud/pkg/apigateway/constants"
|
||||
"yunion.io/x/onecloud/pkg/apigateway/options"
|
||||
policytool "yunion.io/x/onecloud/pkg/apigateway/policy"
|
||||
"yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/appctx"
|
||||
"yunion.io/x/onecloud/pkg/appsrv"
|
||||
"yunion.io/x/onecloud/pkg/cloudcommon/policy"
|
||||
@@ -646,8 +647,11 @@ func getUserAuthCookie(ctx context.Context, s *mcclient.ClientSession, token mcc
|
||||
}
|
||||
|
||||
func getLBAgentInfo(s *mcclient.ClientSession, token mcclient.TokenCredential) (*jsonutils.JSONDict, error) {
|
||||
|
||||
lbagents, err := modules.LoadbalancerAgents.List(s, nil)
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("hb_last_seen.isnotempty()"), "filter.0")
|
||||
params.Add(jsonutils.NewInt(1), "limit")
|
||||
params.Add(jsonutils.JSONFalse, "details")
|
||||
lbagents, err := modules.LoadbalancerAgents.List(s, params)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "user %s get lbagent", token.GetUserName())
|
||||
}
|
||||
@@ -665,6 +669,7 @@ func getLBAgentInfo(s *mcclient.ClientSession, token mcclient.TokenCredential) (
|
||||
}
|
||||
|
||||
func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.TokenCredential, req *http.Request) (*jsonutils.JSONDict, error) {
|
||||
log.Infof("getUserInfo modules.UsersV3.Get")
|
||||
usr, err := modules.UsersV3.Get(s, token.GetUserId(), nil)
|
||||
if err != nil {
|
||||
log.Errorf("modules.UsersV3.Get fail %s", err)
|
||||
@@ -693,6 +698,7 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
data.Add(jsonutils.NewString(token.GetProjectDomain()), "projectDomain")
|
||||
data.Add(jsonutils.NewString(token.GetProjectDomainId()), "projectDomainId")
|
||||
|
||||
log.Infof("getUserInfo modules.RoleAssignments.List")
|
||||
query := jsonutils.NewDict()
|
||||
query.Add(jsonutils.JSONNull, "effective")
|
||||
query.Add(jsonutils.JSONNull, "include_names")
|
||||
@@ -772,6 +778,7 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
log.Errorf("fail to find services????: %#v %s", adminToken, curReg)
|
||||
}
|
||||
|
||||
log.Infof("getUserInfo getLBAgentInfo")
|
||||
lb, err := getLBAgentInfo(s, adminToken)
|
||||
if err != nil {
|
||||
log.Errorf("getLBAgentInfo fail %s", err)
|
||||
@@ -788,13 +795,23 @@ func getUserInfo(ctx context.Context, s *mcclient.ClientSession, token mcclient.
|
||||
}
|
||||
}
|
||||
|
||||
log.Infof("getUserInfo modules.Hosts.Get")
|
||||
s2 := auth.GetSession(ctx, token, FetchRegion(req), "v2")
|
||||
cap, err := modules.Capabilities.List(s2, nil)
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString("host_type"), "field")
|
||||
params.Add(jsonutils.NewString("system"), "scope")
|
||||
params.Add(jsonutils.JSONTrue, "usable")
|
||||
params.Add(jsonutils.JSONTrue, "show_emulated")
|
||||
cap, err := modules.Hosts.Get(s2, "distinct-field", params)
|
||||
if err != nil {
|
||||
log.Errorf("modules.Capabilities.List fail %s", err)
|
||||
log.Errorf("modules.Servers.Get distinct-field fail %s", err)
|
||||
} else {
|
||||
hypervisors, _ := cap.Data[0].Get("hypervisors")
|
||||
data.Add(hypervisors, "hypervisors")
|
||||
hostTypes, _ := jsonutils.GetStringArray(cap, "host_type")
|
||||
hypervisors := make([]string, len(hostTypes))
|
||||
for i, hostType := range hostTypes {
|
||||
hypervisors[i] = compute.HOSTTYPE_HYPERVISOR[hostType]
|
||||
}
|
||||
data.Add(jsonutils.NewStringArray(hypervisors), "hypervisors")
|
||||
}
|
||||
|
||||
data.Add(menus, "menus")
|
||||
|
||||
@@ -117,21 +117,24 @@ func rpcHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) {
|
||||
v, ok := retobj.Interface().(jsonutils.JSONObject)
|
||||
if ok {
|
||||
appsrv.SendJSON(w, v)
|
||||
return
|
||||
}
|
||||
|
||||
v2, ok := retobj.Interface().([]modulebase.SubmitResult)
|
||||
if ok {
|
||||
w.WriteHeader(207)
|
||||
appsrv.SendJSON(w, modulebase.SubmitResults2JSON(v2))
|
||||
} else {
|
||||
httperrors.BadGatewayError(w, "recv invalid data")
|
||||
return
|
||||
}
|
||||
|
||||
httperrors.BadGatewayError(w, "recv invalid data")
|
||||
} else {
|
||||
v, ok := reterr.Interface().(*httputils.JSONClientError)
|
||||
if ok {
|
||||
httperrors.JsonClientError(w, v)
|
||||
} else {
|
||||
httperrors.BadGatewayError(w, fmt.Sprintf("%s", reterr.Interface()))
|
||||
return
|
||||
}
|
||||
|
||||
httperrors.BadGatewayError(w, fmt.Sprintf("%s", reterr.Interface()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ type GatewayOptions struct {
|
||||
|
||||
SqlitePath string `help:"sqlite db path" default:"/etc/yunion/data/yunionapi.db"`
|
||||
|
||||
common_options.CommonOptions
|
||||
common_options.CommonOptions `"request_worker_count->default":"32"`
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -40,9 +40,10 @@ func OnOptionsChange(oldO, newO interface{}) bool {
|
||||
oldOpts := oldO.(*GatewayOptions)
|
||||
newOpts := newO.(*GatewayOptions)
|
||||
|
||||
changed := false
|
||||
if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
|
||||
return true
|
||||
changed = true
|
||||
}
|
||||
|
||||
return false
|
||||
return changed
|
||||
}
|
||||
|
||||
1
pkg/apis/cloudcommon/proxy/doc.go
Normal file
1
pkg/apis/cloudcommon/proxy/doc.go
Normal file
@@ -0,0 +1 @@
|
||||
package proxy // import "yunion.io/x/onecloud/pkg/apis/cloudcommon/proxy"
|
||||
51
pkg/apis/cloudcommon/proxy/proxy.go
Normal file
51
pkg/apis/cloudcommon/proxy/proxy.go
Normal file
@@ -0,0 +1,51 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"yunion.io/x/jsonutils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
ProxySettingId_DIRECT = "DIRECT"
|
||||
)
|
||||
|
||||
type ProxySettingCreateInput struct {
|
||||
apis.StandaloneResourceCreateInput
|
||||
|
||||
ProxySetting
|
||||
}
|
||||
|
||||
type ProxySettingUpdateInput struct {
|
||||
// 资源名称
|
||||
Name string `json:"name"`
|
||||
// 资源描述
|
||||
Description string `json:"description"`
|
||||
|
||||
ProxySetting
|
||||
}
|
||||
|
||||
// String implements ISerializable interface
|
||||
func (ps *SProxySetting) String() string {
|
||||
return jsonutils.Marshal(ps).String()
|
||||
}
|
||||
|
||||
// IsZero implements ISerializable interface
|
||||
func (ps *SProxySetting) IsZero() bool {
|
||||
if ps.HTTPProxy == "" &&
|
||||
ps.HTTPSProxy == "" &&
|
||||
ps.NoProxy == "" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ProxySettingResourceInput struct {
|
||||
// 代理配置
|
||||
ProxySettingId string `json:"proxy_setting_id"`
|
||||
}
|
||||
|
||||
type ProxySettingTestInput struct {
|
||||
HttpProxy string
|
||||
HttpsProxy string
|
||||
}
|
||||
111
pkg/apis/cloudcommon/proxy/setting.go
Normal file
111
pkg/apis/cloudcommon/proxy/setting.go
Normal file
@@ -0,0 +1,111 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/pkg/errors"
|
||||
)
|
||||
|
||||
type ProxySetting struct {
|
||||
HttpProxy string
|
||||
HttpsProxy string
|
||||
NoProxy string
|
||||
}
|
||||
|
||||
func (v *ProxySetting) Sanitize() error {
|
||||
v.HttpProxy = strings.TrimSpace(v.HttpProxy)
|
||||
if u, err := parseProxy(v.HttpProxy); err != nil {
|
||||
return errors.Wrap(err, "invalid https_proxy url")
|
||||
} else if u != nil {
|
||||
v.HttpProxy = u.String()
|
||||
}
|
||||
|
||||
v.HttpsProxy = strings.TrimSpace(v.HttpsProxy)
|
||||
if u, err := parseProxy(v.HttpsProxy); err != nil {
|
||||
return errors.Wrap(err, "invalid http_proxy url")
|
||||
} else if u != nil {
|
||||
v.HttpsProxy = u.String()
|
||||
}
|
||||
|
||||
if noProxy, err := parseNoProxy(v.NoProxy); err == nil {
|
||||
v.NoProxy = strings.Join(noProxy, ",")
|
||||
} else {
|
||||
return errors.Wrap(err, "invalid no_proxy")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func parseProxy(proxy string) (*url.URL, error) {
|
||||
if proxy == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
proxyURL, err := url.Parse(proxy)
|
||||
if err != nil ||
|
||||
(proxyURL.Scheme != "http" &&
|
||||
proxyURL.Scheme != "https" &&
|
||||
proxyURL.Scheme != "socks5") {
|
||||
// proxy was bogus. Try prepending "http://" to it and
|
||||
// see if that parses correctly. If not, we fall
|
||||
// through and complain about the original one.
|
||||
if proxyURL, err := url.Parse("http://" + proxy); err == nil {
|
||||
return proxyURL, nil
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "invalid proxy address %q", proxy)
|
||||
}
|
||||
return proxyURL, nil
|
||||
}
|
||||
|
||||
func parseNoProxy(noProxy string) ([]string, error) {
|
||||
var r []string
|
||||
for _, p := range strings.Split(noProxy, ",") {
|
||||
p = strings.ToLower(strings.TrimSpace(p))
|
||||
if len(p) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
if p == "*" {
|
||||
r = append(r, p)
|
||||
// let it go
|
||||
//return r, nil
|
||||
}
|
||||
|
||||
// IPv4/CIDR, IPv6/CIDR
|
||||
if _, _, err := net.ParseCIDR(p); err == nil {
|
||||
r = append(r, p)
|
||||
continue
|
||||
}
|
||||
|
||||
// IPv4:port, [IPv6]:port
|
||||
phost, _, err := net.SplitHostPort(p)
|
||||
if err == nil {
|
||||
if len(phost) == 0 {
|
||||
// There is no host part, likely the entry is malformed; ignore.
|
||||
return nil, fmt.Errorf("host part must not be empty: %s", p)
|
||||
}
|
||||
if phost[0] == '[' && phost[len(phost)-1] == ']' {
|
||||
phost = phost[1 : len(phost)-1]
|
||||
}
|
||||
} else {
|
||||
phost = p
|
||||
}
|
||||
// IPv4, IPv6
|
||||
if pip := net.ParseIP(phost); pip != nil {
|
||||
r = append(r, p)
|
||||
continue
|
||||
}
|
||||
|
||||
if len(phost) == 0 {
|
||||
// There is no host part, likely the entry is malformed; ignore.
|
||||
continue
|
||||
}
|
||||
|
||||
r = append(r, p)
|
||||
}
|
||||
return r, nil
|
||||
}
|
||||
27
pkg/apis/cloudcommon/proxy/zz_generated.model.go
Normal file
27
pkg/apis/cloudcommon/proxy/zz_generated.model.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Code generated by model-api-gen. DO NOT EDIT.
|
||||
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
// SProxySetting is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudcommon/db/proxy.SProxySetting.
|
||||
type SProxySetting struct {
|
||||
apis.SStandaloneResourceBase
|
||||
HTTPProxy string `json:"http_proxy"`
|
||||
HTTPSProxy string `json:"https_proxy"`
|
||||
NoProxy string `json:"no_proxy"`
|
||||
}
|
||||
@@ -16,8 +16,16 @@ package cloudprovider
|
||||
|
||||
// SGeographicInfo is an autogenerated struct via yunion.io/x/onecloud/pkg/cloudprovider.SGeographicInfo.
|
||||
type SGeographicInfo struct {
|
||||
Latitude float32 `json:"latitude"`
|
||||
Longitude float32 `json:"longitude"`
|
||||
City string `json:"city"`
|
||||
CountryCode string `json:"country_code"`
|
||||
// 纬度
|
||||
// example: 26.647003
|
||||
Latitude float32 `json:"latitude"`
|
||||
// 经度
|
||||
// example: 106.630211
|
||||
Longitude float32 `json:"longitude"`
|
||||
// 城市
|
||||
// example: Guiyang
|
||||
City string `json:"city"`
|
||||
// 国家代码
|
||||
// example: CN
|
||||
CountryCode string `json:"country_code"`
|
||||
}
|
||||
|
||||
@@ -231,6 +231,9 @@ type BaremetalDiskConfig struct {
|
||||
}
|
||||
|
||||
type ServerConfigs struct {
|
||||
// 调度使用指定的云账号
|
||||
PreferManager string `json:"prefer_manager_id"`
|
||||
|
||||
// 调度到指定区域,优先级低于prefer_zone_id
|
||||
PreferRegion string `json:"prefer_region_id"`
|
||||
|
||||
@@ -354,6 +357,9 @@ type ServerCreateInput struct {
|
||||
// required: false
|
||||
UserData string `json:"user_data"`
|
||||
|
||||
// swagger:ignore
|
||||
Keypair string `json:"keypair" deprecated-by:"keypair_id"`
|
||||
|
||||
// 秘钥对Id
|
||||
// required: false
|
||||
KeypairId string `json:"keypair_id"`
|
||||
|
||||
26
pkg/apis/compute/baremetalagent.go
Normal file
26
pkg/apis/compute/baremetalagent.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type BaremetalagentDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SBaremetalagent
|
||||
|
||||
// 裸金属代理程序所在的可用区
|
||||
// example: zone1
|
||||
Zone string `json:"zone"`
|
||||
}
|
||||
@@ -49,10 +49,13 @@ type BucketCreateInput struct {
|
||||
StorageClass string `json:"storage_class"`
|
||||
}
|
||||
|
||||
type BucketDetail struct {
|
||||
apis.Meta
|
||||
type BucketDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SBucket
|
||||
CloudproviderDetails
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
AccessUrls []cloudprovider.SBucketAccessUrl `json:"access_urls"`
|
||||
}
|
||||
|
||||
type BucketObjectsActionInput struct {
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type CachedImageUncacheImageInput struct {
|
||||
// 存储缓存名Id
|
||||
// required: true
|
||||
@@ -23,3 +25,31 @@ type CachedImageUncacheImageInput struct {
|
||||
// default: false
|
||||
IsForce bool `json:"is_force"`
|
||||
}
|
||||
|
||||
type CachedimageDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SCachedimage
|
||||
|
||||
// 镜像状态, 和info里面的status一致
|
||||
// example: active
|
||||
Status string `json:"status"`
|
||||
|
||||
// 操作系统类型
|
||||
// example: FreeBSD
|
||||
OsType string `json:"os_type"`
|
||||
|
||||
// 操作系统发行版
|
||||
// example: FreeBSD
|
||||
OsDistribution string `json:"os_distribution"`
|
||||
|
||||
// 操作系统版本
|
||||
// example: 11
|
||||
OsVersion string `json:"os_version"`
|
||||
|
||||
// 虚拟化类型
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
|
||||
// 此镜像被使用次数
|
||||
// example: 0
|
||||
CachedCount int `json:"cached_count"`
|
||||
}
|
||||
|
||||
24
pkg/apis/compute/cachedloadbalanceracl.go
Normal file
24
pkg/apis/compute/cachedloadbalanceracl.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type CachedLoadbalancerAclDetails struct {
|
||||
apis.SharableVirtualResourceDetails
|
||||
SCachedLoadbalancerAcl
|
||||
|
||||
CloudproviderInfo
|
||||
}
|
||||
24
pkg/apis/compute/cachedloadbalancercertificate.go
Normal file
24
pkg/apis/compute/cachedloadbalancercertificate.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type CachedLoadbalancerCertificateDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SCachedLoadbalancerCertificate
|
||||
|
||||
CloudproviderInfo
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
proxyapi "yunion.io/x/onecloud/pkg/apis/cloudcommon/proxy"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
"yunion.io/x/onecloud/pkg/httperrors"
|
||||
)
|
||||
@@ -79,6 +80,8 @@ type CloudaccountCreateInput struct {
|
||||
// 额外信息,例如账单的access key
|
||||
Options *jsonutils.JSONObject `json:"options"`
|
||||
|
||||
proxyapi.ProxySettingResourceInput
|
||||
|
||||
cloudprovider.SCloudaccount
|
||||
cloudprovider.SCloudaccountCredential
|
||||
}
|
||||
@@ -106,3 +109,77 @@ type CloudaccountListInput struct {
|
||||
|
||||
CapabilityListInput
|
||||
}
|
||||
|
||||
type ProviderProject struct {
|
||||
// 子订阅项目名称
|
||||
// example: system
|
||||
Tenant string `json:"tenant"`
|
||||
|
||||
// 子订阅项目Id
|
||||
// 9a48383a-467a-4542-8b50-4e15b0a8715f
|
||||
TenantId string `json:"tenant_id"`
|
||||
}
|
||||
|
||||
type CloudaccountDetail struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SCloudaccount
|
||||
|
||||
// 子订阅项目信息
|
||||
Projects []ProviderProject `json:"projects"`
|
||||
|
||||
// 同步时间间隔
|
||||
// example: 3600
|
||||
SyncIntervalSeconds int `json:"sync_interval_seconds"`
|
||||
|
||||
// 同步状态
|
||||
SyncStatus2 string `json:"sync_stauts2"`
|
||||
|
||||
// 云账号环境类型
|
||||
// public: 公有云
|
||||
// private: 私有云
|
||||
// onpremise: 本地IDC
|
||||
// example: public
|
||||
CloudEnv string `json:"cloud_env"`
|
||||
|
||||
// 云账号项目名称
|
||||
// example: system
|
||||
Tenant string `json:"tenant"`
|
||||
|
||||
// 弹性公网Ip数量
|
||||
// example: 2
|
||||
EipCount int `json:"eip_count,allowempty"`
|
||||
|
||||
// 虚拟私有网络数量
|
||||
// example: 4
|
||||
VpcCount int `json:"vpc_count,allowempty"`
|
||||
|
||||
// 云盘数量
|
||||
// example: 12
|
||||
DiskCount int `json:"disk_count,allowempty"`
|
||||
|
||||
// 宿主机数量(不计算虚拟机宿主机数量)
|
||||
// example: 0
|
||||
HostCount int `json:"host_count,allowempty"`
|
||||
|
||||
// 云主机数量
|
||||
// example: 4
|
||||
GuestCount int `json:"guest_count,allowempty"`
|
||||
|
||||
// 块存储数量
|
||||
// example: 12
|
||||
StorageCount int `json:"storage_count,allowempty"`
|
||||
|
||||
// 子订阅数量
|
||||
// example: 1
|
||||
ProviderCount int `json:"provider_count,allowempty"`
|
||||
|
||||
// 路由表数量
|
||||
// example: 0
|
||||
RoutetableCount int `json:"routetable_count,allowempty"`
|
||||
|
||||
// 存储缓存数量
|
||||
// example: 10
|
||||
StoragecacheCount int `json:"storagecache_count,allowempty"`
|
||||
|
||||
ProxySetting proxyapi.SProxySetting `json:"proxy_setting"`
|
||||
}
|
||||
|
||||
@@ -18,29 +18,126 @@ import (
|
||||
"yunion.io/x/pkg/utils"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
proxyapi "yunion.io/x/onecloud/pkg/apis/cloudcommon/proxy"
|
||||
"yunion.io/x/onecloud/pkg/cloudprovider"
|
||||
)
|
||||
|
||||
type CloudproviderDetails struct {
|
||||
Provider string `json:"provider,omitempty"`
|
||||
Brand string `json:"brand,omitempty"`
|
||||
Account string `json:"account,omitempty"`
|
||||
AccountId string `json:"account_id,omitempty"`
|
||||
Manager string `json:"manager,omitempty"`
|
||||
ManagerId string `json:"manager_id,omitempty"`
|
||||
ManagerProject string `json:"manager_project,omitempty"`
|
||||
type CloudproviderInfo struct {
|
||||
// 云平台
|
||||
// example: Google
|
||||
Provider string `json:"provider,omitempty"`
|
||||
|
||||
// 云平台品牌
|
||||
// example: Google
|
||||
Brand string `json:"brand,omitempty"`
|
||||
|
||||
// 云账号名称
|
||||
// example: google-account
|
||||
Account string `json:"account,omitempty"`
|
||||
|
||||
// 云账号Id
|
||||
// example: 4d3c8979-9dd0-439b-8d78-36fe1ab1666c
|
||||
AccountId string `json:"account_id,omitempty"`
|
||||
|
||||
// 子订阅名称
|
||||
// example: google-account
|
||||
Manager string `json:"manager,omitempty"`
|
||||
|
||||
// 子订阅Id
|
||||
// example: fa4aaf88-aed8-422d-84e7-56dea533b364
|
||||
ManagerId string `json:"manager_id,omitempty"`
|
||||
|
||||
// 子订阅所在项目名称
|
||||
// example: system
|
||||
ManagerProject string `json:"manager_project,omitempty"`
|
||||
// 子订阅所在项目Id
|
||||
// example: 4d3c8979-9dd0-439b-8d78-36fe1ab1666c
|
||||
ManagerProjectId string `json:"manager_project_id,omitempty"`
|
||||
ManagerDomain string `json:"manager_domain,omitempty"`
|
||||
ManagerDomainId string `json:"manager_domain_id,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
RegionId string `json:"region_id,omitempty"`
|
||||
CloudregionId string `json:"cloudregion_id,omitempty"`
|
||||
|
||||
// 子订阅所在域名称
|
||||
// example: Default
|
||||
ManagerDomain string `json:"manager_domain,omitempty"`
|
||||
|
||||
// 子订阅所在域Id
|
||||
// example: default
|
||||
ManagerDomainId string `json:"manager_domain_id,omitempty"`
|
||||
|
||||
// 区域名称
|
||||
// example: 腾讯云 华南地区(广州)
|
||||
Region string `json:"region,omitempty"`
|
||||
// 区域Id
|
||||
// example: 6151c89b-77f2-4d43-8ef9-cd03d604a16b
|
||||
RegionId string `json:"region_id,omitempty"`
|
||||
// 区域Id
|
||||
// example: 6151c89b-77f2-4d43-8ef9-cd03d604a16b
|
||||
CloudregionId string `json:"cloudregion_id,omitempty"`
|
||||
// 区域外部Id
|
||||
// Qcloud/ap-guangzhou
|
||||
RegionExternalId string `json:"region_external_id,omitempty"`
|
||||
RegionExtId string `json:"region_ext_id,omitempty"`
|
||||
Zone string `json:"zone,omitempty"`
|
||||
ZoneId string `json:"zone_id,omitempty"`
|
||||
ZoneExtId string `json:"zone_ext_id,omitempty"`
|
||||
CloudEnv string `json:"cloud_env,omitempty"`
|
||||
// 区域外部Id(不携带平台信息)
|
||||
// example: ap-guangzhou
|
||||
RegionExtId string `json:"region_ext_id,omitempty"`
|
||||
|
||||
// 可用区名称
|
||||
// example: 腾讯云 广州四区
|
||||
Zone string `json:"zone,omitempty"`
|
||||
// 可用区Id
|
||||
// example: 336ac6d2-b80d-43bb-86d5-1ebf474da8d4
|
||||
ZoneId string `json:"zone_id,omitempty"`
|
||||
// 可用区外部Id
|
||||
// example: ap-guangzhou-4
|
||||
ZoneExtId string `json:"zone_ext_id,omitempty"`
|
||||
|
||||
// 云环境
|
||||
// example: public
|
||||
CloudEnv string `json:"cloud_env,omitempty"`
|
||||
}
|
||||
|
||||
type CloudproviderDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SCloudprovider
|
||||
|
||||
ProxySetting proxyapi.SProxySetting `json:"proxy_setting"`
|
||||
|
||||
// 云账号名称
|
||||
// example: google-account
|
||||
Cloudaccount string `json:"cloudaccount"`
|
||||
// 子订阅同步状态
|
||||
SyncStatus2 string `json:"sync_status2"`
|
||||
// 支持服务列表
|
||||
Capabilities []string `json:"capabilities"`
|
||||
|
||||
// 云主机数量
|
||||
// example: 1
|
||||
GuestCount int `json:"guest_count"`
|
||||
// 宿主机数量
|
||||
// example: 2
|
||||
HostCount int `json:"host_count"`
|
||||
// 虚拟私有网络数量
|
||||
// example: 4
|
||||
VpcCount int `json:"vpc_count"`
|
||||
// 块存储梳理
|
||||
// example: 4
|
||||
StorageCount int `json:"storage_count"`
|
||||
// 存储缓存数量
|
||||
// example: 1
|
||||
StorageCacheCount int `json:"storagecache_count"`
|
||||
// 弹性公网IP数量
|
||||
// example: 12
|
||||
EipCount int `json:"eip_count"`
|
||||
// 快照数量
|
||||
// example: 0
|
||||
SnapshotCount int `json:"snapshot_count"`
|
||||
// 负载均衡器数量
|
||||
// example: 2
|
||||
LoadbalancerCount int `json:"loadbalancer_count"`
|
||||
// 项目数量
|
||||
ProjectCount int `json:"project_count"`
|
||||
// 同步区域数量
|
||||
SyncRegionCount int `json:"sync_region_count"`
|
||||
|
||||
// 子订阅品牌信息
|
||||
Brand string `json:"brand"`
|
||||
}
|
||||
|
||||
type ManagedResourceListInput struct {
|
||||
|
||||
41
pkg/apis/compute/cloudproviderregion.go
Normal file
41
pkg/apis/compute/cloudproviderregion.go
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type CloudproviderregionDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
|
||||
Cloudprovider string
|
||||
Cloudregion string
|
||||
|
||||
// 云账号Id
|
||||
// example: fa4aaf88-aed8-422d-84e7-56dea533b364
|
||||
CloudaccountId string `json:"cloudaccount_id"`
|
||||
// 云账号名称
|
||||
// example: googl-account
|
||||
Cloudaccount string `json:"cloudaccount"`
|
||||
|
||||
// 云账号所在域Id
|
||||
// example: 0df40413-eb69-49c7-895e-618ddeb80f55
|
||||
CloudaccountDomainId string `json:"cloudaccount_domain_id"`
|
||||
// 是否开启自动同步
|
||||
// example: false
|
||||
EnableAutoSync bool `json:"enable_auto_sync"`
|
||||
// 自动同步周期
|
||||
// example: 300
|
||||
SyncIntervalSeconds int `json:"sync_interval_seconds"`
|
||||
}
|
||||
56
pkg/apis/compute/cloudregion.go
Normal file
56
pkg/apis/compute/cloudregion.go
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type CloudregionDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SCloudregion
|
||||
|
||||
// 虚拟私有网络数量
|
||||
// example: 2
|
||||
VpcCount int `json:"vpc_count,allowempty"`
|
||||
// 可用区数量
|
||||
// example: 3
|
||||
ZoneCount int `json:"zone_count,allowempty"`
|
||||
// 云主机梳理
|
||||
// example: 2
|
||||
GuestCount int `json:"guest_count,allowempty"`
|
||||
// IP子网数量
|
||||
// example: 12
|
||||
NetworkCount int `json:"network_count,allowempty"`
|
||||
// 距离前天0点新增云主机数量
|
||||
// example: 0
|
||||
GuestIncrementCount int `json:"guest_increment_count,allowempty"`
|
||||
}
|
||||
|
||||
type CloudregionInfo struct {
|
||||
// 区域的名称
|
||||
// example: Default
|
||||
Region string `json:"region"`
|
||||
|
||||
// 区域的Id
|
||||
// example: default
|
||||
RegionId string `json:"region_id"`
|
||||
|
||||
// 纳管云区域的组合Id(平台+Id)
|
||||
// example: ZStack/59e7bc87-a6b3-4c39-8f02-c68e8243d4e4
|
||||
RegionExternalId string `json:"region_external_id"`
|
||||
|
||||
// 纳管云区域的Id
|
||||
// example: 59e7bc87-a6b3-4c39-8f02-c68e8243d4e4
|
||||
RegionExtId string `json:"region_ext_id"`
|
||||
}
|
||||
@@ -36,6 +36,7 @@ const (
|
||||
CITY_TAIPEI = "Taipei" //台北市
|
||||
CITY_KAOHSIUNG = "Kaohsiung" //高雄市
|
||||
CITY_CHENG_DU = "Chengdu" //成都
|
||||
CITY_HE_YUAN = "HeYuan" //河源
|
||||
CITY_CHONG_QING = "Chongqing" //重庆
|
||||
CITY_LAN_ZHOU = "Lanzhou" //兰州
|
||||
CITY_TAI_YUAN = "Taiyuan" //太原
|
||||
@@ -76,6 +77,11 @@ const (
|
||||
|
||||
//瑞士
|
||||
CITY_ZURICH = "Zurich" //苏黎世
|
||||
CITY_GENEVA = "Geneva" //日内瓦
|
||||
|
||||
// 挪威
|
||||
CITY_STAVANGER = "Stavanger" //斯塔万格
|
||||
CITY_OSLO = "Oslo" // 奥斯陆
|
||||
|
||||
// 马来西亚
|
||||
CITY_KUALA_LUMPUR = "Kuala Lumpur" //吉隆坡
|
||||
@@ -104,6 +110,7 @@ const (
|
||||
CITY_IOWA = "Iowa" //爱荷华
|
||||
CITY_US_GOV_WEST = "us-gov-west" //???
|
||||
CITY_SOUTH_CAROLINA = "South Carolina" //南卡罗来纳州
|
||||
CITY_SALT_LAKE_CITY = "Salt Lake City" //盐湖城
|
||||
|
||||
// 英国
|
||||
CITY_LONDON = "London" //伦敦
|
||||
@@ -114,7 +121,8 @@ const (
|
||||
CITY_DUBAI = "Dubai" //迪拜
|
||||
|
||||
// 德国
|
||||
CITY_FRANKFURT = "Frankfurt" //法兰克福
|
||||
CITY_FRANKFURT = "Frankfurt" // 法兰克福
|
||||
CITY_DELMENHORST = "Delmenhorst" // 代尔门霍斯特
|
||||
|
||||
// 韩国
|
||||
CITY_SEOUL = "Seoul" //首尔
|
||||
@@ -185,4 +193,5 @@ const (
|
||||
COUNTRY_CODE_NG = "NG" //尼日利亚
|
||||
COUNTRY_CODE_VN = "VN" //越南
|
||||
COUNTRY_CODE_CH = "CH" //瑞士
|
||||
COUNTRY_CODE_NO = "NO" //挪威
|
||||
)
|
||||
|
||||
@@ -214,3 +214,24 @@ type DbinstanceFilterListInput struct {
|
||||
// filter by dbinstance_id
|
||||
DbinstanceId string `json:"dbinstance_id" deprecated-by:"dbinstance"`
|
||||
}
|
||||
|
||||
type DBInstanceDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SDBInstance
|
||||
|
||||
CloudproviderInfo
|
||||
// 虚拟私有网络名称
|
||||
// example: test-vpc
|
||||
Vpc string `json:"vpc"`
|
||||
// 安全组名称
|
||||
// example: Default
|
||||
Secgroup string `json:"secgroup"`
|
||||
// iops
|
||||
// example: 0
|
||||
Iops int `json:"iops"`
|
||||
// IP子网名称
|
||||
// example: test-network
|
||||
Network string `json:"network"`
|
||||
// 标签信息
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
}
|
||||
|
||||
@@ -67,3 +67,22 @@ type DBInstanceAccountCreateInput struct {
|
||||
type SDBInstanceSetPrivilegesInput struct {
|
||||
Privileges []SDBInstanceAccountPrivilege `json:"privileges"`
|
||||
}
|
||||
|
||||
type DBInstancePrivilege struct {
|
||||
// 数据库名称
|
||||
Database string
|
||||
// 账号名称
|
||||
Account string
|
||||
// 数据库Id
|
||||
DBInstancedatabaseId string
|
||||
// 权限
|
||||
Privileges string
|
||||
}
|
||||
|
||||
type DBInstanceAccountDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SDBInstanceAccount
|
||||
|
||||
// 账号权限列表
|
||||
DBInstanceprivileges []DBInstancePrivilege `json:"dbinstanceprivileges,allowempty"`
|
||||
}
|
||||
|
||||
@@ -42,3 +42,13 @@ type DBInstanceBackupCreateInput struct {
|
||||
// swagger:ignore
|
||||
ManagerId string
|
||||
}
|
||||
|
||||
type DBInstanceBackupDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SDBInstanceBackup
|
||||
|
||||
// RDS实例名称
|
||||
DBInstance string `json:"dbinstance"`
|
||||
|
||||
CloudproviderInfo
|
||||
}
|
||||
|
||||
@@ -108,10 +108,10 @@ const (
|
||||
ALIYUN_DBINSTANCE_STORAGE_TYPE_CLOUD_SSD = "cloud_ssd" //SSD云盘
|
||||
|
||||
//华为云存储类型
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_SSD = "SSD" //超高IO云硬盘
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_SAS = "SAS" //高IO云硬盘
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_SATA = "SATA" //普通IO云硬盘
|
||||
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_ULTRAHIGH = "ULTRAHIGH" //超高IO云硬盘
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_ULTRAHIGHPRO = "ULTRAHIGHPRO"
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_COMMON = "COMMON"
|
||||
HUAWEI_DBINSTANCE_STORAGE_TYPE_HIGH = "HIGH"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -60,3 +60,11 @@ type DBInstanceDatabaseCreateInput struct {
|
||||
// required: false
|
||||
Accounts []SDBInstanceDatabasePrivilege `json:"accounts"`
|
||||
}
|
||||
|
||||
type DBInstancedatabaseDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SDBInstanceDatabase
|
||||
|
||||
// 数据库权限
|
||||
DBInstanceprivileges []DBInstancePrivilege `json:"dbinstanceprivileges"`
|
||||
}
|
||||
|
||||
23
pkg/apis/compute/dbinstance_sku.go
Normal file
23
pkg/apis/compute/dbinstance_sku.go
Normal file
@@ -0,0 +1,23 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type DBInstanceSkuDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
|
||||
CloudregionInfo
|
||||
}
|
||||
@@ -15,6 +15,8 @@
|
||||
package compute
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
@@ -128,3 +130,53 @@ type DiskFilterListInput struct {
|
||||
// filter by disk_id
|
||||
DiskId string `json:"disk_id" deprecated-by:"disk"`
|
||||
}
|
||||
|
||||
type SimpleGuest struct {
|
||||
Name string `json:"name"`
|
||||
Id string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
type SimpleSnapshotPolicy struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
RepeatWeekdays []int `json:"repeat_weekdays"`
|
||||
TimePoints []int `json:"time_points"`
|
||||
}
|
||||
|
||||
type DiskDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SDisk
|
||||
CloudproviderInfo
|
||||
|
||||
// 云平台
|
||||
Provider string `json:"provider"`
|
||||
// 存储名称
|
||||
Storage string `json:"storage"`
|
||||
// 存储类型
|
||||
StorageType string `json:"storage_type"`
|
||||
// 介质类型
|
||||
MediumType string `json:"medium_type"`
|
||||
|
||||
// 所挂载的虚拟机
|
||||
Guests []SimpleGuest `json:"guests"`
|
||||
// 所挂载的虚拟机
|
||||
Guest string `json:"guest"`
|
||||
// 所挂载虚拟机的数量
|
||||
GuestCount int `json:"guest_count"`
|
||||
// 所挂载虚拟机状态
|
||||
GuestStatus string `json:"guest_status"`
|
||||
|
||||
// 自动清理时间
|
||||
AutoDeleteAt time.Time `json:"auto_delete_at"`
|
||||
// 自动快照策略状态
|
||||
SnapshotpolicyStatus string `json:"snapshotpolicy_status,allowempty"`
|
||||
|
||||
// 自动快照策略
|
||||
Snapshotpolicies []SimpleSnapshotPolicy `json:"snapshotpolicies"`
|
||||
|
||||
// 手动快照数量
|
||||
ManualSnapshotCount int `json:"manual_snapshot_count"`
|
||||
// 最多可创建手动快照数量
|
||||
MaxManualSnapshotCount int `json:"max_manual_snapshot_count"`
|
||||
}
|
||||
|
||||
25
pkg/apis/compute/dynamicschedtag.go
Normal file
25
pkg/apis/compute/dynamicschedtag.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type DynamicschedtagDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SDynamicschedtag
|
||||
|
||||
Schedtag string `json:"schedtag"`
|
||||
ResourceType string `json:"resource_type"`
|
||||
}
|
||||
30
pkg/apis/compute/elasticcache.go
Normal file
30
pkg/apis/compute/elasticcache.go
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ElasticcacheDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
|
||||
SElasticcache
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
// 虚拟私有网络名称
|
||||
Vpc string `json:"vpc"`
|
||||
// IP子网名称
|
||||
Network string `json:"network"`
|
||||
}
|
||||
29
pkg/apis/compute/elasticcachebackup.go
Normal file
29
pkg/apis/compute/elasticcachebackup.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ElasticcacheBackupDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SElasticcacheBackup
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
// 引擎
|
||||
Engine string `json:"engine"`
|
||||
// 引擎版本
|
||||
EngineVersion string `json:"engine_version"`
|
||||
}
|
||||
22
pkg/apis/compute/elasticcachesku.go
Normal file
22
pkg/apis/compute/elasticcachesku.go
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ElasticcacheSkuDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SElasticcacheSku
|
||||
}
|
||||
@@ -67,3 +67,13 @@ type SElasticipCreateInput struct {
|
||||
// swagger:ignore
|
||||
NetworkId string
|
||||
}
|
||||
|
||||
type ElasticipDetails struct {
|
||||
apis.VirtualResourceDetails
|
||||
SElasticip
|
||||
|
||||
CloudproviderInfo
|
||||
|
||||
// 绑定资源名称
|
||||
AssociateName string `json:"associate_name"`
|
||||
}
|
||||
|
||||
@@ -43,10 +43,6 @@ const (
|
||||
EIP_CHARGE_TYPE_BY_TRAFFIC = "traffic"
|
||||
EIP_CHARGE_TYPE_BY_BANDWIDTH = "bandwidth"
|
||||
EIP_CHARGE_TYPE_DEFAULT = EIP_CHARGE_TYPE_BY_TRAFFIC
|
||||
|
||||
// EIP associate resource type
|
||||
EIP_ASSOCIATE_TYPE_VM = "server"
|
||||
EIP_ASSOCIATE_TYPE_ELB = "elb"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
26
pkg/apis/compute/externalproject.go
Normal file
26
pkg/apis/compute/externalproject.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import "yunion.io/x/onecloud/pkg/apis"
|
||||
|
||||
type ExternalProjectDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
|
||||
SExternalProject
|
||||
CloudproviderInfo
|
||||
|
||||
Tenant string `json:"tenant"`
|
||||
}
|
||||
@@ -21,3 +21,8 @@ import (
|
||||
type GlobalVpcCreateInput struct {
|
||||
apis.EnabledStatusStandaloneResourceCreateInput
|
||||
}
|
||||
|
||||
type GlobalVpcDetails struct {
|
||||
apis.StandaloneResourceDetails
|
||||
SGlobalVpc
|
||||
}
|
||||
|
||||
29
pkg/apis/compute/groupguest.go
Normal file
29
pkg/apis/compute/groupguest.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type GroupguestDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
|
||||
Instancegroup string
|
||||
Server string
|
||||
Guest string
|
||||
|
||||
SGroupguest
|
||||
}
|
||||
29
pkg/apis/compute/groupnetwork.go
Normal file
29
pkg/apis/compute/groupnetwork.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2019 Yunion
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package compute
|
||||
|
||||
import (
|
||||
"yunion.io/x/onecloud/pkg/apis"
|
||||
)
|
||||
|
||||
type GroupnetworkDetails struct {
|
||||
apis.JoinModelBaseDetails
|
||||
SGroupnetwork
|
||||
|
||||
// 主机组名称
|
||||
Instancegroup string
|
||||
// IP子网名称
|
||||
Network string
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user