Webapps
Note: The functionalities provided through the
Webapp
feature are deprecated and will eventually be removed. We recommend using theService
feature which offers a more comprehensive and flexible solution for managing web applications and API deployments.
Note: Only generic (EKS-based) webapps are supported when using SDK.
Import the webapps resource module and instantiate a webapps-service
client
[ ]:
from peak.resources import webapps
webapp_client = webapps.get_client()
List all existing webapps
(s) and iterate over them
[ ]:
webapps_list_iterator = webapp_client.list_webapps(
status=["CREATING"],
name="test",
)
webapps_list_iterated = next(webapps_list_iterator)
Prepare the payload and submit a new Webapp
resource for creation
[ ]:
body = {
"name": "webapp101",
"title": "Hello from SDK",
"description": "Hi there",
"imageDetails": { ## If versionId is not passed, webapp will be created using latest ready version of the image
"imageId": 123,
"versionId": 100,
},
"resources": {
"instanceTypeId": 43,
},
"sessionStickiness": True,
}
created_webapp = webapp_client.create_webapp(body)
Modify the payload and update the existing Webapp
resource
[ ]:
updated_body = {
"title": "Updated title",
"description": "Updated Description",
"imageDetails": { ## If versionId is not passed, webapp will be updated using latest ready version of the image
"imageId": 123,
"versionId": 101,
},
"resources": {
"instanceTypeId": 43,
},
"sessionStickiness": True,
}
updated_webapp = webapp_client.update_webapp(webapp_id="84a41de7-d67f-4aa0-aebe-83c1474f0eaf", body=updated_body)
Create or update a Webapp
resource
[ ]:
## If webapp exists, it will be updated, else new webapp will be created
body = {
"name": "webapp101",
"title": "Hello from SDK",
"description": "Hi there",
"imageDetails": { ## If versionId is not passed, webapp will be created or updated using latest ready version of the image
"imageId": 123,
"versionId": 100,
},
"resources": {
"instanceTypeId": 43,
},
"sessionStickiness": True,
}
created_webapp = webapp_client.create_or_update_webapp(body)
Delete an existing Webapp
resource
[ ]:
webapp_client.delete_webapp(webapp_id="some-id")
Describe an existing Webapp
resource
[ ]:
webapp_client.describe_webapp(webapp_id="84a41de7-d67f-4aa0-aebe-83c1474f0eaf")