API

The API module provides wrapper functions for interacting with Kelvin platform services. These functions handle the communication with the Kelvin API and provide convenient interfaces for common operations.

Apps

Functions for managing applications on the Kelvin platform.

Copyright 2021 Kelvin Inc.

Licensed under the Kelvin Inc. Developer SDK License Agreement (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.kelvininc.com/developer-sdk-license

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

kelvin.sdk.lib.api.apps.apps_list(query=None, should_display=False)[source]

Search for apps on the registry that match the provided query.

Return type:

OperationResponse

Parameters:
  • query (str | None)

  • should_display (bool)

Parameters

query: Optional[str]

the query to search for.

should_display: bool

specifies whether or not the display should output data.

Returns

OperationResponse

an OperationResponse object encapsulating the matching Applications available on the platform.

kelvin.sdk.lib.api.apps.apps_show(app_name, should_display=False)[source]

Returns detailed information on the specified application.

Return type:

OperationResponse

Parameters:
  • app_name (str)

  • should_display (bool)

Parameters

app_name: str

the name with version of the application.

should_display: bool

specifies whether or not the display should output data.

Returns

OperationResponse

an OperationResponse object encapsulating the yielded application instance and its data.

kelvin.sdk.lib.api.apps.apps_delete(app_name_with_version, ignore_destructive_warning=False)[source]

Deletes the specified application the platform’s app registry.

Return type:

OperationResponse

Parameters:
  • app_name_with_version (str)

  • ignore_destructive_warning (bool)

Parameters

app_name_with_version: str

the name with version of the app to be deleted.

ignore_destructive_warning: bool

indicates whether it should ignore the destructive warning.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the app deletion operation.

kelvin.sdk.lib.api.apps.inject_alternative_app_config(app_manifest, alternative_config)[source]
Return type:

AppManifest

Parameters:
  • app_manifest (AppManifest)

  • alternative_config (KPath)

kelvin.sdk.lib.api.apps.apps_upload(app_dir_path, build_args={}, archs=[], skip_schema_validation=False)[source]

Uploads the specified application to the platform.

  • Packages the app

  • Pushes the app to the docker registry

  • Publishes the app on the apps endpoint.

Parameters

app_dir_path: str

the path to the application’s dir.

build_args: Dict[str, str]

Build arguments to pass to the docker build command.

archsList[str]

A list of architectures to build for.

skip_schema_validation: bool

If specified, will skip schema validation during the upload process.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the upload operation.

rtype:

OperationResponse

Parameters:
Return type:

OperationResponse

kelvin.sdk.lib.api.apps.apps_download(app_name_with_version, tag_local_name=True)[source]

Downloads the specified application from the platform’s app registry.

Return type:

OperationResponse

Parameters:
  • app_name_with_version (str)

  • tag_local_name (bool)

Parameters

app_name_with_version: str

the app with version to be downloaded.

tag_local_name: bool

specifies whether or not the local name should be tagged.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the app download operation.

kelvin.sdk.lib.api.apps.retrieve_apps_data(query=None, should_display=True)[source]

Centralize the call to list applications. Retrieve all applications that match the provided criteria and yield the result.

Return type:

DisplayObject

Parameters:
  • query (str | None)

  • should_display (bool)

Parameters

query: Optional[str]

the query to search specific applications.

should_display: bool

if specified, will display the results of this retrieve operation.

Returns

DisplayObject

a DisplayObject containing the applications.

App Workloads

Functions for managing application workloads, including deployment, monitoring, and log retrieval.

Copyright 2021 Kelvin Inc.

Licensed under the Kelvin Inc. Developer SDK License Agreement (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.kelvininc.com/developer-sdk-license

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

kelvin.sdk.lib.api.app_workloads.workload_list(query=None, node_name=None, app_name=None, source=StatusDataSource.CACHE, should_display=False)[source]

Returns the list of workloads filtered any of the arguments.

Return type:

OperationResponse

Parameters:

Parameters

query: Optional[str]

the query to search for.

node_nameOptional[str]

the name of the node to filter the workloads.

app_nameOptional[str]

the name of the app to filter the workloads.

sourceStatusDataSource

the status data source from where to obtain data.

should_displaybool

specifies whether or not the display should output data.

Returns

OperationResponse

An OperationResponse object encapsulating the workloads available on the platform.

kelvin.sdk.lib.api.app_workloads.workload_show(workload_name, source, should_display=False)[source]

Show the details of the specified workload.

Return type:

OperationResponse

Parameters:

Parameters

workload_name: str

the name of the workload.

source: StatusDataSource

the status data source from where to obtain data.

should_display: bool

specifies whether or not the display should output data.

Returns

OperationResponse

an OperationResponse object encapsulating the yielded workload and its data.

kelvin.sdk.lib.api.app_workloads.workload_deploy(deployment)[source]

Deploy a workload from the specified deploy request.

Return type:

OperationResponse

Parameters:

deployment (WorkloadDeploymentRequest)

Parameters

deployment: WorkloadDeploymentRequest

the deployment object that encapsulates all the necessary parameters for deploy.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the workload deploy operation.

kelvin.sdk.lib.api.app_workloads.workload_update(update_request)[source]

Update an existing workload with the new parameters.

Return type:

OperationResponse

Parameters:

update_request (WorkloadUpdateRequest)

Parameters

update: WorkloadDeploymentRequest

the update object that encapsulates all the necessary parameters for deploy.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the workload update operation.

kelvin.sdk.lib.api.app_workloads.workload_logs(workload_name, tail_lines, follow, output_file=None)[source]

Show the logs of a deployed workload.

Return type:

OperationResponse

Parameters:
  • workload_name (str)

  • tail_lines (int | None)

  • follow (bool)

  • output_file (str | None)

Parameters

workload_name: str

the name of the workload.

tail_lines: str

the number of lines to retrieve on the logs request.

output_file: bool

the file to output the logs into.

follow: Optional[str]

a flag that indicates whether it should trail the logs, constantly requesting for more logs.

Returns

OperationResponse

an OperationResponse object encapsulating the logs of the workload.

kelvin.sdk.lib.api.app_workloads.workload_undeploy(workload_name, ignore_destructive_warning=False)[source]

Stop and delete a workload on the platform.

Return type:

OperationResponse

Parameters:
  • workload_name (str)

  • ignore_destructive_warning (bool)

Parameters

workload_name: str

the name of the workload to be stopped and deleted.

ignore_destructive_warning: bool

indicates whether it should ignore the destructive warning.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the workload undeploy operation.

kelvin.sdk.lib.api.app_workloads.workload_start(workload_name)[source]

Start the provided workload.

Return type:

OperationResponse

Parameters:

workload_name (str)

Parameters

workload_name: str

the workload to start on the platform.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the workload start operation.

kelvin.sdk.lib.api.app_workloads.workload_stop(workload_name, ignore_destructive_warning=False)[source]

Stop the provided workload.

Return type:

OperationResponse

Parameters:
  • workload_name (str)

  • ignore_destructive_warning (bool)

Parameters

workload_name: str

the workload to stop on the platform.

ignore_destructive_warning: bool

indicates whether it should ignore the destructive warning.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the workload stop operation.

kelvin.sdk.lib.api.app_workloads.retrieve_workload_and_workload_status_data(query=None, app_name=None, app_version=None, node_name=None, source=StatusDataSource.CACHE, should_display=True)[source]

Centralize all calls to workloads. First, retrieve all workloads that match the provided criteria. Second, retrieve all workload status. Last, merge both results and yield the result.

Return type:

DisplayObject

Parameters:

Parameters

node_name: Optional[str]

the name of the node to filter the workloads.

app_name: Optional[str]

the name of the app to filter the workloads.

app_version: Optional[str]

the version of the app to filter the workloads.

query: Optional[str]

the query to query specific workloads.

source: StatusDataSource

the status data source from where to obtain data.

should_display: bool

if specified, will display the results of this retrieve operation.

Returns

DisplayObject

a DisplayObject containing the workload and respective status data.

Secrets

Functions for managing secrets on the platform.

Copyright 2021 Kelvin Inc.

Licensed under the Kelvin Inc. Developer SDK License Agreement (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.kelvininc.com/developer-sdk-license

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

kelvin.sdk.lib.api.secret.secret_create(secret_name, value)[source]

Create a secret on the platform.

Return type:

OperationResponse

Parameters:
  • secret_name (str)

  • value (str)

Parameters

secret_name: str

The name of the secret to create.

value: str

The value corresponding to the secret.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the secrets creation operation.

kelvin.sdk.lib.api.secret.secret_list(query, should_display=False)[source]

List all the available secrets on the Platform.

Return type:

OperationResponse

Parameters:
  • query (str | None)

  • should_display (bool)

Parameters

query: Optional[str]

The query to filter the secrets by.

should_display: bool

specifies whether or not the display should output data.

Returns

OperationResponse

an OperationResponse object encapsulating the secrets available on the platform.

kelvin.sdk.lib.api.secret.secret_delete(secret_names, ignore_destructive_warning=False)[source]

Delete secrets on the platform.

Return type:

OperationResponse

Parameters:

Parameters

secret_names: Sequence[str]

The names of the secrets to delete.

ignore_destructive_warning: bool

indicates whether it should ignore the destructive warning.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the secrets deletion operation.

kelvin.sdk.lib.api.secret.secret_update(secret_name, value)[source]

Update an existing secret on the platform.

Return type:

OperationResponse

Parameters:
  • secret_name (str)

  • value (str)

Parameters

secret_name: str

The name of the secret to update.

value: str

The new value for the secret.

Returns

OperationResponse

an OperationResponse object encapsulating the result of the secret update operation.