Interface¶
The interface module provides the public API for the Kelvin SDK CLI. It serves as a clean abstraction layer between the CLI commands and the underlying library implementations.
All functions in this module are designed to be user-facing and include runtime type checking via typeguard.
Kelvin SDK Interface.
This module provides the public API for interacting with the Kelvin SDK, including functions for application management, authentication, configuration, secrets, workloads, and system reporting.
The interface layer wraps the underlying library implementations and provides a clean, user-facing API with type checking via typeguard.
App Interface¶
Functions for building, testing, and managing local applications.
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.interface.app.app_create_from_parameters(app_dir, app_name, app_description, app_type, app_flavour, kelvin_app_lang)[source]¶
The entry point for the creation of an application. (Parameters)
Creates the directory that will contain the app app.
Creates all necessary base files for the development of the app.
Parameters¶
- app_dir: str
the app’s targeted dir. Will contain all the application files.
- app_name: str
the name of the new app.
- app_description: str
the description of the new app.
- app_type: ProjectType, optional
the type of the new application. # E.g. ‘docker’, ‘kelvin’.
- app_flavour: ApplicationFlavour, optional
the flavour of the new application. # E.g. ‘default’, ‘injector’, ‘extractor’.
- kelvin_app_lang: ApplicationLanguage, optional
the language the new app will be written on. For kelvin apps only. # E.g. python.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object wrapping the result of the creation of the application.
- rtype:
- Parameters:
app_dir (str)
app_name (str)
app_description (str)
app_type (ProjectType)
app_flavour (ApplicationFlavour)
kelvin_app_lang (ApplicationLanguage)
- Return type:
- kelvin.sdk.interface.app.app_create(project_creation_parameters)[source]¶
The entry point for the creation of an application. (Parameters)
Creates the directory that will contain the app app.
Creates all necessary base files for the development of the app.
Parameters¶
- project_creation_parameters: ProjectCreationParametersObject
the object containing all the required variables for App creation.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object wrapping the result of the creation of the application.
- rtype:
- Parameters:
project_creation_parameters (ProjectCreationParametersObject)
- Return type:
- kelvin.sdk.interface.app.app_config(app_config_file_path)[source]¶
Yields the loaded json/dict for the provided configuration file path. (Parameters)
- Return type:
- Parameters:
app_config_file_path (str)
Parameters¶
- app_config_file_path: str
the object containing all the required variables for App creation.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object wrapping the json of the app configuration file.
- kelvin.sdk.interface.app.app_build(app_dir, fresh_build=False, build_args={}, archs=[], skip_schema_validation=False)[source]¶
The entry point for the building of an App.
Package the App on the provided app directory.
- Return type:
- Parameters:
Parameters¶
- app_dir: str
The path where the application is hosted.
- fresh_build: bool
If specified, will remove any cache and rebuild the application from scratch.
- build_args: Dict[str, str]
Key-value pairs of build arguments for the application.
- archs: List[str]
A list of architectures to build for.
- skip_schema_validation: bool
If specified, will skip schema validation during the build process.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
An OperationResponse object wrapping the result of the application build process.
- kelvin.sdk.interface.app.app_images_list(should_display=False)[source]¶
Retrieve the list of all application images available on the local registry.
- Return type:
- Parameters:
should_display (bool)
Parameters¶
- should_display: bool
specifies whether or not output data should be displayed.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object wrapping the app images available on the local registry.
- kelvin.sdk.interface.app.app_image_remove(app_name_with_version)[source]¶
Remove the specified application from the existing image list (in the docker instance).
- Return type:
- Parameters:
app_name_with_version (str)
Parameters¶
- app_name_with_version: str
the app to be removed. Must include the version.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object wrapping the result of the application image removal operation.
- kelvin.sdk.interface.app.app_image_unpack(app_name_with_version, container_dir, output_dir)[source]¶
Extract the content of an application from its built image.
- Return type:
- Parameters:
Parameters¶
- app_name_with_version: str
the name of the image to unpack the app from.
- container_dir: str
The directory to extract from the container.
- output_dir: str
the output directory to output the extracted content.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object wrapping the result of the application image unpack operation.
Apps Interface¶
Functions for interacting with the platform’s Application Registry.
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.interface.apps.apps_list(should_display=False)[source]¶
Returns the list of apps on the registry.
- Return type:
- Parameters:
should_display (bool)
Parameters¶
- should_display: bool
specifies whether or not the display should output data.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the Applications available on the platform.
- kelvin.sdk.interface.apps.apps_search(query, should_display=False)[source]¶
Search for apps on the registry that match the provided query.
- Return type:
- Parameters:
Parameters¶
- query: str
the query to search for.
- should_display: bool
specifies whether or not the display should output data.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the matching Applications available on the platform.
- kelvin.sdk.interface.apps.apps_show(app_name, should_display=False)[source]¶
Returns detailed information on the specified application.
- Return type:
- Parameters:
Parameters¶
- app_name: str
the name with version of the app.
- should_display: bool
specifies whether or not the display should output data.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the yielded Application instance and its data.
- kelvin.sdk.interface.apps.apps_upload(app_dir, 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: str
the path to the application’s dir.
- multiarch: bool
If specified, will try to build the application for multiple architectures.
- skip_schema_validation: bool
If specified, will skip schema validation during the upload process.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the upload operation.
- rtype:
- kelvin.sdk.interface.apps.apps_download(app_name_with_version, tag_local_name=True)[source]¶
Downloads the specified application from the platform’s app registry.
- Return type:
- Parameters:
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 (no registry).
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the app download operation.
- kelvin.sdk.interface.apps.apps_delete(app_name_with_version, ignore_destructive_warning=False)[source]¶
Deletes the specified application the platform’s app registry.
- Return type:
- Parameters:
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¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the app deletion operation.
Authentication Interface¶
Functions for authentication and session management.
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.interface.authentication.reset()[source]¶
Reset all authentication credentials and configuration cache.
- Return type:
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the credentials reset.
- kelvin.sdk.interface.authentication.logout(ignore_destructive_warning=False)[source]¶
Logs off the client all currently stored sessions.
- Return type:
- Parameters:
ignore_destructive_warning (bool)
Parameters¶
- ignore_destructive_warning: bool
indicates whether it should ignore the destructive warning.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the logout request.
- kelvin.sdk.interface.authentication.authentication_token(full=False, margin=10.0)[source]¶
Obtain an authentication authentication_token from the API.
- Return type:
- Parameters:
Parameters¶
- full: bool
return the full authentication_token.
- margin: float
minimum time to expiry.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the authentication token.
Configuration Interface¶
Functions for managing local SDK configurations.
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.interface.configuration.global_configuration_list(should_display=False)[source]¶
List all available configurations for the Kelvin-SDK
- Return type:
- Parameters:
should_display (bool)
Parameters¶
- should_display: bool, Default=False
specifies whether or not the display should output data.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the yielded Kelvin tool configurations.
- kelvin.sdk.interface.configuration.global_configuration_set(configuration, value)[source]¶
Set the specified configuration on the platform system.
- Return type:
- Parameters:
Parameters¶
- configuration: str
the configuration to change.
- value: str
the value that corresponds to the provided config.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result the configuration set operation.
- kelvin.sdk.interface.configuration.global_configuration_unset(configuration)[source]¶
Unset the specified configuration from the platform system
- Return type:
- Parameters:
configuration (str)
Parameters¶
- configuration: str
the configuration to unset.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result the configuration unset operation.
- kelvin.sdk.interface.configuration.configuration_autocomplete(shell_type)[source]¶
Generate completion commands for shell.
- kelvin.sdk.interface.configuration.full_reset(ignore_destructive_warning=False)[source]¶
Reset all configurations & cache used by Kelvin SDK.
- Return type:
- Parameters:
ignore_destructive_warning (bool)
Parameters¶
- ignore_destructive_warningbool
indicates whether or not the command should bypass the destructive prompt warning.
Returns¶
- OperationResponse
an OperationResponse encapsulating the result of the reset operation.
Secret Interface¶
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.interface.secret.secret_create(secret_name, value)[source]¶
Create a secret on the platform.
- Return type:
- Parameters:
Parameters¶
- secret_name: str
The name of the secret to create.
- value: str
The value corresponding to the secret.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the secrets creation operation.
- kelvin.sdk.interface.secret.secret_list(query=None, should_display=False)[source]¶
List all the available secrets on the Platform.
- Return type:
- Parameters:
Parameters¶
- query: Optional[str]
The query to filter the secrets by.
- should_display: bool, Default=False
specifies whether or not the display should output data.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the secrets available on the platform.
- kelvin.sdk.interface.secret.secret_delete(secret_names, ignore_destructive_warning=False)[source]¶
Delete secrets on the platform.
- Return type:
- Parameters:
Parameters¶
- secret_names: Sequence[str]
The names of the secrets to delete.
- ignore_destructive_warning: bool, Default=False
indicates whether it should ignore the destructive warning.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the secrets deletion operation.
- kelvin.sdk.interface.secret.secret_update(secret_name, value)[source]¶
Update an existing secret on the platform.
- Return type:
- Parameters:
Parameters¶
- secret_name: str
The name of the secret to update.
- value: str
The new value for the secret.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the secret update operation.
Workload Interface¶
Functions for managing workloads 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.interface.workload.workload_list(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:
- Parameters:
node_name (str | None)
app_name (str | None)
source (StatusDataSource)
should_display (bool)
Parameters¶
- node_nameOptional[str]
the name of the node to filter the workloads.
- app_nameOptional[str]
the name of the app to filter the workloads.
- enabledbool, Default=None
indicates whether it should filter workloads by their status.
- sourceStatusDataSource, Default=StatusDataSource.CACHE
the status data source from where to obtain data.
- should_displaybool, Default=False
specifies whether or not the display should output data.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
An OperationResponse object encapsulating the workloads available on the platform.
- kelvin.sdk.interface.workload.workload_search(query, source=StatusDataSource.CACHE, should_display=False)[source]¶
Search for workloads matching the provided query.
- Return type:
- Parameters:
query (str)
source (StatusDataSource)
should_display (bool)
Parameters¶
- query: str
the query to search for.
- source: StatusDataSource, Default=StatusDataSource=StatusDataSource.CACHE
the status data source from where to obtain data.
- should_display: bool, Default=False
specifies whether or not the display should output data.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the workload search on the platform.
- kelvin.sdk.interface.workload.workload_show(workload_name, source=StatusDataSource.CACHE, should_display=False)[source]¶
Show the details of the specified workload.
- Return type:
- Parameters:
workload_name (str)
source (StatusDataSource)
should_display (bool)
Parameters¶
- workload_name: str
the name of the workload.
- source: Default=StatusDataSource=StatusDataSource.CACHE
the status data source from where to obtain data.
- should_display: bool, Default=False
specifies whether or not the display should output data.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the yielded workload and its data.
- kelvin.sdk.interface.workload.workload_deploy(workload_deployment_request)[source]¶
Deploy a workload from the specified deploy request.
- Return type:
- Parameters:
workload_deployment_request (WorkloadDeploymentRequest)
Parameters¶
- workload_deployment_request: WorkloadDeploymentRequest
the deployment object that encapsulates all the necessary parameters for deploy.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the workload deploy operation.
- kelvin.sdk.interface.workload.workload_update(update_request)[source]¶
Update an existing workload with the new parameters.
- Return type:
- Parameters:
update_request (WorkloadUpdateRequest)
Parameters¶
- workload_name: str
the name for the workload to update.
- workload_title: Optional[str]
the title for the workload.
- app_config: str
the path to the app configuration file.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the workload update operation.
- kelvin.sdk.interface.workload.workload_logs(workload_name, tail_lines, output_file, follow)[source]¶
Show the logs of a deployed workload.
- Return type:
- Parameters:
Parameters¶
- workload_name: str
the name of the workload.
- tail_lines: int
the number of lines to retrieve on the logs request.
- output_file: Optional[str]
the file to output the logs into.
- follow: bool
a flag that indicates whether it should trail the logs, constantly requesting for more logs.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the logs of the workload.
- kelvin.sdk.interface.workload.workload_undeploy(workload_name, ignore_destructive_warning)[source]¶
Stop and delete a workload on the platform.
- Return type:
- Parameters:
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¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the workload undeploy operation.
- kelvin.sdk.interface.workload.workload_start(workload_name)[source]¶
Start the provided workload.
- Return type:
- Parameters:
workload_name (str)
Parameters¶
- workload_name: str
the workload to start on the platform.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the workload start operation.
- kelvin.sdk.interface.workload.workload_stop(workload_name, ignore_destructive_warning)[source]¶
Stop the provided workload.
- Return type:
- Parameters:
Parameters¶
- workload_name: str
the workload to stop on the platform.
- ignore_destructive_warning: bool
indicates whether it should ignore the destructive warning.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the workload stop operation.
Schema Interface¶
Functions for schema validation and management.
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.interface.schema.schema_validate(file_path, schema_file_path, full_schema_errors=False)[source]¶
Validate a file against a schema.
- Return type:
- Parameters:
Parameters¶
- file_path: str
The path to the file to validate.
- schema_file_path: Optional[str]
The path to the schema file to validate the file against.
- full_schema_errors: bool, Default=False
Indicates whether or not it should log the complete stack trace.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the result of the file schema validation.
- kelvin.sdk.interface.schema.schema_get(schema_file_path)[source]¶
Yield the the content of a schema.
- Return type:
- Parameters:
schema_file_path (str | None)
Parameters¶
- schema_file_path: Optional[str]
The path to the schema file to yield.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the contents of the schema file.
System Report Interface¶
Functions for generating system reports and diagnostics.
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.interface.system_report.kelvin_support_report(app_config=None, generate_report_file=True)[source]¶
Report the user’s system information and log records for support purposes.
- Return type:
- Parameters:
Parameters¶
- app_config: Optional[str]
the path to the application’s configuration file.
- generate_report_file: bool, Default=True
if set to true, will generate the report file to the default location.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating the host machine’s system report.
- kelvin.sdk.interface.system_report.kelvin_system_information(display=True, log_type=LogType.KSDK)[source]¶
Report the entire configuration set currently in use by Kelvin SDK.
- Return type:
- Parameters:
Parameters¶
- displaybool
indicates whether the information should be logged
- log_typeLogType
the output log type of the output type. Applicable only if ‘display’ is true and for display purposes.
Returns¶
- kelvin.sdk.lib.models.operation.OperationResponse
an OperationResponse object encapsulating provided system information and the currently logged platform.