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

Commit cfca0e5

Browse files
committed
release python sdk 1.0.28
1 parent 829712e commit cfca0e5

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

PKG-INFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Metadata-Version: 1.1
22
Name: huaweicloud-sdk-python
3-
Version: 1.0.27
3+
Version: 1.0.28
44
Summary: An SDK for building applications to work with OpenStack
55
Home-page: https://github.com/huaweicloud/huaweicloud-sdk-python
66
Author: "HuaweiCloud SDK"
77
Author-email: "hwcloudsdk@huawei.com"
88
License: Apache LICENSE 2.0
99
Description: Python SDK for Cloud
10-
10+
1111
Platform: UNKNOWN
1212
Classifier: Environment :: OpenStack
1313
Classifier: Intended Audience :: Information Technology

examples/cdn/queryTask.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,16 @@ def query_task():
5757
now = time.time()
5858
end_date = int(now * 1000)
5959
start_date = end_date - 3600 * 1000
60-
tasks = conn.cdn.tasks(page_size=100, page_number=1, start_date=start_date, end_date=end_date)
60+
tasks = conn.cdn.tasks(page_size=100, page_number=1, start_date=start_date, end_date=end_date,
61+
enterprise_project_id='ALL')
6162
task_list = list(tasks)
6263
print(task_list)
6364

6465

6566
# Querying Details About a Cache Refreshing or Preheating Task
66-
def query_task_detail(_task_id):
67+
def query_task_detail(task_id):
6768
print("query task detail by id:")
68-
task_detail = conn.cdn.get_task(_task_id)
69+
task_detail = conn.cdn.get_task(task_id, page_size=30, page_number=1, enterprise_project_id='ALL')
6970
print(task_detail)
7071

7172

@@ -76,5 +77,5 @@ def query_task_detail(_task_id):
7677
query_task()
7778

7879
# Querying Details About a Cache Refreshing or Preheating Task
79-
task_id = 'xxxxxxx'
80-
query_task_detail(task_id)
80+
history_task_id = 'xxxxxxx'
81+
query_task_detail(history_task_id)

openstack/cdn/v1/_proxy.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,17 +712,18 @@ def tasks(self, page_size=100, page_number=1, **query):
712712
paginated=True)
713713
return self._list(_task.Task, **query)
714714

715-
def get_task(self, task):
715+
def get_task(self, task_id, **params):
716716
"""Get details about a cache refreshing or preheating task
717717
718-
:param task: The value can be the ID of a task or a
718+
:param task_id: The value can be the ID of a task or a
719719
:class:`~openstack.cdn.v1.task.Task` instance.
720720
721721
:returns: One :class:`~openstack.cdn.v1.task.Task`
722722
:raises: :class:`~openstack.exceptions.ResourceNotFound`
723723
when no resource can be found.
724724
"""
725-
return self._get(_task.Task, task)
725+
res = self._get_resource(_task.Task, task_id)
726+
return res.get(self._session, **params)
726727

727728
def create_refresh_task(self, **attrs):
728729
"""Create a new cache refresh task from attributes

openstack/cdn/v1/task.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Task(cdn_resource.Resource):
3232
_query_mapping = cdn_resource.QueryParameters('status', 'start_date',
3333
'end_date', 'order_field',
3434
'order_type',
35-
'user_domain_id')
35+
'user_domain_id', 'enterprise_project_id')
3636

3737
#: The type of a task. The value is either 'refresh' or 'preheating'.
3838
task_type = resource.Body('task_type')
@@ -95,7 +95,7 @@ def list(cls, session, paginated=False, **params):
9595
params['order_field'] = mapping[params['order_field']]
9696
return super(Task, cls).list(session, paginated=paginated, **params)
9797

98-
def get(self, session, requires_id=True):
98+
def get(self, session, requires_id=True, **params):
9999
"""Get a remote resource based on this instance.
100100
101101
:param session: The session to use for making this request.
@@ -107,11 +107,10 @@ def get(self, session, requires_id=True):
107107
:rtype: :class:`~openstack.cdn.v1.task.Task`
108108
"""
109109
request = self._prepare_request(requires_id=requires_id)
110-
# NOTE(samsong8610): The URL for GET is not standard.
111110
request.uri = utils.urljoin(request.uri, 'detail')
112111
endpoint_override = self.service.get_endpoint_override()
113112
response = session.get(request.uri, endpoint_filter=self.service,
114-
endpoint_override=endpoint_override)
113+
endpoint_override=endpoint_override, params=params)
115114

116115
self._translate_response(response)
117116
return self
@@ -165,6 +164,7 @@ def create(self, session, prepend_key=True):
165164
self._translate_response(response)
166165
return self
167166

167+
168168
class PreheatTask(Task):
169169
base_path = '/cdn/preheatingtasks'
170170
resource_key = 'preheatingTask'
@@ -204,4 +204,4 @@ def create(self, session, prepend_key=True):
204204
json=request.body, headers=request.headers, params={"enterprise_project_id": 'ALL'})
205205

206206
self._translate_response(response)
207-
return self
207+
return self

0 commit comments

Comments
 (0)