Services¶
The services module provides core service implementations for the CLI, including authentication, session management, Docker integration, and more.
Exceptions¶
Custom exceptions used throughout the SDK.
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.
- exception kelvin.sdk.lib.exceptions.KSDKException(message='')[source]¶
Bases:
ExceptionBase KSDK Exception
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.KSDKFatal(message='')[source]¶
Bases:
KSDKExceptionRaised when a fatal error occurs and the program cannot continue.
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.AppException(message='')[source]¶
Bases:
KSDKExceptionRaised when the a generic process fails.
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.AppNameIsInvalid(message='')[source]¶
Bases:
KSDKExceptionRaised when the provided application name is not valid (either a tuple or a different type)
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.KDockerException(message='')[source]¶
Bases:
KSDKExceptionRaised when there is an issue with Docker.
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.DependencyNotRunning(message='')[source]¶
Bases:
KSDKExceptionRaised when a dependency is not running.
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.DependencyNotInstalled(message='')[source]¶
Bases:
KSDKExceptionRaised when a dependency is not installed.
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.DataTypeException(message='')[source]¶
Bases:
KSDKExceptionRaised when a process related to Datatype fails.
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.DataTypeNameIsInvalid(message='')[source]¶
Bases:
KSDKExceptionRaised when the provided datatype name is not valid (either a tuple or a different type)
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.EmulationException(message='')[source]¶
Bases:
KSDKExceptionRaised when an Emulation process fails.
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.InvalidBaseImageException(registry_url, docker_image_name)[source]¶
Bases:
KSDKExceptionRaised when the provided docker image is not valid/supported by the current system.
- exception kelvin.sdk.lib.exceptions.InvalidApplicationConfiguration(message='')[source]¶
Bases:
KSDKExceptionRaised when the provided application configuration is not valid.
- Parameters:
message (str)
- exception kelvin.sdk.lib.exceptions.MandatoryConfigurationsException(validation_error, message=None)[source]¶
Bases:
KSDKExceptionRaised when a mandatory configuration is missing from the metadata.
- Parameters:
validation_error (ValidationError | None)
message (str | None)
- exception kelvin.sdk.lib.exceptions.InvalidSchemaVersionException(min_version, current_version, latest_version)[source]¶
Bases:
KSDKExceptionRaised when the schema version does not match the pre-established values.
- exception kelvin.sdk.lib.exceptions.MissingTTYException(message='')[source]¶
Bases:
KSDKExceptionRaised when tty interaction is not available
- Parameters:
message (str)
Authentication¶
Credential Manager¶
Manages user credentials and secure storage.
- class kelvin.sdk.lib.auth.credential_storage.TokenCredentials(access_token, access_expires_at, refresh_token=None, refresh_expires_at=None)[source]¶
Bases:
object- Parameters:
- class kelvin.sdk.lib.auth.credential_storage.CredentialStorage[source]¶
Bases:
object- KEYRING_SERVICE_NAME = 'kelvin:kelvin-sdk'¶
- EXPIRATION_THRESHOLD = 60¶
- store_credentials(url, oauth_tokens)[source]¶
Store OAuth tokens in keyring.
- Return type:
- Parameters:
Parameters¶
- urlstr
The platform URL to associate with these credentials
- oauth_tokensDict
OAuth token response containing access_token, expires_in, refresh_token, refresh_expires_in, etc.
Session¶
Session Manager¶
Manages user sessions and API client connections.
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.
- class kelvin.sdk.lib.session.session_manager.Server(request, client_address, server)[source]¶
Bases:
BaseHTTPRequestHandler- log_message(format, *args)[source]¶
Log an arbitrary message.
This is used by all other logging functions. Override it if you have specific logging wishes.
The first argument, FORMAT, is a format string for the message to be logged. If the format string contains any % escapes requiring parameters, they should be specified as subsequent arguments (it’s just like printf!).
The client ip and current date/time are prefixed to every message.
Unicode control characters are replaced with escaped hex before writing the output to stderr.
- class kelvin.sdk.lib.session.session_manager.SessionManager[source]¶
Bases:
object- reset_session(full_reset=False, ignore_destructive_warning=False)[source]¶
Logs off the client all currently stored sessions.
- Return type:
- Parameters:
Parameters¶
- full_reset: bool, default=False
Indicates whether it should proceed with a full reset.
- ignore_destructive_warning: bool, default=False
Ignore_destructive_warning: indicates whether it should ignore the destructive warning.
Returns¶
- OperationResponse
An OperationResponse object encapsulating the result of the logout request.
- reset_session_tokens(url=None)[source]¶
Reset stored tokens for the specified url.
Parameters¶
- url: str, optional
The url to reset tokens for. If None, resets tokens for the current session.
- logout_from_url(url=None)[source]¶
Logout from the specified url.
Parameters¶
- url: str, optional
The url to logout from. If None, logs out from the current session.
- 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.
- login_with_stored_credentials(url)[source]¶
Logs the user into the provided url using stored credentials.
Parameters¶
- url: str
The url to log on.
Returns¶
- bool
True if login was successful, False otherwise.
- login_on_url(url, username=None, password=None, totp=None, client_id=None, client_secret=None, reset=False)[source]¶
Logs the user into the provided url.
- Return type:
- Parameters:
Parameters¶
- url: str, optional
The url to log on.
- username: str, optional
The username of the client site.
- password: str, optional
The password corresponding to the username.
- browser: bool, default=False
If set, opens a browser window to proceed with the authentication.
- reset: bool, default=False
If set to True, will clear the existing configuration prior to the new session.
Returns¶
- OperationResponse
An OperationResponse object encapsulating the result of the authentication request.
- login_client_on_current_url(verbose=True)[source]¶
Login process
- Return type:
Client- Parameters:
verbose (bool)
- check_token_expiration(url, tokens)[source]¶
Check if the token is expired and refresh if needed.
- Return type:
- Parameters:
url (str)
tokens (TokenCredentials)
Parameters¶
- url: str
The platform URL.
- tokens: TokenCredentials
The current token credentials.
- authentication_token(full, margin=10.0)[source]¶
Obtain an authentication authentication_token from the API.
- Return type:
- Parameters:
- get_global_ksdk_configuration()[source]¶
Attempt to retrieve the KelvinSDKGlobalConfiguration from specified file path.
- Return type:
Returns¶
- KelvinSDKGlobalConfiguration
A KelvinSDKGlobalConfiguration object corresponding to the current configuration.
- get_documentation_link_for_current_url()[source]¶
Retrieve, if existent, the complete url to the documentation page.
- get_kelvin_system_information_for_display()[source]¶
Display system information as well as, if existent, the current session’s url.
- Return type:
- get_kelvin_system_information()[source]¶
Report the entire configuration set currently in use by Kelvin SDK.
- Return type:
- refresh_metadata(url)[source]¶
Refresh metadata on request.
- Return type:
SyncMetadata- Parameters:
url (str)
- setup_logger(verbose=False, colored_logs=True)[source]¶
Sets up the logger based on the verbose flag.
Parameters¶
- verbosebool
the flag indicating whether it should setup the logger in verbose mode.
- colored_logs: bool, Default=False
Indicates whether all logs should be colored and ‘pretty’ formatted.
Returns¶
- Any
the setup logger.
- 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=True
specifies whether or not the display should output data.
Returns¶
- OperationResponse
An OperationResponse object encapsulating the yielded Kelvin tool configurations.
- 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 configuration.
Returns¶
- OperationResponse
An OperationResponse object encapsulating the result the configuration set operation.
- 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¶
- OperationResponse
an OperationResponse object encapsulating the result the configuration unset operation.
Session Storage¶
Persistent storage for session data.
- class kelvin.sdk.lib.session.session_storage.SessionConfig(**data)[source]¶
Bases:
KSDKModel- Parameters:
- kelvin.sdk.lib.session.session_storage.session_config_from_metadata(metadata_json)[source]¶
- Return type:
- Parameters:
metadata_json (dict)
- kelvin.sdk.lib.session.session_storage.store_session(session_conf)[source]¶
Store session configuration
- Return type:
- Parameters:
session_conf (SessionConfig)
- kelvin.sdk.lib.session.session_storage.load_session()[source]¶
Load session configuration
- Return type:
- kelvin.sdk.lib.session.session_storage.clear_session()[source]¶
Clear session configuration
- Return type:
- kelvin.sdk.lib.session.session_storage.store_metadata(metadata_json)[source]¶
Store metadata configuration
Session Utilities¶
Helper functions for session management.
- kelvin.sdk.lib.session.session_utils.warn_ksdk_version(session_conf)[source]¶
- Return type:
- Parameters:
session_conf (SessionConfig)
Docker¶
Docker Manager¶
Manages Docker operations for building and pushing application images.
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.
- class kelvin.sdk.lib.docker.docker_manager.DockerManager[source]¶
Bases:
object- static build_kelvin_app_dockerfile(kelvin_app_building_object)[source]¶
Build the docker file used in the creation of the docker image.
- Return type:
- Parameters:
kelvin_app_building_object (KelvinAppBuildingObject)
Parameters¶
- kelvin_app_building_objectKelvinAppBuildingObject
the KelvinAppBuildingObject with all the required variables to build an app.
Returns¶
- bool
a boolean indicating whether the dockerfile was successfully built.
- get_docker_images(labels=None, image_ids=None, image_parent_ids=None, image_names=None)[source]¶
Obtain a list of all docker images available in the system.
This image list can be narrowed down by using labels or an image name. By default, includes the standard: {‘source’: ‘ksdk’} labels.
- Return type:
- Parameters:
Parameters¶
- image_namesOptional[List[str]]
the names of the docker images to filter.
- image_idsOptional[List[str]]
the ids of the docker images to filter.
- image_parent_idsOptional[List[str]]
- the ids of the parents
to filter.
- labelsOptional[dict]
the labels used to selectively get containers.
Returns¶
- List[DockerImage]
a list of DockerImage items.
- build_kelvin_app_docker_image(kelvin_app_building_object)[source]¶
Build the docker image from the provided KelvinAppBuildingObject.
An exception is expected should any step of the process fail.
- Return type:
- Parameters:
kelvin_app_building_object (KelvinAppBuildingObject)
Parameters¶
- kelvin_app_building_objectKelvinAppBuildingObject
an object that contains the necessary variables to build a kelvin-type app.
Returns¶
- bool
a boolean indicating whether the image was successfully built
- build_docker_app_image(docker_build_object)[source]¶
Build the docker image from the provided DockerAppBuildingObject.
An exception is expected should any step of the process fail.
- Return type:
- Parameters:
docker_build_object (DockerAppBuildingObject)
Parameters¶
- docker_build_objectDockerAppBuildingObject
an object that contains the necessary variables to build a docker-type app.
Returns¶
- bool
a boolean indicating whether the image was successfully built.
- build_kelvin_v2_app_image(build_object)[source]¶
Build the docker image from the provided DockerAppBuildingObject.
An exception is expected should any step of the process fail.
- Return type:
- Parameters:
build_object (ProjectBuildingObject)
Parameters¶
- docker_build_objectDockerAppBuildingObject
an object that contains the necessary variables to build a docker-type app.
Returns¶
- bool
a boolean indicating whether the image was successfully built.
- ensure_docker_image_exists(docker_image)[source]¶
Using the base logged client, ensure that the provided image is valid either in the currently logged registry or the in the public one (DockerHub).
Parameters¶
- docker_imagestr
the docker image to be checked and downloaded.
Returns¶
- str
a boolean indicating whether the images are valid in the currently logged registry or the public one.
- pull_docker_image_from_registry(docker_image_name, auth_config=None, tag_local_name=False)[source]¶
Pull the specified docker image from the currently logged registry.
- Return type:
- Parameters:
docker_image_name (DockerImageName)
auth_config (dict | None)
tag_local_name (bool)
Parameters¶
- docker_image_nameDockerImageName
the name of the docker image to pull.
- auth_configOptional[dict]
if set, will indicate whether the pulled image should be pulled from a public registry.
Returns¶
- str
the name of the docker image pulled from the remote registry.
- remove_docker_image(docker_image_name)[source]¶
Remove the specified docker image from the local system.
Raise an exception if the docker image was not successfully removed.
Parameters¶
- docker_image_namestr
the name of the docker image to be removed.
Returns¶
- bool
a boolean indicating whether the image was successfully removed.
- prune_docker_images(filters=None)[source]¶
A simple wrapper around the client to prune dangling docker images.
Parameters¶
- filtersdict
the keywords used to filter out the prune operation.
Returns¶
- bool
a bool indicating the images were successfully pruned.
- check_if_docker_image_exists(docker_image_name, silent=False, raise_exception=False)[source]¶
Check whether the specified docker image exists on the local system.
Parameters¶
- docker_image_namestr
the name of the docker image to be checked.
- silentbool
indicates whether logs should be displayed.
- raise_exceptionbool
indicates whether or not it should raise if the provided image is not found.
Returns¶
- bool
a boolean indicating whether the image exists on the local docker list.
- extract_dir_from_docker_image(app_name, output_dir, container_dir='/opt/kelvin/app')[source]¶
Extract the content of the specified built application to the provided output directory.
Parameters¶
- app_namestr
the name of the application to unpack.
- container_dir: str
The directory to extract from the container.
- output_dir: str
the output directory to output the extracted content.
- clean_dirstr
clean the directory before extracting into it.
Returns¶
a boolean flag indicating the image was successfully unpacked.
- get_docker_containers(target_all_containers=False, image_names=None, container_names=None, labels=None)[source]¶
Obtain a list of all docker containers available in the system.
This image list can be narrowed down by using labels or an image name. By default, includes the standard: {‘source’: ‘ksdk’} labels.
- Return type:
- Parameters:
Parameters¶
- target_all_containersbool
if set to ‘True’, will target all containers, running or stopped alike.
- image_namesOptional[List[str]]
the name of the docker image to filters the containers.
- container_namesOptional[List[str]]
the name of the docker container to filter.
- labelsOptional[dict]
the labels used to selectively get containers.
Returns¶
- List[DockerContainer]
a list of DockerContainer items.
- stop_containers(container_names=None, image_names=None)[source]¶
Internal function for stopping containers by either container name or image name.
Parameters¶
- container_namesOptional[List[str]]
the name of the docker container to filter.
- image_namesOptional[List[str]]
the name of the docker image to filters the containers.
Returns¶
- bool
a bool indicating whether the container(s) was(were) successfully stopped
Docker Utilities¶
Helper functions for Docker operations.
- kelvin.sdk.lib.docker.docker_utils.display_docker_progress(stream)[source]¶
When provided with a docker stream generator, display the overall progress of all layer involved.
Parameters¶
- stream: Generator
a docker stream generator that outputs every entry of the process
Returns¶
- bool
Return a bool indicating all progress info has been successfully displayed
- kelvin.sdk.lib.docker.docker_utils.process_docker_image_progress_entry(entry)[source]¶
Print the docker image push progress entry from its rightful dict.
- Return type:
- Parameters:
entry (bytes)
Parameters¶
- entry: bytes
A dictionary containing the docker image progress entry.
Returns¶
- List[DockerProgressEntry]
A list of docker progress entries the result of the processed entry object.
- kelvin.sdk.lib.docker.docker_utils.process_docker_entry(entry)[source]¶
Print the datatype compilation entry from its raw string.
Parameters¶
- entry: bytes
A byte string containing the datatype compilation entry.
Returns¶
- str
A string containing the result of the processed entry object.
- kelvin.sdk.lib.docker.docker_utils.assess_docker_connection_exception(exc)[source]¶
Parse the provided exception and return a ‘pretty’ docker exception.
- Return type:
- Parameters:
exc (Exception)
Parameters¶
- exc: Exception
the exception to verify.
Returns¶
- Exception
an exception with the adequate result.
Apps¶
Local Apps Manager¶
Manages local application projects and builds.
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.apps.local_apps_manager.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, optional
the name of the new app.
- app_description: str, optional
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¶
- 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.lib.apps.local_apps_manager.project_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¶
- OperationResponse
an OperationResponse object wrapping the result of the creation of the application.
- rtype:
- Parameters:
project_creation_parameters (ProjectCreationParametersObject)
- Return type:
- kelvin.sdk.lib.apps.local_apps_manager.legacy_project_build(build_obj)[source]¶
- Return type:
- Parameters:
build_obj (ProjectBuildingObject)
- kelvin.sdk.lib.apps.local_apps_manager.project_build(app_dir, fresh_build=False, build_for_upload=False, docker_registry='', archs=[], build_args={}, app_config_obj=None, skip_schema_validation=False)[source]¶
The entry point for the building of an application.
Attempts to read the application content
- Return type:
- Parameters:
Parameters¶
- app_dirstr
The path where the application is hosted.
- fresh_buildbool
If specified, will remove any cache and rebuild the application from scratch.
- build_for_uploadbool
Indicates whether the package object aims for an upload.
- docker_registry: str
The docker registry to push the image to.
- archsList[str]
A list of architectures to build for.
- build_args: Dict[str, str]
Build arguments to pass to the docker build command.
- skip_schema_validation: bool
If specified, will skip schema validation during the build process.
Returns¶
- OperationResponse
An OperationResponse object wrapping the result of the application build process.
- kelvin.sdk.lib.apps.local_apps_manager.app_image_unpack(app_name_with_version, output_dir, container_dir=None)[source]¶
Extract the content of an image into a target directory.
- 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¶
- OperationResponse
an OperationResponse object wrapping the result of the image extraction operation.
- kelvin.sdk.lib.apps.local_apps_manager.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.lib.apps.local_apps_manager.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¶
- OperationResponse
an OperationResponse object wrapping the result of the application image removal operation.
- kelvin.sdk.lib.apps.local_apps_manager.get_local_appregistry_images(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.
Schema¶
Schema Manager¶
Manages application schema validation and generation.
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.schema.schema_manager.generate_base_schema_template(project_creation_parameters_object)[source]¶
Generate the base schema template. Attempt to retrieve the latest schema version and generate the default from it.
- Return type:
- Parameters:
project_creation_parameters_object (ProjectCreationParametersObject)
Parameters¶
- project_creation_parameters_objectProjectCreationParametersObject
the app creation parameters object used to generate the default schema.
Returns¶
- dict
A dict containing the default app creation object.
- kelvin.sdk.lib.schema.schema_manager.build_kelvin_app_block(project_creation_parameters_object)[source]¶
Creates the app configuration for the kelvin apps
- Return type:
- Parameters:
project_creation_parameters_object (ProjectCreationParametersObject)
Parameters¶
- project_creation_parameters_objectProjectCreationParametersObject
the app creation parameters object used to generate the default schema.
Returns¶
- dict
The schema app block for kelvin apps
- kelvin.sdk.lib.schema.schema_manager.validate_app_schema_from_app_config_file(app_config=None, app_config_file_path=None)[source]¶
When provided with an app configuration file, retrieve the schema for that version and validate it. Fetches schema on-demand without caching.
Parameters¶
- app_configOptional[Dict]
the alternative app configuration to the app_config_file_path.
- app_config_file_pathOptional[KPath]
the path to the app configuration.
Returns¶
- bool
A boolean indicating whether or not the schema complies with the provided spec.
- kelvin.sdk.lib.schema.schema_manager.schema_validate(file_path, schema_file_path, full_schema_errors=True)[source]¶
Validate a file against a schema.
- Return type:
- Parameters:
Parameters¶
- file_pathstr
The path to the file to validate.
- schema_file_pathOptional[str]
The path to the schema file to validate the file against.
- full_schema_errorsbool
Indicates whether or not it should log the complete stack trace.
Returns¶
- OperationResponse
an OperationResponse object encapsulating the result of the file schema validation.
- kelvin.sdk.lib.schema.schema_manager.schema_get(schema_file_path=None)[source]¶
Yield the the content of a schema.
- Return type:
- Parameters:
schema_file_path (str | None)
Parameters¶
- schema_file_pathOptional[str]
The path to the schema file to yield.
Returns¶
- OperationResponse
an OperationResponse object encapsulating the result of the file schema validation.
System Report¶
System Report Manager¶
Generates system reports and diagnostics information.
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.system_report.system_report_manager.kelvin_support_report(app_config, report_file=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.
- report_file: Optional[KPath]
the path to the desired output report file.
- generate_report_file: bool
if set to true, will generate the report file to the default location.
Returns¶
- OperationResponse:
an OperationResponse object encapsulating the host machine’s system report.
- kelvin.sdk.lib.system_report.system_report_manager.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.