Skip to content

Commit 71d76bc

Browse files
author
金山云SDK
authored
Merge pull request KscSDK#66 from KscSDK/trunk
Trunk
2 parents 892c596 + 9133a58 commit 71d76bc

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

README.rst

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ A low-level interface to a growing number of KSC Web Services.
88
Install 安装
99
----------------
1010

11-
+ pip 安装
12-
+ pip install ksc-sdk-python
13-
1411
+ github 安装
1512
+ 通过 `GitHub <https://github.com/KscSDK/ksc-sdk-python>`__ 下载
1613
+ 通过命令 python setup.py install 安装
@@ -21,7 +18,7 @@ Config 配置
2118

2219
+ 申请安全凭证:
2320

24-
在第一次使用云API之前,用户首先需要在金山云控制台IAM服务申请安全凭证,安全凭证包括access_key_id和secret_access_key,access_key_id 是用于标识API调用者的身份,secret_access_key是用于加密签名字符串和服务器端验证签名字符串的密钥。secret_access_key 必须严格保管,避免泄露。
21+
在第一次使用云API之前,用户首先需要在金山云控制台申请安全凭证,安全凭证包括access_key_id和secret_access_key,access_key_id 是用于标识API调用者的身份,secret_access_key是用于加密签名字符串和服务器端验证签名字符串的密钥。secret_access_key 必须严格保管,避免泄露。
2522

2623
+ 通过文件配置及管理密钥,参考examples内示例:
2724

@@ -259,9 +256,3 @@ BUG FIXED 问题修正
259256
::
260257

261258
yum install python-devel
262-
263-
--------------------
264-
Contact Information
265-
--------------------
266-
267-
服 务 群 号: 580681922

examples/kec.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@
55
if __name__ == "__main__":
66
s = get_session()
77

8-
client = s.create_client("kec", "cn-beijing-6", use_ssl=True)
8+
client = s.create_client("kec", "cn-beijing-6", use_ssl=False)
99

10-
print client.describe_instances()
10+
# https://docs.ksyun.com/read/latest/52/_book/oaDescribeInstances.html
11+
client.describe_instances()
1112

12-
# client.create_user(UserName="test22", RealName=u"刘一辰")
13+
# https://docs.ksyun.com/read/latest/52/_book/oaRunInstances.html
14+
client.run_instances(
15+
MaxCount=50, MinCount=20, ImageId="3f3bddcf-4982-4ab4-a63d-795e8d74e9d5",
16+
SubnetId="f1bd236b-7fd3-44d3-aef9-2d673a65466e", InstancePassword="Ksyun2017",
17+
SecurityGroupId="2f43a9e4-1a3c-448e-b661-efa6d04b82fc", DataDiskGb=50, ChargeType="Monthly",
18+
InstanceType="C1.1A", PurchaseTime=1, InstanceName="test", InstanceNameSuffix="1")
19+
20+
# https://docs.ksyun.com/read/latest/52/_book/oaTerminateInstances.html
21+
instances = ["2f43a9e4-1a3c-448e-b661-efa6d04b82fc", "2f43a9e4-1a3c-448e-b661-efa6d04b82fc"]
1322

14-
# client.update_user(UserName="test22",)
23+
instances = dict(("InstanceId.{}".format(index), instance) for index, instance in enumerate(instances, 1))
24+
25+
client.terminate_instances(**instances)
1526

16-
# client.delete_user(UserName="test22")

kscore/data/_retry.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ definitions:
1818
applies_when:
1919
socket_errors:
2020
- GENERAL_CONNECTION_ERROR
21-
general_server_error:
22-
applies_when:
23-
response:
24-
http_status_code: 500
2521
bad_gateway:
2622
applies_when:
2723
response:
@@ -44,8 +40,6 @@ retry:
4440
policies:
4541
general_socket_errors:
4642
"$ref": general_socket_errors
47-
general_server_error:
48-
"$ref": general_server_error
4943
service_unavailable:
5044
"$ref": service_unavailable
5145
limit_exceeded:

0 commit comments

Comments
 (0)