Skip to content

Commit

Permalink
Add update project (#307)
Browse files Browse the repository at this point in the history
* feat: add update_project api

* feat: bump version 0.9.12
  • Loading branch information
crimson-gao authored Oct 10, 2024
1 parent 107150d commit 8e3346e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
25 changes: 25 additions & 0 deletions aliyun/log/logclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -2560,6 +2560,31 @@ def create_project(self, project_name, project_des, resource_group_id='', data_r

(resp, header) = self._send("POST", project_name, body, resource, params, headers)
return CreateProjectResponse(header, resp)

def update_project(self, project_name, project_des):
""" Update a project
Unsuccessful operation will cause an LogException.
:type project_name: string
:param project_name: the Project name
:type project_des: string
:param project_des: the description of a project
:return: UpdateProjectResponse
:raise: LogException
"""

params = {}
body = {"description": project_des}

body = six.b(json.dumps(body))
headers = {'Content-Type': 'application/json', 'x-log-bodyrawsize': str(len(body))}
resource = "/"

(resp, header) = self._send("PUT", project_name, body, resource, params, headers)
return UpdateProjectResponse(header, resp)

def get_project(self, project_name):
""" get project
Expand Down
13 changes: 12 additions & 1 deletion aliyun/log/project_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .util import Util

__all__ = [
'CreateProjectResponse', 'DeleteProjectResponse',
'CreateProjectResponse', 'UpdateProjectResponse', 'DeleteProjectResponse',
'GetProjectResponse', 'ListProjectResponse',
'GetProjectTagsResponse',
]
Expand All @@ -26,6 +26,17 @@ def log_print(self):
print('CreateProjectResponse:')
print('headers:', self.get_all_headers())

class UpdateProjectResponse(LogResponse):
"""
Response of update_project
"""
def __init__(self, header, resp=''):
LogResponse.__init__(self, header, resp)

def log_print(self):
print('UpdateProjectResponse:')
print('headers:', self.get_all_headers())


class DeleteProjectResponse(LogResponse):
def __init__(self, header, resp=''):
Expand Down

0 comments on commit 8e3346e

Please sign in to comment.