Press-App
Apps client module.
- peak.press.apps.get_client(session=None)
Returns an 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, revision info and parameters that would used at run-time.
- Returns:
ID of the created App deployment
- Return type:
Dict[str, str]
- SCHEMA:
{ "metadata": { "description": "string" "descriptionContentType": "string" "imageUrl": "string" "name": "string(required)", "summary": "string(required)", "tags": [ { "name": "string" } ], "title": "string" }, "appParameters": { "build": { "param_name": "param_value (string | number | boolean | array)" }, "run": { "param_name": "param_value (string | number | boolean | array)" } }, "parameters": { "spec_name": { "build": { "param_name": "param_value (string | number | boolean | array)" }, "run": { "param_name": "param_value (string | number | boolean | array)" } }, }, "revision": { "notes": "string(required)", }, "spec": { "id": "string(required)", "release": { "version": "string(required)", } } }
- 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.
- Parameters:
body (Dict[str, Any]) –
- Return type:
Dict[str, str]
- create_deployment_revision(deployment_id, body)
Creates a new Revision of a Deployment, from a selected App Spec Release.
Publish a new revision of an App Deployment. The payload must specify the release version of the parent spec that you wish to use (if one is not provided, the latest available will be used), optional revision notes in the expected format,, and optional parameters if required by the associated block spec releases.
- REFERENCE:
- Parameters:
deployment_id (str) – Id of the deployment in which new revision will be created.
body (Dict[str, str]) – release version, revision notes, and any parameters required
- Returns:
ID of the created App deployment, and the new Revision number
- Return type:
Dict[str, str]
- SCHEMA:
{ "release": { "version": "string" }, "revision": { "notes": "string", }, "appParameters": { "build": { "param_name": "param_value (string | number | boolean | array)" }, "run": { "param_name": "param_value (string | number | boolean | array)" } }, "parameters": { "block-name-1":{ "build": { "param_name": "param_value (string | number | boolean | array)" }, "run": { "param_name": "param_value (string | number | boolean | array)" } }, "block-name-2":{ "build": { "param_name": "param_value (string | number | boolean | array)" }, "run": { "param_name": "param_value (string | number | boolean | array)" } } } }
- 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 deployment or spec release does not exist.
ConflictException – There is a conflict with the current state of the target resource.
UnprocessableEntityException – The server was unable to process the request.
InternalServerErrorException – The server encountered an unexpected condition that prevented it from fulfilling the request.
- Parameters:
deployment_id (str) –
body (Dict[str, Any]) –
- Return type:
Dict[str, str]
- create_spec(body, featured=None, scope=None, tenants=None, parameters=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 (Block spec ID and Release version) needs to be added to the config key. config also contains a autoRunOnDeploy key which is a boolean value to specify if the resource should be executed on successful deployment of the app. By default, it is False.
- 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.
parameters (Optional[Dict[str, List[Dict[str, Any]]]]) –
A dictionary containing optional keys build and run. The structure of the dictionary is as follows:
build (List[Dict[str, Any]], optional): A list of parameter objects, the values of which will be given and used at deployment time.
run (List[Dict[str, Any]], optional): A list of parameter objects, the values of which will be given at deployment time and will be used at run time.
- Returns:
Id of the created app spec.
- Return type:
Dict[str, str]
- SCHEMA:
{ "version": "number(required)", "kind": "string(required)", "metadata": { "name": "string(required)", "title": "string", "summary": "string(required)", "description": "string", "descriptionContentType": "string", "imageUrl": "string", "tags": [ { "name": "string", } ] }, "release": { "notes": "string(required)", "version": "string(required)", }, "config": [ { "id": "string(required)", "release": { "version": "string(required)", }, "autoRunOnDeploy": "boolean (By default it is False)", } ] }
- SCHEMA(Parameters):
The valid types for parameters are boolean, string, string_array, number, number_array, object and object_array.
{ "build": [ { "name": "string(required)", "type": "string(required)", "required": "boolean(required)", "description": "string", "defaultValue": "string(required)", "title": "string", "options": "list(str)", "hideValue": "boolean", } ], "run": [ { "name": "string(required)", "type": "string(required)", "required": "boolean(required)", "description": "string", "defaultValue": "string(required)", "title": "string", "options": "list(str)", "hideValue": "boolean", } ] }
- 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.
- Parameters:
body (Dict[str, Any]) –
featured (bool | None) –
scope (str | None) –
tenants (List[str] | None) –
parameters (Dict[str, List[Dict[str, Any]]] | None) –
- Return type:
Dict[str, str]
- create_spec_release(spec_id, body, parameters=None)
Publish a new release to an existing App spec.
Spec details (Block spec ID and Release version) needs to be added to the config key. config also contains a autoRunOnDeploy key which is a boolean value to specify if the resource should be executed on successful deployment of the app. By default, it is False.
- 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.
parameters (Optional[Dict[str, List[Dict[str, Any]]]]) –
A dictionary containing optional keys build and run. The structure of the dictionary is as follows:
build (List[Dict[str, Any]], optional): A list of parameter objects, the values of which will be given and used at deployment time.
run (List[Dict[str, Any]], optional): A list of parameter objects, the values of which will be given at deployment time and will be used at run time.
- Returns:
Dictionary containing spec id and release version
- Return type:
Dict[str, str]
- SCHEMA:
{ "config": [ { "id": "string(required)", "release": { "version": "string(required)", }, "autoRunOnDeploy": "boolean (By default it is False)", } ], "release": { "notes": "string(required)", "version": "string(required)", } }
- SCHEMA(Parameters):
The valid types for parameters are boolean, string, string_array, number, number_array, object and object_array.
{ "build": [ { "defaultValue": "string(required)", "description": "string", "hideValue": "boolean", "name": "string(required)", "required": "boolean(required)", "title": "string", "type": "string(required)", } ], "run": [ { "defaultValue": "string(required)", "description": "string", "hideValue": "boolean", "name": "string(required)", "required": "boolean(required)", "title": "string", "type": "string(required)", } ] }
- 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.
- Parameters:
spec_id (str) –
body (Dict[str, Any]) –
parameters (Dict[str, List[Dict[str, Any]]] | None) –
- Return type:
Dict[str, str]
- 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_deployment_revision(deployment_id, revision)
Describes an existing App deployment revision, Parameters listed in the response are masked if “hideValue” was set to true when creating the associated block specs.
- REFERENCE:
- Parameters:
deployment_id (str) – The ID of the App deployment to retrieve the revision from.
revision (str) – The revision number to retrieve
- Returns:
Dictionary containing the details of the deployment revision.
- 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 or revision 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_deployment_revisions(deployment_id: str, sort: List[str] | None = None, status: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[False]) Dict[str, Any]
- list_deployment_revisions(deployment_id: str, sort: List[str] | None = None, status: List[str] | None = None, page_size: int | None = None, page_number: int | None = None, *, return_iterator: Literal[True] = True) Iterator[Dict[str, Any]]
Lists revisions for an App deployment ordered by creation date or provided sort key.
- REFERENCE:
- Parameters:
deployment_id (str) – The ID of the App deployment to retrieve the revision from.
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.
status (List[str] | None) – List of statuses to filter revisions. Valid values are deleting, delete_failed, deployed, deploying, failed, platform_resource_error, rollback, rollback_complete, rollback_failed and superseded.
page_size (int | None) – Number of revisions 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 revisions 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 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.
StopIteration – There are no more pages to list.
- 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. Valid values are deploying, deployed, deleting, delete_failed, failed, platform_resource_error, redeploying, rollback, rollback_complete, rollback_failed, and warning.
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. Valid values are available, unavailable and archived.
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
- redeploy(deployment_id)
Redeploy latest revision of an existing App deployment.
This function allows you to redeploy an App deployment that is in a failed or warning state, provided at least one of its block deployments is also in a failed or warning state.
- REFERENCE:
- Parameters:
deployment_id (str) – The ID of the App deployment to redeploy.
- Returns:
A dictionary containing 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 or its revisions do not exist.
ConflictException – There is a conflict with the current state of the target resource.
UnprocessableEntityException – The server was unable to process the request.
InternalServerErrorException – the server encountered an unexpected condition that prevented it from fulfilling the request.
- 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
- SCHEMA:
{ "description": "string", "descriptionContentType": "string", "imageUrl": "string", "name": "string", "summary": "string", "tags": [ { "name": "string", } ], "title": "string", }
- 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
- SCHEMA:
{ "metadata": { "name": "string", "title": "string", "summary": "string", "description": "string", "descriptionContentType": "string", "imageUrl": "string", "tags": [ { "name": "string", } ], "status": "string", }, "featured": "boolean", "scope": "string", "tenants": [ "string", ] }
- 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.
- Parameters:
spec_id (str) –
body (Dict[str, Any]) –
- Return type:
Dict[None, None]