Compare commits

..

242 Commits

Author SHA1 Message Date
Zexi Li
ca7f5495fe Merge pull request #5393 from swordqiu/automated-cherry-pick-of-#5392-upstream-release-3.1
Automated cherry pick of #5392: fix: scoped resource should override FetchOwnerId
2020-03-07 15:51:52 +08:00
Qiu Jian
34b7d1e9c3 fix: scoped resource should override FetchOwnerId 2020-03-07 15:38:46 +08:00
Zexi Li
13a3e1c778 Merge pull request #5389 from swordqiu/automated-cherry-pick-of-#5388-upstream-release-3.1
Automated cherry pick of #5388: fix: keystone prefers internal endpoint type
2020-03-07 11:07:29 +08:00
Qiu Jian
603b3f8b8e fix: keystone prefers internal endpoint type 2020-03-06 21:45:21 +08:00
yunion-ci-robot
2c1e0a4fe2 Merge pull request #5383 from rainzm/automated-cherry-pick-of-#5378-upstream-release-3.1
Automated cherry pick of #5378: fix: Add 'scope=system' and 'system' for Caches when querying from Keystone.
2020-03-06 19:19:52 +08:00
Zexi Li
f9a9f92003 Merge pull request #5373 from swordqiu/automated-cherry-pick-of-#5372-upstream-release-3.1
Automated cherry pick of #5372: fix: no scope shcedtag should be visible to all
2020-03-06 18:32:28 +08:00
yunion-ci-robot
8d1c0ba9c9 Merge pull request #5382 from tb365/automated-cherry-pick-of-#5379-upstream-release-3.1
Automated cherry pick of #5379: huawei reset password bugfix
2020-03-06 18:10:50 +08:00
Rain
845ba285fc fix: Add 'scope=system' and 'system' for Caches when querying from Keystone.
1. Query 'scope=system' and 'system=true' is neccessary when fetching all users
   or groups from Keystone.
   Without these, users and groups in other domains (non-caller domains),
   as well as system-level users, cannot be detected.
2. Query 'scope=system' is neccessary when fetching all project from Keystone.
2020-03-06 17:15:23 +08:00
TangBin
72f1e58833 ctyun region name fix 2020-03-06 16:52:53 +08:00
TangBin
1cc1ff7213 huawei reset password bugfix 2020-03-06 16:52:53 +08:00
Qiu Jian
6c15c80abb fix: no scope shcedtag should be visible to all 2020-03-06 15:23:27 +08:00
Yousong Zhou
7869e3d134 Merge pull request #5371 from yousong/automated-cherry-pick-of-#5226-upstream-release-3.1
Automated cherry pick of #5226: lbbackend: fix nil ref when getting details
2020-03-06 13:38:43 +08:00
Yousong Zhou
2e0efc6c4a lbbackend: fix nil ref when getting details
Return arguments of lbbackend.getVpc() can be both nil

	[E 200224 10:13:18 httperrors.HTTPError(httperrors.go:53)] Send error {"fields":["runtime error: invalid memory address or nil pointer dereference"],"id":"Internal server error: {0}"}
	...
	panic(0x27da0c0, 0x57f4ff0)
		/usr/local/go/src/runtime/panic.go:522 +0x1b5
	yunion.io/x/onecloud/pkg/compute/models.(*SLoadbalancerBackend).GetExtraDetails(0xc0002af680, 0x33cde20, 0xc0010e61e0, 0x34246c0, 0xc008893de0, 0x341d940, 0xc012fe69d0, 0x1, 0x0, 0x0, ...)
		/data/git/yunion-build/work/go/src/yunion.io/x/onecloud/pkg/compute/models/loadbalancerbackends.go:314 +0x37c
	reflect.Value.call(0x2d87a00, 0xc0002af680, 0x8a13, 0x2db0aa8, 0x4, 0xc0044ad680, 0x4, 0x4, 0x2bd5d60, 0xc002a29cf0, ...)
		/usr/local/go/src/reflect/value.go:447 +0x461
	reflect.Value.Call(0x2d87a00, 0xc0002af680, 0x8a13, 0xc0044ad680, 0x4, 0x4, 0x2d87a00, 0xc0002af680, 0x16)
		/usr/local/go/src/reflect/value.go:308 +0xa4
	yunion.io/x/onecloud/pkg/cloudcommon/db.callFunc(0x2d87a00, 0xc0002af680, 0x8a13, 0xc000951688, 0x4, 0x4, 0xc0002af680, 0x8a13, 0x2dc0527, 0xb, ...)
		/data/git/yunion-build/work/go/src/yunion.io/x/onecloud/pkg/cloudcommon/db/caller.go:78 +0x397
	...
	[I 200224 10:13:18 appsrv.(*Application).ServeHTTP(appsrv.go:237)] MfQCvNyik-obRBzFjFZy5ARfXcE= 500 5c1d82 GET /loadbalancerbackends?backend_group=Yunion-Tools&details=true&limit=20&offset=0 (10.40.156.64:57606) 57.90ms

Fixes 76d974f6d ("feature: api -> response struct")
2020-03-06 13:36:06 +08:00
Zexi Li
1d440b57ce Merge pull request #5362 from swordqiu/automated-cherry-pick-of-#5361-upstream-release-3.1
Automated cherry pick of #5361: fix: allow project do user-list, group-list, returns current project user and group
2020-03-06 13:03:32 +08:00
Zexi Li
e3c564bd56 Merge pull request #5367 from rainzm/automated-cherry-pick-of-#5366-upstream-release-3.1
Automated cherry pick of #5366: fix/notify: Fix the resend mechanism
2020-03-06 12:46:02 +08:00
yunion-ci-robot
45e04c4d50 Merge pull request #5364 from wanyaoqi/automated-cherry-pick-of-#5363-upstream-release-3.1
Automated cherry pick of #5363: fix disk billing type on guest is postpaid
2020-03-06 12:29:50 +08:00
Rain
ee0f6de3b0 fix/notify: Fix the resend mechanism 2020-03-06 11:12:34 +08:00
wanyaoqi
608be69260 fix disk billing type on guest is postpaid 2020-03-05 20:33:19 +08:00
Qiu Jian
88fa459aac fix: allow project do user-list, group-list, returns current project user and group 2020-03-05 20:09:58 +08:00
yunion-ci-robot
b4bb5d902f Merge pull request #5360 from wanyaoqi/automated-cherry-pick-of-#5359-upstream-release-3.1
Automated cherry pick of #5359: enable network list filter by host show vpc networks
2020-03-05 20:00:49 +08:00
wanyaoqi
7f467ab3a7 enable network list filter by host show vpc networks 2020-03-05 19:33:17 +08:00
yunion-ci-robot
5c1714d11d Merge pull request #5357 from rainzm/automated-cherry-pick-of-#5353-upstream-release-3.1
Automated cherry pick of #5353: feature(notify): Add query and return value for contact UPDATE interface
2020-03-05 19:03:51 +08:00
Rain
5f36cbb31c feature(notify): Add query and return value for contact UPDATE interface
1. Add same return value with contact GET interface when updating
2. Add pull params for query to pull subcontact by mobile number.
   For example, pull user_id from dingtalk throught user's mobile
   number.
3. Add corresponding feature based on above for climc.
4. UserCache will try FetchByName if there is no id matched user when
   fetching users from KeyStone.
2020-03-05 17:10:04 +08:00
Zexi Li
850544ee4d Merge pull request #5352 from rainzm/automated-cherry-pick-of-#5330-upstream-release-3.1
Automated cherry pick of #5330: feat: Add useridByMobile and accessToken cache for feishu
2020-03-05 14:18:38 +08:00
Rain
7ff8935abc feat: Add useridByMobile and accessToken cache for feishu 2020-03-05 14:12:39 +08:00
Zexi Li
874cf21b00 Merge pull request #5346 from swordqiu/hotfix/qj-update-autogen-struct-json-fieldname-3.1
fix: update autogen struct json field name for release/3.1
2020-03-05 14:07:41 +08:00
yunion-ci-robot
231fefed1f Merge pull request #5350 from zexi/automated-cherry-pick-of-#5349-upstream-release-3.1
Automated cherry pick of #5349: monitor: fix alert update not work
2020-03-04 22:54:20 +08:00
Qiu Jian
5dd591f1bb update autogen struct with comment lines 2020-03-04 21:19:54 +08:00
Zexi Li
ab32057ab1 monitor: fix alert update not work 2020-03-04 21:17:27 +08:00
yunion-ci-robot
84fec885e8 Merge pull request #5334 from yousong/automated-cherry-pick-of-#5333-upstream-release-3.1
Automated cherry pick of #5333: hostman: default ovn options from environment
2020-03-04 20:57:11 +08:00
yunion-ci-robot
8057b95ac2 Merge pull request #5344 from ioito/automated-cherry-pick-of-#5343-upstream-release-3.1
Automated cherry pick of #5343: fix: 支持aws rds sync
2020-03-04 20:50:09 +08:00
Qiu Jian
9adac58590 fix: update autogen struct json field name for release/3.1 2020-03-04 20:43:26 +08:00
Qu Xuan
f409fca66b fix: 支持aws rds sync 2020-03-04 20:10:22 +08:00
yunion-ci-robot
edd7136d3e Merge pull request #5341 from zexi/automated-cherry-pick-of-#5340-upstream-release-3.1
Automated cherry pick of #5340: alert notification use joint model
2020-03-04 19:59:09 +08:00
Zexi Li
b1c80010cc Merge pull request #5332 from yousong/automated-cherry-pick-of-#5331-upstream-release-3.1
Automated cherry pick of #5331: build: docker-centos-build: run as root
2020-03-04 19:17:02 +08:00
Zexi Li
5ff255d622 alert notification use joint model 2020-03-04 19:17:00 +08:00
Zexi Li
fb531b4d68 Merge pull request #5338 from swordqiu/automated-cherry-pick-of-#5336-upstream-release-3.1
Automated cherry pick of #5336: fix: keystone user password history check should skip system account
2020-03-04 19:16:27 +08:00
Qiu Jian
03cd5dc63a fix: keystone user password history check should skip system account 2020-03-04 18:44:04 +08:00
Yousong Zhou
fa48381bd7 hostman: default ovn options from environment 2020-03-04 16:43:33 +08:00
Yousong Zhou
38a6decc25 build: docker-centos-build: run as root
so that output file ownership can be properly changed

The Dockerfile was moved to a separate repo for maintenance
2020-03-04 15:10:20 +08:00
Zexi Li
627495d200 Merge pull request #5329 from zexi/automated-cherry-pick-of-#5328-upstream-release-3.1
Automated cherry pick of #5328: fix: docker_push uncomment build bin
2020-03-03 16:18:09 +08:00
Zexi Li
37b823a43c fix: docker_push uncomment build bin 2020-03-03 16:19:29 +08:00
Zexi Li
112eb0d7ae Merge pull request #5325 from swordqiu/automated-cherry-pick-of-#5324-upstream-release-3.1
Automated cherry pick of #5324: fix: clean up pending usage no matter whether object upload is success
2020-03-03 13:14:18 +08:00
yunion-ci-robot
bee314a0e6 Merge pull request #5316 from ioito/automated-cherry-pick-of-#5315-upstream-release-3.1
Automated cherry pick of #5315: fix: 避免旧套餐下架zone信息未知,导致同步rds异常
2020-03-03 02:23:44 +08:00
Qiu Jian
60ef016f42 fix: clean up pending usage no matter whether object upload is success 2020-03-03 02:12:49 +08:00
yunion-ci-robot
da235de896 Merge pull request #5323 from zexi/automated-cherry-pick-of-#5322-upstream-release-3.1
Automated cherry pick of #5322: add monitor service
2020-03-02 20:51:43 +08:00
Zexi Li
68a425ebd5 add monitor service 2020-03-02 20:05:50 +08:00
yunion-ci-robot
15f6b94bec Merge pull request #5321 from yousong/automated-cherry-pick-of-#5320-upstream-release-3.1
Automated cherry pick of #5320: build: docker: chown _output dir to current user:group
2020-03-02 17:47:38 +08:00
Yousong Zhou
d8dd372cb0 build: docker: chown _output dir to current user:group 2020-03-02 17:36:26 +08:00
Qu Xuan
e14a596d9f fix: 避免旧套餐下架zone信息未知,导致同步rds异常 2020-03-02 17:09:13 +08:00
yunion-ci-robot
a0ab40dbb8 Merge pull request #5313 from wanyaoqi/automated-cherry-pick-of-#5312-upstream-release-3.1
Automated cherry pick of #5312: fix get remote address because of request is proxyed by k8s
2020-02-29 00:15:30 +08:00
wanyaoqi
75e49ac8c6 fix get remote address because of request is proxyed by k8s 2020-02-28 22:27:16 +08:00
yunion-ci-robot
590ec32860 Merge pull request #5273 from zhaoxiangchun/automated-cherry-pick-of-#5268-upstream-release-3.1
Automated cherry pick of #5268: 谷歌云multicloud监控
2020-02-28 22:24:29 +08:00
yunion-ci-robot
57fd313b43 Merge pull request #5308 from ioito/automated-cherry-pick-of-#5307-upstream-release-3.1
Automated cherry pick of #5307: 修复aliyun没有权限获取余额问题
2020-02-28 22:05:29 +08:00
yunion-ci-robot
86e4df54d9 Merge pull request #5287 from wanyaoqi/automated-cherry-pick-of-#5286-upstream-release-3.1
Automated cherry pick of #5286: host register use default vpc
2020-02-28 21:55:21 +08:00
yunion-ci-robot
a9f60a7b1a Merge pull request #5306 from yousong/automated-cherry-pick-of-#5305-upstream-release-3.1
Automated cherry pick of #5305: build: github: build vpcagent image
2020-02-28 21:51:28 +08:00
yunion-ci-robot
087de62171 Merge pull request #5278 from ioito/automated-cherry-pick-of-#5277-upstream-release-3.1
Automated cherry pick of #5277: fix: 新加gcp region 翻译
2020-02-28 20:51:21 +08:00
Qu Xuan
8577cb096e 修复aliyun没有权限获取余额问题 2020-02-28 19:55:33 +08:00
Yousong Zhou
2110057bac hostman: disable services on host system when running in container 2020-02-28 18:22:29 +08:00
Yousong Zhou
3c09ce17d0 build: github: build vpcagent image 2020-02-28 18:22:29 +08:00
Zexi Li
dc870afaed Merge pull request #5304 from yousong/automated-cherry-pick-of-#5303-upstream-release-3.1
Automated cherry pick of #5303: build: github: add back ceph devel deps for baremetal-agent
2020-02-28 16:13:30 +08:00
Yousong Zhou
fcb8bba00c build: github: add back ceph devel deps for baremetal-agent 2020-02-28 16:10:28 +08:00
yunion-ci-robot
7996a02a80 Merge pull request #5302 from yousong/automated-cherry-pick-of-#5301-upstream-release-3.1
Automated cherry pick of #5301: build: rename docker-build to docker-centos-build
2020-02-28 15:52:30 +08:00
Yousong Zhou
3349dc46c5 build: github: build host with docker-alpine-build 2020-02-28 15:28:04 +08:00
Yousong Zhou
a85fd307d3 build: add docker-alpine-build 2020-02-28 15:28:04 +08:00
Yousong Zhou
37f1906f72 build: rename docker-build to docker-centos-build 2020-02-28 15:28:04 +08:00
yunion-ci-robot
d5096ad4ee Merge pull request #5296 from tb365/automated-cherry-pick-of-#5295-upstream-release-3.1
Automated cherry pick of #5295: vpc list add param vpc_usable
2020-02-28 14:22:21 +08:00
yunion-ci-robot
24da237790 Merge pull request #5291 from ioito/automated-cherry-pick-of-#5290-upstream-release-3.1
Automated cherry pick of #5290: 添加azure region city信息
2020-02-28 13:17:19 +08:00
TangBin
d34b00ddc4 vpc list add param vpc_usable 2020-02-28 12:10:54 +08:00
Zexi Li
2f47d93215 Merge pull request #5267 from yousong/automated-cherry-pick-of-#5266-upstream-release-3.1
Automated cherry pick of #5266: vpcagent: resolve ovn db address at args validation time
2020-02-28 11:58:13 +08:00
Yousong Zhou
1bbf79528b build: host: adjust build method
- new host-base for native alpine utilities
 - build host with native alpine toolchain
2020-02-28 11:43:12 +08:00
Yousong Zhou
0c0c4fc94d build: build vpcagent container 2020-02-28 11:43:12 +08:00
Yousong Zhou
01de80ed09 hostman: use "uname -m" for for fetch processor type
"uname -p" command from native busybox, coreutils may return "unknown".
CentOS coreutils has a patch fallback to using uts.machine if sysinfo
syscall is not available

Use "uname -m" for maximum compatibility
2020-02-28 11:43:12 +08:00
Yousong Zhou
3861bb6bc1 hostman: work with ovn-controller already in container 2020-02-28 11:43:12 +08:00
Yousong Zhou
681fee1317 sysutils: use remote executor for hostnamectl as far as possible
So that hostnamectl can be omitted in host-base container image
2020-02-28 11:43:12 +08:00
Yousong Zhou
2496a12833 vpcagent: resolve ovn db address at args validation time
Until we find a reliable way to get k8s svc dns name
2020-02-28 11:43:12 +08:00
Yousong Zhou
c76062406d hostman: resolve ovn db address before setting it into ovsdb 2020-02-28 11:43:12 +08:00
Yousong Zhou
df94352e00 ovsutils: add NormalizeDbHost 2020-02-28 11:43:12 +08:00
Qu Xuan
5b9c7ba9f2 添加azure region city信息 2020-02-28 11:37:00 +08:00
yunion-ci-robot
e8dc05084a Merge pull request #5276 from ioito/automated-cherry-pick-of-#5275-upstream-release-3.1
Automated cherry pick of #5275: fix: 谷歌云建议关机下调整配置,部分linux开机也调整不了配置
2020-02-28 09:34:19 +08:00
wanyaoqi
0774a2ded0 host register use default vpc 2020-02-27 23:29:28 +08:00
yunion-ci-robot
50421b06b9 Merge pull request #5270 from tb365/automated-cherry-pick-of-#5269-upstream-release-3.1
Automated cherry pick of #5269: huawei secgroup default vpc id fix
2020-02-27 20:57:18 +08:00
TangBin
7e7825a681 huawei secgroup default vpc id fix 2020-02-27 19:32:10 +08:00
Qu Xuan
45b8a7afd9 fix: 新加gcp region 翻译 2020-02-27 18:54:47 +08:00
Qu Xuan
4ec1fc58d9 fix: 谷歌云建议关机下调整配置,部分linux开机也调整不了配置 2020-02-27 16:53:10 +08:00
zhaoxiangchun
69564365b9 谷歌云multicloud监控
monitor.go文件中GetMonitorData函数:
 1)首先组装参数信息
 2)通过external_id获取相关id信息,根据restAPI文档中的resource格式拼装完成monitoring相关的resource信息
 3)然后通过monitorList函数获取相关的监控信息

