Webapp

Webapp client module.

Warning

The Webapp module is deprecated and will eventually be removed. It is recommended that users begin transitioning to the Service module, which offers all the features of Webapp along with the added capability of API deployment and other significant updates for enhanced functionality. Transitioning early to the Service module will ensure easier adoption of its advanced features and future updates.

For guidance on migrating to the Service module and taking full advantage of its capabilities, please refer to the Service module’s documentation.

peak.resources.webapps.get_client(session=None)

Returns a Webapp client, If no session is provided, a default session is used.

Parameters:

session (Optional[Session]) – A Session Object. Default is None.

Returns:

the webapp client object

Return type:

Webapp

Webapp Client

class peak.resources.webapps.Webapp(session=None)

Client class for interacting with webapps resource.

Parameters:

session (Session) –

create_or_update_webapp(body)

Create a new webapp or updates an existing webapp based on webapp name.

When updating the webapp, it will trigger a redeployment only under specific conditions. Redeployment is triggered if you make changes to any of the following parameters: imageId, versionId, instanceTypeId or sessionStickiness. However, only modifying the title or description will not trigger a redeployment.

REFERENCE:

🔗 API Documentation

Parameters:

body (Dict[str, Any]) – A dictionary containing the webapp config. Schema can be found below.

Returns:

Id of the new or updated webapp.

Return type:

Dict[str, str]

SCHEMA:
{
    "name": "string(required)",
    "title": "string",
    "imageDetails": {
        "imageId": "number(required)",
        "versionId": "number"
    },
    "resources": {
        "instanceTypeId": "number"
    },
    "description": "string",
    "sessionStickiness": "boolean"
}
Raises:
  • BadRequestException – The given request parameters are invalid.

  • UnauthorizedException – The credentials are invalid.

  • ForbiddenException – The user does not have permission to perform the operation.

  • InternalServerErrorException – The server failed to process the request.

Parameters:

body (Dict[str, Any]) –

Return type:

Dict[str, str]

create_webapp(body)

Create a new webapp. Only geneic (EKS-based) webapps are supported at the moment.

REFERENCE:

🔗 API Documentation

Parameters:

body (Dict[str, Any]) – A dictionary containing the webapp config. Schema can be found below.

Returns:

Id of the new webapp

Return type:

Dict[str, str]

SCHEMA:
{
    "name": "string(required)",
    "title": "string",
    "imageDetails": {
        "imageId": "number(required)",
        "versionId": "number",
    },
    "resources": {
        "instanceTypeId": "number"
    },
    "description": "string",
    "sessionStickiness": "boolean"
}
Raises:
  • BadRequestException – The given request parameters are invalid.

  • UnauthorizedException – The credentials are invalid.

  • ForbiddenException – The user does not have permission to perform the operation.

  • InternalServerErrorException – The server failed to process the request.

Parameters:

body (Dict[str, Any]) –

Return type:

Dict[str, str]

delete_webapp(webapp_id)

Delete a webapp.

REFERENCE:

🔗 API Documentation

Parameters:

webapp_id (str) – The ID of the webapp to delete.

Returns:

Dictonary containing Id of the deleted webapp

Return type:

Dict[str, str]

Raises:
  • UnauthorizedException – The credentials are invalid.

  • ForbiddenException – The user does not have permission to perform the operation.

  • NotFoundException – The given webapp does not exist.

  • ConflictException – If the webapp is in a conflicting state while deleting.

  • InternalServerErrorException – The server failed to process the request.

describe_webapp(webapp_id)

Retrieve details of a specific webapp.

REFERENCE:

🔗 API Documentation

Parameters:

webapp_id (str) – The ID of the webapp to fetch.

Returns:

Dictonary containing details of the webapp

Return type:

Dict[str, Any]

Raises:
  • UnauthorizedException – The credentials are invalid.

  • ForbiddenException – The user does not have permission to perform the operation.

  • NotFoundException – The given webapp does not exist.

  • UnprocessableEntityException – The server was unable to process the request.

  • InternalServerErrorException – The server failed to process the request.

list_webapps(page_size: int | None = None, page_number: int | None = None, status: List[str] | None = None, name: str | None = None, *, return_iterator: Literal[False]) Dict[str, Any]
list_webapps(page_size: int | None = None, page_number: int | None = None, status: List[str] | None = None, name: str | None = None, *, return_iterator: Literal[True] = True) Iterator[Dict[str, Any]]

Retrieve a list of webapps.

REFERENCE:

🔗 API Documentation

Parameters:
  • page_size (int | None) – The number of webapps per page.

  • page_number (int | None) – The page number to retrieve. Only used when return_iterator is False.

  • status (List[str] | None) – A list of webapp status to filter the list by. Valid values are CREATING, DEPLOYING, AVAILABLE, DELETING, CREATE_FAILED, DELETE_FAILED.

  • name (str | None) – Name of the webapp to search for.

  • return_iterator (bool) – Whether to return an iterator object or list of webapps for a specified page number, defaults to True.

Returns:

an iterator object which returns an element per iteration, until there are no more elements to return. If return_iterator is set to False, a dictionary containing the list and pagination details is returned instead. Set return_iterator to True if you want automatic client-side pagination, or False if you want server-side pagination.

Return type:

Iterator[Dict[str, Any] | Dict[str, Any]

Raises:
  • BadRequestException – The given request parameters are invalid.

  • UnauthorizedException – The credentials are invalid.

  • ForbiddenException – The user does not have permission to perform the operation.

  • InternalServerErrorException – The server failed to process the request.

update_webapp(webapp_id, body)

Updates the existing webapp. Only geneic (EKS-based) webapps are supported at the moment.

When updating the webapp, it will trigger a redeployment only under specific conditions. Redeployment is triggered if you make changes to any of the following parameters: imageId, versionId, instanceTypeId or sessionStickiness. However, only modifying the title or description will not trigger a redeployment.

REFERENCE:

🔗 API Documentation

Parameters:
  • webapp_id (str) – The ID of the webapp to update.

  • body (Dict[str, Any]) – A dictionary containing the webapp config. Schema can be found below.

Returns:

Id of the webapp.

Return type:

Dict[str, str]

SCHEMA:
{
    "title": "string",
    "imageDetails": {
        "imageId": "number(required)",
        "versionId": "number",
    },
    "resources": {
        "instanceTypeId": "number"
    },
    "description": "string",
    "sessionStickiness": "boolean"
}
Raises:
  • BadRequestException – The given request parameters are invalid.

  • UnauthorizedException – The credentials are invalid.

  • ForbiddenException – The user does not have permission to perform the operation.

  • NotFoundException – The given webapp does not exist.

  • UnprocessableEntityException – The server was unable to process the request.

  • InternalServerErrorException – The server failed to process the request.

Parameters:
  • webapp_id (str) –

  • body (Dict[str, Any]) –

Return type:

Dict[str, str]