Source code for verda._verda
# Copyright 2026 Verda Cloud Oy
#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from verda._version import __version__
from verda.authentication import AuthenticationService
from verda.balance import BalanceService
from verda.cluster_types import ClusterTypesService
from verda.clusters import ClustersService
from verda.constants import Constants
from verda.container_types import ContainerTypesService
from verda.containers import ContainersService
from verda.http_client import HTTPClient
from verda.images import ImagesService
from verda.instance_types import InstanceTypesService
from verda.instances import InstancesService
from verda.job_deployments import JobDeploymentsService
from verda.locations import LocationsService
from verda.long_term import LongTermService
from verda.ssh_keys import SSHKeysService
from verda.startup_scripts import StartupScriptsService
from verda.volume_types import VolumeTypesService
from verda.volumes import VolumesService
[docs]
class VerdaClient:
"""Client for interacting with Verda public API."""
def __init__(
self,
client_id: str,
client_secret: str,
base_url: str = 'https://api.verda.com/v1',
inference_key: str | None = None,
) -> None:
"""Verda client.
:param client_id: client id
:type client_id: str
:param client_secret: client secret
:type client_secret: str
:param base_url: base url for all the endpoints, optional, defaults to "https://api.verda.com/v1"
:type base_url: str, optional
:param inference_key: inference key, optional
:type inference_key: str, optional
"""
# Validate that client_id and client_secret are not empty
if not client_id or not client_secret:
raise ValueError('client_id and client_secret must be provided')
# Constants
self.constants: Constants = Constants(base_url, __version__)
"""Constants"""
# Services
self._authentication: AuthenticationService = AuthenticationService(
client_id, client_secret, self.constants.base_url
)
self._http_client: HTTPClient = HTTPClient(self._authentication, self.constants.base_url)
self.balance: BalanceService = BalanceService(self._http_client)
"""Balance service. Get client balance"""
self.images: ImagesService = ImagesService(self._http_client)
"""Image service"""
self.instance_types: InstanceTypesService = InstanceTypesService(self._http_client)
"""Instance type service"""
self.instances: InstancesService = InstancesService(self._http_client)
"""Instances service. Deploy, delete, hibernate (etc) instances"""
self.ssh_keys: SSHKeysService = SSHKeysService(self._http_client)
"""SSH keys service"""
self.startup_scripts: StartupScriptsService = StartupScriptsService(self._http_client)
"""Startup Scripts service"""
self.volume_types: VolumeTypesService = VolumeTypesService(self._http_client)
"""Volume type service"""
self.volumes: VolumesService = VolumesService(self._http_client)
"""Volume service. Create, attach, detach, get, rename, delete volumes"""
self.locations: LocationsService = LocationsService(self._http_client)
"""Locations service. Get locations"""
self.containers: ContainersService = ContainersService(self._http_client, inference_key)
"""Containers service. Deploy, manage, and monitor container deployments"""
self.job_deployments: JobDeploymentsService = JobDeploymentsService(self._http_client)
"""Job deployments service. Deploy and manage serverless jobs"""
self.container_types: ContainerTypesService = ContainerTypesService(self._http_client)
"""Container types service. Get available serverless container info"""
self.clusters: ClustersService = ClustersService(self._http_client)
"""Clusters service. Create and manage compute clusters"""
self.cluster_types: ClusterTypesService = ClusterTypesService(self._http_client)
"""Cluster types service. Get available cluster info"""
self.long_term: LongTermService = LongTermService(self._http_client)
"""Long-term service. Get available commitment periods"""
__all__ = ['VerdaClient']