更新go.mod google.golang.org所依赖的google.golang.org/api版本
2020-02-27 15:48:52 +08:00
yunion-ci-robot
54caca2d04 Merge pull request #5262 from tb365/automated-cherry-pick-of-#5261-upstream-release-3.1
Automated cherry pick of #5261: ctyun get vm by id fix
2020-02-27 07:19:13 +08:00
yunion-ci-robot
ce3241d046 Merge pull request #5265 from rainzm/automated-cherry-pick-of-#5263-upstream-release-3.1
Automated cherry pick of #5263: fix(esxiagent): SSHKey was not unmarshalled correctly
2020-02-27 07:11:14 +08:00
yunion-ci-robot
40773180fa Merge pull request #5239 from wanyaoqi/automated-cherry-pick-of-#5238-upstream-release-3.1
Automated cherry pick of #5238: fix host init set reserve memory
2020-02-26 23:13:13 +08:00
yunion-ci-robot
32411bf2ec Merge pull request #5237 from tb365/automated-cherry-pick-of-#5236-upstream-release-3.1
Automated cherry pick of #5236: huawei & ctyun security group sync fix
2020-02-26 21:04:13 +08:00
wanyaoqi
c99265e743 makesure /etc/ceph created before connect 2020-02-26 20:44:31 +08:00
Rain
2d4cff4ef1 fix(esxiagent): SSHKey was not unmarshalled correctly 2020-02-26 20:12:47 +08:00
TangBin
bb90b5e8a1 ctyun vpc create fix 2020-02-26 17:40:56 +08:00
TangBin
b1c4bc276f ctyun eip charge type fix 2020-02-26 17:40:56 +08:00
TangBin
1923e36740 ctyun attach disk fix 2020-02-26 17:40:56 +08:00
TangBin
7bec5e6f7e ctyun get vm by id fix 2020-02-26 17:40:56 +08:00
yunion-ci-robot
b40be2608b Merge pull request #5232 from ioito/automated-cherry-pick-of-#5231-upstream-release-3.1
Automated cherry pick of #5231: fix: 添加磁盘回滚snapshot日志
2020-02-26 16:00:15 +08:00
Zexi Li
46d2f6efb7 Merge pull request #5254 from swordqiu/automated-cherry-pick-of-#5252-upstream-release-3.1
Automated cherry pick of #5252: fix: use globalEndpointType as default endpoint type
2020-02-26 10:37:37 +08:00
yunion-ci-robot
d55f1db7ff Merge pull request #5243 from ioito/automated-cherry-pick-of-#5242-upstream-release-3.1
Automated cherry pick of #5242: fix: 避免根磁盘小于镜像大小导致创建失败
2020-02-26 10:20:13 +08:00
yunion-ci-robot
0bcc19d7c1 Merge pull request #5248 from ioito/automated-cherry-pick-of-#5247-upstream-release-3.1
Automated cherry pick of #5247: fix: 返回azure api 错误信息
2020-02-25 21:07:14 +08:00
Qiu Jian
b395dc8cee fix: use globalEndpointType as default endpoint type 2020-02-25 20:47:15 +08:00
Qu Xuan
c908e0c19a fix: 返回azure api 错误信息 2020-02-25 19:31:07 +08:00
Qu Xuan
ce5a95607f fix: 避免根磁盘小于镜像大小导致创建失败 2020-02-25 15:38:19 +08:00
wanyaoqi
d4ba5ca52e fix host register get network filter: add server_type baremetal 2020-02-25 11:25:46 +08:00
wanyaoqi
92129824c0 fix guest network get desc 2020-02-25 11:25:46 +08:00
wanyaoqi
7326b1fb0d fix host init set reserve memory 2020-02-25 11:25:46 +08:00
yunion-ci-robot
1b5756fe1c Merge pull request #5227 from rainzm/automated-cherry-pick-of-#5186-upstream-release-3.1
Automated cherry pick of #5186: feature(notify): Validate config
2020-02-25 08:21:09 +08:00
TangBin
08f8ce1f7c huawei & ctyun security group sync fix 2020-02-24 20:15:48 +08:00
Qu Xuan
2c5234b97e fix: 添加磁盘回滚snapshot日志 2020-02-24 16:07:28 +08:00
Rain
37049bd5f3 feature(notify): Validate config 2020-02-24 14:10:41 +08:00
yunion-ci-robot
177ba6cf2c Merge pull request #5225 from tb365/automated-cherry-pick-of-#5224-upstream-release-3.1
Automated cherry pick of #5224: network query by ip fix
2020-02-23 18:52:06 +08:00
yunion-ci-robot
bf2bb9878f Merge pull request #5223 from wanyaoqi/automated-cherry-pick-of-#5222-upstream-release-3.1
Automated cherry pick of #5222: region misc fix:
2020-02-21 23:38:00 +08:00
TangBin
530b2a1422 network query by ip fix 2020-02-21 19:00:27 +08:00
wanyaoqi
1eba8b8a7e region misc fix:
- guest postpaid expire support set expire time
- list instance snapshot sub snapshot return size
2020-02-21 17:45:46 +08:00
Zexi Li
4829e0d285 Merge pull request #5212 from swordqiu/automated-cherry-pick-of-#5208-upstream-release-3.1
Automated cherry pick of #5208: fix: reset paging limit to 2048 from 20
2020-02-21 16:46:05 +08:00
Zexi Li
b29d6d4f4e Merge pull request #5218 from rainzm/automated-cherry-pick-of-#5217-upstream-release-3.1
Automated cherry pick of #5217: fix: Storage filter not work for Esxi
2020-02-21 16:44:38 +08:00
yunion-ci-robot
d41c3bfea7 Merge pull request #5207 from tb365/automated-cherry-pick-of-#5199-upstream-release-3.1
Automated cherry pick of #5199: cloud region city list add default limit 2048
2020-02-21 15:53:41 +08:00
yunion-ci-robot
907058464a Merge pull request #5197 from ioito/automated-cherry-pick-of-#5196-upstream-release-3.1
Automated cherry pick of #5196: fix: gcp win os not support change config when vm running
2020-02-21 15:44:33 +08:00
Rain
c727334bc4 fix: Storage filter not work for Esxi
1. SESXiGuestDriver.DoScheduleStorageFilter should return true.
2. ESXi's SHost.GetStorageSizeMB should return the capacity of all the
storage belonging to it.
2020-02-21 15:13:18 +08:00
yunion-ci-robot
b7e2c462cb Merge pull request #5214 from ioito/automated-cherry-pick-of-#5213-upstream-release-3.1
Automated cherry pick of #5213: fix: 添加gcp region中文翻译
2020-02-20 21:17:29 +08:00
yunion-ci-robot
1efc0fe07b Merge pull request #5200 from ioito/automated-cherry-pick-of-#5198-upstream-release-3.1
Automated cherry pick of #5198: fix: 修复azure坐标问题,添加新的azure region城市信息
2020-02-20 21:02:31 +08:00
yunion-ci-robot
9d1b407c40 Merge pull request #5192 from ioito/automated-cherry-pick-of-#5191-upstream-release-3.1
Automated cherry pick of #5191: fix: add aliyun new region info
2020-02-20 18:21:29 +08:00
Qu Xuan
67c2435f4f fix: 添加gcp region中文翻译 2020-02-20 17:38:25 +08:00
yunion-ci-robot
c11c79ef71 Merge pull request #5188 from ioito/automated-cherry-pick-of-#5187-upstream-release-3.1
Automated cherry pick of #5187: fix: 填充gcp disk_format字段
2020-02-20 15:30:30 +08:00
Qiu Jian
c245013e59 fix: reset paging limit to 2048 from 20 2020-02-20 15:22:07 +08:00
TangBin
83b4916646 huawei cloud create bugfix 2020-02-20 15:03:54 +08:00
TangBin
f6d1ea7b25 cloud region city list add default limit 2048 2020-02-20 15:03:54 +08:00
Qu Xuan
c988fd1b1f fix: 修复azure坐标问题,添加新的azure region城市信息 2020-02-20 14:55:16 +08:00
Qu Xuan
f6df6d34e0 fix: gcp win os not support change config when vm running 2020-02-20 12:00:06 +08:00
Qu Xuan
44183902f7 fix: add aliyun new region info 2020-02-20 11:07:17 +08:00
Qu Xuan
64fda24e76 fix: 填充gcp disk_format字段 2020-02-20 10:45:43 +08:00
yunion-ci-robot
0701512da9 Merge pull request #5185 from tb365/automated-cherry-pick-of-#5181-upstream-release-3.1
Automated cherry pick of #5181: aws listener sync fix
2020-02-19 19:18:28 +08:00
tangbin
71499e7e1b huawei http listener sync fix 2020-02-19 18:48:30 +08:00
tangbin
6f6cf7cd64 aws rebuild root fix 2020-02-19 18:48:30 +08:00
tangbin
8f175ec326 aws listener sync fix 2020-02-19 18:48:30 +08:00
yunion-ci-robot
c0c26c7c40 Merge pull request #5180 from rainzm/automated-cherry-pick-of-#5178-upstream-release-3.1
Automated cherry pick of #5178: fix(esxi): No distinction between ordinary scsi and pvscsi when creating disks
2020-02-19 17:51:29 +08:00
Rain
42cd5b1435 fix(esxi): No distinction between ordinary scsi and pvscsi when creating disks
parascsi 是 vmware 中一种高性能的 scsi 控制器。

在此之前,scsi 只包括 "lsilogic", "lsilogicsas", "buslogic"; 而别名为 pvscsi
的 parascsi 没有被包含进来;并且,一个 pci controller只能挂一个 scsi controller,
这会导致如果在一个拥有 pvscsi 的机器上添加普通scsi驱动类型的磁盘,就会替换驱动;
反之亦然。这会导致驱动的 key 不是我们指定的key,并且在添加磁盘的时候替换驱动的
类型有些随意。再者,我们的驱动类型的选择其实并没有暴露给前端。

所以,在寻找相应的controller时,将 parascsi 也纳入 scsi 类型。
尽量避免在创建磁盘的时候做硬件的改动,所以在创建磁盘的时候不区分 scsi
还是 pvscsi,如果两种 controller 均没有,就按照请求的类型创建一个。

此外,在 CloneVM 的时候,如果支持,优先使用 parascsi。
2020-02-19 16:59:57 +08:00
yunion-ci-robot
4fafb8ae75 Merge pull request #5150 from tb365/automated-cherry-pick-of-#5145-upstream-release-3.1
Automated cherry pick of #5145: qcloud elb sync
2020-02-19 16:08:28 +08:00
Yousong Zhou
8349dcbba3 Merge pull request #5177 from swordqiu/automated-cherry-pick-of-#5173-upstream-release-3.1
Automated cherry pick of #5173: fix: sync cloud provider should change its cloud account's sync_status
2020-02-19 16:02:46 +08:00
yunion-ci-robot
85a792d2b1 Merge pull request #5161 from rainzm/automated-cherry-pick-of-#5097-upstream-release-3.1
Automated cherry pick of #5097: feature: Specify cloud provider when creating vm
2020-02-19 14:50:28 +08:00
yunion-ci-robot
71fee70283 Merge pull request #5166 from tb365/automated-cherry-pick-of-#5162-upstream-release-3.1
Automated cherry pick of #5162: huawei elb backend vpc validate fix
2020-02-19 13:43:28 +08:00
yunion-ci-robot
456c5fb50e Merge pull request #5168 from ioito/automated-cherry-pick-of-#5167-upstream-release-3.1
Automated cherry pick of #5167: fix: 避免将虚拟机ip同步到弹性网卡
2020-02-19 12:37:28 +08:00
yunion-ci-robot
b706356ba9 Merge pull request #5160 from yousong/automated-cherry-pick-of-#5159-upstream-release-3.1
Automated cherry pick of #5159: region: lbagent: deploy: use 'public' endpoint type
2020-02-19 12:04:27 +08:00
Qiu Jian
ed2bba3dd5 fix: sync cloud provider should change its cloud account's sync_status 2020-02-19 12:02:42 +08:00
Zexi Li
b6e701a6b2 Merge pull request #5158 from swordqiu/automated-cherry-pick-of-#5156-upstream-release-3.1
Automated cherry pick of #5156: fix: add climc helper scripts into docker images
2020-02-19 02:32:58 +08:00
Zexi Li
c21636b521 Merge pull request #5155 from swordqiu/automated-cherry-pick-of-#5151-upstream-release-3.1
Automated cherry pick of #5151: fix: 1. adjust default response header timer to 30 seconds 2. set default paging limit to 20
2020-02-19 02:30:10 +08:00
Yousong Zhou
2e0f424c73 lbagent: fix config for sticky session cookie
- account for user specific cookie name for insert mode
 - dont tamper cache instructions from backend server for server mode
