Delete a project
Updated at:
Use the DeleteProject operation to delete a specified project.
Prerequisites
-
Simple Log Service is activated. For more information, see Activate Simple Log Service.
-
The Simple Log Service SDK for Python is initialized. For more information, see Initialize Simple Log Service SDK for Python.
Parameters
def delete_project(self, project_name):Request parameters
Parameter | Type | Required | Description |
project_name | String | Yes | The name of the project. The project in Simple Log Service is used to isolate the resources of different users and control access to specific resources. See Manage projects. |
Response parameters
For more information, see DeleteProject.
Sample code
from aliyun.log import LogClient
import os
# In this example, the AccessKey ID and AccessKey secret are obtained from environment variables.
access_key_id = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', '')
access_key_secret = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')
# The Simple Log Service endpoint.
endpoint = "cn-hangzhou.log.aliyuncs.com"
# Create a Simple Log Service client.
client = LogClient(endpoint, access_key_id, access_key_secret)
# Project name
project_name = "slsproject-1"
# Delete the specified project.
def main():
try:
response = client.delete_project(project_name)
response.log_print()
except Exception as error:
print(error)
if __name__ == '__main__':
main()
Sample response
DeleteProjectResponse:
headers: {'Server': 'AliyunSLS', 'Content-Length': '0', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*', 'Date': 'Thu, 21 Nov 2024 08:10:54 GMT', 'x-log-time': '1732176654', 'x-log-requestid': '673EEB0D6BC05B398EB6****'}
Process finished with exit code 0References
-
Project-related API operations:
Is this page helpful?