Press Blocks

  • Currently supported block kinds are webapps and workflows

Blocks client module.

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

Returns a Block client.

Parameters:

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

Returns:

the Block client object

Return type:

Block

class peak.press.blocks.Block(session=None)

Client class for interacting with Blocks.

Parameters:

session (Session) –

create_deployment(body)

Creates a new deployment from Block spec.

Uses the latest spec release if release version is not provided. For each Block kind, all Deployments must have unique names within a tenant.

REFERENCE:

🔗 API Documentation

Parameters:

body (Dict[str, str]) – Dictionary containing deployment metadata, spec ID, release version (optional, defaults to latest spec release), revision info and parameters that would be used at run-time.

Returns:

ID of the created Block 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",
    },
    "parameters": {
        "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",
        }
    }
}
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 block 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, str]) –

Return type:

Dict[str, str]

create_deployment_revision(deployment_id, body)

Creates a new Revision of a Deployment, from a selected Block Spec Release.

Publish a new revision of a Block Deployment. The payload may 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 spec release.

REFERENCE:

🔗 API Documentation

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 Block deployment, and the new Revision number

Return type:

Dict[str, str]

SCHEMA:
{
    "release": {
        "version": "string"
    },
    "revision": {
        "notes": "string",
    },
    "parameters": {
        "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, str]) –

Return type:

Dict[str, str]

create_spec(body, artifact=None, featured=None, scope=None, tenants=None, parameters=None, auto_run_on_deploy=None)

Create a new Block spec.

For each Block kind, all Specs must have unique names within a tenant.

REFERENCE:

🔗 API Documentation

Parameters:
  • body (Dict[str, Any]) – Dictionary containing Block spec metadata and configuration.

  • artifact (ArtifactInfo | None) – Mapping of artifact attributes that specifies how the artifact will be generated, it accepts two keys path, which is required and ignore_files which is optional, and defaults to .dockerignore, it is strongly advised that users use ignore_files when generating artifacts to avoid copying any extra files in artifact. It is not required if an existing image and version is used for creating the spec.

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

  • auto_run_on_deploy (bool | None) – Whether to execute the resource after the block is deployed. By default it is False.

Returns:

Id of the created block spec.

Return type:

Dict[str, str]

SCHEMA (body):

Information about providing image details in blocks can be found here.

{
    "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",
        "version": "string (required)",
    },
    "config": {
        "images": {
            "image-name": {
                "version": "string",
                "dockerfile": "string",
                "context": "string",
                "useCache": "boolean",
                "buildArguments": {
                    "key (string)": "value (string)"
                },
            }
        },
        "steps": {
            "stepName": {
                "type": "standard",
                "image": {
                    "version": "string",
                    "dockerfile": "string",
                    "context": "string",
                    "useCache": "boolean",
                    "buildArguments": {
                        "key (string)": "value (string)"
                    },
                    "secrets": []
                }
                "imageRef": "string",
                "imageDetails": {
                    "id": "number (required)",
                    "versionId": "number"
                },
                "command": "string (required)",
                "resources": {
                    "instanceTypeId": "number",
                    "storage": "string"
                },
                "parents": [],
                "stepTimeout": "number",
                "clearImageCache": "boolean",
                "repository": {
                    "branch": "string",
                    "token": "string",
                    "url": "string"
                },
                "runConfiguration": {
                    "retryOptions": {
                        "duration": "number",
                        "exitCodes": [],
                        "exponentialBackoff": "boolean",
                        "numberOfRetries": "number"
                    },
                    "skipConfiguration": {
                        "skip": "boolean",
                        "skipDAG": "boolean",
                    }
                },
                "parameters": {
                    "env": {
                        "key (string)": "value (string)"
                    },
                    "secrets": [],
                },
                "outputParameters": {
                    "key (string)": "value (string)"
                },
                "executionParameters": {
                    "conditional": [
                        {
                            "condition": "string",
                            "paramName": "string",
                            "stepName": "string",
                            "value": "string"
                        }
                    ],
                    "parentStatus": [
                        {
                            "condition": "string",
                            "parents": [],
                            "status": []
                        }
                    ]
                }
            },
            "stepName2": {
                "type": "http",
                "method": "enum(get, post, put, patch, delete)",
                "url": "string",
                "payload": "string",
                "headers": {
                    "absolute": {
                        "key (string)": "value (string)"
                    },
                    "secrets": {
                        "key (string)": "value (string)"
                    }
                },
                "auth": {
                    "type": "enum(no-auth, oauth, basic, api-key, bearer-token)(required)",
                    "clientId": "string | required for oauth",
                    "clientSecret": "",
                    "authUrl": "string | required for oauth",
                    "username": "string | required for basic",
                    "password": "",
                    "apiKey": "",
                    "bearerToken": "string | required for bearer-token"
                },
                "parents": [],
                "parameters": {
                    "env": {
                        "key (string)": "value (string)"
                    },
                    "inherit": {
                        "key (string)": "value (string)"
                    },
                    "secrets": [],
                },
                "outputParameters": {
                    "key (string)": "value (string)"
                },
                "executionParameters": {
                    "conditional": [
                        {
                            "condition": "string",
                            "paramName": "string",
                            "stepName": "string",
                            "value": "string"
                        }
                    ],
                    "parentStatus": [
                        {
                            "condition": "string",
                            "parents": [],
                            "status": []
                        }
                    ]
                },
                "runConfiguration": {
                    "retryOptions": {
                        "duration": "number",
                        "exitCodes": [],
                        "exponentialBackoff": "boolean",
                        "numberOfRetries": "number"
                    },
                    "skipConfiguration": {
                        "skip": "boolean",
                        "skipDAG": "boolean",
                    }
                }
            },
            "stepName3": {
                "type": "export",
                "schema": "string (required)",
                "table": "string (required)",
                "sortBy": "string (required)",
                "sortOrder": "enum(asc, desc) | Default is asc",
                "compression": "boolean | Default is false",
                "parents": [],
                "executionParameters": {
                    "conditional": [
                        {
                            "condition": "string",
                            "paramName": "string",
                            "stepName": "string",
                            "value": "string"
                        }
                    ],
                    "parentStatus": [
                        {
                            "condition": "string",
                            "parents": [],
                            "status": []
                        }
                    ]
                },
                "runConfiguration": {
                    "retryOptions": {
                        "duration": "number",
                        "exitCodes": [],
                        "exponentialBackoff": "boolean",
                        "numberOfRetries": "number"
                    },
                    "skipConfiguration": {
                        "skip": "boolean",
                        "skipDAG": "boolean",
                    }
                }
            },
            "stepName4": {
                "type": "sql",
                "sqlQueryPath": "string",
                "repository": {
                    "branch": "string | Required if repository is provided",
                    "token": "string",
                    "url": "string | Required if repository is provided",
                    "filePath": "string | Required if repository is provided"
                }
                "parents": [],
                "parameters": {
                    "env": {
                        "key (string)": "value (string)"
                    },
                    "inherit": {
                        "key (string)": "value (string)"
                    }
                },
                "executionParameters": {
                    "conditional": [
                        {
                            "condition": "string",
                            "paramName": "string",
                            "stepName": "string",
                            "value": "string"
                        }
                    ],
                    "parentStatus": [
                        {
                            "condition": "string",
                            "parents": [],
                            "status": []
                        }
                    ]
                },
                "runConfiguration": {
                    "retryOptions": {
                        "duration": "number",
                        "exitCodes": [],
                        "exponentialBackoff": "boolean",
                        "numberOfRetries": "number"
                    },
                    "skipConfiguration": {
                        "skip": "boolean",
                        "skipDAG": "boolean",
                    }
                }
            }
        },
        "triggers": [
            {
                "cron": "string"
            },
            {
                "webhook": "boolean"
            },
        ],
        "watchers": [
            {
                "events": {
                    "success": "boolean",
                    "fail": "boolean",
                    "runtimeExceeded": "number"
                },
                "user": "string",
            },
            {
                "events": {
                    "success": "boolean",
                    "fail": "boolean",
                    "runtimeExceeded": "number"
                },
                "webhook": {
                    "name": "string(required)",
                    "url": "string(required)",
                    "payload": "string(required)"
                }
            },
            {
                "events": {
                    "success": "boolean",
                    "fail": "boolean",
                    "runtimeExceeded": "number"
                },
                "email": {
                    "name": "string",
                    "recipients": {
                        "to": ["string"]
                    }
                }
            }
        ],
    }
}
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.

  • PayloadTooLargeException – The given artifact size exceeds maximum limit.

  • 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]) –

  • artifact (ArtifactInfo | None) –

  • featured (bool | None) –

  • scope (str | None) –

  • tenants (List[str] | None) –

  • parameters (Dict[str, List[Dict[str, Any]]] | None) –

  • auto_run_on_deploy (bool | None) –

