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

Commit

Permalink
release python sdk 1.0.28
Browse files Browse the repository at this point in the history
  • Loading branch information
wuchen-huawei committed Dec 31, 2020
1 parent 829712e commit cfca0e5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Metadata-Version: 1.1
Name: huaweicloud-sdk-python
Version: 1.0.27
Version: 1.0.28
Summary: An SDK for building applications to work with OpenStack
Home-page: https://github.com/huaweicloud/huaweicloud-sdk-python
Author: "HuaweiCloud SDK"
Author-email: "[email protected]"
License: Apache LICENSE 2.0
Description: Python SDK for Cloud

Platform: UNKNOWN
Classifier: Environment :: OpenStack
Classifier: Intended Audience :: Information Technology
Expand Down
11 changes: 6 additions & 5 deletions examples/cdn/queryTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,16 @@ def query_task():
now = time.time()
end_date = int(now * 1000)
start_date = end_date - 3600 * 1000
tasks = conn.cdn.tasks(page_size=100, page_number=1, start_date=start_date, end_date=end_date)
tasks = conn.cdn.tasks(page_size=100, page_number=1, start_date=start_date, end_date=end_date,
enterprise_project_id='ALL')
task_list = list(tasks)
print(task_list)


# Querying Details About a Cache Refreshing or Preheating Task
def query_task_detail(_task_id):
def query_task_detail(task_id):
print("query task detail by id:")
task_detail = conn.cdn.get_task(_task_id)
task_detail = conn.cdn.get_task(task_id, page_size=30, page_number=1, enterprise_project_id='ALL')
print(task_detail)


Expand All @@ -76,5 +77,5 @@ def query_task_detail(_task_id):
query_task()

# Querying Details About a Cache Refreshing or Preheating Task
task_id = 'xxxxxxx'
query_task_detail(task_id)
history_task_id = 'xxxxxxx'
query_task_detail(history_task_id)
7 changes: 4 additions & 3 deletions openstack/cdn/v1/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,17 +712,18 @@ def tasks(self, page_size=100, page_number=1, **query):
paginated=True)
return self._list(_task.Task, **query)

def get_task(self, task):
def get_task(self, task_id, **params):
"""Get details about a cache refreshing or preheating task
:param task: The value can be the ID of a task or a
:param task_id: The value can be the ID of a task or a
:class:`~openstack.cdn.v1.task.Task` instance.
:returns: One :class:`~openstack.cdn.v1.task.Task`
:raises: :class:`~openstack.exceptions.ResourceNotFound`
when no resource can be found.
"""
return self._get(_task.Task, task)
res = self._get_resource(_task.Task, task_id)
return res.get(self._session, **params)

def create_refresh_task(self, **attrs):
"""Create a new cache refresh task from attributes
Expand Down
10 changes: 5 additions & 5 deletions openstack/cdn/v1/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Task(cdn_resource.Resource):
_query_mapping = cdn_resource.QueryParameters('status', 'start_date',
'end_date', 'order_field',
'order_type',
'user_domain_id')
'user_domain_id', 'enterprise_project_id')

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

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

self._translate_response(response)
return self
Expand Down Expand Up @@ -165,6 +164,7 @@ def create(self, session, prepend_key=True):
self._translate_response(response)
return self


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

self._translate_response(response)
return self
return self

0 comments on commit cfca0e5

Please sign in to comment.