Skip to content
This repository was archived by the owner on Nov 13, 2023. It is now read-only.

Commit c11c18b

Browse files
committed
release go sdk 1.0.20
1 parent 7a404cd commit c11c18b

File tree

88 files changed

+5316
-56
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+5316
-56
lines changed

PKG-INFO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 1.1
22
Name: huaweicloud-sdk-python
3-
Version: 1.0.19
3+
Version: 1.0.20
44
Summary: An SDK for building applications to work with OpenStack
55
Home-page: https://github.com/huaweicloud/huaweicloud-sdk-python
66
Author: huawei
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python
2+
# coding=utf-8
3+
from openstack import connection
4+
5+
ak = "replace-with-your-ak"
6+
sk = "replace-with-your-sk"
7+
cloud = "myhuaweicloud.com"
8+
domain_id = "replace-with-your-domain-id"
9+
10+
conn = connection.Connection(
11+
ak=ak,
12+
sk=sk,
13+
cloud=cloud,
14+
domain_id=domain_id,
15+
)
16+
17+
18+
def test_list_zones():
19+
query = {
20+
"limit": 3,
21+
}
22+
data = conn.dns.zones(**query)
23+
for i in data:
24+
print i
25+
26+
27+
if __name__ == "__main__":
28+
test_list_zones()
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env python
2+
# coding=utf-8
3+
from openstack import connection
4+
5+
ak = "replace-with-your-ak"
6+
sk = "replace-with-your-sk"
7+
cloud = "myhuaweicloud.com"
8+
project_id = "replace-with-your-project-id"
9+
region = "replace-with-your-region-name"
10+
conn = connection.Connection(
11+
ak=ak,
12+
sk=sk,
13+
cloud=cloud,
14+
project_id=project_id,
15+
region=region
16+
)
17+
18+
19+
def test_list_servers():
20+
query = {
21+
"limit": 3,
22+
}
23+
objs = conn.compute.servers(**query)
24+
for i in objs:
25+
print i
26+
27+
28+
if __name__ == "__main__":
29+
test_list_servers()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python
2+
# coding=utf-8
3+
from openstack import connection
4+
5+
auth_token = "replace-with-your-token-id"
6+
auth_url = "https://iam.example.com/v3"
7+
8+
token_conn = connection.Connection(
9+
auth_url=auth_url,
10+
auth_token=auth_token,
11+
)
12+
13+
14+
def test_list_endpoints(conn):
15+
query = {
16+
"limit": 3,
17+
}
18+
objs = conn.identity.endpoints(**query)
19+
for i in objs:
20+
print i
21+
22+
23+
if __name__ == "__main__":
24+
test_list_endpoints(token_conn)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python
2+
# coding=utf-8
3+
from openstack import connection
4+
5+
# create connection
6+
username = "replace-with-your-username"
7+
password = "replace-with-your-password"
8+
domainId = "replace-with-your-domain-id"
9+
userDomainId = "replace-with-your-user-domain-id"
10+
auth_url = "https://iam.example.com/v3"
11+
conn = connection.Connection(auth_url=auth_url,
12+
user_domain_id=userDomainId,
13+
domain_id=domainId,
14+
username=username,
15+
password=password)
16+
17+
18+
def test_list_zones():
19+
query = {
20+
"limit": 3,
21+
}
22+
data = conn.dns.zones(**query)
23+
for i in data:
24+
print i
25+
26+
27+
if __name__ == "__main__":
28+
test_list_zones()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python
2+
# coding=utf-8
3+
from openstack import connection
4+
5+
# create connection
6+
username = "replace-with-your-username"
7+
password = "replace-with-your-password"
8+
projectId = "replace-with-your-project-id"
9+
userDomainId = "replace-with-your-user-domain-id"
10+
auth_url = "https://iam.example.com/v3"
11+
conn = connection.Connection(auth_url=auth_url,
12+
user_domain_id=userDomainId,
13+
project_id=projectId,
14+
username=username,
15+
password=password)
16+
17+
18+
def list_metrics():
19+
query = {
20+
"namespace": "SYS.ECS",
21+
"metric_name": "cpu_util",
22+
"limit": 1
23+
}
24+
metrics = conn.cloud_eye.metrics(**query)
25+
for metric in metrics:
26+
print(metric)
27+
28+
29+
if __name__ == "__main__":
30+
list_metrics()

examples/block_store/v2/snapshot.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def create_snapshot():
3535
}
3636
print(conn.block_store.create_snapshot(**data))
3737

38+
3839
# update snapshot
3940
def update_snapshot():
4041
snapshot_id = 'xxx'
@@ -44,6 +45,7 @@ def update_snapshot():
4445
snapshot = conn.block_store.update_snapshot(snapshot_id, **data)
4546
print(snapshot)
4647

48+
4749
# get snapshot
4850
def get_snapshot():
4951
snapshot_id = 'xxx'
@@ -56,6 +58,7 @@ def delete_snapshot():
5658
snapshot_id = 'xxx'
5759
conn.block_store.delete_snapshot(snapshot_id)
5860

61+
5962
# create snapshot metadata
6063
def create_snapshot_metadata():
6164
snapshot_id = 'xxx'
@@ -67,12 +70,14 @@ def create_snapshot_metadata():
6770
snapshot_metadata = conn.block_store.create_snapshot_metadata(snapshot_id, **data)
6871
print(snapshot_metadata)
6972

73+
7074
# get snapshot metadata
7175
def get_snapshot_metadata():
7276
snapshot_id = 'xxx'
7377
snapshot_metadata = conn.block_store.get_snapshot_metadata(snapshot_id, key=None)
7478
print(snapshot_metadata)
7579

80+
7681
# update snapshot metadata
7782
def update_snapshot_metadata():
7883
snapshot_id = 'xxx'
@@ -84,17 +89,26 @@ def update_snapshot_metadata():
8489
snapshot_metadata = conn.block_store.update_snapshot_metadata(snapshot_id, key=None, **data_all)
8590
print(snapshot_metadata)
8691

92+
8793
# delete snapshot metadata
8894
def delete_snapshot_metadata():
8995
snapshot_id = 'xxx'
9096
snapshot_metadata = conn.block_store.delete_snapshot_metadata(snapshot_id, key='delete_key')
9197
print(snapshot_metadata)
9298

99+
93100
# snapshots
94101
def snapshots():
95102
for index in conn.block_store.snapshots():
96103
print(index)
97104

105+
106+
# list snapshots with paginated
107+
def list_snapshots_one_page():
108+
for index in conn.block_store.snapshots(paginated=False, limit=4):
109+
print(index)
110+
111+
98112
if __name__ == '__main__':
99113
create_snapshot()
100114
update_snapshot()
@@ -105,3 +119,4 @@ def snapshots():
105119
update_snapshot_metadata()
106120
delete_snapshot_metadata()
107121
snapshots()
122+
list_snapshots_one_page()

examples/block_store/v2/volume.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ def volumes():
9393
print(index)
9494

9595

96+
# list volumes with paginated
97+
def list_volumes_one_page():
98+
for index in conn.block_store.volumes(paginated=False, limit=3):
99+
print(index)
100+
101+
96102
# get volume
97103
def get_volume():
98104
volume_id = 'xxx'
@@ -177,6 +183,7 @@ def export_image_by_volume():
177183
update_volume()
178184
expand_volume()
179185
volumes()
186+
list_volumes_one_page()
180187
get_volume()
181188
get_quota_set()
182189
create_volume_metadata()

examples/bss/__init__.py

Whitespace-only changes.

examples/bss/v1/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)