Skip to content

Commit ceb1116

Browse files
authored
Merge pull request #235 from xiaoq08/kirk
add kirk sdk for vendors
2 parents 352bcb1 + b276d9e commit ceb1116

File tree

14 files changed

+1464
-2
lines changed

14 files changed

+1464
-2
lines changed

examples/kirk/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Examples
2+
3+
```
4+
$ python list_apps.py <YOUR_AK> <YOUR_SK>
5+
```

examples/kirk/list_apps.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
# flake8: noqa
3+
4+
import sys
5+
from qiniu import QiniuMacAuth
6+
from qiniu import AccountClient
7+
8+
access_key = sys.argv[1]
9+
secret_key = sys.argv[2]
10+
11+
acc_client = AccountClient(QiniuMacAuth(access_key, secret_key))
12+
13+
ret, info = acc_client.list_apps()
14+
15+
print(ret)
16+
print(info)
17+
18+
assert len(ret) is not None

examples/kirk/list_services.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
# flake8: noqa
3+
4+
import sys
5+
from qiniu import QiniuMacAuth
6+
from qiniu import AccountClient
7+
8+
access_key = sys.argv[1]
9+
secret_key = sys.argv[2]
10+
11+
acc_client = AccountClient(QiniuMacAuth(access_key, secret_key))
12+
apps, info = acc_client.list_apps()
13+
14+
for app in apps:
15+
if app.get('runMode') == 'Private':
16+
uri = app.get('uri')
17+
qcos = acc_client.get_qcos_client(uri)
18+
if qcos != None:
19+
stacks, info = qcos.list_stacks()
20+
for stack in stacks:
21+
stack_name = stack.get('name')
22+
services, info = qcos.list_services(stack_name)
23+
print("list_services of '%s : %s':"%(uri, stack_name))
24+
print(services)
25+
print(info)
26+
assert len(services) is not None

examples/kirk/list_stacks.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
# flake8: noqa
3+
4+
import sys
5+
from qiniu import QiniuMacAuth
6+
from qiniu import AccountClient
7+
8+
access_key = sys.argv[1]
9+
secret_key = sys.argv[2]
10+
11+
acc_client = AccountClient(QiniuMacAuth(access_key, secret_key))
12+
apps, info = acc_client.list_apps()
13+
14+
for app in apps:
15+
if app.get('runMode') == 'Private':
16+
uri = app.get('uri')
17+
qcos = acc_client.get_qcos_client(uri)
18+
if qcos != None:
19+
stacks, info = qcos.list_stacks()
20+
print("list_stacks of '%s':"%uri)
21+
print(stacks)
22+
print(info)
23+
assert len(stacks) is not None

0 commit comments

Comments
 (0)