BentoCloud API¶
This page provides API reference for managing BentoCloud resources including Deployments and API tokens.
See also
Manage Deployments for Deployment usage details
Manage API tokens for API token usage details
Create¶
Create a Deployment on BentoCloud.
- bentoml.deployment.create(name: str | None = None, path_context: str | None = None, *, bento: BentoType | None = None, cluster: str | None = None, access_authorization: bool | None = None, scaling_min: int | None = None, scaling_max: int | None = None, instance_type: str | None = None, strategy: str | None = None, envs: t.List[EnvItemSchema] | t.List[dict[str, t.Any]] | None = None, secrets: t.List[str] | None = None, labels: t.List[LabelItemSchema] | t.List[dict[str, str]] | None = None, extras: dict[str, t.Any] | None = None) Deployment[source]¶
- bentoml.deployment.create(name: str | None = None, path_context: str | None = None, *, bento: BentoType | None = None, config_file: str | None = None) Deployment
- bentoml.deployment.create(name: str | None = None, path_context: str | None = None, *, bento: BentoType | None = None, config_dict: dict[str, t.Any] | None = None) Deployment
For more information, see Create Deployments.
Get¶
Retrieve details about a specific Deployment.
- bentoml.deployment.get(name: str, cluster: str | None = None, _cloud_client: BentoCloudClient = <simple_di.providers.SingletonFactory object>) Deployment[source]¶
For more information, see View.
List¶
List all Deployments on BentoCloud.
- bentoml.deployment.list(cluster: str | None = None, search: str | None = None, dev: bool = False, q: str | None = None, labels: t.List[LabelItemSchema] | t.List[dict[str, t.Any]] | None = None, _cloud_client: BentoCloudClient = <simple_di.providers.SingletonFactory object>) t.List[Deployment][source]¶
Update¶
Update the configuration of a specific Deployment.
- bentoml.deployment.update(name: str | None = None, path_context: str | None = None, cluster: str | None = None, *, bento: BentoType | None = None, access_authorization: bool | None = None, scaling_min: int | None = None, scaling_max: int | None = None, instance_type: str | None = None, strategy: str | None = None, envs: t.List[EnvItemSchema] | t.List[dict[str, t.Any]] | None = None, secrets: t.List[str] | None = None, extras: dict[str, t.Any] | None = None) Deployment[source]¶
- bentoml.deployment.update(name: str | None = None, path_context: str | None = None, cluster: str | None = None, *, bento: BentoType | None = None, config_file: str | None = None) Deployment
- bentoml.deployment.update(name: str | None = None, path_context: str | None = None, cluster: str | None = None, *, bento: BentoType | None = None, config_dict: dict[str, t.Any] | None = None) Deployment
For more information, see Update.
Apply¶
Create or update a Deployment based on the specifications provided.
- bentoml.deployment.apply(name: str | None = None, cluster: t.Optional[str] = None, path_context: t.Optional[str] = None, *, bento: t.Optional[t.Union[Tag, str]] = None, config_dict: t.Optional[dict[str, t.Any]] = None) Deployment[source]¶
- bentoml.deployment.apply(name: str | None = None, cluster: t.Optional[str] = None, path_context: t.Optional[str] = None, *, bento: t.Optional[t.Union[Tag, str]] = None, config_file: t.Optional[str] = None) Deployment
For more information, see Apply.
Terminate¶
Stop a Deployment, which can be restarted later.
- bentoml.deployment.terminate(name: str, cluster: str | None = None, wait: bool = False, _cloud_client: BentoCloudClient = <simple_di.providers.SingletonFactory object>) Deployment[source]¶
For more information, see Terminate.
Delete¶
Remove a Deployment from BentoCloud.
- bentoml.deployment.delete(name: str, cluster: str | None = None, _cloud_client: BentoCloudClient = <simple_di.providers.SingletonFactory object>) None[source]¶
For more information, see Delete.
API Token Management¶
The bentoml.api_token module provides functions for managing API tokens on BentoCloud programmatically.
List API tokens¶
List all API tokens in your organization.
- bentoml.api_token.list(search: str | None = None, _cloud_client: BentoCloudClient = <simple_di.providers.SingletonFactory object>) t.List[ApiToken][source]¶
List all API tokens.
- Parameters:
search – Optional search string to filter tokens by name
- Returns:
List of ApiToken objects
Example
>>> import bentoml >>> tokens = bentoml.api_token.list(search="my-token") >>> for token in tokens: ... print(f"{token.name}: {token.uid}")
Create an API token¶
Create a new API token with specified scopes and expiration.
- bentoml.api_token.create(name: str, description: str | None = None, scopes: t.List[str] | None = None, expired_at: datetime | None = None, _cloud_client: BentoCloudClient = <simple_di.providers.SingletonFactory object>) ApiToken[source]¶
Create a new API token.
- Parameters:
name – Name of the token
description – Optional description
scopes – List of scopes. Available scopes: - api: General API access - read_organization: Read organization data - write_organization: Write organization data - read_cluster: Read cluster data - write_cluster: Write cluster data
expired_at – Optional expiration datetime
- Returns:
ApiToken object (includes token value - save it, it won’t be shown again!)
Example
>>> import bentoml >>> from datetime import datetime, timedelta >>> token = bentoml.api_token.create( ... name="ci-token", ... description="CI/CD pipeline token", ... scopes=["api", "read_cluster"], ... expired_at=datetime.now() + timedelta(days=30) ... ) >>> print(f"Token: {token.token}") # Save this!
Get API token¶
Retrieve details about a specific API token by its UID.
- bentoml.api_token.get(token_uid: str, _cloud_client: BentoCloudClient = <simple_di.providers.SingletonFactory object>) ApiToken | None[source]¶
Get an API token by UID.
- Parameters:
token_uid – The UID of the token
- Returns:
ApiToken object or None if not found
Example
>>> import bentoml >>> token = bentoml.api_token.get("token_abc123") >>> if token: ... print(f"Scopes: {token.scopes}")
Delete API token¶
Delete an API token by its UID.
- bentoml.api_token.delete(token_uid: str, _cloud_client: BentoCloudClient = <simple_di.providers.SingletonFactory object>) None[source]¶
Delete an API token.
- Parameters:
token_uid – The UID of the token to delete
Example
>>> import bentoml >>> bentoml.api_token.delete("token_abc123")
For more information and examples, see Manage API tokens.