Press-Deployment

Deployments client module.

peak.press.deployments.get_client(session=None)

Returns a Deployment client.

Parameters:

session (Optional[Session]) – A Session Object. If no session is provided, a default session is used.

Returns:

the Deployment client object

Return type:

Deployment

Press-Deployment Client

class peak.press.deployments.Deployment(session=None)

Client class for interacting with Deployments.

Parameters:

session (Session) –

execute_resources(deployment_id)

Trigger the resources of an app or block deployment. This will execute the resources of the latest revision of the deployment.

REFERENCE:

🔗 API Documentation

Parameters:

deployment_id (str) – ID of the app or block deployment to trigger resources for.

Returns:

A dictionary containing the details of the triggered 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.

  • InternalServerErrorException – The server encountered an unexpected condition that prevented it from fulfilling the request.

list_deployments(status: List[str] | None = None, kind: str | None = None, term: 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, kind: str | None = None, term: 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]]

List all App & Block Deployments ordered by creation date. Returns info on the latest revision of each deployment.

REFERENCE:

🔗 API Documentation

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.

  • kind (str | None) – Return deployments of the kind specified.

  • term (str | None) – Return deployments containing the specified term in name, title, description and summary.

  • 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 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.

  • InternalServerErrorException – The server encountered an unexpected condition that prevented it from fulfilling the request.

  • StopIteration – There are no more pages to list.