Return type:

Dict[str, str]

create_spec_release(spec_id, body, artifact=None, parameters=None, auto_run_on_deploy=None)

Publish a new release to an existing Block spec.

REFERENCE:

🔗 API Documentation

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.

  • artifact (ArtifactInfo | None) – Mapping of artifact attributes that specifies how the artifact will be generated, it accepts two keys path, which is required and ignore_files which is optional, and defaults to .dockerignore, it is strongly advised that users use ignore_files when generating artifacts to avoid copying any extra files in artifact. It is not required if an existing image and version is used for creating the 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.

  • auto_run_on_deploy (bool | None) – Whether to execute the resource after the block is deployed. By default it is False.

Returns:

Dictionary containing spec id and release version.

Return type:

Dict[str, str]

SCHEMA (body):

Information about providing image details in blocks can be found here.

{
    "release": {
        "notes": "string",
        "version": "string (required)",
    },
    "config": {
        "images": {
            "image-name": {
                "version": "string",
                "dockerfile": "string",
                "context": "string",
                "useCache": "boolean",
                "buildArguments": {
                    "key (string)": "value (string)"
                },
            }
        },
        "steps": {
            "stepName": {
                "type": "string",
                "image": {
                    "version": "string",
                    "dockerfile": "string",
                    "context": "string",
                    "useCache": "boolean",
                    "buildArguments": {
                        "key (string)": "value (string)"
                    },
                    "secrets": []
                }
                "imageRef": "string",
                "imageDetails": {
                    "id": "number (required)",
                    "versionId": "number"
                },
                "command": "string (required)",
                "resources": {
                    "instanceTypeId": "number",
                    "storage": "string"
                },
                "parents": [],
                "stepTimeout": "number",
                "clearImageCache": "boolean",
                "repository": {
                    "branch": "string",
                    "token": "string",
                    "url": "string"
                },
                "runConfiguration": {
                    "retryOptions": {
                        "duration": "number",
                        "exitCodes": [],
                        "exponentialBackoff": "boolean",
                        "numberOfRetries": "number"
                    },
                    "skipConfiguration": {
                        "skip": "boolean",
                        "skipDAG": "boolean",
                    }
                },
                "parameters": {
                    "env": {
                        "key (string)": "value (string)"
                    },
                    "secrets": [],
                },
                "outputParameters": {
                    "key (string)": "value (string)"
                },
                "executionParameters": {
                    "conditional": [
                        {
                            "condition": "string",
                            "paramName": "string",
                            "stepName": "string",
                            "value": "string"
                        }
                    ],
                    "parentStatus": [
                        {
                            "condition": "string",
                            "parents": [],
                            "status": []
                        }
                    ]
                }
            },
            "stepName2": {
                "type": "http",
                "method": "enum(get, post, put, patch, delete)",
                "url": "string",
                "payload": "string",
                "headers": {
                    "absolute": {
                        "key (string)": "value (string)"
                    },
                    "secrets": {
                        "key (string)": "value (string)"
                    }
                },
                "auth": {
                    "type": "enum(no-auth, oauth, basic, api-key, bearer-token)(required)",
                    "clientId": "string | required for oauth",
                    "clientSecret": "",
                    "authUrl": "string | required for oauth",
                    "username": "string | required for basic",
                    "password": "",
                    "apiKey": "",
                    "bearerToken": "string | required for bearer-token"
                },
                "parents": [],
                "parameters": {
                    "env": {
                        "key (string)": "value (string)"
                    },
                    "inherit": {
                        "key (string)": "value (string)"
                    },
                    "secrets": [],
                },
                "outputParameters": {
                    "key (string)": "value (string)"
                },
                "executionParameters": {
                    "conditional": [
                        {
                            "condition": "string",
                            "paramName": "string",
                            "stepName": "string",
                            "value": "string"
                        }
                    ],
                    "parentStatus": [
                        {
                            "condition": "string",
                            "parents": [],
                            "status": []
                        }
                    ]
                },
                "runConfiguration": {
                    "retryOptions": {
                        "duration": "number",
                        "exitCodes": [],
                        "exponentialBackoff": "boolean",
                        "numberOfRetries": "number"
                    },
                    "skipConfiguration": {
                        "skip": "boolean",
                        "skipDAG": "boolean",
                    }
                }
            },
            "stepName3": {
                "type": "export",
                "schema": "string (required)",
                "table": "string (required)",
                "sortBy": "string (required)",
                "sortOrder": "enum(asc, desc) | Default is asc",
                "compression": "boolean | Default is false",
                "parents": [],
                "executionParameters": {
                    "conditional": [
                        {
                            "condition": "string",
                            "paramName": "string",
                            "stepName": "string",
                            "value": "string"
                        }
                    ],
                    "parentStatus": [
                        {
                            "condition": "string",
                            "parents": [],
                            "status": []
                        }
                    ]
                },
                "runConfiguration": {
                    "retryOptions": {
                        "duration": "number",
                        "exitCodes": [],
                        "exponentialBackoff": "boolean",
                        "numberOfRetries": "number"
                    },
                    "skipConfiguration": {
                        "skip": "boolean",
                        "skipDAG": "boolean",
                    }
                }
            },
            "stepName4": {
                "type": "sql",
                "sqlQueryPath": "string",
                "repository": {
                    "branch": "string | Required if repository is provided",
                    "token": "string",
                    "url": "string | Required if repository is provided",
                    "filePath": "string | Required if repository is provided"
                }
                "parents": [],
                "parameters": {
                    "env": {
                        "key (string)": "value (string)"
                    },
                    "inherit": {
                        "key (string)": "value (string)"
                    }
                },
                "executionParameters": {
                    "conditional": [
                        {
                            "condition": "string",
                            "paramName": "string",
                            "stepName": "string",
                            "value": "string"
                        }
                    ],
                    "parentStatus": [
                        {
                            "condition": "string",
                            "parents": [],
                            "status": []
                        }
                    ]
                },
                "runConfiguration": {
                    "retryOptions": {
                        "duration": "number",
                        "exitCodes": [],
                        "exponentialBackoff": "boolean",
                        "numberOfRetries": "number"
                    },
                    "skipConfiguration": {
                        "skip": "boolean",
                        "skipDAG": "boolean",
                    }
                }
            }
        },
        "triggers": [
            {
                "cron": "string"
            },
            {
                "webhook": "boolean"
            }
        ],
        "watchers": [
            {
                "events": {
                    "success": "boolean",
                    "fail": "boolean",
                    "runtimeExceeded": "number"
                },
                "user": "string",
            },
            {
                "events": {
                    "success": "boolean",
                    "fail": "boolean",
                    "runtimeExceeded": "number"
                },
                "webhook": {
                    "name": "string(required)",
                    "url": "string(required)",
                    "payload": "string(required)"
                }
            },
            {
                "events": {
                    "success": "boolean",
                    "fail": "boolean",
                    "runtimeExceeded": "number"
                },
                "email": {
                    "name": "string",
                    "recipients": {
                        "to": ["string"]
                    }
                }
            }
        ],
    }
}
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.

  • PayloadTooLargeException – The given artifact size exceeds maximum limit.

  • 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]) –

  • artifact (ArtifactInfo | None) –

  • parameters (Dict[str, List[Dict[str, Any]]] | None) –

  • auto_run_on_deploy (bool | None) –