2020-02-18 20:55:10 +08:00
Yousong Zhou
a2f30806cf region: lbagent: deploy: use 'public' endpoint type 2020-02-18 20:55:10 +08:00
Qu Xuan
0c0b4b43aa fix: 避免将虚拟机ip同步到弹性网卡 2020-02-18 15:38:12 +08:00
yunion-ci-robot
209bee4181 Merge pull request #5139 from ioito/automated-cherry-pick-of-#5138-upstream-release-3.1
Automated cherry pick of #5138: fix: 避免未过滤掉同一个network底下的guest
2020-02-18 14:46:39 +08:00
tangbin
ba265a7b83 huawei elb backend vpc validate fix 2020-02-18 14:21:47 +08:00
yunion-ci-robot
1a8f8dcb93 Merge pull request #5135 from zhaoxiangchun/automated-cherry-pick-of-#5132-upstream-release-3.1
Automated cherry pick of #5132: zstack监控功能
2020-02-18 12:06:45 +08:00
Rain
2a01c86428 feature: Specify cloud provider when creating vm
Specifying the eip is equivalent to specifying the cloudprovider when
creating vm.
2020-02-18 11:44:27 +08:00
Qiu Jian
dc75d93414 fix: add climc helper scripts into docker images 2020-02-18 10:17:31 +08:00
yunion-ci-robot
fe44564bf7 Merge pull request #5137 from yousong/automated-cherry-pick-of-#5136-upstream-release-3.1
Automated cherry pick of #5136: regiondrivers: kvm: dummy impl for RequestDeleteVpc
2020-02-18 09:45:38 +08:00
yunion-ci-robot
8cd23304ae Merge pull request #5144 from wanyaoqi/automated-cherry-pick-of-#5143-upstream-release-3.1
Automated cherry pick of #5143: check scsi driver on add disk
2020-02-18 09:41:40 +08:00
Qiu Jian
4b8e13f171 fix: 1. adjust default response header timer to 30 seconds 2. set default paging limit to 20 2020-02-18 08:55:58 +08:00
yunion-ci-robot
b6739ba7e8 Merge pull request #5131 from tb365/automated-cherry-pick-of-#5130-upstream-release-3.1
Automated cherry pick of #5130: huawei sync fix
2020-02-18 08:15:41 +08:00
TangBin
3db7b0c962 qcloud elb sync 2020-02-17 22:33:23 +08:00
wanyaoqi
0d6480723d check scsi driver on add disk 2020-02-17 22:00:07 +08:00
yunion-ci-robot
9a91bf244c Merge pull request #5129 from tb365/automated-cherry-pick-of-#5128-upstream-release-3.1
Automated cherry pick of #5128: huawei userdata fix
2020-02-17 21:54:36 +08:00
Qu Xuan
b1a641ca4d fix: 避免未过滤掉同一个network底下的guest 2020-02-17 20:51:43 +08:00
Yousong Zhou
c65e1e0855 regiondrivers: kvm: dummy impl for RequestDeleteVpc
Regression since 4a6a4c594a ("feature:
google云操作支持")

	Feb 17 15:53:12 titan-10-168-222-196 region[20940]: [I 200217 15:53:12 appsrv.(*Application).ServeHTTP(appsrv.go:237)] Ao9tyX8XY4DXa3tBiUyXgPm_ipc= 200 f7a73c DELETE /vpcs/vpc1 (10.168.222.196:46354) 723.91ms
	Feb 17 15:53:13 titan-10-168-222-196 region[20940]: [E 200217 15:53:13 tasks.(*VpcDeleteTask).taskFailed(vpc_delete_task.go:41)] vpc delete task fail: RequestDeleteVpc: Not implement RequestDeleteVpc
	Feb 17 15:53:13 titan-10-168-222-196 region[20940]: [I 200217 15:53:13 taskman.(*STask).SetStageFailed(tasks.go:636)] XXX TASK VpcDeleteTask failed: RequestDeleteVpc: Not implement RequestDeleteVpc on stage OnDeleteVpcComplete
	Feb 17 15:53:13 titan-10-168-222-196 region[20940]: [I 200217 15:53:13 taskman.(*STask).NotifyParentTaskComplete(tasks.go:648)] notify_parent_task_complete: VpcDeleteTask params {"__failed_reason":"RequestDeleteVpc: Not implement RequestDeleteVpc","__request_context":{"request_id":"f7a73c","service_name":"compute_v2","trace":{"debug":true,"duration":0,"id":"0","kind":"SERVER","local_endpoint":{"port":0,"service_name":"compute_v2"},"name":"delete","remote_endpoint":{"addr":"10.168.222.196","port":46354,"service_name":"(unknown_service)"},"shared":false,"tags":{"resource":"vpcs"},"timestamp":"2020-02-17T07:53:12.052219Z","trace_id":"5cf3e014"}},"__stages":[{"complete_at":"2020-02-17T15:53:12Z","name":"on_init"},{"complete_at":"2020-02-17T15:53:13Z","name":"OnDeleteVpcComplete"}]}
2020-02-17 16:22:17 +08:00
zhaoxiangchun
d8fc57b217 zstack监控功能
monitor.go中GetMonitorData函数通过传入的参数拼装请求参数,然后调用zstack.go中的getMonitor(),通过GET请求,获取相应的指标监控数据
2020-02-17 12:03:17 +08:00
tangbin
f9a47d94c7 ctyun custom image create bugfix 2020-02-15 17:33:55 +08:00
tangbin
ac2c3697bf ctyun sync fix 2020-02-15 17:33:55 +08:00
tangbin
b1048baef3 huawei sync fix 2020-02-15 17:33:55 +08:00
tangbin
bfc1f0125f huawei userdata fix 2020-02-15 12:56:43 +08:00
yunion-ci-robot
4b6d0107b0 Merge pull request #5127 from ioito/automated-cherry-pick-of-#5126-upstream-release-3.1
Automated cherry pick of #5126: fix: 添加host标签返回值
2020-02-15 07:58:06 +08:00
yunion-ci-robot
1948c12012 Merge pull request #5116 from tb365/automated-cherry-pick-of-#5115-upstream-release-3.1
Automated cherry pick of #5115: aws userdata bugfix
2020-02-15 00:05:06 +08:00
Qu Xuan
6345086c5b fix: 添加host标签返回值 2020-02-14 20:46:55 +08:00
tangbin
08d412669d aws userdata bugfix 2020-02-14 19:36:13 +08:00
yunion-ci-robot
c85a8d354e Merge pull request #5125 from ioito/automated-cherry-pick-of-#5124-upstream-release-3.1
Automated cherry pick of #5124: fix: disks_info typo
2020-02-14 18:22:05 +08:00
Qu Xuan
03be58f39a fix: disks_info typo 2020-02-14 17:51:58 +08:00
yunion-ci-robot
60cb619043 Merge pull request #5123 from rainzm/automated-cherry-pick-of-#5121-upstream-release-3.1
Automated cherry pick of #5121: fix(esxiagent): Delete image backup file after saving to glance instead of before
2020-02-14 17:42:05 +08:00
Rain
91c39cf8cd fix(esxiagent): Delete image backup file after saving to glance instead of before 2020-02-14 17:17:06 +08:00
yunion-ci-robot
f73ac4844f Merge pull request #5118 from ioito/automated-cherry-pick-of-#5117-upstream-release-3.1
Automated cherry pick of #5117: fix: 谷歌新加region翻译
2020-02-14 16:12:05 +08:00
Qu Xuan
e681f66aad fix: 谷歌新加region翻译 2020-02-14 14:44:22 +08:00
yunion-ci-robot
d7bf41e173 Merge pull request #5110 from rainzm/automated-cherry-pick-of-#5106-upstream-release-3.1
Automated cherry pick of #5106: fix(notify): Set some default template
2020-02-14 12:20:06 +08:00
yunion-ci-robot
ea3247eaba Merge pull request #5112 from zexi/automated-cherry-pick-of-#5111-upstream-release-3.1
Automated cherry pick of #5111: region: server list by host sn
2020-02-14 12:09:04 +08:00
Zexi Li
d91dbf5f47 region: server list by host sn 2020-02-13 21:09:06 +08:00
Rain
52129c544b fix(notify): Set some default template 2020-02-13 16:54:28 +08:00
yunion-ci-robot
a3b3e9c627 Merge pull request #5089 from rainzm/automated-cherry-pick-of-#5087-upstream-release-3.1
Automated cherry pick of #5087: fix(esxi): Create one if no suitable driver exists when creating disk
2020-02-13 14:38:04 +08:00
yunion-ci-robot
04c73b189d Merge pull request #5084 from tb365/automated-cherry-pick-of-#5083-upstream-release-3.1
Automated cherry pick of #5083: fix ctyun os version
2020-02-13 12:16:03 +08:00
tangbin
f75dbefbfd ctyun vm create fix 2020-02-13 11:44:21 +08:00
tangbin
a2e4490613 add more log 2020-02-13 11:44:21 +08:00
tangbin
2c32832946 eip dissociate bugfixC 2020-02-13 11:44:21 +08:00
tangbin
18239e30cc fix create sys disk snapshot 2020-02-13 11:44:20 +08:00
tangbin
77d6e24ae7 fix ctyun os version 2020-02-13 11:44:20 +08:00
yunion-ci-robot
d5f6473d57 Merge pull request #5096 from bistuzx/automated-cherry-pick-of-#5092-upstream-release-3.1
Automated cherry pick of #5092: update account bucket options
2020-02-13 03:48:04 +08:00
yunion-ci-robot
f7d927cbdd Merge pull request #5086 from zexi/automated-cherry-pick-of-#5085-upstream-release-3.1
Automated cherry pick of #5085: webconsole: use base64 encode connect_params
2020-02-12 22:14:02 +08:00
张旭
56a3d9c05d update account bucket options 2020-02-12 18:29:40 +08:00
Rain
a4b76036c5 fix(esxi): Create one if no suitable driver when creating disk 2020-02-12 16:05:26 +08:00
yunion-ci-robot
9e20cce793 Merge pull request #5064 from zhaoxiangchun/automated-cherry-pick-of-#5061-upstream-release-3.1
Automated cherry pick of #5061: multicloud的vmware监控功能
2020-02-12 15:22:01 +08:00
Zexi Li
f7b3b0c1a0 webconsole: use base64 encode connect_params 2020-02-12 11:44:41 +08:00
yunion-ci-robot
6404e3c2a0 Merge pull request #5082 from rainzm/automated-cherry-pick-of-#5081-upstream-release-3.1
Automated cherry pick of #5081: fix: Fix the bug introduced by pr #4921
2020-02-11 19:16:00 +08:00
yunion-ci-robot
9a1b040933 Merge pull request #5078 from ioito/automated-cherry-pick-of-#5077-upstream-release-3.1
Automated cherry pick of #5077: fix: 修复gcp出方向规则同步问题
2020-02-11 17:42:00 +08:00
yunion-ci-robot
b5468ca840 Merge pull request #5073 from ioito/automated-cherry-pick-of-#5072-upstream-release-3.1
Automated cherry pick of #5072: fix: 忽略无权限的资源标签
2020-02-11 17:22:58 +08:00
Rain
77bbb2bda8 fix: Fix the bug introduced by pr #4921
1. The display problem of contact and notification in notify.
2. The display problem of snat's network info.
2020-02-11 16:51:09 +08:00
zhaoxiangchun
562498da68 multicloud的vmware监控功能
monitor.go中GetMonitorData()函数获取监控数据
2020-02-11 00:44:48 +08:00
Qu Xuan
b91c19bcb5 fix: 修复gcp出方向规则同步问题 2020-02-10 18:47:54 +08:00
Qu Xuan
e48c4d0bb2 fix: 忽略无权限的资源标签 2020-02-10 16:44:06 +08:00
Zexi Li
8c3872000a Merge pull request #5051 from ioito/automated-cherry-pick-of-#5050-upstream-release-3.1
Automated cherry pick of #5050: 统一 details -> isList
2020-02-10 11:12:37 +08:00
yunion-ci-robot
7fde85b83f Merge pull request #5053 from swordqiu/automated-cherry-pick-of-#5052-upstream-release-3.1
Automated cherry pick of #5052: fix: progressively update image size while uploading
2020-02-10 10:34:00 +08:00
yunion-ci-robot
262096d99d Merge pull request #5071 from swordqiu/automated-cherry-pick-of-#5065-upstream-release-3.1
Automated cherry pick of #5065: fix: allow empty domain for windows deployment
2020-02-10 10:32:57 +08:00
Qiu Jian
60ba83b40f fix: progressively update image size while uploading 2020-02-10 09:29:37 +08:00
Qiu Jian
5834ec297e fix: allow empty domain for windows deployment 2020-02-10 09:25:16 +08:00
yunion-ci-robot
8701c6172e Merge pull request #5055 from swordqiu/automated-cherry-pick-of-#5054-upstream-release-3.1
Automated cherry pick of #5054: fix: createdAt should not be synced when update
2020-02-09 22:08:59 +08:00
Qiu Jian
d912e29772 fix: createdAt should not be synced when update 2020-02-08 21:29:06 +08:00
Qu Xuan
bf0adeb0e2 统一 details -> isList 2020-02-07 18:03:18 +08:00
yunion-ci-robot
8857a6281e Merge pull request #5049 from ioito/automated-cherry-pick-of-#5048-upstream-release-3.1
Automated cherry pick of #5048: fix: google e2不支持本地盘
2020-02-07 16:42:54 +08:00
Qu Xuan
5537648dc7 fix: google e2不支持本地盘 2020-02-07 16:08:28 +08:00
yunion-ci-robot
158750373b Merge pull request #5045 from ioito/automated-cherry-pick-of-#5044-upstream-release-3.1
Automated cherry pick of #5044: fix: guest创建兼容keypair参数
2020-02-07 16:05:50 +08:00
Qu Xuan
8a719ffe1f fix: guest创建兼容keypair参数 2020-02-07 15:09:48 +08:00
Zexi Li
c1278bf088 Merge pull request #5043 from wanyaoqi/automated-cherry-pick-of-#5042-upstream-release-3.1
Automated cherry pick of #5042: bm register support update baremetal
2020-02-07 13:04:21 +08:00
Zexi Li
86d6a224cd Merge pull request #5030 from swordqiu/automated-cherry-pick-of-#5026-upstream-release-3.1
Automated cherry pick of #5026: fix: api gateway rpc handler redudant response
2020-02-07 13:03:37 +08:00
wanyaoqi
6b6a15e6b8 bm register support update baremetal 2020-02-07 09:27:02 +08:00
yunion-ci-robot
4a2b10e842 Merge pull request #5039 from ioito/automated-cherry-pick-of-#5038-upstream-release-3.1
Automated cherry pick of #5038: fix: 避免因tenantcache未缓存tenant导致创建云账号失败
2020-02-07 04:54:51 +08:00
yunion-ci-robot
38557f8bcd Merge pull request #5037 from tb365/automated-cherry-pick-of-#5032-upstream-release-3.1
Automated cherry pick of #5032: aws create with eip fix
2020-02-07 04:49:50 +08:00
Qu Xuan
8739393e52 fix: 避免因tenantcache未缓存tenant导致创建云账号失败 2020-02-06 18:29:15 +08:00
tangbin
fdad1303bc aws create with eip fix 2020-02-06 17:58:18 +08:00
yunion-ci-robot
bd2d11f964 Merge pull request #5031 from ioito/automated-cherry-pick-of-#5029-upstream-release-3.1
Automated cherry pick of #5029: fix: 修复gcp安全组同步问题
2020-02-06 17:51:52 +08:00
Qu Xuan
01c962f1c6 fix: 修复gcp安全组同步问题 2020-02-06 17:03:36 +08:00
Qiu Jian
d5ec862e26 fix: api gateway rpc handler redudant response 2020-02-06 17:03:13 +08:00
yunion-ci-robot
1e04ddfe5e Merge pull request #5022 from ioito/automated-cherry-pick-of-#5021-upstream-release-3.1
Automated cherry pick of #5021: fix: 避免因大小写导致linux未注入默认用户
2020-02-06 13:50:52 +08:00
Qu Xuan
67a6f9687d fix: 避免因大小写导致linux未注入默认用户 2020-02-06 12:02:12 +08:00
yunion-ci-robot
9bfb6c0c8e Merge pull request #5020 from swordqiu/automated-cherry-pick-of-#5014-upstream-release-3.1
Automated cherry pick of #5014: fix: support empty dns domain
2020-02-06 09:41:48 +08:00
yunion-ci-robot
b4fff49236 Merge pull request #5013 from swordqiu/automated-cherry-pick-of-#5012-upstream-release-3.1
Automated cherry pick of #5012: fix: network update error caused by vpc feature
2020-02-06 09:34:48 +08:00
Qiu Jian
8536166426 fix: support empty dns domain 2020-02-06 03:28:26 +08:00
Qiu Jian
4bd9051ae4 fix: network update error caused by vpc feature 2020-02-06 03:11:26 +08:00
yunion-ci-robot
74c272cfae Merge pull request #5011 from yousong/automated-cherry-pick-of-#5010-upstream-release-3.1
Automated cherry pick of #5010: vpcagent: ignore external stub guestnetworks
2020-02-06 01:50:48 +08:00
Yousong Zhou
38aed0ca4a vpcagent: ignore external stub guestnetworks 2020-02-05 11:38:57 +08:00
yunion-ci-robot
06eea75674 Merge pull request #5009 from yousong/automated-cherry-pick-of-#5008-upstream-release-3.1
Automated cherry pick of #5008: hostman: fix hostinfo init interrupted by ovn chassis setup
2020-02-05 10:22:47 +08:00
Yousong Zhou
ad73aa590a hostman: fix hostinfo init interrupted by ovn chassis setup
Causing sysinfo.SSystemInfo not initialized

[E 200205 09:45:49 timeutils2.AddTimeout.func1.1(timeutils.go:31)] runtime error: invalid memory address or nil pointer dereference
goroutine 405 [running]:
runtime/debug.Stack(0x551210, 0xc0000de1c0, 0x0)
        /opt/hostedtoolcache/go/1.12.16/x64/src/runtime/debug/stack.go:24 +0x9d
runtime/debug.PrintStack()
        /opt/hostedtoolcache/go/1.12.16/x64/src/runtime/debug/stack.go:16 +0x22
yunion.io/x/onecloud/pkg/util/timeutils2.AddTimeout.func1.1()
        /home/runner/work/onecloud/onecloud/pkg/util/timeutils2/timeutils.go:32 +0x96
panic(0x1b208e0, 0x3bd1880)
        /opt/hostedtoolcache/go/1.12.16/x64/src/runtime/panic.go:522 +0x1b5
yunion.io/x/onecloud/pkg/hostman/hostinfo.(*SHostInfo).updateHostRecord(0xc0009a8a80, 0xc000aff3b0, 0x24)
        /home/runner/work/onecloud/onecloud/pkg/hostman/hostinfo/hostinfo.go:866 +0xbba
yunion.io/x/onecloud/pkg/hostman/hostinfo.(*SHostInfo).getHostInfo(0xc0009a8a80, 0xc00099a510, 0x24)
        /home/runner/work/onecloud/onecloud/pkg/hostman/hostinfo/hostinfo.go:782 +0x37d
yunion.io/x/onecloud/pkg/hostman/hostinfo.(*SHostInfo).getZoneInfo(0xc0009a8a80, 0xc00099a4b0, 0x24, 0x0)
        /home/runner/work/onecloud/onecloud/pkg/hostman/hostinfo/hostinfo.go:760 +0x55c
yunion.io/x/onecloud/pkg/hostman/hostinfo.(*SHostInfo).onGetWireId(0xc0009a8a80, 0xc000aff2f0, 0x24)
        /home/runner/work/onecloud/onecloud/pkg/hostman/hostinfo/hostinfo.go:734 +0x16a
yunion.io/x/onecloud/pkg/hostman/hostinfo.(*SHostInfo).fetchAccessNetworkInfo(0xc0009a8a80)
        /home/runner/work/onecloud/onecloud/pkg/hostman/hostinfo/hostinfo.go:719 +0x3ee
yunion.io/x/onecloud/pkg/hostman/hostinfo.(*SHostInfo).register(...)
        /home/runner/work/onecloud/onecloud/pkg/hostman/hostinfo/hostinfo.go:662
yunion.io/x/onecloud/pkg/util/timeutils2.AddTimeout.func1(0x77359400, 0xc000925520)
        /home/runner/work/onecloud/onecloud/pkg/util/timeutils2/timeutils.go:37 +0x6b
created by yunion.io/x/onecloud/pkg/util/timeutils2.AddTimeout
        /home/runner/work/onecloud/onecloud/pkg/util/timeutils2/timeutils.go:28 +0x49
2020-02-05 10:08:32 +08:00
yunion-ci-robot
4322981be4 Merge pull request #5006 from yousong/automated-cherry-pick-of-#5005-upstream-release-3.1
Automated cherry pick of #5005: hostman: fix detection of ovn controller version
2020-02-05 02:17:48 +08:00
yunion-ci-robot
655d3632fa Merge pull request #5004 from zhaoxiangchun/automated-cherry-pick-of-#4996-upstream-release-3.1
Automated cherry pick of #4996: azure的主机监控信息的获取
2020-02-05 02:10:45 +08:00
Yousong Zhou
cd34e0db95 hostman: skip setting up ovn chassis when env support is not ready 2020-02-04 17:36:13 +08:00
Yousong Zhou
aae5d0dc33 hostman: fix detection of ovn controller version 2020-02-04 17:36:13 +08:00
Zexi Li
51b2f4d3af Merge pull request #5003 from ioito/automated-cherry-pick-of-#4921-upstream-release-3.1
Automated cherry pick of #4921: feature: api -> response struct
2020-02-04 15:55:51 +08:00
zhaoxiangchun
f7987dbf61 modify files by github comments 2020-02-04 10:26:10 +08:00
zhaoxiangchun
f1282345f1 azure的主机监控信息的获取
monitor.go中的GetMonitorData函数完成参数的组装,查询获取监控信息
2020-02-04 10:26:10 +08:00
Qu Xuan
9046117e00 feature: api -> response struct 2020-02-03 18:16:36 +08:00
3568 changed files with 192411 additions and 502611 deletions

View File

@@ -13,7 +13,7 @@ jobs:
- checkout
- run:
command: |
make -j3 check
make check
build:
requires:
- check
@@ -38,7 +38,7 @@ jobs:
command: |
targets="$(circleci tests glob "cmd/*" | grep -v cmd/host-image | circleci tests split)"
echo $targets | tr ' ' '\n'
make -j3 $targets
make $targets
ls -lh _output/bin/
- save_cache:
key: onecloud-build-cache-{{ checksum "go.mod" }}-{{ checksum "Makefile" }}
@@ -55,7 +55,6 @@ jobs:
environment:
GO111MODULE: "on"
working_directory: /root/go/onecloud
parallelism: 4
steps:
- checkout
- restore_cache:

View File

@@ -1,15 +1,9 @@
**这个 PR 实现什么功能/修复什么问题**:
<!--
- [ ] 功能、bugfix描述
- [ ] 冒烟测试
- [ ] 单元测试编写
-->
**是否需要 backport 到之前的 release 分支**:
<!--
如果不需要,填写 "NONE".
如果需要,就以下面 item 的格式写 release 分支名,并提交对应的 cherry-pick PR:
- release/3.1
- release/2.8.0
- release/2.6.0
-->

View File

@@ -36,40 +36,10 @@ jobs:
make cmd/ansibleserver cmd/cloudnet cmd/notify
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 cmd/cloudid
make cmd/cloudevent cmd/devtool
make cmd/*cli
make cmd/esxi-agent
make docker-alpine-build F='-j4 cmd/host cmd/vpcagent cmd/region-dns'
- name: Image region
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/region
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.region
- name: Image host
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/host
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.host
- name: Image host-deployer
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/host-deployer
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.host-deployer
make docker-alpine-build F='-j4 cmd/host cmd/vpcagent'
- name: Image baremetal-agent
uses: elgohr/Publish-Docker-Github-Action@master
@@ -131,6 +101,16 @@ jobs:
snapshot: true
dockerfile: build/docker/Dockerfile.logger
- name: Image region
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/region
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.region
- name: Image scheduler
uses: elgohr/Publish-Docker-Github-Action@master
with:
@@ -201,6 +181,26 @@ jobs:
snapshot: true
dockerfile: build/docker/Dockerfile.notify
- name: Image host
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/host
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.host
- name: Image host-deployer
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/host-deployer
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.host-deployer
- name: Image cloudevent
uses: elgohr/Publish-Docker-Github-Action@master
with:
@@ -211,16 +211,6 @@ jobs:
snapshot: true
dockerfile: build/docker/Dockerfile.cloudevent
- name: Image cloudid
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/cloudid
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.cloudid
- name: Image devtool
uses: elgohr/Publish-Docker-Github-Action@master
with:
@@ -230,13 +220,3 @@ jobs:
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.devtool
- name: Image region DNS
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: registry.cn-beijing.aliyuncs.com/yunionio/region-dns
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
registry: registry.cn-beijing.aliyuncs.com
snapshot: true
dockerfile: build/docker/Dockerfile.region-dns

3
.gitignore vendored
View File

@@ -30,10 +30,7 @@ _output
/relay
/structargtest
.idea
.vscode
GPATH
GRTAGS
GTAGS
pkg/generated
*.orig

View File

@@ -10,7 +10,7 @@ BUILD_SCRIPT := $(ROOT_DIR)/build/build.sh
ifeq ($(ONECLOUD_CI_BUILD),)
GIT_COMMIT := $(shell git rev-parse --short HEAD)
GIT_BRANCH := $(shell git name-rev --name-only HEAD)
GIT_VERSION := $(shell git describe --always --tags --abbrev=14 $(GIT_COMMIT)^{commit})
GIT_VERSION := $(shell git describe --tags --abbrev=14 $(GIT_COMMIT)^{commit})
GIT_TREE_STATE := $(shell s=`git status --porcelain 2>/dev/null`; if [ -z "$$s" ]; then echo "clean"; else echo "dirty"; fi)
BUILD_DATE := $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
else
@@ -51,7 +51,6 @@ ifdef LIBQEMUIO_PATH
X_CGO_LDFLAGS := ${CGO_LDFLAGS_ENV} -laio -lqemuio -lpthread -L ${LIBQEMUIO_PATH}/src
endif
export GOOS ?= linux
export GO111MODULE:=on
export CGO_CFLAGS = ${X_CGO_CFLAGS}
export CGO_LDFLAGS = ${X_CGO_LDFLAGS}
@@ -76,7 +75,7 @@ install: prepare_dir
gencopyright:
@bash scripts/gencopyright.sh pkg cmd
@sh scripts/gencopyright.sh pkg cmd
test:
@go test $(GO_BUILD_FLAGS) $(shell go list ./... | egrep -v 'host-image|hostimage')
@@ -163,15 +162,9 @@ goimports-check:
fi
.PHONY: goimports-check
vet-check:
./scripts/vet.sh gen
./scripts/vet.sh chk
.PHONY: vet-check
check: fmt-check
check: gendocgo-check
check: goimports-check
check: vet-check
.PHONY: check
@@ -194,7 +187,7 @@ dep:
@$(MAKE) mod
mod:
go get -d $(patsubst %,%@master,$(shell GO111MODULE=on go mod edit -print | sed -n -e 's|.*\(yunion.io/x/[a-z].*\) v.*|\1|p'))
go get $(patsubst %,%@master,$(shell GO111MODULE=on go mod edit -print | sed -n -e 's|.*\(yunion.io/x/[a-z].*\) v.*|\1|p'))
go mod tidy
go mod vendor -v
@@ -218,7 +211,6 @@ docker-centos-build:
--name onecloud-ci-build \
--rm \
--volume $(CURDIR):/root/onecloud \
--volume $(CURDIR)/_output/_cache:/root/.cache \
registry.cn-beijing.aliyuncs.com/yunionio/centos-build:$(DOCKER_BUILD_IMAGE_VERSION) \
/bin/bash -c "$$dockerCentOSBuildCmd"
chown -R $$(id -u):$$(id -g) _output
@@ -249,7 +241,6 @@ docker-alpine-build:
--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
@@ -297,15 +288,10 @@ gen-swagger: gen-swagger-check
$(ROOT_DIR)/scripts/codegen.py swagger-code
$(ROOT_DIR)/scripts/codegen.py swagger-yaml
swagger-serve-only:
swagger-serve: gen-swagger
$(ROOT_DIR)/scripts/codegen.py swagger-serve
swagger-serve: gen-model-api gen-swagger swagger-serve-only
swagger-site: gen-model-api gen-swagger
$(ROOT_DIR)/scripts/codegen.py swagger-site
.PHONY: gen-model-api-check gen-model-api gen-swagger-check gen-swagger swagger-serve swagger-site
.PHONY: gen-model-api-check gen-model-api gen-swagger-check gen-swagger swagger-serve
REGISTRY ?= "registry.cn-beijing.aliyuncs.com/yunionio"
VERSION ?= $(shell git describe --exact-match 2> /dev/null || \

View File

@@ -1,7 +1,7 @@
# Yunion OneCloud
[![CircleCI](https://circleci.com/gh/yunionio/onecloud.svg?style=svg)](https://circleci.com/gh/yunionio/onecloud)
[![Build Status](https://travis-ci.com/yunionio/onecloud.svg?branch=master)](https://travis-ci.com/yunionio/onecloud/branches)
[![Build Status](https://travis-ci.com/yunionio/onecloud.svg?branch=master)](https://travis-ci.org/yunionio/onecloud)
[![Go Report Card](https://goreportcard.com/badge/github.com/yunionio/onecloud)](https://goreportcard.com/report/github.com/yunionio/onecloud)
### [README in Chinese](./README-CN.md)
@@ -40,7 +40,7 @@ Please refers to [install & deployment](https://docs.yunion.io/docs/setup/) (cur
- [Yunion OneCloud Documents](https://docs.yunion.io/)
- [Swagger API](https://docs.yunion.cn/apiv2/)
- [Swagger API](https://docs.yunion.cn/api/)
## Architecture

View File

@@ -1 +0,0 @@
DESCRIPTION="Yunion CloudId"

View File

@@ -1,3 +1,3 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/ansibleserver-base:1.0.0
FROM registry.cn-beijing.aliyuncs.com/yunionio/ansibleserver-base:latest
ADD ./_output/alpine-build/bin/ansibleserver /opt/yunion/bin/ansibleserver
ADD ./_output/bin/ansibleserver /opt/yunion/bin/ansibleserver

View File

@@ -1,12 +1,13 @@
FROM alpine:3.11.6
FROM frolvlad/alpine-glibc:glibc-2.28
MAINTAINER "Yousong Zhou <zhouyousong@yunionyun.com>"
MAINTAINER "Zexi Li <lizexi@yunionyun.com>"
# openssh-client, for ansible ssh connection
# git, ca-certificates, for fetching ansible roles
RUN set -x \
&& apk update \
&& apk add openssh-client \
&& apk add ansible \
&& apk add tzdata git ca-certificates \
&& rm -rf /var/cache/apk/*
ENV TZ Asia/Shanghai
RUN mkdir -p /opt/yunion/bin
RUN apk update && \
apk add --no-cache tzdata ansible ca-certificates && \
rm -rf /var/cache/apk/*
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

View File

@@ -1,3 +1,3 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
ADD ./_output/bin/apigateway /opt/yunion/bin/apigateway

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:v20200308
FROM registry.cn-beijing.aliyuncs.com/yunionio/climc-base:latest
ADD ./build/climc/root/opt /opt

View File

@@ -6,7 +6,7 @@ ENV TZ Asia/Shanghai
RUN mkdir -p /opt/yunion/bin
RUN apk add --no-cache bash bash-completion tzdata ca-certificates vim && \
RUN apk add --no-cache bash bash-completion tzdata ca-certificates && \
rm -rf /var/cache/apk/*
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

View File

@@ -1,3 +1,3 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
ADD ./_output/bin/cloudevent /opt/yunion/bin/cloudevent

View File

@@ -1,3 +0,0 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
ADD ./_output/bin/cloudid /opt/yunion/bin/cloudid

View File

@@ -1,3 +1,3 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
ADD ./_output/bin/cloudnet /opt/yunion/bin/cloudnet

View File

@@ -1,3 +1,3 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
ADD ./_output/bin/devtool /opt/yunion/bin/devtool

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
COPY ./build/esxi-agent/root/opt/ /opt/
ADD ./_output/bin/esxi-agent /opt/yunion/bin/esxi-agent

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-base:v0.2.0
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-base:v0.1.0
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:v0.0.3
FROM registry.cn-beijing.aliyuncs.com/yunionio/host-deployer-base:v0.0.2
MAINTAINER "Yaoqi Wan wanyaoqi@yunionyun.com"

View File

@@ -1,3 +1,3 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
ADD ./_output/bin/keystone /opt/yunion/bin/keystone

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
ADD ./_output/bin/logger /opt/yunion/bin/logger

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
ADD ./_output/bin/monitor /opt/yunion/bin/monitor

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
COPY ./build/notify/root/opt/ /opt/
ADD ./_output/bin/notify /opt/yunion/bin/notify

View File

@@ -7,7 +7,7 @@ ENV TZ Asia/Shanghai
RUN mkdir -p /opt/yunion/bin
RUN apk update && \
apk add --no-cache tzdata curl busybox-extras tcpdump strace ca-certificates && \
apk add --no-cache tzdata ca-certificates && \
rm -rf /var/cache/apk/*
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
COPY ./build/region/root/opt/ /opt/
ADD ./_output/bin/region /opt/yunion/bin/region

View File

@@ -1,4 +1,3 @@
FROM alpine:3.11.3
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
RUN mkdir -p /opt/yunion/bin
ADD ./_output/alpine-build/bin/region-dns /opt/yunion/bin/region-dns
ADD ./_output/bin/region-dns /opt/yunion/bin/region-dns

View File

@@ -1,3 +1,3 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
ADD ./_output/bin/s3gateway /opt/yunion/bin/s3gateway

View File

@@ -1,3 +1,3 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
ADD ./_output/bin/scheduler /opt/yunion/bin/scheduler

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/openvswitch:2.10.4-0
FROM registry.cn-beijing.aliyuncs.com/yunionio/openvswitch:2.9.6-1
MAINTAINER "Yousong Zhou <zhouyousong@yunion.cn>"

View File

@@ -1,4 +1,4 @@
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:v0.1
FROM registry.cn-beijing.aliyuncs.com/yunionio/onecloud-base:latest
ADD ./_output/bin/yunionconf /opt/yunion/bin/yunionconf

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
{{.os_type}} 镜像 {{.name}} 上传完成

View File

@@ -1,66 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<table style="width: 650px; margin-bottom: 20px;" border="0" cellpadding="0" cellspacing="0" align="center">
<tr style="height: 50px; background: #333; overflow: hidden;">
<td>
<table style="margin-left: 20px;">
<tr>
<td>
<img src="data:{{.login_logo_format}};base64,{{.login_logo}}" alt="" style="color: #fff; height: 32px; vertical-align: middle;">
</td>
</tr>
</table>
</td>
<td>
<table style="float: right;">
<tr>
<td style="padding-left: 20px; padding-right: 20px;">
<a href="" style="text-decoration: none; color: #20A0FF; font-size: 12px; display: none;">产品</a>
</td>
<td style="padding-left: 20px; padding-right: 20px;">
<a href="" style="text-decoration: none; color: #20A0FF; font-size: 12px; display: none;">解决方案</a>
</td>
<td style="padding-left: 20px; padding-right: 20px;">
<a href="" style="text-decoration: none; color: #20A0FF; font-size: 12px; display: none;">服务</a>
</td>
<td style="padding-left: 20px; padding-right: 20px;">
<a href="" style="text-decoration: none; color: #20A0FF; font-size: 12px; display: none;">帮助与文档</a>
</td>
<td style="padding-left: 20px; padding-right: 20px;">
<a href="" style="text-decoration: none; color: #20A0FF; font-size: 12px; display: none;">关于我们</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="width: 100%;" colspan="2">
<table style="padding: 20px 10px; width: 100%;">
<tr>
<td style="padding-bottom: 20px;">
尊敬的{{.name}},您好:
</td>
</tr>
<tr>
<td style="padding-bottom: 10px;">请点击下面的链接,完成用户邮箱的激活:</td>
</tr>
<tr>
<td style="padding-bottom: 30px;"><a href="{{.link}}">{{.link}}</a></td>
</tr>
</table>
</td>
</tr>
<tr style="width: 96%;">
<td colspan="2" style="border-top: 1px dashed #ccc; color: #333; font-size: 12px; padding-bottom: 10px; font-weight: 100;">*为了确保您的帐号安全该链接仅48小时内访问有效请勿直接回复此邮件。</td>
</tr>
<tr>
<td colspan="2" style="background: #333; text-align: right; padding-right: 20px; font-size: 12px; color: #fff; height: 50px;">版权所有 © {{.copyright}} 保留一切权利</td>
</tr>
</table>
</body>
</html>

View File

@@ -1 +0,0 @@
镜像 {{.name}} 上传完成

View File

@@ -1 +0,0 @@
Yunion Verify

View File

@@ -84,11 +84,7 @@ func newClient(options *BaseOptions) (*aliyun.SRegion, error) {
return nil, fmt.Errorf("Missing secret")
}
cli, err := aliyun.NewAliyunClient(
aliyun.NewAliyunClientConfig(
options.AccessKey, options.Secret,
).Debug(options.Debug),
)
cli, err := aliyun.NewAliyunClient("", "", options.AccessKey, options.Secret, options.Debug)
if err != nil {
return nil, err
}

View File

@@ -85,13 +85,7 @@ func newClient(options *BaseOptions) (*aws.SRegion, error) {
return nil, fmt.Errorf("Missing secret")
}
cli, err := aws.NewAwsClient(
aws.NewAwsClientConfig(
options.AccessUrl,
options.AccessKey,
options.Secret,
).Debug(options.Debug),
)
cli, err := aws.NewAwsClient("", "", options.AccessUrl, options.AccessKey, options.Secret, options.Debug)
if err != nil {
return nil, err
}

View File

@@ -100,17 +100,11 @@ func newClient(options *BaseOptions) (*azure.SRegion, error) {
return nil, fmt.Errorf("Missing Cloud Environment")
}
cli, err := azure.NewAzureClient(
azure.NewAzureClientConfig(
options.CloudEnv,
options.DirectoryID,
options.ApplicationID,
options.ApplicationKey,
).
SubscriptionId(options.SubscriptionID).
Debug(options.Debug),
)
cli, err := azure.NewAzureClient("", "", options.CloudEnv,
options.DirectoryID,
options.ApplicationID, options.ApplicationKey,
options.SubscriptionID,
options.Debug)
if err != nil {
return nil, err
}

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package entry
package main
import (
"context"
@@ -32,6 +32,10 @@ import (
"yunion.io/x/onecloud/cmd/climc/promputils"
"yunion.io/x/onecloud/cmd/climc/shell"
_ "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"
)
@@ -45,7 +49,7 @@ type BaseOptions struct {
CertFile string `default:"$YUNION_CERT_FILE" help:"certificate file"`
KeyFile string `default:"$YUNION_KEY_FILE" help:"private key file"`
Completion string `default:"" help:"Generate climc auto complete script" choices:"bash|zsh"`
Completion string `default:"" help:"Generate climc auto complete script" choices:"bash"`
UseCachedToken bool `default:"$YUNION_USE_CACHED_TOKEN|false" help:"Use cached token"`
OsUsername string `default:"$OS_USERNAME" help:"Username, defaults to env[OS_USERNAME]"`
@@ -58,8 +62,6 @@ type BaseOptions struct {
OsAccessKey string `default:"$OS_ACCESS_KEY" help:"ak/sk access key, defaults to env[OS_ACCESS_KEY]"`
OsSecretKey string `default:"$OS_SECRET_KEY" help:"ak/s secret, defaults to env[OS_SECRET_KEY]"`
OsAuthToken string `default:"$OS_AUTH_TOKEN" help:"token authenticate, defaults to env[OS_AUTH_TOKEN]"`
OsAuthURL string `default:"$OS_AUTH_URL" help:"Defaults to env[OS_AUTH_URL]"`
OsRegionName string `default:"$OS_REGION_NAME" help:"Defaults to env[OS_REGION_NAME]"`
@@ -71,13 +73,9 @@ type BaseOptions struct {
}
func getSubcommandsParser() (*structarg.ArgumentParser, error) {
var (
prog = "climc"
desc = `Command-line interface to the API server.`
)
parse, e := structarg.NewArgumentParser(&BaseOptions{},
prog,
desc,
"climc",
`Command-line interface to the API server.`,
`See "climc help COMMAND" for help on a specific command.`)
if e != nil {
return nil, e
@@ -98,28 +96,26 @@ func getSubcommandsParser() (*structarg.ArgumentParser, error) {
return nil
}
})
promptRootCmd := promputils.InitRootCmd(prog, desc, parse.GetOptArgs(), parse.GetPosArgs())
for _, v := range shell.CommandTable {
_par, e := subcmd.AddSubParser(v.Options, v.Command, v.Desc, v.Callback)
if e != nil {
return nil, e
}
promputils.AppendCommand(promptRootCmd, v.Command, v.Desc)
promputils.AppendCommand(v.Command, v.Desc)
cmd := v.Command
for _, v := range _par.GetOptArgs() {
text := v.String()
text = strings.TrimLeft(text, "[<")
text = strings.TrimRight(text, "]>")
promputils.AppendOpt(cmd, text, v.HelpString(""), v)
promputils.AppendOpt(cmd, text, v.HelpString(""))
}
for _, v := range _par.GetPosArgs() {
text := v.String()
text = strings.TrimLeft(text, "[<")
text = strings.TrimRight(text, "]>")
promputils.AppendPos(cmd, text, v.HelpString(""), v)
promputils.AppendPos(cmd, text, v.HelpString(""))
}
}
return parse, nil
@@ -135,8 +131,8 @@ func newClientSession(options *BaseOptions) (*mcclient.ClientSession, error) {
if len(options.OsAuthURL) == 0 {
return nil, fmt.Errorf("Missing OS_AUTH_URL")
}
if len(options.OsUsername) == 0 && len(options.OsAccessKey) == 0 && len(options.OsAuthToken) == 0 {
return nil, fmt.Errorf("Missing OS_USERNAME or OS_ACCESS_KEY or OS_AUTH_TOKEN")
if len(options.OsUsername) == 0 && len(options.OsAccessKey) == 0 {
return nil, fmt.Errorf("Missing OS_USERNAME or OS_ACCESS_KEY")
}
if len(options.OsUsername) > 0 && len(options.OsPassword) == 0 {
return nil, fmt.Errorf("Missing OS_PASSWORD")
@@ -144,6 +140,9 @@ func newClientSession(options *BaseOptions) (*mcclient.ClientSession, error) {
if len(options.OsAccessKey) > 0 && len(options.OsSecretKey) == 0 {
return nil, fmt.Errorf("Missing OS_SECRET_KEY")
}
if len(options.OsRegionName) == 0 {
return nil, fmt.Errorf("Missing OS_REGION_NAME")
}
logLevel := "info"
if options.Debug {
@@ -186,11 +185,7 @@ func newClientSession(options *BaseOptions) (*mcclient.ClientSession, error) {
if cacheToken == nil {
var token mcclient.TokenCredential
var err error
if len(options.OsAuthToken) > 0 {
token, err = client.AuthenticateToken(options.OsAuthToken, options.OsProjectName,
options.OsProjectDomain,
mcclient.AuthSourceCli)
} else if len(options.OsAccessKey) > 0 {
if len(options.OsAccessKey) > 0 {
token, err = client.AuthenticateByAccessKey(options.OsAccessKey,
options.OsSecretKey, mcclient.AuthSourceCli)
} else {
@@ -266,7 +261,7 @@ func executeSubcommand(
}
}
func ClimcMain() {
func main() {
parser, e := getSubcommandsParser()
if e != nil {
showErrorAndExit(e)
@@ -275,7 +270,7 @@ func ClimcMain() {
options := parser.Options().(*BaseOptions)
if len(options.Completion) > 0 {
completeScript := promputils.GenerateAutoCompleteCmds(promputils.GetRootCmd(), options.Completion)
completeScript := promputils.GenerateAutoCompleteCmds(options.Completion)
if len(completeScript) > 0 {
fmt.Printf("%s", completeScript)
}

View File

@@ -1,42 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
"yunion.io/x/onecloud/cmd/climc/entry"
_ "yunion.io/x/onecloud/cmd/climc/shell"
_ "yunion.io/x/onecloud/cmd/climc/shell/ansible"
_ "yunion.io/x/onecloud/cmd/climc/shell/cloudevent"
_ "yunion.io/x/onecloud/cmd/climc/shell/cloudid"
_ "yunion.io/x/onecloud/cmd/climc/shell/cloudnet"
_ "yunion.io/x/onecloud/cmd/climc/shell/compute"
_ "yunion.io/x/onecloud/cmd/climc/shell/etcd"
_ "yunion.io/x/onecloud/cmd/climc/shell/events"
_ "yunion.io/x/onecloud/cmd/climc/shell/identity"
_ "yunion.io/x/onecloud/cmd/climc/shell/image"
_ "yunion.io/x/onecloud/cmd/climc/shell/itsm"
_ "yunion.io/x/onecloud/cmd/climc/shell/k8s"
_ "yunion.io/x/onecloud/cmd/climc/shell/logger"
_ "yunion.io/x/onecloud/cmd/climc/shell/meter"
_ "yunion.io/x/onecloud/cmd/climc/shell/misc"
_ "yunion.io/x/onecloud/cmd/climc/shell/monitor"
_ "yunion.io/x/onecloud/cmd/climc/shell/notify"
_ "yunion.io/x/onecloud/cmd/climc/shell/servicetree"
_ "yunion.io/x/onecloud/cmd/climc/shell/yunionconf"
)
func main() {
entry.ClimcMain()
}

View File

@@ -1,178 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package promputils
import (
"fmt"
"io"
"strings"
"text/template"
"yunion.io/x/structarg"
)
// ref: https://github.com/spf13/cobra/blob/master/zsh_completions.go
var (
zshCompFuncMap = template.FuncMap{
"genZshFuncName": zshCompGenFuncName,
"extractFlags": zshCompExtractFlag,
"genFlagEntryForZshArguments": zshCompGenFlagEntryForArguments,
"extractArgsCompletions": zshCompExtractArgumentCompletionHintsForRendering,
}
zshCompletionText = `
{{/* should accept Command (that contains subcommands) as parameter */}}
{{define "argumentsC" -}}
{{ $cmdPath := genZshFuncName .}}
function {{$cmdPath}} {
local -a commands
_arguments -C \{{- range extractFlags .}}
{{genFlagEntryForZshArguments .}} \{{- end}}
"1: :->cmnds" \
"*::arg:->args"
case $state in
cmnds)
commands=({{range .SubCmds}}
"{{.Name}}:{{.Desc}}"{{end}}
)
_describe "command" commands
;;
esac
case "$words[1]" in {{- range .SubCmds}}
{{.Name}})
{{$cmdPath}}_{{.Name}}
;;{{end}}
esac
}
{{range .SubCmds}}
{{template "selectCmdTemplate" .}}
{{- end}}
{{- end}}
{{/* should accept Command without subcommands as parameter */}}
{{define "arguments" -}}
function {{genZshFuncName .}} {
{{" _arguments"}}{{range extractFlags .}} \
{{genFlagEntryForZshArguments . -}}
{{end}}{{range extractArgsCompletions .}} \
{{.}}{{end}}
}
{{end}}
{{/* dispatcher for commands with or without subcommands */}}
{{define "selectCmdTemplate" -}}
{{if .SubCmds}}{{template "argumentsC" .}}{{else}}{{template "arguments" .}}{{end}}
{{- end}}
{{/* template entry point */}}
{{define "Main" -}}
#compdef _{{.Name}} {{.Name}}
{{template "selectCmdTemplate" .}}
compdef _{{.Name}} {{.Name}}
{{end}}
`
)
func zshCompGenFuncName(c *Cmd) string {
if c.ParentCmd != nil {
return zshCompGenFuncName(c.ParentCmd) + "_" + c.Name
}
return "_" + c.Name
}
func zshCompExtractFlag(c *Cmd) []structarg.Argument {
return c.GetArguments()
}
func zshCompGenFlagEntryForArguments(f structarg.Argument) string {
// not process positional argument and single command
if f.IsPositional() {
return ""
}
if f.ShortToken() == "" {
return zshCompGenFlagEntryForSingleOptionFlag(f)
}
return zshCompGenFlagEntryForMultiOptionFlag(f)
}
func zshCompGenFlagEntryForSingleOptionFlag(f structarg.Argument) string {
var option, multiMark, extras string
if f.IsMulti() {
multiMark = "*"
}
option = "--" + f.Token()
extras = zshCompGenFlagEntryExtras(f)
return fmt.Sprintf(`'%s%s[%s]%s'`, multiMark, option, zshCompQuoteFlagDescription(f.HelpString("")), extras)
}
func zshCompGenFlagEntryForMultiOptionFlag(f structarg.Argument) string {
var options, parenMultiMark, curlyMultiMark, extras string
if f.IsMulti() {
parenMultiMark = "*"
curlyMultiMark = "\\*"
}
options = fmt.Sprintf(`'(%s-%s %s--%s)'{%s-%s,%s--%s}`,
parenMultiMark, f.ShortToken(), parenMultiMark, f.Token(), curlyMultiMark, f.ShortToken(), curlyMultiMark, f.Token())
extras = zshCompGenFlagEntryExtras(f)
return fmt.Sprintf(`%s'[%s]%s'`, options, zshCompQuoteFlagDescription(f.HelpString("")), extras)
}
func zshCompGenFlagEntryExtras(f structarg.Argument) string {
if !f.NeedData() {
return ""
}
// allow options for flag
extras := ":"
type iChoices interface {
Choices() []string
}
if hasChoices, ok := f.(iChoices); ok {
// process choices
var words []string
for _, w := range hasChoices.Choices() {
words = append(words, fmt.Sprintf("%q", w))
}
if len(words) != 0 {
extras = fmt.Sprintf("%s :(%s)", extras, strings.Join(words, " "))
}
}
return extras
}
func zshCompQuoteFlagDescription(s string) string {
s = strings.Replace(s, "'", `'\''`, -1)
s = strings.Replace(s, "[", `\[`, -1)
s = strings.Replace(s, "]", `\]`, -1)
return s
}
func zshCompExtractArgumentCompletionHintsForRendering(c *Cmd) []string {
return nil
}
func (c *Cmd) GenZshCompletion(w io.Writer) error {
tmpl, err := template.New("Main").Funcs(zshCompFuncMap).Parse(zshCompletionText)
if err != nil {
return fmt.Errorf("error creating zsh completion template: %v", err)
}
return tmpl.Execute(w, c.Root())
}

View File

@@ -75,3 +75,33 @@ _climc(){
do
line="${arr[$i]}"
allopts[count]=${line%s`
const ZSH_COMPLETE_SCRIPT_2 = `%"#"*}
subopts[count]=${line#*"#"}
((count++))
done
_arguments \
'1: :->commands'\
'*: :->options'
case $state in
commands)
_arguments '1:Comm:(${allopts[*]})'
;;
*)
item=1
for key in ${allopts[*]}
do
case $words[2] in
$key)
compadd "$@"` + "`echo $subopts[item]`" + `
;;
*)
;;
esac
((item++))
done
esac
}
_climc "$@"
`

