Press Specs

Import the press spec module and Instantiate a press-spec client

[ ]:
from collections.abc import Iterator
from typing import Any

from peak.press import specs

client: specs.Spec = specs.get_client()

Possible field values

Spec kind

The kind of the spec. The following kinds are supported: app, workflow and service.

Scope

The scope of the app or block spec. The following scopes are supported: private, public, and shared.

Spec status

The status of the app or block specs. The following statuses are supported: available, unavailable, and archived.

Deployment status

The status of the app or block deployments. The following statuses are supported: deployed, deploying, failed, redeploying, deleting, delete_failed, platform_resource_error, rollback, rollback_complete, rollback_failed and warning.

List all app spec(s) and block spec(s) and iterate over them

[ ]:
spec_iterator: Iterator[dict[str, Any]] = client.list_specs()
spec_iterated: dict[str, Any] = next(spec_iterator)

"""
This method returns all the app and block specs that are available in the tenant.
The list of specs will be returned in the following format:

{
  "pageCount": 1,
  "pageNumber": 1,
  "pageSize": 25,
  "specCount": 2,
  "specs": [
    {
      "featured": false,
      "id": "0bddb4c6-40c5-45c3-b477-fceb2c051609",
      "kind": "workflow",
      "latestRelease": {
        "createdAt": "2020-01-01T18:00:00.000Z",
        "createdBy": "jane.smith@peak.ai",
        "id": "df113d64-ff44-4aa0-9278-edb03dae7a3f",
        "notes": "This is the original release",
        "version": "1.0.0"
      },
      "metadata": {
        "createdAt": "2020-01-01T18:00:00.000Z",
        "createdBy": "jane.smith@peak.ai",
        "description": "This Workflow loads Opportunities and Accounts table from Salesforce into Peak-managed Snowflake.",
        "descriptionContentType": "text/markdown",
        "imageUrl": "https://my-block-pics.com/image-0.jpg",
        "name": "load-salesforce-objects",
        "status": "available",
        "summary": "Load Opportunities and Accounts table from Salesforce.",
        "tags": [
          {
            "name": "salesforce"
          }
        ],
        "title": "Load Salesforce Objects",
        "updatedAt": "2020-01-01T18:00:00.000Z",
        "updatedBy": "jane.smith@peak.ai"
      },
      "scope": "private",
      "tenants": []
    }
  ]
}
"""

List all deployment(s) for an existing app-spec release

Returns all deployment(s) for the app-spec release.

[ ]:
all_spec_release_deployments: dict[str, Any] = client.list_spec_release_deployments(
    spec_id="12a345-1234-47ae-a6c3-bea7f7cafe64",
    version="2.0.0",
    sort=["name"],
    page_size=10,
)

"""
This method returns all the deployments of the provided spec. If release version is not provided, the deployments of all the releases of the spec will be returned.
The deployments will be returned in the following format:

{
  "deploymentCount": 1,
  "deployments": [
    {
      "id": "db283fc2-9164-4027-b09e-8c1ecedb122b",
      "kind": "app",
      "latestRevision": {
        "createdAt": "2020-01-01T18:00:00.000Z",
        "createdBy": "jane.smith@peak.ai",
        "id": "2fa92990-3183-40fd-8c93-7ded5a99f705",
        "notes": "This is the initial revision",
        "releaseVersion": "1.0.0",
        "revision": 1,
        "status": "deploying"
      },
      "metadata": {
        "createdAt": "2020-01-01T18:00:00.000Z",
        "createdBy": "jane.smith@peak.ai",
        "description": "This App loads Opportunities and Accounts tables from Salesforce into Peak-managed Snowflake. It then runs a modelling pipeline to predict account churn. Finally it sets up an analytics dashboard for tracking customer behaviours including churn propensity.",
        "descriptionContentType": "text/markdown",
        "imageUrl": "https://my-spec-pics.com/image-1.jpg",
        "name": "sca-deployment",
        "status": "deploying",
        "summary": "This app packages up Block specs to enable analyses on salesforce customers",
        "tags": [
          {
            "name": "salesforce"
          }
        ],
        "title": "SCA Deployment",
        "updatedAt": "2020-01-01T18:00:00.000Z",
        "updatedBy": "jane.smith@peak.ai"
      }
    }
  ],
  "pageCount": 1,
  "pageNumber": 1,
  "pageSize": 25
}
"""