Return type:

Dict[str, str]

delete_deployment(deployment_id)

Deletes the Block deployment.

REFERENCE:

🔗 API Documentation

Parameters:

deployment_id (str) – The ID of the Block 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 Block 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 a Block Spec and all it’s associated releases.

REFERENCE:

🔗 API Documentation

Parameters:

spec_id (str) – The ID of the Block spec to delete.

Returns:

Empty dict object.

Return type:

dict

Raises:
  • UnauthorizedException – The credentials are invalid.

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

  • NotFoundException – The given Block 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 Block deployment, also provides details of the latest revision. Parameters listed in the response are masked if “hideValue” was set to true when creating th block spec.

REFERENCE:

🔗 API Documentation

Parameters:

deployment_id (str) – The ID of the Block 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 Block 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 Block deployment revision, Parameters listed in the response are masked if “hideValue” was set to true when creating the block spec.

REFERENCE:

🔗 API Documentation

Parameters:
  • deployment_id (str) – The ID of the Block 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 Block 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 Block spec and also provides details of the latest release.

REFERENCE:

🔗 API Documentation

Parameters:

spec_id (str) – The ID of the block 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 block spec does not exist.

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

describe_spec_release(spec_id, version)

Describe an existing spec release.

REFERENCE:

🔗 API Documentation