View File

@@ -15,118 +15,26 @@
package promputils
import (
"bytes"
"fmt"
"regexp"
"strings"
prompt "github.com/c-bata/go-prompt"
"yunion.io/x/structarg"
)
var (
subcmds = make(map[string]*Cmd)
rootCmd *Cmd
)
type Cmd struct {
desc string
optArgs []prompt.Suggest
posArgs []prompt.Suggest
}
var cmds = make(map[string]*Cmd)
var optionHelp = []prompt.Suggest{
{Text: "-h"},
{Text: "--help"},
}
type Cmd struct {
Name string
Desc string
optArgs []CmdArgument
posArgs []CmdArgument
ParentCmd *Cmd
SubCmds []*Cmd
}
func InitRootCmd(name, desc string, optArgs, posArgs []structarg.Argument) *Cmd {
rootCmd = NewCmd(name, desc)
for _, optA := range optArgs {
rootCmd.AddOptArgument(optA, optA.Token(), optA.HelpString(""))
}
for _, posA := range posArgs {
rootCmd.AddPosArgument(posA, posA.Token(), posA.HelpString(""))
}
return rootCmd
}
func GetRootCmd() *Cmd {
return rootCmd
}
func NewCmd(name, desc string) *Cmd {
return &Cmd{
Name: name,
Desc: desc,
optArgs: make([]CmdArgument, 0),
posArgs: make([]CmdArgument, 0),
SubCmds: make([]*Cmd, 0),
}
}
func (c Cmd) getPromptSuggests(args []CmdArgument) []prompt.Suggest {
ret := make([]prompt.Suggest, 0)
for _, arg := range args {
ret = append(ret, arg.Suggest)
}
return ret
}
func (c *Cmd) Root() *Cmd {
if c.ParentCmd == nil {
return c
}
return c.ParentCmd.Root()
}
func (c Cmd) GetName() string {
return c.Name
}
func (c *Cmd) AddCmd(cmd *Cmd) {
c.SubCmds = append(c.SubCmds, cmd)
}
func (c Cmd) GetPromptOptSuggests() []prompt.Suggest {
return c.getPromptSuggests(c.optArgs)
}
func (c Cmd) GetPromptPosSuggests() []prompt.Suggest {
return c.getPromptSuggests(c.posArgs)
}
func (c Cmd) GetOptArguments() []structarg.Argument {
return c.getArguments(c.optArgs)
}
func (c Cmd) GetArguments() []structarg.Argument {
ret := c.GetOptArguments()
ret = append(ret, c.GetPosArguments()...)
return ret
}
func (c Cmd) GetPosArguments() []structarg.Argument {
return c.getArguments(c.posArgs)
}
func (c Cmd) getArguments(args []CmdArgument) []structarg.Argument {
ret := make([]structarg.Argument, 0)
for _, a := range args {
ret = append(ret, a.Argument)
}
return ret
}
type CmdArgument struct {
Suggest prompt.Suggest
Argument structarg.Argument
}
func optionCompleter(args []string, long bool) []prompt.Suggest {
l := len(args)
if l == 0 {
@@ -139,11 +47,11 @@ func optionCompleter(args []string, long bool) []prompt.Suggest {
return optionHelp
}
if subcmds[args[0]] == nil {
if cmds[args[0]] == nil {
return []prompt.Suggest{}
}
_cmd := subcmds[args[0]].GetPromptOptSuggests()
_cmd := cmds[args[0]].optArgs
return prompt.FilterContains(_cmd, strings.TrimLeft(args[l-1], "-"), true)
}
@@ -192,7 +100,7 @@ func argumentsCompleter(args []string) []prompt.Suggest {
if len(args) == 1 {
return prompt.FilterHasPrefix(commands, args[0], true)
}
_cmd, ok := subcmds[args[0]]
_cmd, ok := cmds[args[0]]
if !ok {
return []prompt.Suggest{}
}
@@ -203,75 +111,48 @@ func argumentsCompleter(args []string) []prompt.Suggest {
prm := _cmd.posArgs[len(args)-2]
subcommands := []prompt.Suggest{
prm.Suggest,
prm,
}
return prompt.FilterHasPrefix(subcommands, args[len(args)-1], true)
}
func AppendCommand(parentCmd *Cmd, text, desc string) {
func AppendCommand(text, desc string) {
commands = append(commands, prompt.Suggest{Text: text, Description: desc})
cmd := &Cmd{
Name: text,
Desc: desc,
posArgs: make([]CmdArgument, 0),
optArgs: make([]CmdArgument, 0),
ParentCmd: parentCmd,
}
subcmds[text] = cmd
parentCmd.AddCmd(cmd)
cmds[text] = &Cmd{}
cmds[text].desc = desc
cmds[text].posArgs = []prompt.Suggest{}
cmds[text].optArgs = []prompt.Suggest{}
}
func (c *Cmd) addArgument(target *[]CmdArgument, arg structarg.Argument, argStr string, desc string) {
*target = append(*target, CmdArgument{
Suggest: prompt.Suggest{
Text: argStr,
Description: desc,
},
Argument: arg,
})
func AppendPos(text, cmd, desc string) {
var v = []prompt.Suggest{{Text: cmd, Description: desc}}
cmds[text].posArgs = append(cmds[text].posArgs, v...)
}
func (c *Cmd) AddPosArgument(arg structarg.Argument, argStr string, desc string) {
c.addArgument(&c.posArgs, arg, argStr, desc)
func AppendOpt(text, cmd, desc string) {
var v = []prompt.Suggest{{Text: cmd, Description: desc}}
cmds[text].optArgs = append(cmds[text].optArgs, v...)
}
func (c *Cmd) AddOptArgument(arg structarg.Argument, argStr string, desc string) {
c.addArgument(&c.optArgs, arg, argStr, desc)
}
func AppendPos(text, cmd, desc string, arg structarg.Argument) {
cmdObj := subcmds[text]
cmdObj.AddPosArgument(arg, cmd, desc)
}
func AppendOpt(text, cmd, desc string, arg structarg.Argument) {
cmdObj := subcmds[text]
cmdObj.AddOptArgument(arg, cmd, desc)
}
func GenerateAutoCompleteCmds(rootCmd *Cmd, shell string) string {
func GenerateAutoCompleteCmds(shell string) string {
var ret = []string{}
var i = 0
if strings.ToLower(shell) == "zsh" {
out := bytes.NewBufferString("")
if err := rootCmd.GenZshCompletion(out); err != nil {
panic(err)
}
return out.String()
i = 1
}
for _, cmd := range subcmds {
for cmd, options := range cmds {
var (
strPosArgs = []string{}
strOptArgs = []string{}
)
for _, posArg := range cmd.GetPromptPosSuggests() {
for _, posArg := range options.posArgs {
strPosArgs = append(strPosArgs, posArg.Text)
}
for _, optArg := range cmd.GetPromptOptSuggests() {
for _, optArg := range options.optArgs {
strOptArgs = append(strOptArgs, strings.Split(optArg.Text, " ")[0])
}
ret = append(ret, fmt.Sprintf(`arr[%d]="%s# %s %s"`, i, cmd.Name,
ret = append(ret, fmt.Sprintf(`arr[%d]="%s# %s %s"`, i, cmd,
strings.Join(strPosArgs, " "), strings.Join(strOptArgs, " ")))
i += 1
}

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package meter
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package logger
package shell
import (
"fmt"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package servicetree
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package servicetree
package shell
import (
"fmt"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package servicetree
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package servicetree
package shell
import (
"strings"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package ansible
package shell
import (
"fmt"

View File

@@ -1,32 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ansible
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
InvalidUpdateError = shell.InvalidUpdateError
printObjectRecursive = printutils.PrintJSONObjectRecursive
exportList = shell.ExportList
)

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package ansible
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package ansible
package shell
import (
"yunion.io/x/onecloud/pkg/mcclient"
@@ -49,34 +49,4 @@ func init() {
printList(apbs, modules.AnsiblePlaybooksV2.GetColumns(s))
return nil
})
R(&AnsiblePlaybookV2IdOptions{}, "ansibleplaybookv2-run", "Run ansible playbook",
func(s *mcclient.ClientSession, opts *AnsiblePlaybookV2IdOptions) error {
apb, err := modules.AnsiblePlaybooksV2.PerformAction(s, opts.ID, "run", nil)
if err != nil {
return err
}
printObject(apb)
return nil
},
)
R(&AnsiblePlaybookV2IdOptions{}, "ansibleplaybookv2-stop", "Stop ansible playbook",
func(s *mcclient.ClientSession, opts *AnsiblePlaybookV2IdOptions) error {
apb, err := modules.AnsiblePlaybooksV2.PerformAction(s, opts.ID, "stop", nil)
if err != nil {
return err
}
printObject(apb)
return nil
},
)
R(&AnsiblePlaybookV2IdOptions{}, "ansibleplaybookv2-delete", "Delete ansible playbook",
func(s *mcclient.ClientSession, opts *AnsiblePlaybookV2IdOptions) error {
apb, err := modules.AnsiblePlaybooksV2.Delete(s, opts.ID, nil)
if err != nil {
return err
}
printObject(apb)
return nil
},
)
}

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package meter
package shell
import (
"yunion.io/x/onecloud/pkg/mcclient"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package logger
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package meter
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package meter
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package meter
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package meter
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package meter
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package meter
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package shell
import (
"fmt"
@@ -26,28 +26,18 @@ import (
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
"yunion.io/x/onecloud/pkg/multicloud/objectstore"
objectshell "yunion.io/x/onecloud/pkg/multicloud/objectstore"
)
func init() {
type BucketListOptions struct {
options.BaseListOptions
DistinctField string `help:"query specified distinct field"`
}
R(&BucketListOptions{}, "bucket-list", "List all buckets", func(s *mcclient.ClientSession, args *BucketListOptions) error {
params, err := options.ListStructToParams(args)
if err != nil {
return err
}
if len(args.DistinctField) > 0 {
params.Add(jsonutils.NewString(args.DistinctField), "extra_field")
result, err := modules.Buckets.Get(s, "distinct-field", params)
if err != nil {
return err
}
fmt.Println(result)
return nil
}
result, err := modules.Buckets.List(s, params)
if err != nil {
return err
@@ -56,10 +46,10 @@ func init() {
return nil
})
type BucketIdOptions struct {
type BucketShowOptions struct {
ID string `help:"ID or name of bucket"`
}
R(&BucketIdOptions{}, "bucket-show", "Id details of bucket", func(s *mcclient.ClientSession, args *BucketIdOptions) error {
R(&BucketShowOptions{}, "bucket-show", "Show details of bucket", func(s *mcclient.ClientSession, args *BucketShowOptions) error {
result, err := modules.Buckets.Get(s, args.ID, nil)
if err != nil {
return err
@@ -68,15 +58,6 @@ func init() {
return nil
})
R(&BucketIdOptions{}, "bucket-syncstatus", "Sync bucket statust", func(s *mcclient.ClientSession, args *BucketIdOptions) error {
result, err := modules.Buckets.PerformAction(s, args.ID, "syncstatus", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type BucketUpdateOptions struct {
ID string `help:"ID or name of bucket" json:"-"`
Name string `help:"new name of bucket" json:"name"`
@@ -188,7 +169,7 @@ func init() {
StorageClass string `help:"storage CLass"`
Acl string `help:"object acl." choices:"private|public-read|public-read-write"`
objectstore.ObjectHeaderOptions
objectshell.ObjectHeaderOptions
}
R(&BucketUploadObjectsOptions{}, "bucket-object-upload", "Upload an object into a bucket", func(s *mcclient.ClientSession, args *BucketUploadObjectsOptions) error {
var body io.Reader
@@ -325,7 +306,7 @@ func init() {
Key []string `help:"Optional object key" json:"key"`
objectstore.ObjectHeaderOptions
objectshell.ObjectHeaderOptions
}
R(&BucketSetMetadataOptions{}, "bucket-set-metadata", "Set metadata of object", func(s *mcclient.ClientSession, args *BucketSetMetadataOptions) error {
input := api.BucketMetadataInput{}

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package shell
import (
"yunion.io/x/onecloud/pkg/mcclient"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package shell
import (
"yunion.io/x/onecloud/pkg/mcclient"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package meter
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package shell
import (
"fmt"
@@ -26,36 +26,11 @@ import (
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func parseGcpCredential(filename string) (jsonutils.JSONObject, error) {
data, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
authParams, err := jsonutils.Parse(data)
if err != nil {
return nil, err
}
ret := jsonutils.NewDict()
for _, k := range []string{
"client_email",
"project_id",
"private_key_id",
"private_key",
} {
v, _ := authParams.Get(k)
ret.Add(v, fmt.Sprintf("gcp_%s", k))
}
return ret, nil
}
func init() {
type CloudaccountListOptions struct {
options.BaseListOptions
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
DistinctField string `help:"distinct field"`
ProxySetting string `help:"Proxy setting id or name"`
}
R(&CloudaccountListOptions{}, "cloud-account-list", "List cloud accounts", func(s *mcclient.ClientSession, args *CloudaccountListOptions) error {
var params *jsonutils.JSONDict
@@ -68,18 +43,6 @@ func init() {
if len(args.Capability) > 0 {
params.Add(jsonutils.NewStringArray(args.Capability), "capability")
}
if len(args.ProxySetting) > 0 {
params.Add(jsonutils.NewString(args.ProxySetting), "proxy_setting")
}
}
if len(args.DistinctField) > 0 {
params.Add(jsonutils.NewString(args.DistinctField), "extra_field")
result, err := modules.Cloudaccounts.Get(s, "distinct-field", params)
if err != nil {
return err
}
fmt.Println(result)
return nil
}
result, err := modules.Cloudaccounts.List(s, params)
if err != nil {
@@ -125,22 +88,6 @@ func init() {
printObject(result)
return nil
})
type SVMwareCloudAccountPrepareNetsOptions struct {
Project string `help:"project for this account"`
ProjectDomain string `help:"domain for this account"`
NAME string `help:"name for this account"`
options.SVMwareCredentialWithEnvironment
}
R(&SVMwareCloudAccountPrepareNetsOptions{}, "cloud-account-preparenets-vmware", "Prepare networks for a VMware cloud account before create this accout", func(s *mcclient.ClientSession, args *SVMwareCloudAccountPrepareNetsOptions) error {
params := jsonutils.Marshal(args)
params.(*jsonutils.JSONDict).Add(jsonutils.NewString("VMware"), "provider")
result, err := modules.Cloudaccounts.PerformClassAction(s, "prepare-nets", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SAliyunCloudAccountCreateOptions{}, "cloud-account-create-aliyun", "Create an Aliyun cloud account", func(s *mcclient.ClientSession, args *options.SAliyunCloudAccountCreateOptions) error {
params := jsonutils.Marshal(args)
@@ -191,7 +138,11 @@ func init() {
R(&options.SGoogleCloudAccountCreateOptions{}, "cloud-account-create-google", "Create a Google cloud account", func(s *mcclient.ClientSession, args *options.SGoogleCloudAccountCreateOptions) error {
params := jsonutils.Marshal(args)
params.(*jsonutils.JSONDict).Add(jsonutils.NewString("Google"), "provider")
authParams, err := parseGcpCredential(args.GoogleJsonFile)
data, err := ioutil.ReadFile(args.GoogleJsonFile)
if err != nil {
return err
}
authParams, err := jsonutils.Parse(data)
if err != nil {
return err
}
@@ -430,19 +381,6 @@ func init() {
return nil
})
R(&options.SGoogleCloudAccountUpdateOptions{}, "cloud-account-update-google", "update a google cloud account", func(s *mcclient.ClientSession, args *options.SGoogleCloudAccountUpdateOptions) error {
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
if params.Size() == 0 {
return InvalidUpdateError()
}
result, err := modules.Cloudaccounts.Update(s, args.ID, params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SAWSCloudAccountUpdateOptions{}, "cloud-account-update-aws", "update an AWS cloud account", func(s *mcclient.ClientSession, args *options.SAWSCloudAccountUpdateOptions) error {
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
@@ -484,7 +422,7 @@ func init() {
return nil
})
R(&options.SOpenStackCloudAccountUpdateOptions{}, "cloud-account-update-openstack", "update an OpenStack cloud account", func(s *mcclient.ClientSession, args *options.SOpenStackCloudAccountUpdateOptions) error {
R(&options.SOpenStackCloudAccountUpdateOptions{}, "cloud-account-update-openstack", "update an AWS cloud account", func(s *mcclient.ClientSession, args *options.SOpenStackCloudAccountUpdateOptions) error {
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
if params.Size() == 0 {
return InvalidUpdateError()
@@ -737,7 +675,11 @@ func init() {
})
R(&options.SGoogleCloudAccountUpdateCredentialOptions{}, "cloud-account-update-credential-google", "Update credential of a Google cloud account", func(s *mcclient.ClientSession, args *options.SGoogleCloudAccountUpdateCredentialOptions) error {
params, err := parseGcpCredential(args.GoogleJsonFile)
data, err := ioutil.ReadFile(args.GoogleJsonFile)
if err != nil {
return err
}
params, err := jsonutils.Parse(data)
if err != nil {
return err
}
@@ -769,129 +711,6 @@ func init() {
return nil
})
R(&options.SVMwareCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-vmware", "Update credential of a VMware cloud account", func(s *mcclient.ClientSession, args *options.SVMwareCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SAliyunCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-aliyun", "Update credential of an Aliyun cloud account", func(s *mcclient.ClientSession, args *options.SAliyunCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SAzureCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-azure", "Update credential of an Azure cloud account", func(s *mcclient.ClientSession, args *options.SAzureCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SQcloudCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-qcloud", "Update credential of a Qcloud cloud account", func(s *mcclient.ClientSession, args *options.SQcloudCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SAWSCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-aws", "Update credential of an AWS cloud account", func(s *mcclient.ClientSession, args *options.SAWSCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SOpenStackCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-openstack", "Update credential of an OpenStack cloud account", func(s *mcclient.ClientSession, args *options.SOpenStackCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SHuaweiCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-huawei", "Update credential of an Huawei cloud account", func(s *mcclient.ClientSession, args *options.SHuaweiCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SUcloudCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-ucloud", "Update credential of a Ucloud cloud account", func(s *mcclient.ClientSession, args *options.SUcloudCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SZStackCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-zstack", "Update credential of a ZStack cloud account", func(s *mcclient.ClientSession, args *options.SZStackCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SGoogleCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-google", "Update credential of a Google cloud account", func(s *mcclient.ClientSession, args *options.SGoogleCloudAccountUpdateCredentialOptions) error {
params, err := parseGcpCredential(args.GoogleJsonFile)
if err != nil {
return err
}
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SS3CloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-s3", "Update credential of a generic S3 cloud account", func(s *mcclient.ClientSession, args *options.SS3CloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.SCtyunCloudAccountUpdateCredentialOptions{}, "cloud-account-test-connectivity-ctyun", "Update credential of an Ctyun cloud account", func(s *mcclient.ClientSession, args *options.SCtyunCloudAccountUpdateCredentialOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "test-connectivity", params)
if err != nil {
return err
}
printObject(result)
return nil
})
type CloudaccountSyncOptions struct {
ID string `help:"ID or Name of cloud account"`
Force bool `help:"Force sync no matter what"`
@@ -955,14 +774,10 @@ func init() {
})
type CloudaccountPublicOptions struct {
ID string `help:"ID or name of cloud account" json:"-"`
Scope string `help:"public_sccope" choices:"domain|system" json:"scope"`
SharedDomains []string `help:"shared domains" json:"shared_domains"`
ShareMode string `help:"share_mode" choices:"account_domain|provider_domain|system"`
ID string `help:"ID or name of cloud account"`
}
R(&CloudaccountPublicOptions{}, "cloud-account-public", "Mark this cloud account public ", func(s *mcclient.ClientSession, args *CloudaccountPublicOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "public", params)
result, err := modules.Cloudaccounts.PerformAction(s, args.ID, "public", nil)
if err != nil {
return err
}
@@ -1022,47 +837,4 @@ func init() {
printObject(result)
return nil
})
type ClouaccountChangeOwnerOptions struct {
ID string `help:"ID or name of cloudaccount" json:"-"`
ProjectDomain string `json:"project_domain" help:"target domain"`
}
R(&ClouaccountChangeOwnerOptions{}, "cloud-account-change-owner", "Change owner domain of cloudaccount", func(s *mcclient.ClientSession, args *ClouaccountChangeOwnerOptions) error {
if len(args.ProjectDomain) == 0 {
return fmt.Errorf("empty project_domain")
}
params := jsonutils.Marshal(args)
ret, err := modules.Cloudaccounts.PerformAction(s, args.ID, "change-owner", params)
if err != nil {
return err
}
printObject(ret)
return nil
})
type ClouaccountChangeProjectOptions struct {
ID string `help:"ID or name of cloudaccount" json:"-"`
PROJECT string `json:"project" help:"target domain"`
}
R(&ClouaccountChangeProjectOptions{}, "cloud-account-change-project", "Change domain/project of cloudaccount", func(s *mcclient.ClientSession, args *ClouaccountChangeProjectOptions) error {
if len(args.PROJECT) == 0 {
return fmt.Errorf("empty project")
}
params := jsonutils.Marshal(args)
ret, err := modules.Cloudaccounts.PerformAction(s, args.ID, "change-project", params)
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&CloudaccountShowOptions{}, "cloud-account-change-owner-candidate-domains", "Show candiate domains of a cloud account changing project", func(s *mcclient.ClientSession, args *CloudaccountShowOptions) error {
result, err := modules.Cloudaccounts.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -1,25 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudevent
import (
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/util/printutils"
)
var (
R = shell.R
printList = printutils.PrintJSONList
)

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudevent
package shell
import (
"yunion.io/x/onecloud/pkg/mcclient"

View File

@@ -1,168 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudid
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 CloudgroupListOptions struct {
options.BaseListOptions
ClouduserId string `json:"clouduser_id"`
CloudpolicyId string `json:"cloudpolicy_id"`
Usable bool `json:"usable"`
}
R(&CloudgroupListOptions{}, "cloud-group-list", "List cloud groups", func(s *mcclient.ClientSession, opts *CloudgroupListOptions) error {
params, err := options.ListStructToParams(opts)
if err != nil {
return err
}
result, err := modules.Cloudgroups.List(s, params)
if err != nil {
return err
}
printList(result, modules.Cloudgroups.GetColumns(s))
return nil
})
type CloudgroupCreateOptions struct {
NAME string `json:"name"`
PROVIDER string `json:"provider" choices:"Google|Aliyun|Aws|Huawei|Qcloud"`
CloudpolicyIds []string `json:"cloudpolicy_ids"`
Desc string `json:"description"`
}
R(&CloudgroupCreateOptions{}, "cloud-group-create", "Create cloud group", func(s *mcclient.ClientSession, opts *CloudgroupCreateOptions) error {
params := jsonutils.Marshal(opts)
result, err := modules.Cloudgroups.Create(s, params)
if err != nil {
return err
}
printObject(result)
return nil
})
type CloudgroupIdOptions struct {
ID string `help:"Cloudgroup Id"`
}
R(&CloudgroupIdOptions{}, "cloud-group-delete", "Delete cloud group", func(s *mcclient.ClientSession, opts *CloudgroupIdOptions) error {
result, err := modules.Cloudgroups.Delete(s, opts.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&CloudgroupIdOptions{}, "cloud-group-show", "Show cloud group", func(s *mcclient.ClientSession, opts *CloudgroupIdOptions) error {
result, err := modules.Cloudgroups.Get(s, opts.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&CloudgroupIdOptions{}, "cloud-group-syncstatus", "Sync cloud group status", func(s *mcclient.ClientSession, opts *CloudgroupIdOptions) error {
result, err := modules.Cloudgroups.PerformAction(s, opts.ID, "syncstatus", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type CloudgroupPolicyOptions struct {
ID string `help:"Cloudgroup Id"`
CLOUDPOLICY_ID string `help:"Cloudpolicy Id"`
}
R(&CloudgroupPolicyOptions{}, "cloud-group-attach-policy", "Attach policy for cloud group", func(s *mcclient.ClientSession, opts *CloudgroupPolicyOptions) error {
result, err := modules.Cloudgroups.PerformAction(s, opts.ID, "attach-policy", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
R(&CloudgroupPolicyOptions{}, "cloud-group-detach-policy", "Detach policy from cloud group", func(s *mcclient.ClientSession, opts *CloudgroupPolicyOptions) error {
result, err := modules.Cloudgroups.PerformAction(s, opts.ID, "detach-policy", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
type CloudgroupUserOptions struct {
ID string `help:"Cloudgroup Id"`
CLOUDUSER_ID string `help:"Clouduser Id"`
}
R(&CloudgroupUserOptions{}, "cloud-group-add-user", "Add user to cloud group", func(s *mcclient.ClientSession, opts *CloudgroupUserOptions) error {
result, err := modules.Cloudgroups.PerformAction(s, opts.ID, "add-user", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
R(&CloudgroupUserOptions{}, "cloud-group-remove-user", "Remove user from cloud group", func(s *mcclient.ClientSession, opts *CloudgroupUserOptions) error {
result, err := modules.Cloudgroups.PerformAction(s, opts.ID, "remove-user", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
type CloudgroupPoliciesOptions struct {
ID string `help:"Cloudgroup Id"`
CloudpolicyIds []string `json:"cloudpolicy_ids"`
}
R(&CloudgroupPoliciesOptions{}, "cloud-group-set-policies", "Set cloudpolicies for cloud group", func(s *mcclient.ClientSession, opts *CloudgroupPoliciesOptions) error {
result, err := modules.Cloudgroups.PerformAction(s, opts.ID, "set-policies", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
type CloudgroupUsersOptions struct {
ID string `help:"Cloudgroup Id"`
ClouduserIds []string `json:"clouduser_ids"`
}
R(&CloudgroupUsersOptions{}, "cloud-group-set-users", "Set users for cloud group", func(s *mcclient.ClientSession, opts *CloudgroupUsersOptions) error {
result, err := modules.Cloudgroups.PerformAction(s, opts.ID, "set-users", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -1,73 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudid
import (
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type CloudgroupcacheListOptions struct {
options.BaseListOptions
CloudgroupId string `json:"cloudgroup_id"`
}
R(&CloudgroupcacheListOptions{}, "cloud-group-cache-list", "List cloud group caches", func(s *mcclient.ClientSession, opts *CloudgroupcacheListOptions) error {
params, err := options.ListStructToParams(opts)
if err != nil {
return err
}
result, err := modules.Cloudgroupcaches.List(s, params)
if err != nil {
return err
}
printList(result, modules.Cloudgroupcaches.GetColumns(s))
return nil
})
type CloudgroupcacheIdOption struct {
ID string `help:"Cloudgroup Id"`
}
R(&CloudgroupcacheIdOption{}, "cloud-group-cache-show", "Show cloud groupcache details", func(s *mcclient.ClientSession, opts *CloudgroupcacheIdOption) error {
result, err := modules.Cloudgroupcaches.Get(s, opts.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&CloudgroupcacheIdOption{}, "cloud-group-cache-syncstatus", "Sync cloudgroupcache", func(s *mcclient.ClientSession, opts *CloudgroupcacheIdOption) error {
result, err := modules.Cloudgroupcaches.PerformAction(s, opts.ID, "syncstatus", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&CloudgroupcacheIdOption{}, "cloud-group-cache-delete", "Delete cloudgroupcache", func(s *mcclient.ClientSession, opts *CloudgroupcacheIdOption) error {
result, err := modules.Cloudgroupcaches.Delete(s, opts.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -1,72 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudid
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type CloudgroupPolicyListOptions struct {
options.BaseListOptions
Cloudgroup string `help:"ID or Name of Cloudgroup"`
Cloudpolicy string `help:"Policy ID or name"`
}
R(&CloudgroupPolicyListOptions{}, "cloud-group-policy-list", "List cloudgroup cloudpolicy pairs", func(s *mcclient.ClientSession, args *CloudgroupPolicyListOptions) error {
var params *jsonutils.JSONDict
{
var err error
params, err = args.BaseListOptions.Params()
if err != nil {
return err
}
}
var result *modulebase.ListResult
var err error
if len(args.Cloudgroup) > 0 {
result, err = modules.Cloudgrouppolicies.ListDescendent(s, args.Cloudgroup, params)
} else if len(args.Cloudpolicy) > 0 {
result, err = modules.Cloudgrouppolicies.ListDescendent2(s, args.Cloudpolicy, params)
} else {
result, err = modules.Cloudgrouppolicies.List(s, params)
}
if err != nil {
return err
}
printList(result, modules.Cloudgrouppolicies.GetColumns(s))
return nil
})
type CloudgroupPolicyDetailOptions struct {
CLOUDUSER string `help:"ID or Name of Cloudgroup"`
CLOUDPOLICY string `help:"ID or Name of Cloudpolicy"`
}
R(&CloudgroupPolicyDetailOptions{}, "cloud-group-policy-show", "Show cloudgrouppolicy details", func(s *mcclient.ClientSession, args *CloudgroupPolicyDetailOptions) error {
query := jsonutils.NewDict()
result, err := modules.Cloudgrouppolicies.Get(s, args.CLOUDUSER, args.CLOUDPOLICY, query)
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -1,72 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudid
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type CloudgroupUserListOptions struct {
options.BaseListOptions
Cloudgroup string `help:"ID or Name of Cloudgroup"`
Clouduser string `help:"User ID or name"`
}
R(&CloudgroupUserListOptions{}, "cloud-group-user-list", "List cloudgroup clouduser pairs", func(s *mcclient.ClientSession, args *CloudgroupUserListOptions) error {
var params *jsonutils.JSONDict
{
var err error
params, err = args.BaseListOptions.Params()
if err != nil {
return err
}
}
var result *modulebase.ListResult
var err error
if len(args.Cloudgroup) > 0 {
result, err = modules.Cloudgroupusers.ListDescendent(s, args.Cloudgroup, params)
} else if len(args.Clouduser) > 0 {
result, err = modules.Cloudgroupusers.ListDescendent2(s, args.Clouduser, params)
} else {
result, err = modules.Cloudgroupusers.List(s, params)
}
if err != nil {
return err
}
printList(result, modules.Cloudgroupusers.GetColumns(s))
return nil
})
type CloudgroupUserDetailOptions struct {
CLOUDUSER string `help:"ID or Name of Cloudgroup"`
CLOUDPOLICY string `help:"ID or Name of Clouduser"`
}
R(&CloudgroupUserDetailOptions{}, "cloud-group-user-show", "Show cloudgroupuser details", func(s *mcclient.ClientSession, args *CloudgroupUserDetailOptions) error {
query := jsonutils.NewDict()
result, err := modules.Cloudgroupusers.Get(s, args.CLOUDUSER, args.CLOUDPOLICY, query)
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -1,81 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudid
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 CloudpolicyListOptions struct {
options.BaseListOptions
ClouduserId string `json:"clouduser_id"`
CloudgroupId string `json:"cloudgroup_id"`
}
R(&CloudpolicyListOptions{}, "cloud-policy-list", "List cloud policies", func(s *mcclient.ClientSession, opts *CloudpolicyListOptions) error {
params, err := options.ListStructToParams(opts)
if err != nil {
return err
}
result, err := modules.Cloudpolicies.List(s, params)
if err != nil {
return err
}
printList(result, modules.Cloudpolicies.GetColumns(s))
return nil
})
type CloudpolicyIdOptions struct {
ID string `help:"Cloudpolicy Id"`
}
R(&CloudpolicyIdOptions{}, "cloud-policy-show", "Sow cloud policiy details", func(s *mcclient.ClientSession, opts *CloudpolicyIdOptions) error {
result, err := modules.Cloudpolicies.Get(s, opts.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type CloudpolicyGroupOptions struct {
ID string `help:"Cloudpolicy Id"`
CLOUDGROUP_ID string `help:"Cloudgroup Id" json:"cloudgroup_id"`
}
R(&CloudpolicyGroupOptions{}, "cloud-policy-assign-group", "Assign cloud policiy to group", func(s *mcclient.ClientSession, opts *CloudpolicyGroupOptions) error {
result, err := modules.Cloudpolicies.PerformAction(s, opts.ID, "assign-group", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
R(&CloudpolicyGroupOptions{}, "cloud-policy-revoke-group", "Revoke cloud policiy from group", func(s *mcclient.ClientSession, opts *CloudpolicyGroupOptions) error {
result, err := modules.Cloudpolicies.PerformAction(s, opts.ID, "revoke-group", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -1,72 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudid
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type ClouduserPolicyListOptions struct {
options.BaseListOptions
Clouduser string `help:"ID or Name of Clouduser"`
Cloudpolicy string `help:"Policy ID or name"`
}
R(&ClouduserPolicyListOptions{}, "cloud-user-policy-list", "List clouduser cloudpolicy pairs", func(s *mcclient.ClientSession, args *ClouduserPolicyListOptions) error {
var params *jsonutils.JSONDict
{
var err error
params, err = args.BaseListOptions.Params()
if err != nil {
return err
}
}
var result *modulebase.ListResult
var err error
if len(args.Clouduser) > 0 {
result, err = modules.Clouduserpolicies.ListDescendent(s, args.Clouduser, params)
} else if len(args.Cloudpolicy) > 0 {
result, err = modules.Clouduserpolicies.ListDescendent2(s, args.Cloudpolicy, params)
} else {
result, err = modules.Clouduserpolicies.List(s, params)
}
if err != nil {
return err
}
printList(result, modules.Clouduserpolicies.GetColumns(s))
return nil
})
type ClouduserPolicyDetailOptions struct {
CLOUDUSER string `help:"ID or Name of Clouduser"`
CLOUDPOLICY string `help:"ID or Name of Cloudpolicy"`
}
R(&ClouduserPolicyDetailOptions{}, "cloud-user-policy-show", "Show clouduserpolicy details", func(s *mcclient.ClientSession, args *ClouduserPolicyDetailOptions) error {
query := jsonutils.NewDict()
result, err := modules.Clouduserpolicies.Get(s, args.CLOUDUSER, args.CLOUDPOLICY, query)
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -1,197 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudid
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 ClouduserListOptions struct {
options.BaseListOptions
CloudaccountId string `help:"Cloudaccount Id"`
CloudproviderId string `help:"Cloudprovider Id"`
CloudpolicyId string `help:"filter cloudusers by cloudpolicy"`
CloudgroupId string `help:"filter cloudusers by cloudgroup"`
}
R(&ClouduserListOptions{}, "cloud-user-list", "List cloud users", func(s *mcclient.ClientSession, opts *ClouduserListOptions) error {
params, err := options.ListStructToParams(opts)
if err != nil {
return err
}
result, err := modules.Cloudusers.List(s, params)
if err != nil {
return err
}
printList(result, modules.Cloudusers.GetColumns(s))
return nil
})
type ClouduserCreateOptions struct {
Name string
CloudaccountId string `help:"Cloudaccount Id"`
CloudproviderId string `help:"Cloudprovider Id"`
OwnerId string `help:"Owner Id"`
CloudpolicyIds []string `help:"cloudpolicy ids"`
CloudgroupIds []string `help:"cloudgroup ids"`
Email string `help:"email address"`
MobilePhone string `help:"phone number"`
IsConsoleLogin *bool `help:"is console login"`
Password string `help:"clouduser password"`
}
R(&ClouduserCreateOptions{}, "cloud-user-create", "Create cloud user", func(s *mcclient.ClientSession, opts *ClouduserCreateOptions) error {
params := jsonutils.Marshal(opts)
result, err := modules.Cloudusers.Create(s, params)
if err != nil {
return err
}
printObject(result)
return nil
})
type ClouduserIdOptions struct {
ID string `help:"Clouduser Id"`
}
R(&ClouduserIdOptions{}, "cloud-user-delete", "Delete cloud user", func(s *mcclient.ClientSession, opts *ClouduserIdOptions) error {
result, err := modules.Cloudusers.Delete(s, opts.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&ClouduserIdOptions{}, "cloud-user-logininfo", "Show cloud user login info", func(s *mcclient.ClientSession, opts *ClouduserIdOptions) error {
result, err := modules.Cloudusers.GetLoginInfo(s, opts.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&ClouduserIdOptions{}, "cloud-user-show", "Show cloud user", func(s *mcclient.ClientSession, opts *ClouduserIdOptions) error {
result, err := modules.Cloudusers.Get(s, opts.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type ClouduserSyncOptions struct {
ID string `help:"Clouduser Id"`
PolicyOnly bool `help:"Ony sync clouduser policies for cloud"`
}
R(&ClouduserSyncOptions{}, "cloud-user-sync", "Sync cloud user policies", func(s *mcclient.ClientSession, opts *ClouduserSyncOptions) error {
result, err := modules.Cloudusers.PerformAction(s, opts.ID, "sync", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
R(&ClouduserIdOptions{}, "cloud-user-syncstatus", "Sync cloud user status", func(s *mcclient.ClientSession, opts *ClouduserIdOptions) error {
result, err := modules.Cloudusers.PerformAction(s, opts.ID, "syncstatus", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type ClouduserPolicyOptions struct {
ID string `help:"Clouduser Id"`
CLOUDPOLICY_ID string `help:"cloudpolicy Id"`
}
R(&ClouduserPolicyOptions{}, "cloud-user-attach-policy", "Attach policy for cloud user", func(s *mcclient.ClientSession, opts *ClouduserPolicyOptions) error {
result, err := modules.Cloudusers.PerformAction(s, opts.ID, "attach-policy", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
R(&ClouduserPolicyOptions{}, "cloud-user-detach-policy", "Detach policy from cloud user", func(s *mcclient.ClientSession, opts *ClouduserPolicyOptions) error {
result, err := modules.Cloudusers.PerformAction(s, opts.ID, "detach-policy", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
type ClouduserPasswordOptions struct {
ID string `help:"Clouduser Id"`
Password string `help:"clouduser password"`
}
R(&ClouduserPasswordOptions{}, "cloud-user-reset-password", "Reset clouduser password", func(s *mcclient.ClientSession, opts *ClouduserPasswordOptions) error {
result, err := modules.Cloudusers.PerformAction(s, opts.ID, "reset-password", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
type ClouduserChangeOwnerOptions struct {
ID string `help:"clouduser id"`
USER_ID string `help:"local user id"`
}
R(&ClouduserChangeOwnerOptions{}, "cloud-user-change-owner", "Change clouduser owner", func(s *mcclient.ClientSession, opts *ClouduserChangeOwnerOptions) error {
result, err := modules.Cloudusers.PerformAction(s, opts.ID, "change-owner", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
type ClouduserGroupOptions struct {
ID string `help:"clouduser id"`
CLOUDGROUP_ID string `help:"cloudgroup id" json:"cloudgroup_id"`
}
R(&ClouduserGroupOptions{}, "cloud-user-join-group", "Join user to cloudgroup", func(s *mcclient.ClientSession, opts *ClouduserGroupOptions) error {
result, err := modules.Cloudusers.PerformAction(s, opts.ID, "join-group", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
R(&ClouduserGroupOptions{}, "cloud-user-leave-group", "Leave from cloudgroup", func(s *mcclient.ClientSession, opts *ClouduserGroupOptions) error {
result, err := modules.Cloudusers.PerformAction(s, opts.ID, "leave-group", jsonutils.Marshal(opts))
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -1,26 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cloudid
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
)

View File

@@ -15,19 +15,16 @@
package shell
import (
"yunion.io/x/onecloud/pkg/multicloud/zstack"
"yunion.io/x/onecloud/pkg/util/shellutils"
"yunion.io/x/onecloud/pkg/mcclient"
)
func init() {
type QuotaListOptions struct {
type CloudmetaOptions struct {
PROVIDER_ID string `help:"provider_id"`
REGION_ID string `help:"region_id"`
ZONE_ID string `help:"zone_id"`
}
shellutils.R(&QuotaListOptions{}, "quota-list", "List quotas", func(cli *zstack.SRegion, args *QuotaListOptions) error {
quotas, err := cli.GetQuotas()
if err != nil {
return err
}
printList(quotas, 0, 0, 0, nil)
R(&CloudmetaOptions{}, "instance-type-list", "query backend service for its version", func(s *mcclient.ClientSession, args *CloudmetaOptions) error {
return nil
})
}

View File

@@ -22,7 +22,7 @@ import (
)
func init() {
R(&options.RouteCreateOptions{}, "router-route-create", "Create router route", func(s *mcclient.ClientSession, opts *options.RouteCreateOptions) error {
R(&options.RouteCreateOptions{}, "router-route-create", "Create router", func(s *mcclient.ClientSession, opts *options.RouteCreateOptions) error {
params, err := base_options.StructToParams(opts)
if err != nil {
return err
@@ -34,7 +34,7 @@ func init() {
printObject(router)
return nil
})
R(&options.RouteGetOptions{}, "router-route-show", "Show router route", func(s *mcclient.ClientSession, opts *options.RouteGetOptions) error {
R(&options.RouteGetOptions{}, "router-route-show", "Show router", func(s *mcclient.ClientSession, opts *options.RouteGetOptions) error {
router, err := modules.Routes.Get(s, opts.ID, nil)
if err != nil {
return err
@@ -42,7 +42,7 @@ func init() {
printObject(router)
return nil
})
R(&options.RouteListOptions{}, "router-route-list", "List router routes", func(s *mcclient.ClientSession, opts *options.RouteListOptions) error {
R(&options.RouteListOptions{}, "router-route-list", "List routers", func(s *mcclient.ClientSession, opts *options.RouteListOptions) error {
params, err := base_options.ListStructToParams(opts)
if err != nil {
return err
@@ -54,7 +54,7 @@ func init() {
printList(result, modules.Routes.GetColumns(s))
return nil
})
R(&options.RouteUpdateOptions{}, "router-route-update", "Update router route", func(s *mcclient.ClientSession, opts *options.RouteUpdateOptions) error {
R(&options.RouteUpdateOptions{}, "router-route-update", "Update router", func(s *mcclient.ClientSession, opts *options.RouteUpdateOptions) error {
params, err := base_options.StructToParams(opts)
router, err := modules.Routes.Update(s, opts.ID, params)
if err != nil {
@@ -63,7 +63,7 @@ func init() {
printObject(router)
return nil
})
R(&options.RouteDeleteOptions{}, "router-route-delete", "Delete router route", func(s *mcclient.ClientSession, opts *options.RouteDeleteOptions) error {
R(&options.RouteDeleteOptions{}, "router-route-delete", "Delete router", func(s *mcclient.ClientSession, opts *options.RouteDeleteOptions) error {
router, err := modules.Routes.Delete(s, opts.ID, nil)
if err != nil {
return err

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package shell
import (
"yunion.io/x/jsonutils"
@@ -27,8 +27,6 @@ func init() {
type CloudproviderRegionListOptions struct {
options.BaseListOptions
Region string `help:"ID or Name of Host"`
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
}
R(&CloudproviderRegionListOptions{}, "cloud-provider-region-list", "List cloudprovider region synchronization status", func(s *mcclient.ClientSession, args *CloudproviderRegionListOptions) error {
var params *jsonutils.JSONDict

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package shell
import (
"fmt"
@@ -34,7 +34,6 @@ func init() {
HasObjectStorage bool `help:"filter cloudproviders that has object storage"`
NoObjectStorage bool `help:"filter cloudproviders that has no object storage"`
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
Cloudregion string `help:"filter cloudproviders by cloudregion"`
}
R(&CloudproviderListOptions{}, "cloud-provider-list", "List cloud providers", func(s *mcclient.ClientSession, args *CloudproviderListOptions) error {
var params *jsonutils.JSONDict
@@ -58,10 +57,6 @@ func init() {
if len(args.Capability) > 0 {
params.Add(jsonutils.NewStringArray(args.Capability), "capability")
}
if len(args.Cloudregion) > 0 {
params.Add(jsonutils.NewString(args.Cloudregion), "cloudregion")
}
}
result, err := modules.Cloudproviders.List(s, params)
if err != nil {
@@ -250,13 +245,4 @@ func init() {
printObject(result)
return nil
})
R(&CloudproviderShowOptions{}, "cloud-provider-change-owner-candidate-domains", "Show candiate domains of a cloud provider changing owner", func(s *mcclient.ClientSession, args *CloudproviderShowOptions) error {
result, err := modules.Cloudproviders.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -12,11 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
package shell
import (
"fmt"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
@@ -34,25 +32,12 @@ func init() {
Service string `help:"List regions which service has available skus" choices:"dbinstances|servers"`
City string `help:"List regions in the specified city"`
Capability []string `help:"capability filter" choices:"project|compute|network|loadbalancer|objectstore|rds|cache|event"`
DistinctField string `help:"list the specified distinct field, e.g. city, region"`
}
R(&CloudregionListOptions{}, "cloud-region-list", "List cloud regions", func(s *mcclient.ClientSession, opts *CloudregionListOptions) error {
params, err := options.ListStructToParams(opts)
if err != nil {
return err
}
if len(opts.DistinctField) > 0 {
params.Add(jsonutils.NewString(opts.DistinctField), "extra_field")
result, err := modules.Cloudregions.Get(s, "distinct-field", params)
if err != nil {
return err
}
fmt.Println(result)
return nil
}
result, err := modules.Cloudregions.List(s, params)
if err != nil {
return err

View File

@@ -1,60 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type CloudproviderQuotaListOptions struct {
options.BaseListOptions
Cloudregion string `help:"ID or Name of Cloudregion"`
QuotaType string `help:"Quota type"`
QuotaRange string `help:"Quota range" choices:"cloudregion|cloudprovider"`
}
R(&CloudproviderQuotaListOptions{}, "cloud-provider-quota-list", "List cloudprovider quota", func(s *mcclient.ClientSession, args *CloudproviderQuotaListOptions) error {
params, err := args.Params()
if err != nil {
return err
}
if len(args.QuotaType) > 0 {
params.Add(jsonutils.NewString(args.QuotaType), "quota_type")
}
if len(args.QuotaRange) > 0 {
params.Add(jsonutils.NewString(args.QuotaRange), "quota_range")
}
if len(args.Cloudregion) > 0 {
params.Add(jsonutils.NewString(args.Cloudregion), "cloudregion")
}
result, err := modules.CloudproviderQuotas.List(s, params)
if err != nil {
return err
}
printList(result, modules.CloudproviderQuotas.GetColumns(s))
return nil
})
}

View File

@@ -1,34 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/onecloud/cmd/climc/shell"
"yunion.io/x/onecloud/pkg/util/printutils"
)
var (
R = shell.R
printList = printutils.PrintJSONList
printObject = printutils.PrintJSONObject
printBatchResults = printutils.PrintJSONBatchResults
InvalidUpdateError = shell.InvalidUpdateError
printObjectRecursive = printutils.PrintJSONObjectRecursive
exportList = shell.ExportList
printObjectRecursiveEx = printutils.PrintJSONObjectRecursiveEx
)

View File

@@ -1,109 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"fmt"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type GlobalVpcListOptions struct {
options.BaseListOptions
}
R(&GlobalVpcListOptions{}, "global-vpc-list", "List global vpcs", func(s *mcclient.ClientSession, args *GlobalVpcListOptions) error {
params, err := options.ListStructToParams(args)
if err != nil {
return err
}
result, err := modules.GlobalVpcs.List(s, params)
if err != nil {
return err
}
printList(result, modules.GlobalVpcs.GetColumns(s))
return nil
})
type GlobalVpcShowOptions struct {
ID string `help:"ID or Name of globalvpc"`
}
R(&GlobalVpcShowOptions{}, "global-vpc-show", "Show details of a global vpc", func(s *mcclient.ClientSession, args *GlobalVpcShowOptions) error {
result, err := modules.GlobalVpcs.GetById(s, args.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type GlobalVpcPublicOptions struct {
ID string `help:"ID or name of global vpc" json:"-"`
Scope string `help:"sharing scope" choices:"system|domain"`
SharedDomains []string `help:"share to domains"`
}
R(&GlobalVpcPublicOptions{}, "global-vpc-public", "Make global vpc public", func(s *mcclient.ClientSession, args *GlobalVpcPublicOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.GlobalVpcs.PerformAction(s, args.ID, "public", params)
if err != nil {
return err
}
printObject(result)
return nil
})
type GlobalVpcPrivateOptions struct {
ID string `help:"ID or name of global vpc" json:"-"`
}
R(&GlobalVpcPrivateOptions{}, "global-vpc-private", "Make global vpc private", func(s *mcclient.ClientSession, args *GlobalVpcPrivateOptions) error {
params := jsonutils.Marshal(args)
result, err := modules.GlobalVpcs.PerformAction(s, args.ID, "private", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&GlobalVpcShowOptions{}, "global-vpc-change-owner-candidate-domains", "Show candiate domains of a global vpc for changing owner", func(s *mcclient.ClientSession, args *GlobalVpcShowOptions) error {
result, err := modules.GlobalVpcs.GetSpecific(s, args.ID, "change-owner-candidate-domains", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type GlobalVpcChangeOwnerOptions struct {
ID string `help:"ID or name of vpc" json:"-"`
ProjectDomain string `json:"project_domain" help:"target domain"`
}
R(&GlobalVpcChangeOwnerOptions{}, "global-vpc-change-owner", "Change owner domain of a global vpc", func(s *mcclient.ClientSession, args *GlobalVpcChangeOwnerOptions) error {
if len(args.ProjectDomain) == 0 {
return fmt.Errorf("empty project_domain")
}
params := jsonutils.Marshal(args)
ret, err := modules.GlobalVpcs.PerformAction(s, args.ID, "change-owner", params)
if err != nil {
return err
}
printObject(ret)
return nil
})
}

View File

@@ -1,62 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type PolicyListOptions struct {
options.BaseListOptions
}
R(&PolicyListOptions{}, "policy-definition-list", "List policy definitions", func(s *mcclient.ClientSession, args *PolicyListOptions) error {
params, err := args.Params()
if err != nil {
return err
}
result, err := modules.PolicyDefinition.List(s, params)
if err != nil {
return err
}
printList(result, modules.PolicyDefinition.GetColumns(s))
return nil
})
type PolicyIdOptions struct {
ID string `help:"policy definition name or id"`
}
R(&PolicyIdOptions{}, "policy-definition-show", "Show policy definition", func(s *mcclient.ClientSession, args *PolicyIdOptions) error {
result, err := modules.PolicyDefinition.Get(s, args.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&PolicyIdOptions{}, "policy-definition-syncstatus", "Sync policy definition status", func(s *mcclient.ClientSession, args *PolicyIdOptions) error {
result, err := modules.PolicyDefinition.PerformAction(s, args.ID, "syncstatus", nil)
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -1,101 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
R(&options.ProxySettingCreateOptions{}, "proxysetting-create", "Create proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingCreateOptions) error {
params, err := options.StructToParams(opts)
if err != nil {
return err
}
proxysetting, err := modules.ProxySettings.Create(s, params)
if err != nil {
return err
}
printObject(proxysetting)
return nil
})
R(&options.ProxySettingGetOptions{}, "proxysetting-show", "Show proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingGetOptions) error {
proxysetting, err := modules.ProxySettings.Get(s, opts.ID, nil)
if err != nil {
return err
}
printObject(proxysetting)
return nil
})
R(&options.ProxySettingListOptions{}, "proxysetting-list", "List proxysettings", func(s *mcclient.ClientSession, opts *options.ProxySettingListOptions) error {
params, err := options.ListStructToParams(opts)
if err != nil {
return err
}
result, err := modules.ProxySettings.List(s, params)
if err != nil {
return err
}
printList(result, modules.ProxySettings.GetColumns(s))
return nil
})
R(&options.ProxySettingUpdateOptions{}, "proxysetting-update", "Update proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingUpdateOptions) error {
params, err := options.StructToParams(opts)
proxysetting, err := modules.ProxySettings.Update(s, opts.ID, params)
if err != nil {
return err
}
printObject(proxysetting)
return nil
})
R(&options.ProxySettingDeleteOptions{}, "proxysetting-delete", "Delete proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingDeleteOptions) error {
proxysetting, err := modules.ProxySettings.Delete(s, opts.ID, nil)
if err != nil {
return err
}
printObject(proxysetting)
return nil
})
R(&options.ProxySettingTestOptions{}, "proxysetting-test", "Test proxysetting", func(s *mcclient.ClientSession, opts *options.ProxySettingTestOptions) error {
proxysetting, err := modules.ProxySettings.PerformAction(s, opts.ID, "test", nil)
if err != nil {
return err
}
printObject(proxysetting)
return nil
})
R(&options.ProxySettingPublicOptions{}, "proxysetting-public", "Make proxysetting public", func(s *mcclient.ClientSession, opts *options.ProxySettingPublicOptions) error {
params := jsonutils.Marshal(opts)
result, err := modules.ProxySettings.PerformAction(s, opts.ID, "public", params)
if err != nil {
return err
}
printObject(result)
return nil
})
R(&options.ProxySettingPrivateOptions{}, "proxysetting-private", "Make proxysetting private", func(s *mcclient.ClientSession, opts *options.ProxySettingPrivateOptions) error {
params := jsonutils.Marshal(opts)
result, err := modules.ProxySettings.PerformAction(s, opts.ID, "private", params)
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -1,41 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type ScalingActivityListOptions struct {
options.BaseListOptions
}
R(&ScalingActivityListOptions{}, "scaling-activity-list", "List Scaling Activity",
func(s *mcclient.ClientSession, args *ScalingActivityListOptions) error {
params, err := options.ListStructToParams(args)
if err != nil {
return err
}
list, err := modules.ScalingActivity.List(s, params)
if err != nil {
return err
}
printList(list, modules.ScalingActivity.GetColumns(s))
return nil
},
)
}

View File

@@ -1,145 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type ScalingGroupListOptions struct {
options.BaseListOptions
Hypervisor string `help:"Hypervisor"`
Cloudregion string `help:"Cloudregion"`
Network string `help:"network"`
}
R(&ScalingGroupListOptions{}, "scaling-group-list", "List scaling group", func(s *mcclient.ClientSession, args *ScalingGroupListOptions) error {
params, err := options.ListStructToParams(args)
if err != nil {
return err
}
result, err := modules.ScalingGroup.List(s, params)
if err != nil {
return err
}
printList(result, modules.ScalingGroup.GetColumns(s))
return nil
})
type ScalingGroupShowOptions struct {
ID string
}
R(&ScalingGroupShowOptions{}, "scaling-group-show", "Show scaling group", func(s *mcclient.ClientSession,
args *ScalingGroupShowOptions) error {
result, err := modules.ScalingGroup.Get(s, args.ID, nil)
if err != nil {
return err
}
printObject(result)
return nil
})
type ScalingGroupCreateOptions struct {
NAME string
Hypervisor string
Cloudregion string
Network string
GuestTemplate string
MinInstanceNumber string
MaxInstanceNumber string
DesireInstanceNumber string
Loadbalance string
}
R(&ScalingGroupCreateOptions{}, "scaling-group-create", "Create scaling group", func(s *mcclient.ClientSession, args *ScalingGroupCreateOptions) error {
params := jsonutils.Marshal(args).(*jsonutils.JSONDict)
scalingGroup, err := modules.ScalingGroup.Create(s, params)
if err != nil {
return err
}
printObject(scalingGroup)
return nil
})
type ScalingGroupDeleteOptions struct {
ID string `help:"ScalingGroup ID or Name"`
}
R(&ScalingGroupDeleteOptions{}, "scaling-group-delete", "Delete Scaling Group", func(s *mcclient.ClientSession,
args *ScalingGroupDeleteOptions) error {
scalingGroup, err := modules.ScalingGroup.Delete(s, args.ID, jsonutils.NewDict())
if err != nil {
return err
}
printObject(scalingGroup)
return nil
})
type ScalingGroupListInstanceOptions struct {
ID string `help:"ScalingGroup ID or Name"`
}
R(&ScalingGroupListInstanceOptions{}, "scaling-group-list-instance", "List all instance of Scaling Group",
func(s *mcclient.ClientSession, args *ScalingGroupListInstanceOptions) error {
params := jsonutils.NewDict()
params.Set("scaling_group", jsonutils.NewString(args.ID))
servers, err := modules.Servers.List(s, params)
if err != nil {
return err
}
printList(servers, modules.Servers.GetColumns(s))
return nil
},
)
type ScalingGroupRemoveInstanceOptions struct {
ID string `help:"ScalingGroup ID or Name"`
SERVER string `help:"Server ID or Name"`
Delete bool `help:"If delete the server"`
}
R(&ScalingGroupRemoveInstanceOptions{}, "scaling-group-remove-instance", "Remove instance of ScalingGroup",
func(s *mcclient.ClientSession, args *ScalingGroupRemoveInstanceOptions) error {
params := jsonutils.NewDict()
params.Set("scaling_group", jsonutils.NewString(args.ID))
params.Set("delete_server", jsonutils.NewBool(args.Delete))
server, err := modules.Servers.PerformAction(s, args.SERVER, "detach-scaling-group", params)
if err != nil {
return err
}
printObject(server)
return nil
},
)
type ScalingGroupEnableOptions struct {
ID string `help:"ScalingGroup ID or Name"`
}
R(&ScalingGroupEnableOptions{}, "scaling-group-enable", "Enable ScalingGroup", func(s *mcclient.ClientSession,
args *ScalingGroupEnableOptions) error {
ret, err := modules.ScalingGroup.PerformAction(s, args.ID, "enable", jsonutils.NewDict())
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&ScalingGroupEnableOptions{}, "scaling-group-disable", "Disable ScalingGroup", func(s *mcclient.ClientSession,
args *ScalingGroupEnableOptions) error {
ret, err := modules.ScalingGroup.PerformAction(s, args.ID, "disable", jsonutils.NewDict())
if err != nil {
return err
}
printObject(ret)
return nil
})
}

View File

@@ -1,202 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"fmt"
"time"
"yunion.io/x/jsonutils"
api "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
type Timer struct {
TimingExecTime string `help:"Exectime for 'timing' type trigger, format:'2006-01-02 15:04:05'" json:"exec_time"`
}
type CycleTimer struct {
CycleCycleType string `help:"Cycle type for cycle timer" json:"cycle_type" choices:"day|week|month"`
CycleMinute int `help:"Minute of cycle timer" json:"minute"`
CycleHour int `help:"Hour of cycle timer" json:"hour"`
CycleWeekdays []int `help:"Weekdays for cycle timer" json:"weekdays"`
CycleMonthDays []int `help:"Month days for cycle timer" json:"month_days"`
CycleStartTime string `help:"Start time for cycle timer, format:'2006-01-02 15:04:05'" json:"start_time"`
CycleEndTime string `help:"End time for cycle timer, format:'2006-01-02 15:04:05'" json:"end_time"`
}
func init() {
type ScalingPolicyListOptions struct {
options.BaseListOptions
ScalingGroup string `help:"ScalingGroup ID or Name"`
TriggerType string `help:"Trigger type" choices:"alarm|timing|cycle"`
}
R(&ScalingPolicyListOptions{}, "scaling-policy-list", "List Scaling Policy", func(s *mcclient.ClientSession,
args *ScalingPolicyListOptions) error {
params, err := options.ListStructToParams(args)
policies, err := modules.ScalingPolicy.List(s, params)
if err != nil {
return err
}
printList(policies, modules.ScalingPolicy.GetColumns(s))
return nil
})
type ScalingPolicyShowOptions struct {
ID string `help:"ScalingPolicy ID or Name"`
}
R(&ScalingPolicyShowOptions{}, "scaling-policy-show", "Show Scaling Policy", func(s *mcclient.ClientSession,
args *ScalingPolicyShowOptions) error {
params := jsonutils.NewDict()
params.Set("details", jsonutils.JSONTrue)
policy, err := modules.ScalingPolicy.Get(s, args.ID, params)
if err != nil {
return err
}
printObject(policy)
return nil
})
type ScalingAlarm struct {
AlarmCumulate int `help:"Cumulate times alarm will trigger, for 'alarm' trigger" json:"cumulate"`
AlarmCycle int `help:"Monitoring cycle for indicators, for 'alarm' trigger" json:"cycle"`
AlarmIndicator string `help:"Indicator for 'alarm' trigger" json:"indicator"`
AlarmWrapper string `help:"Wrapper for Indicators" choices:"max|min|average" json:"wrapper"`
AlarmOperator string `help:"Operator between Indicator and Operator" json:"operator"`
AlarmValue float64 `help:"Value of Indicator" json:"value"`
}
type ScalingPolicyCreateOptions struct {
NAME string `help:"ScalingPolicy Name" json:"name"`
ScalingGroup string `help:"ScalingGroup ID or Name" json:"scaling_group"`
TriggerType string `help:"Trigger type" choices:"alarm|timing|cycle" json:"trigger_type"`
Timer
CycleTimer
ScalingAlarm
Action string `help:"Action for scaling policy" choices:"add|remove|set" json:"action"`
Number int `help:"Instance number for action" json:"number"`
Unit string `help:"Unit for Number" choices:"s|%" json:"unit"`
CoolingTime int `help:"Cooling time, unit: s" json:"cooling_time"`
}
R(&ScalingPolicyCreateOptions{}, "scaling-policy-create", "Create Scaling Policy",
func(s *mcclient.ClientSession, args *ScalingPolicyCreateOptions) error {
formatStr := "2006-01-02 15:04:05"
timingExecTime, err := time.Parse(formatStr, args.TimingExecTime)
if err != nil {
return fmt.Errorf("invalid time format for 'exec_time'")
}
cycleStarTime, err := time.Parse(formatStr, args.CycleStartTime)
if err != nil {
return fmt.Errorf("invalid time format for 'start_time'")
}
cycleEndTime, err := time.Parse(formatStr, args.CycleEndTime)
if err != nil {
return fmt.Errorf("invalid time format for 'end_time'")
}
spCreateInput := api.ScalingPolicyCreateInput{
ScalingGroup: args.ScalingGroup,
TriggerType: args.TriggerType,
Timer: api.TimerCreateInput{
ExecTime: timingExecTime,
},
CycleTimer: api.CycleTimerCreateInput{
CycleType: args.CycleCycleType,
Minute: args.CycleMinute,
Hour: args.CycleHour,
WeekDays: args.CycleWeekdays,
MonthDays: args.CycleMonthDays,
StartTime: cycleStarTime,
EndTime: cycleEndTime,
},
Alarm: api.ScalingAlarmCreateInput{
Cumulate: args.AlarmCumulate,
Cycle: args.AlarmCycle,
Indicator: args.AlarmIndicator,
Wrapper: args.AlarmWrapper,
Operator: args.AlarmOperator,
Value: args.AlarmValue,
},
Action: args.Action,
Number: args.Number,
Unit: args.Unit,
CoolingTime: args.CoolingTime,
}
spCreateInput.Name = args.NAME
ret, err := modules.ScalingPolicy.Create(s, jsonutils.Marshal(spCreateInput))
if err != nil {
return err
}
printObject(ret)
return nil
},
)
type ScalingPolicyEnableOptions struct {
ID string `help:"ScalingPolicy ID or Name"`
}
R(&ScalingPolicyEnableOptions{}, "scaling-policy-enable", "Enable ScalingPolicy", func(s *mcclient.ClientSession,
args *ScalingPolicyEnableOptions) error {
ret, err := modules.ScalingPolicy.PerformAction(s, args.ID, "enable", jsonutils.NewDict())
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&ScalingPolicyEnableOptions{}, "scaling-policy-disable", "Disable ScalingPolicy",
func(s *mcclient.ClientSession, args *ScalingPolicyEnableOptions) error {
ret, err := modules.ScalingPolicy.PerformAction(s, args.ID, "disable", jsonutils.NewDict())
if err != nil {
return err
}
printObject(ret)
return nil
},
)
type ScalingPolicyTriggerOptions struct {
ID string `help:"ScalingPolicy ID or Name"`
}
R(&ScalingPolicyTriggerOptions{}, "scaling-policy-trigger", "Trigger ScalingPolicy's action",
func(s *mcclient.ClientSession, args *ScalingPolicyTriggerOptions) error {
ret, err := modules.ScalingPolicy.PerformAction(s, args.ID, "trigger", jsonutils.NewDict())
if err != nil {
return err
}
printObject(ret)
return nil
},
)
type ScalingPolicyDeleteOptions struct {
ID string `help:"ScalingPolicy ID or Name"`
}
R(&ScalingPolicyDeleteOptions{}, "scaling-policy-delete", "Delete SclaingPolicy",
func(s *mcclient.ClientSession, args *ScalingPolicyDeleteOptions) error {
ret, err := modules.ScalingPolicy.Delete(s, args.ID, jsonutils.NewDict())
if err != nil {
return err
}
printObject(ret)
return nil
},
)
}

View File

@@ -1,211 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"fmt"
"time"
"yunion.io/x/jsonutils"
apis "yunion.io/x/onecloud/pkg/apis/compute"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type ScheduledTaskListOptions struct {
options.BaseListOptions
ScheduledType string `help:"scheduled type" choices:"timing|cycle"`
ResourceType string `help:"resource type"`
Operation string `help:"operation"`
}
R(&ScheduledTaskListOptions{}, "scheduledtask-list", "list Scheduled Task", func(s *mcclient.ClientSession, args *ScheduledTaskListOptions) error {
params, err := options.ListStructToParams(args)
tasks, err := modules.ScheduledTask.List(s, params)
if err != nil {
return err
}
printList(tasks, modules.ScheduledTask.GetColumns(s))
return nil
})
type ScheduledTaskShowOptions struct {
ID string `help:"ScheduledTask ID or Name"`
}
R(&ScheduledTaskShowOptions{}, "scheudled-task-show", "Show Scheduled Task", func(s *mcclient.ClientSession,
args *ScheduledTaskShowOptions) error {
params := jsonutils.NewDict()
params.Set("details", jsonutils.JSONTrue)
task, err := modules.ScheduledTask.Get(s, args.ID, params)
if err != nil {
return err
}
printObject(task)
return nil
})
type ScheduledTaskCreateOptions struct {
NAME string `help:"ScheduledTask Name" json:"name"`
ScheduledType string `help:"Scheudled Type" choices:"timing|cycle" json:"scheduled_type"`
Timer
CycleTimer
ResourceType string `help:"resource type"`
Operation string `help:"operation"`
LabelType string `help:"label type"`
Labels []string `help:"labels"`
}
R(&ScheduledTaskCreateOptions{}, "scheduledtask-create", "Create Scheduled Task", func(s *mcclient.ClientSession, args *ScheduledTaskCreateOptions) error {
formatStr := "2006-01-02 15:04:05"
var exectime, starttime, endtime time.Time
var err error
if len(args.TimingExecTime) > 0 {
exectime, err = time.Parse(formatStr, args.TimingExecTime)
if err != nil {
return fmt.Errorf("invalid time format for 'exec_time'")
}
}
if len(args.CycleStartTime) > 0 {
starttime, err = time.Parse(formatStr, args.CycleStartTime)
if err != nil {
return fmt.Errorf("invalid time format for 'start_time'")
}
}
if len(args.CycleEndTime) > 0 {
endtime, err = time.Parse(formatStr, args.CycleEndTime)
if err != nil {
return fmt.Errorf("invalid time format for 'end_time'")
}
}
stCreateInput := apis.ScheduledTaskCreateInput{
ScheduledType: args.ScheduledType,
Timer: apis.TimerCreateInput{
ExecTime: exectime,
},
CycleTimer: apis.CycleTimerCreateInput{
CycleType: args.CycleCycleType,
Minute: args.CycleMinute,
Hour: args.CycleHour,
WeekDays: args.CycleWeekdays,
MonthDays: args.CycleMonthDays,
StartTime: starttime,
EndTime: endtime,
},
ResourceType: args.ResourceType,
Operation: args.Operation,
LabelType: args.LabelType,
Labels: args.Labels,
}
stCreateInput.Name = args.NAME
ret, err := modules.ScheduledTask.Create(s, jsonutils.Marshal(stCreateInput))
if err != nil {
return err
}
printObject(ret)
return nil
})
type ScheduledTaskEnableOptions struct {
ID string `help:"ScheduledTask ID or Name"`
}
R(&ScheduledTaskEnableOptions{}, "scheduledtask-enable", "Enable ScheduledTask", func(s *mcclient.ClientSession,
args *ScheduledTaskEnableOptions) error {
ret, err := modules.ScheduledTask.PerformAction(s, args.ID, "enable", jsonutils.NewDict())
if err != nil {
return err
}
printObject(ret)
return nil
})
R(&ScheduledTaskEnableOptions{}, "scheduledtask-disable", "Disable ScheduledTask",
func(s *mcclient.ClientSession, args *ScheduledTaskEnableOptions) error {
ret, err := modules.ScheduledTask.PerformAction(s, args.ID, "disable", jsonutils.NewDict())
if err != nil {
return err
}
printObject(ret)
return nil
},
)
type ScheduledTaskSetLabelsOptions struct {
ID string `help:"ScheduledTask ID or Name"`
Labels []string `help:"Label"`
}
R(&ScheduledTaskSetLabelsOptions{}, "scheduledtask-setlabels", "Trigger ScheduledTask's action",
func(s *mcclient.ClientSession, args *ScheduledTaskSetLabelsOptions) error {
params := jsonutils.NewDict()
params.Set("labels", jsonutils.Marshal(args.Labels))
ret, err := modules.ScheduledTask.PerformAction(s, args.ID, "set-labels", params)
if err != nil {
return err
}
printObject(ret)
return nil
},
)
type ScheduledTaskTriggerOptions struct {
ID string `help:"ScheduledTask ID or Name"`
}
R(&ScheduledTaskTriggerOptions{}, "scheduledtask-trigger", "Trigger ScheduledTask",
func(s *mcclient.ClientSession, args *ScheduledTaskTriggerOptions) error {
params := jsonutils.NewDict()
ret, err := modules.ScheduledTask.PerformAction(s, args.ID, "trigger", params)
if err != nil {
return err
}
printObject(ret)
return nil
},
)
type ScheduledTaskDeleteOptions struct {
ID string `help:"ScheduledTask ID or Name"`
}
R(&ScheduledTaskDeleteOptions{}, "scheduledtask-delete", "Delete ScheduledTask",
func(s *mcclient.ClientSession, args *ScheduledTaskDeleteOptions) error {
ret, err := modules.ScheduledTask.Delete(s, args.ID, jsonutils.NewDict())
if err != nil {
return err
}
printObject(ret)
return nil
},
)
type ScheduledTaskAvtivityListOptions struct {
options.BaseListOptions
ScheduledTask string `help:"Scheduled Task" json:"scheduled_task"`
}
R(&ScheduledTaskAvtivityListOptions{}, "scheduledtask-activity-list", "List Scheduled Task Activity",
func(s *mcclient.ClientSession, args *ScheduledTaskAvtivityListOptions) error {
params, err := options.ListStructToParams(args)
if err != nil {
return err
}
list, err := modules.ScheduledTaskActivity.List(s, params)
if err != nil {
return err
}
printList(list, modules.ScheduledTaskActivity.GetColumns(s))
return nil
},
)
}

View File

@@ -1,72 +0,0 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compute
import (
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/options"
)
func init() {
type ServerSecgroupListOptions struct {
options.BaseListOptions
Server string `help:"ID or Name of Server"`
Secgroup string `help:"Secgroup ID or name"`
}
R(&ServerSecgroupListOptions{}, "server-secgroup-list", "List server secgroup pairs", func(s *mcclient.ClientSession, args *ServerSecgroupListOptions) error {
var params *jsonutils.JSONDict
{
var err error
params, err = args.BaseListOptions.Params()
if err != nil {
return err
}
}
var result *modulebase.ListResult
var err error
if len(args.Server) > 0 {
result, err = modules.Serversecgroups.ListDescendent(s, args.Server, params)
} else if len(args.Secgroup) > 0 {
result, err = modules.Serversecgroups.ListDescendent2(s, args.Secgroup, params)
} else {
result, err = modules.Serversecgroups.List(s, params)
}
if err != nil {
return err
}
printList(result, modules.Serversecgroups.GetColumns(s))
return nil
})
type ServerSecgroupDetailOptions struct {
SERVER string `help:"ID or Name of Server"`
SECGROUP string `help:"ID or Name of Security Group"`
}
R(&ServerSecgroupDetailOptions{}, "server-secgroup-show", "Show server security group details", func(s *mcclient.ClientSession, args *ServerSecgroupDetailOptions) error {
query := jsonutils.NewDict()
result, err := modules.Serversecgroups.Get(s, args.SERVER, args.SECGROUP, query)
if err != nil {
return err
}
printObject(result)
return nil
})
}

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package notify
package shell
import (
"yunion.io/x/jsonutils"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package notify
package shell
import (
"yunion.io/x/jsonutils"
@@ -29,11 +29,11 @@ func init() {
* 操作用户的通信地址如果用户的通信地址不存在则进行添加如果已存在则进行修改如果设置空则进行删除
*/
type ContactsUpdateOptions struct {
UID string `help:"The user you wanna add contact to (Keystone User ID)"`
CONTACTTYPE string `help:"The contact type email|mobile" choices:"email|mobile|dingtalk"`
CONTACT string `help:"The contacts details mobile number or email address or dingtalk's userid, if set it the empty str means delete"`
Status string `help:"Enabled or disabled contact status" choices:"enable|disable"`
Pull []string `help:"pull some subcontacts(e.g., dingtalk, feishu, etc) related to mobile"`
UID string `help:"The user you wanna add contact to (Keystone User ID)"`
CONTACTTYPE string `help:"The contact type email|mobile" choices:"email|mobile|dingtalk"`
CONTACT string `help:"The contacts details mobile number or email address or dingtalk's userid, if set it the empty str means delete"`
Status string `help:"Enabled or disabled contact status" choices:"enable|disable"`
Pull string `help:"pull some subcontacts(e.g., dingtalk, feishu, etc) related to mobile"`
}
R(&ContactsUpdateOptions{}, "contact-update", "Create, delete or update contact for user", func(s *mcclient.ClientSession, args *ContactsUpdateOptions) error {
arr := jsonutils.NewArray()
@@ -53,13 +53,7 @@ func init() {
params := jsonutils.NewDict()
params.Add(arr, "contacts")
pulls := jsonutils.NewArray()
for _, pull := range args.Pull {
pulls.Add(jsonutils.NewString(pull))
}
params.Add(pulls, "pull")
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", args.Pull, params)
if err != nil {
return err
}
@@ -75,8 +69,7 @@ func init() {
R(&ContactsPullOptions{}, "contact-pull", "Pull contact", func(s *mcclient.ClientSession, args *ContactsPullOptions) error {
params := jsonutils.NewDict()
params.Set("contacts", jsonutils.NewArray())
params.Set("pull", jsonutils.NewArray(jsonutils.NewString(args.CONTACTTYPE)))
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", args.CONTACTTYPE, params)
if err != nil {
return err
}
@@ -96,7 +89,7 @@ func init() {
arr.Add(tmpObj)
params := jsonutils.NewDict()
params.Add(arr, "contacts")
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", params)
contact, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "update-contact", "", params)
if err != nil {
return err
}
@@ -187,7 +180,7 @@ func init() {
tmpDict := jsonutils.NewDict()
tmpDict.Add(jsonutils.NewString(args.CONTACT_TYPE), "contact_type")
tmpDict.Add(jsonutils.NewString(args.CONTACT), "contact")
_, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "verify", tmpDict)
_, err := modules.Contacts.CustomizedPerformAction(s, args.UID, "verify", "", tmpDict)
if err != nil {
return err
}

View File

@@ -0,0 +1,59 @@
// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package shell
import (
"fmt"
"yunion.io/x/jsonutils"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/mcclient/modules"
)
func init() {
type CopyrightUpdateOptions struct {
Copyright string `help:"The copyright"`
Email string `help:"The Email"`
Docs *string `help:"the Docs website address"`
}
R(&CopyrightUpdateOptions{}, "copyright-update", "update copyright", func(s *mcclient.ClientSession, args *CopyrightUpdateOptions) error {
if !s.HasSystemAdminPrivilege() {
return fmt.Errorf("require admin privilege")
}
params := jsonutils.NewDict()
if args.Docs != nil {
params.Add(jsonutils.NewString(*args.Docs), "docs")
}
if len(args.Copyright) > 0 {
params.Add(jsonutils.NewString(args.Copyright), "copyright")
}
if len(args.Email) > 0 {
params.Add(jsonutils.NewString(args.Email), "email")
}
r, err := modules.Copyright.Update(s, "copyright", params)
if err != nil {
return err
}
printObject(r)
return nil
})
}

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package identity
package shell
import (
"fmt"

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package misc
package shell
import (
"yunion.io/x/onecloud/pkg/mcclient"

Some files were not shown because too many files have changed in this diff Show More