Press-App
Apps client module.
- peak.press.apps.get_client(session=None)
Returns an App client.
Press-App Client
- class peak.press.apps.App(session=None)
Client class for interacting with Apps.
- Parameters:
session (Session) –
- create_deployment(body)
Creates a new deployment from App spec.
Uses the latest spec release if release version is not provided.
- REFERENCE:
- Parameters:
body (Dict[str, str]) – Dictionary containing deployment metadata, spec ID, release version and revision info.
- Returns:
ID of the created App deployment
- Return type:
Dict[str, str]
- Raises:
BadRequestException – The given parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given app spec release does not exist.
UnprocessableEntityException – The server was unable to process the request.
InternalServerErrorException – The server encountered an unexpected condition that prevented it from fulfilling the request.
- create_spec(body, featured=None, scope=None, tenants=None)
Creates a new App spec.
All App Specs must have unique names within a tenant. An App Spec must now be made up of already existing block specs. Spec details (specId and release) needs to be added in the spec body inside config key.
- REFERENCE:
- Parameters:
body (Dict[str, Any]) – A payload specifying an App’s metadata, release and corresponding config in the expected format.
featured (bool | None) – Whether to feature this spec. By default it is False.
scope (str | None) – Specify weather tenants can discover and deploy this spec. private restricts the spec to this tenant alone, public makes it available on all tenants and shared allows specifying what set of tenants can access and use this spec. By default it is private.
tenants (List[str] | None) – Given a shared scope, specify what other tenants can discover and deploy this spec.
- Returns:
Id of the created app spec.
- Return type:
Dict[str, str]
- Raises:
BadRequestException – The given parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
UnprocessableEntityException – The server was unable to process the request.
InternalServerErrorException – The server encountered an unexpected condition that prevented it from fulfilling the request.
- create_spec_release(spec_id, body)
Publish a new release to an existing App spec.
- REFERENCE:
- Parameters:
spec_id (str) – Id of the spec in which new release will be created
body (Dict[str, Any]) – Dictionary containing updated release and config in the expected format.
- Returns:
Dictionary containing spec id and release version
- Return type:
Dict[str, str]
- Raises:
BadRequestException – The given parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given app spec does not exist.
UnprocessableEntityException – The server was unable to process the request.
InternalServerErrorException – the server encountered an unexpected condition that prevented it from fulfilling the request.
- delete_deployment(deployment_id)
Deletes an App deployment.
- REFERENCE:
- Parameters:
deployment_id (str) – The ID of the App deployment to delete.
- Returns:
Empty dict object.
- Return type:
dict
- Raises:
BadRequestException – The given parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given App deployment does not exist.
UnprocessableEntityException – The server was unable to process the request.
InternalServerErrorException – the server encountered an unexpected condition that prevented it from fulfilling the request.
- delete_spec(spec_id)
Delete an App Spec and all it’s associated releases.
- REFERENCE:
- Parameters:
spec_id (str) – The ID of the App spec to delete.
- Returns:
Empty dict object.
- Return type:
dict
- Raises:
BadRequestException – The given parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given App spec does not exist.
UnprocessableEntityException – The server was unable to process the request.
InternalServerErrorException – the server encountered an unexpected condition that prevented it from fulfilling the request.
- describe_deployment(deployment_id)
Describes an existing App deployment, also provides details of the latest revision.
- REFERENCE:
- Parameters:
deployment_id (str) – The ID of the App deployment to retrieve.
- Returns:
Dictionary containing the details of the deployment.
- Return type:
Dict[str, Any]
- Raises:
BadRequestException – The given parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given App deployment does not exist.
InternalServerErrorException – The server encountered an unexpected condition that prevented it from fulfilling the request.
- describe_spec(spec_id)
Describes an existing App spec and also provides details of the latest release.
- REFERENCE:
- Parameters:
spec_id (str) – The ID of the app spec to retrieve.
- Returns:
Dictionary containing the details of the spec.
- Return type:
Dict[str, Any]
- Raises:
BadRequestException – The given parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given app spec does not exist.
InternalServerErrorException – The server encountered an unexpected condition that prevented it from fulfilling the request.
- describe_spec_release(spec_id, version)
Describes an existing App spec release.
- REFERENCE:
- Parameters:
spec_id (str) – The ID of the app spec to retrieve.
version (str) – The release version of spec to retrieve in valid semantic versioning format.
- Returns:
Dictionary containing details of the spec release
- Return type:
Dict[str, Any]
- Raises:
BadRequestException – The given parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given app spec does not exist.
InternalServerErrorException – the server encountered an unexpected condition that prevented it from fulfilling the request.
- list_deployments(status: List[str] | None = None, name: str | None = None, sort: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[False]) Dict[str, Any]
- list_deployments(status: List[str] | None = None, name: str | None = None, sort: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[True] = True) Iterator[Dict[str, Any]]
Lists App deployments ordered by creation date.
- REFERENCE:
- Parameters:
status (List[str] | None) – List of statuses to filter deployments.
name (str | None) – Only return deployments whose names begins with the query string.
sort (List[str] | None) – List of fields with desired ordering in the format [<field>:<order>, …], where order is one of [‘asc’, ‘desc’] and field is an ordered parameter within the response. Valid fields are createdAt, createdBy, name and title.
page_size (int | None) – Number of deployments to include per page.
page_number (int | None) – The page number to retrieve. Only used when return_iterator is False.
return_iterator (bool) – Whether to return an iterator object or list of deployments 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 parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
UnprocessableEntityException – The server was unable to process the request.
InternalServerErrorException – The server encountered an unexpected condition that prevented it from fulfilling the request.
StopIteration – There are no more pages to list.
- list_spec_releases(spec_id: str, sort: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[False]) Dict[str, Any]
- list_spec_releases(spec_id: str, sort: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[True] = True) Iterator[Dict[str, Any]]
Get all releases of an App spec (ordered by most recently created to oldest).
- REFERENCE:
- Parameters:
spec_id (str) – The ID of the app spec to retrieve.
sort (List[str] | None) – List of fields with desired ordering in the format [<field>:<order>, …], where order is one of [‘asc’, ‘desc’] and field is an ordered parameter within the response. Valid fields are createdAt and createdBy.
page_size (int | None, optional) – Number of releases to include per page.
page_number (int | None) – The page number to retrieve. Only used when return_iterator is False.
return_iterator (bool) – Whether to return an iterator object or list of releases 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 parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given App spec does not exist.
InternalServerErrorException – the server encountered an unexpected condition that prevented it from fulfilling the request.
StopIteration – There are no more pages to list
- list_specs(status: List[str] | None = None, featured: bool | None = None, name: str | None = None, title: str | None = None, sort: List[str] | None = None, scope: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[False]) Dict[str, Any]
- list_specs(status: List[str] | None = None, featured: bool | None = None, name: str | None = None, title: str | None = None, sort: List[str] | None = None, scope: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[True] = True) Iterator[Dict[str, Any]]
Lists all published App specs ordered by creation date. Returns info for the latest release for each spec.
- REFERENCE:
- Parameters:
status (List[str] | None) – List of statuses to filter specs.
featured (bool | None) – Whether to only return featured specs.
name (str | None) – Only return specs whose names begins with the query string.
title (str | None) – Only return specs whose title begins with the query string.
sort (List[str] | None) – List of fields with desired ordering in the format [<field>:<order>, …], where order is one of [‘asc’, ‘desc’] and field is an ordered parameter within the response, defaults to []. Valid fields are createdAt, createdBy, name, title.
scope (List[str] | None) – List of scopes to only return specs of those scopes. Valid values are private, public and shared.
page_size (int | None) – Number of specs to include per page.
page_number (int | None) – The page number to retrieve. Only used when return_iterator is False.
return_iterator (bool) – Whether to return an iterator object or list of specs 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 parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
InternalServerErrorException – The server encountered an unexpected condition that prevented it from fulfilling the request.
StopIteration – There are no more pages to list
- update_deployment_metadata(deployment_id, body)
Update the metadata of an App deployment.
- REFERENCE:
- Parameters:
deployment_id (str) – ID of the App deployment to update.
body (Dict[str, Dict[str, str]]) – Dictionary of the new deployment metadata.
- Returns:
Details of the updated deployment.
- Return type:
dict
- Raises:
BadRequestException – The given parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given App deployment does not exist.
InternalServerErrorException – the server encountered an unexpected condition that prevented it from fulfilling the request.
- update_spec_metadata(spec_id, body)
Updates the metadata of an App spec.
- REFERENCE:
- Parameters:
spec_id (str) – ID of the spec to update
body (Dict[str, Any]) – Dictionary containing the new spec metadata
- Returns:
Dictionary containing the details of the updated spec.
- Return type:
dict
- Raises:
BadRequestException – The given parameters are invalid.
UnauthorizedException – The credentials are invalid.
ForbiddenException – The user does not have permission to perform the operation.
NotFoundException – The given App spec does not exist.
InternalServerErrorException – the server encountered an unexpected condition that prevented it from fulfilling the request.