Parameters:
  • spec_id (str) – The ID of the block spec to retrieve.

  • version (str) – The release version of spec to retrieve in valid semantic versioning format.

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 block spec does not exist.

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

get_parameters(deployment_id=None, fallback_params_file=None)

Get the parameters for a deployment at run time.

REFERENCE:

🔗 API Documentation

Parameters:
  • deployment_id (str | None) – The ID of the deployment.

  • fallback_params_file (str | None) – Path of the YAML file to be used when deployment_id is not present.

Returns:

Dictionary containing deployment run parameters.

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 deployment does not exist.

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

  • TypeError – Required parameters were not passed or the YAML file is invalid.

  • FileNotFoundError – File specified in fallback_params_file is not present.

Get the info for related blocks within an app.

Parameters:
  • deployment_id (str | None) – The ID of the deployment.

  • fallback_details_file (str | None) – Path of the YAML file to be used when deployment_id is not present. should be a List of Dicts

Returns:

  • “id” (str): The unique identifier of the block

  • ”resource_id” (str | None): The unique identifier of the block’s main platform resource.

    May be None if resource has been manually deleted or is awaiting creation

  • ”kind” (str): The type or category of the resource.

  • ”name” (str): The name of the resource.

  • ”status” (str): The current status of the block. The platform resource status can be inferred from this.

Return type:

A list of dictionaries, where each dictionary represents a block with the following keys

Example return value:
[
    {   "id": "12345",
        "resource_id": "6789",
        "kind": "workflow",
        "name": "my-workflow",
        "status": "deployed",
    },
]
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 does not exist.

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

  • TypeError – The YAML file is invalid.

  • ValueError – The YAML file is empty.

  • FileNotFoundError – File specified in fallback_details_file is not present.

Parameters:
  • deployment_id (str | None) –

  • fallback_details_file (str | None) –

Return type:

List[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[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 a Block deployment ordered by creation date or provided sort key.

REFERENCE:

🔗 API Documentation

Parameters:
  • deployment_id (str) – The ID of the Block 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 Block deployment or revision 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, title: 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, title: 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 Block deployments ordered by creation date.

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.

  • name (str | None) – Only return deployments whose names begins with the query string.

  • title (str | None) – Only return deployments 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. 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 a Block spec (ordered by most recently created to oldest).

REFERENCE:

🔗 API Documentation

Parameters:
  • spec_id (str) – The ID of the Block 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) – 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 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 Block 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 Block specs ordered by creation date. Returns info for the latest release for each spec.

REFERENCE:

🔗 API Documentation

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

patch_parameters(deployment_id, body)

Get the parameters for a deployment at run time.

REFERENCE:

🔗 API Documentation

Parameters:
  • deployment_id (str) – The ID of the deployment.

  • body (Dict[str, Any]) – Dictionary containing the updated parameters.

Returns:

Dictionary containing the updated parameters.

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 deployment does not exist.

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

redeploy(deployment_id)

Redeploy latest revision of an existing Block deployment.

This function allows you to redeploy a Block deployment that is in failed or warning state.

REFERENCE:

🔗 API Documentation

Parameters:

deployment_id (str) – The ID of the Block deployment to redeploy.

Returns:

A dictionary containing details of the deployment.

Return type:

Dict[str, Any]

Raises:
  • BadRequestException – The given parameters are invalid.

  • ConflictException – There is a conflict with the current state of the target resource.

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

  • NotFoundException – The given block deployment or its revisions do not exist.

  • UnauthorizedException – The credentials are invalid.

update_deployment_metadata(deployment_id, body)

Update the metadata of the Block deployment.

REFERENCE:

🔗 API Documentation

Parameters:
  • deployment_id (str) – ID of the Block deployment to update.

  • body (Dict[str, Any]) – 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 block 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:
  • deployment_id (str) –

  • body (Dict[str, Any]) –

Return type:

Dict[None, None]

update_spec_metadata(spec_id, body)

Update the metadata and discoverability of a Block Spec.

REFERENCE:

🔗 API Documentation

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 block 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]) –

Return type:

Dict[None, None]