daytona_api_client 0.21.3a0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of daytona_api_client might be problematic. Click here for more details.
- daytona_api_client/__init__.py +129 -0
- daytona_api_client/api/__init__.py +15 -0
- daytona_api_client/api/api_keys_api.py +1234 -0
- daytona_api_client/api/docker_registry_api.py +1741 -0
- daytona_api_client/api/object_storage_api.py +268 -0
- daytona_api_client/api/organizations_api.py +5792 -0
- daytona_api_client/api/preview_api.py +715 -0
- daytona_api_client/api/runners_api.py +664 -0
- daytona_api_client/api/sandbox_api.py +3584 -0
- daytona_api_client/api/snapshots_api.py +1830 -0
- daytona_api_client/api/toolbox_api.py +10545 -0
- daytona_api_client/api/users_api.py +1733 -0
- daytona_api_client/api/volumes_api.py +1267 -0
- daytona_api_client/api/workspace_api.py +3626 -0
- daytona_api_client/api_client.py +696 -0
- daytona_api_client/api_response.py +20 -0
- daytona_api_client/configuration.py +586 -0
- daytona_api_client/exceptions.py +216 -0
- daytona_api_client/models/__init__.py +101 -0
- daytona_api_client/models/account_provider.py +101 -0
- daytona_api_client/models/account_provider_dto.py +101 -0
- daytona_api_client/models/api_key_list.py +149 -0
- daytona_api_client/models/api_key_response.py +142 -0
- daytona_api_client/models/build_info.py +115 -0
- daytona_api_client/models/build_snapshot.py +118 -0
- daytona_api_client/models/command.py +104 -0
- daytona_api_client/models/completion_context.py +103 -0
- daytona_api_client/models/completion_item.py +124 -0
- daytona_api_client/models/completion_list.py +116 -0
- daytona_api_client/models/create_api_key.py +134 -0
- daytona_api_client/models/create_build_info.py +107 -0
- daytona_api_client/models/create_docker_registry.py +123 -0
- daytona_api_client/models/create_linked_account.py +101 -0
- daytona_api_client/models/create_organization.py +100 -0
- daytona_api_client/models/create_organization_invitation.py +122 -0
- daytona_api_client/models/create_organization_quota.py +130 -0
- daytona_api_client/models/create_organization_role.py +126 -0
- daytona_api_client/models/create_runner.py +150 -0
- daytona_api_client/models/create_sandbox.py +198 -0
- daytona_api_client/models/create_session_request.py +100 -0
- daytona_api_client/models/create_snapshot.py +138 -0
- daytona_api_client/models/create_user.py +132 -0
- daytona_api_client/models/create_volume.py +100 -0
- daytona_api_client/models/create_workspace.py +196 -0
- daytona_api_client/models/docker_registry.py +135 -0
- daytona_api_client/models/execute_request.py +104 -0
- daytona_api_client/models/execute_response.py +101 -0
- daytona_api_client/models/file_info.py +118 -0
- daytona_api_client/models/file_status.py +110 -0
- daytona_api_client/models/get_build_logs400_response.py +101 -0
- daytona_api_client/models/git_add_request.py +101 -0
- daytona_api_client/models/git_branch_request.py +101 -0
- daytona_api_client/models/git_checkout_request.py +101 -0
- daytona_api_client/models/git_clone_request.py +114 -0
- daytona_api_client/models/git_commit_info.py +112 -0
- daytona_api_client/models/git_commit_request.py +110 -0
- daytona_api_client/models/git_commit_response.py +100 -0
- daytona_api_client/models/git_delete_branch_request.py +101 -0
- daytona_api_client/models/git_repo_request.py +104 -0
- daytona_api_client/models/git_status.py +122 -0
- daytona_api_client/models/list_branch_response.py +100 -0
- daytona_api_client/models/lsp_completion_params.py +120 -0
- daytona_api_client/models/lsp_document_request.py +104 -0
- daytona_api_client/models/lsp_location.py +107 -0
- daytona_api_client/models/lsp_server_request.py +101 -0
- daytona_api_client/models/lsp_symbol.py +112 -0
- daytona_api_client/models/match.py +102 -0
- daytona_api_client/models/organization.py +134 -0
- daytona_api_client/models/organization_invitation.py +161 -0
- daytona_api_client/models/organization_role.py +147 -0
- daytona_api_client/models/organization_suspension.py +102 -0
- daytona_api_client/models/organization_user.py +145 -0
- daytona_api_client/models/paginated_snapshots_dto.py +120 -0
- daytona_api_client/models/port_preview_url.py +101 -0
- daytona_api_client/models/position.py +101 -0
- daytona_api_client/models/project_dir_response.py +100 -0
- daytona_api_client/models/range.py +113 -0
- daytona_api_client/models/registry_push_access_dto.py +114 -0
- daytona_api_client/models/replace_request.py +104 -0
- daytona_api_client/models/replace_result.py +102 -0
- daytona_api_client/models/sandbox.py +226 -0
- daytona_api_client/models/sandbox_info.py +110 -0
- daytona_api_client/models/sandbox_labels.py +100 -0
- daytona_api_client/models/sandbox_state.py +50 -0
- daytona_api_client/models/sandbox_volume.py +101 -0
- daytona_api_client/models/search_files_response.py +100 -0
- daytona_api_client/models/session.py +121 -0
- daytona_api_client/models/session_execute_request.py +110 -0
- daytona_api_client/models/session_execute_response.py +106 -0
- daytona_api_client/models/set_snapshot_general_status_dto.py +100 -0
- daytona_api_client/models/snapshot_dto.py +185 -0
- daytona_api_client/models/snapshot_state.py +44 -0
- daytona_api_client/models/storage_access_dto.py +121 -0
- daytona_api_client/models/toggle_state.py +100 -0
- daytona_api_client/models/update_assigned_organization_roles.py +100 -0
- daytona_api_client/models/update_docker_registry.py +104 -0
- daytona_api_client/models/update_organization_invitation.py +114 -0
- daytona_api_client/models/update_organization_member_role.py +107 -0
- daytona_api_client/models/update_organization_quota.py +175 -0
- daytona_api_client/models/update_organization_role.py +126 -0
- daytona_api_client/models/upload_file.py +101 -0
- daytona_api_client/models/upload_file_dto.py +101 -0
- daytona_api_client/models/upload_file_request_file.py +159 -0
- daytona_api_client/models/upload_files_multi_request_files_inner.py +101 -0
- daytona_api_client/models/usage_overview.py +124 -0
- daytona_api_client/models/user.py +120 -0
- daytona_api_client/models/user_public_key.py +101 -0
- daytona_api_client/models/volume.py +133 -0
- daytona_api_client/models/volume_dto.py +138 -0
- daytona_api_client/models/volume_state.py +41 -0
- daytona_api_client/models/workspace.py +259 -0
- daytona_api_client/py.typed +0 -0
- daytona_api_client/rest.py +208 -0
- daytona_api_client-0.21.3a0.dist-info/METADATA +23 -0
- daytona_api_client-0.21.3a0.dist-info/RECORD +117 -0
- daytona_api_client-0.21.3a0.dist-info/WHEEL +5 -0
- daytona_api_client-0.21.3a0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Daytona
|
|
5
|
+
|
|
6
|
+
Daytona AI platform API Docs
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Contact: support@daytona.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
+
from daytona_api_client.models.volume_state import VolumeState
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class VolumeDto(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
VolumeDto
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
|
|
33
|
+
id: StrictStr = Field(description="Volume ID")
|
|
34
|
+
name: StrictStr = Field(description="Volume name")
|
|
35
|
+
organization_id: StrictStr = Field(description="Organization ID", alias="organizationId")
|
|
36
|
+
state: VolumeState = Field(description="Volume state")
|
|
37
|
+
created_at: StrictStr = Field(description="Creation timestamp", alias="createdAt")
|
|
38
|
+
updated_at: StrictStr = Field(description="Last update timestamp", alias="updatedAt")
|
|
39
|
+
last_used_at: Optional[StrictStr] = Field(default=None, description="Last used timestamp", alias="lastUsedAt")
|
|
40
|
+
error_reason: Optional[StrictStr] = Field(description="The error reason of the volume", alias="errorReason")
|
|
41
|
+
additional_properties: Dict[str, Any] = {}
|
|
42
|
+
__properties: ClassVar[List[str]] = [
|
|
43
|
+
"id",
|
|
44
|
+
"name",
|
|
45
|
+
"organizationId",
|
|
46
|
+
"state",
|
|
47
|
+
"createdAt",
|
|
48
|
+
"updatedAt",
|
|
49
|
+
"lastUsedAt",
|
|
50
|
+
"errorReason",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
model_config = ConfigDict(
|
|
54
|
+
populate_by_name=True,
|
|
55
|
+
validate_assignment=True,
|
|
56
|
+
protected_namespaces=(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def to_str(self) -> str:
|
|
60
|
+
"""Returns the string representation of the model using alias"""
|
|
61
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
62
|
+
|
|
63
|
+
def to_json(self) -> str:
|
|
64
|
+
"""Returns the JSON representation of the model using alias"""
|
|
65
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
66
|
+
return json.dumps(self.to_dict())
|
|
67
|
+
|
|
68
|
+
@classmethod
|
|
69
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
70
|
+
"""Create an instance of VolumeDto from a JSON string"""
|
|
71
|
+
return cls.from_dict(json.loads(json_str))
|
|
72
|
+
|
|
73
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
74
|
+
"""Return the dictionary representation of the model using alias.
|
|
75
|
+
|
|
76
|
+
This has the following differences from calling pydantic's
|
|
77
|
+
`self.model_dump(by_alias=True)`:
|
|
78
|
+
|
|
79
|
+
* `None` is only added to the output dict for nullable fields that
|
|
80
|
+
were set at model initialization. Other fields with value `None`
|
|
81
|
+
are ignored.
|
|
82
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
83
|
+
"""
|
|
84
|
+
excluded_fields: Set[str] = set(
|
|
85
|
+
[
|
|
86
|
+
"additional_properties",
|
|
87
|
+
]
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
_dict = self.model_dump(
|
|
91
|
+
by_alias=True,
|
|
92
|
+
exclude=excluded_fields,
|
|
93
|
+
exclude_none=True,
|
|
94
|
+
)
|
|
95
|
+
# puts key-value pairs in additional_properties in the top level
|
|
96
|
+
if self.additional_properties is not None:
|
|
97
|
+
for _key, _value in self.additional_properties.items():
|
|
98
|
+
_dict[_key] = _value
|
|
99
|
+
|
|
100
|
+
# set to None if last_used_at (nullable) is None
|
|
101
|
+
# and model_fields_set contains the field
|
|
102
|
+
if self.last_used_at is None and "last_used_at" in self.model_fields_set:
|
|
103
|
+
_dict["lastUsedAt"] = None
|
|
104
|
+
|
|
105
|
+
# set to None if error_reason (nullable) is None
|
|
106
|
+
# and model_fields_set contains the field
|
|
107
|
+
if self.error_reason is None and "error_reason" in self.model_fields_set:
|
|
108
|
+
_dict["errorReason"] = None
|
|
109
|
+
|
|
110
|
+
return _dict
|
|
111
|
+
|
|
112
|
+
@classmethod
|
|
113
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
114
|
+
"""Create an instance of VolumeDto from a dict"""
|
|
115
|
+
if obj is None:
|
|
116
|
+
return None
|
|
117
|
+
|
|
118
|
+
if not isinstance(obj, dict):
|
|
119
|
+
return cls.model_validate(obj)
|
|
120
|
+
|
|
121
|
+
_obj = cls.model_validate(
|
|
122
|
+
{
|
|
123
|
+
"id": obj.get("id"),
|
|
124
|
+
"name": obj.get("name"),
|
|
125
|
+
"organizationId": obj.get("organizationId"),
|
|
126
|
+
"state": obj.get("state"),
|
|
127
|
+
"createdAt": obj.get("createdAt"),
|
|
128
|
+
"updatedAt": obj.get("updatedAt"),
|
|
129
|
+
"lastUsedAt": obj.get("lastUsedAt"),
|
|
130
|
+
"errorReason": obj.get("errorReason"),
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
# store additional fields in additional_properties
|
|
134
|
+
for _key in obj.keys():
|
|
135
|
+
if _key not in cls.__properties:
|
|
136
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
137
|
+
|
|
138
|
+
return _obj
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Daytona
|
|
5
|
+
|
|
6
|
+
Daytona AI platform API Docs
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Contact: support@daytona.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import json
|
|
18
|
+
from enum import Enum
|
|
19
|
+
from typing_extensions import Self
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class VolumeState(str, Enum):
|
|
23
|
+
"""
|
|
24
|
+
Volume state
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
allowed enum values
|
|
29
|
+
"""
|
|
30
|
+
CREATING = "creating"
|
|
31
|
+
READY = "ready"
|
|
32
|
+
PENDING_CREATE = "pending_create"
|
|
33
|
+
PENDING_DELETE = "pending_delete"
|
|
34
|
+
DELETING = "deleting"
|
|
35
|
+
DELETED = "deleted"
|
|
36
|
+
ERROR = "error"
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def from_json(cls, json_str: str) -> Self:
|
|
40
|
+
"""Create an instance of VolumeState from a JSON string"""
|
|
41
|
+
return cls(json.loads(json_str))
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Daytona
|
|
5
|
+
|
|
6
|
+
Daytona AI platform API Docs
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Contact: support@daytona.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
import pprint
|
|
18
|
+
import re # noqa: F401
|
|
19
|
+
import json
|
|
20
|
+
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
|
|
22
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
|
23
|
+
from daytona_api_client.models.build_info import BuildInfo
|
|
24
|
+
from daytona_api_client.models.sandbox_info import SandboxInfo
|
|
25
|
+
from daytona_api_client.models.sandbox_state import SandboxState
|
|
26
|
+
from daytona_api_client.models.sandbox_volume import SandboxVolume
|
|
27
|
+
from typing import Optional, Set
|
|
28
|
+
from typing_extensions import Self
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Workspace(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
Workspace
|
|
34
|
+
""" # noqa: E501
|
|
35
|
+
|
|
36
|
+
id: StrictStr = Field(description="The ID of the sandbox")
|
|
37
|
+
organization_id: StrictStr = Field(description="The organization ID of the sandbox", alias="organizationId")
|
|
38
|
+
snapshot: Optional[StrictStr] = Field(default=None, description="The snapshot used for the sandbox")
|
|
39
|
+
user: StrictStr = Field(description="The user associated with the project")
|
|
40
|
+
env: Dict[str, StrictStr] = Field(description="Environment variables for the sandbox")
|
|
41
|
+
labels: Dict[str, StrictStr] = Field(description="Labels for the sandbox")
|
|
42
|
+
public: StrictBool = Field(description="Whether the sandbox http preview is public")
|
|
43
|
+
target: StrictStr = Field(description="The target environment for the sandbox")
|
|
44
|
+
cpu: Union[StrictFloat, StrictInt] = Field(description="The CPU quota for the sandbox")
|
|
45
|
+
gpu: Union[StrictFloat, StrictInt] = Field(description="The GPU quota for the sandbox")
|
|
46
|
+
memory: Union[StrictFloat, StrictInt] = Field(description="The memory quota for the sandbox")
|
|
47
|
+
disk: Union[StrictFloat, StrictInt] = Field(description="The disk quota for the sandbox")
|
|
48
|
+
state: Optional[SandboxState] = Field(default=None, description="The state of the sandbox")
|
|
49
|
+
error_reason: Optional[StrictStr] = Field(
|
|
50
|
+
default=None, description="The error reason of the sandbox", alias="errorReason"
|
|
51
|
+
)
|
|
52
|
+
backup_state: Optional[StrictStr] = Field(default=None, description="The state of the backup", alias="backupState")
|
|
53
|
+
backup_created_at: Optional[StrictStr] = Field(
|
|
54
|
+
default=None, description="The creation timestamp of the last backup", alias="backupCreatedAt"
|
|
55
|
+
)
|
|
56
|
+
auto_stop_interval: Optional[Union[StrictFloat, StrictInt]] = Field(
|
|
57
|
+
default=None, description="Auto-stop interval in minutes (0 means disabled)", alias="autoStopInterval"
|
|
58
|
+
)
|
|
59
|
+
auto_archive_interval: Optional[Union[StrictFloat, StrictInt]] = Field(
|
|
60
|
+
default=None, description="Auto-archive interval in minutes", alias="autoArchiveInterval"
|
|
61
|
+
)
|
|
62
|
+
runner_domain: Optional[StrictStr] = Field(
|
|
63
|
+
default=None, description="The domain name of the runner", alias="runnerDomain"
|
|
64
|
+
)
|
|
65
|
+
volumes: Optional[List[SandboxVolume]] = Field(default=None, description="Array of volumes attached to the sandbox")
|
|
66
|
+
build_info: Optional[BuildInfo] = Field(
|
|
67
|
+
default=None, description="Build information for the sandbox", alias="buildInfo"
|
|
68
|
+
)
|
|
69
|
+
created_at: Optional[StrictStr] = Field(
|
|
70
|
+
default=None, description="The creation timestamp of the sandbox", alias="createdAt"
|
|
71
|
+
)
|
|
72
|
+
updated_at: Optional[StrictStr] = Field(
|
|
73
|
+
default=None, description="The last update timestamp of the sandbox", alias="updatedAt"
|
|
74
|
+
)
|
|
75
|
+
var_class: Optional[StrictStr] = Field(default=None, description="The class of the sandbox", alias="class")
|
|
76
|
+
name: StrictStr = Field(description="The name of the workspace")
|
|
77
|
+
image: Optional[StrictStr] = Field(default=None, description="The image used for the workspace")
|
|
78
|
+
snapshot_state: Optional[StrictStr] = Field(
|
|
79
|
+
default=None, description="The state of the snapshot", alias="snapshotState"
|
|
80
|
+
)
|
|
81
|
+
snapshot_created_at: Optional[StrictStr] = Field(
|
|
82
|
+
default=None, description="The creation timestamp of the last snapshot", alias="snapshotCreatedAt"
|
|
83
|
+
)
|
|
84
|
+
info: Optional[SandboxInfo] = Field(default=None, description="Additional information about the sandbox")
|
|
85
|
+
additional_properties: Dict[str, Any] = {}
|
|
86
|
+
__properties: ClassVar[List[str]] = [
|
|
87
|
+
"id",
|
|
88
|
+
"organizationId",
|
|
89
|
+
"snapshot",
|
|
90
|
+
"user",
|
|
91
|
+
"env",
|
|
92
|
+
"labels",
|
|
93
|
+
"public",
|
|
94
|
+
"target",
|
|
95
|
+
"cpu",
|
|
96
|
+
"gpu",
|
|
97
|
+
"memory",
|
|
98
|
+
"disk",
|
|
99
|
+
"state",
|
|
100
|
+
"errorReason",
|
|
101
|
+
"backupState",
|
|
102
|
+
"backupCreatedAt",
|
|
103
|
+
"autoStopInterval",
|
|
104
|
+
"autoArchiveInterval",
|
|
105
|
+
"runnerDomain",
|
|
106
|
+
"volumes",
|
|
107
|
+
"buildInfo",
|
|
108
|
+
"createdAt",
|
|
109
|
+
"updatedAt",
|
|
110
|
+
"class",
|
|
111
|
+
"name",
|
|
112
|
+
"image",
|
|
113
|
+
"snapshotState",
|
|
114
|
+
"snapshotCreatedAt",
|
|
115
|
+
"info",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
@field_validator("backup_state")
|
|
119
|
+
def backup_state_validate_enum(cls, value):
|
|
120
|
+
"""Validates the enum"""
|
|
121
|
+
if value is None:
|
|
122
|
+
return value
|
|
123
|
+
|
|
124
|
+
if value not in set(["None", "Pending", "InProgress", "Completed", "Error"]):
|
|
125
|
+
raise ValueError("must be one of enum values ('None', 'Pending', 'InProgress', 'Completed', 'Error')")
|
|
126
|
+
return value
|
|
127
|
+
|
|
128
|
+
@field_validator("var_class")
|
|
129
|
+
def var_class_validate_enum(cls, value):
|
|
130
|
+
"""Validates the enum"""
|
|
131
|
+
if value is None:
|
|
132
|
+
return value
|
|
133
|
+
|
|
134
|
+
if value not in set(["small", "medium", "large"]):
|
|
135
|
+
raise ValueError("must be one of enum values ('small', 'medium', 'large')")
|
|
136
|
+
return value
|
|
137
|
+
|
|
138
|
+
@field_validator("snapshot_state")
|
|
139
|
+
def snapshot_state_validate_enum(cls, value):
|
|
140
|
+
"""Validates the enum"""
|
|
141
|
+
if value is None:
|
|
142
|
+
return value
|
|
143
|
+
|
|
144
|
+
if value not in set(["None", "Pending", "InProgress", "Completed", "Error"]):
|
|
145
|
+
raise ValueError("must be one of enum values ('None', 'Pending', 'InProgress', 'Completed', 'Error')")
|
|
146
|
+
return value
|
|
147
|
+
|
|
148
|
+
model_config = ConfigDict(
|
|
149
|
+
populate_by_name=True,
|
|
150
|
+
validate_assignment=True,
|
|
151
|
+
protected_namespaces=(),
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
def to_str(self) -> str:
|
|
155
|
+
"""Returns the string representation of the model using alias"""
|
|
156
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
157
|
+
|
|
158
|
+
def to_json(self) -> str:
|
|
159
|
+
"""Returns the JSON representation of the model using alias"""
|
|
160
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
161
|
+
return json.dumps(self.to_dict())
|
|
162
|
+
|
|
163
|
+
@classmethod
|
|
164
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
165
|
+
"""Create an instance of Workspace from a JSON string"""
|
|
166
|
+
return cls.from_dict(json.loads(json_str))
|
|
167
|
+
|
|
168
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
169
|
+
"""Return the dictionary representation of the model using alias.
|
|
170
|
+
|
|
171
|
+
This has the following differences from calling pydantic's
|
|
172
|
+
`self.model_dump(by_alias=True)`:
|
|
173
|
+
|
|
174
|
+
* `None` is only added to the output dict for nullable fields that
|
|
175
|
+
were set at model initialization. Other fields with value `None`
|
|
176
|
+
are ignored.
|
|
177
|
+
* Fields in `self.additional_properties` are added to the output dict.
|
|
178
|
+
"""
|
|
179
|
+
excluded_fields: Set[str] = set(
|
|
180
|
+
[
|
|
181
|
+
"additional_properties",
|
|
182
|
+
]
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
_dict = self.model_dump(
|
|
186
|
+
by_alias=True,
|
|
187
|
+
exclude=excluded_fields,
|
|
188
|
+
exclude_none=True,
|
|
189
|
+
)
|
|
190
|
+
# override the default output from pydantic by calling `to_dict()` of each item in volumes (list)
|
|
191
|
+
_items = []
|
|
192
|
+
if self.volumes:
|
|
193
|
+
for _item_volumes in self.volumes:
|
|
194
|
+
if _item_volumes:
|
|
195
|
+
_items.append(_item_volumes.to_dict())
|
|
196
|
+
_dict["volumes"] = _items
|
|
197
|
+
# override the default output from pydantic by calling `to_dict()` of build_info
|
|
198
|
+
if self.build_info:
|
|
199
|
+
_dict["buildInfo"] = self.build_info.to_dict()
|
|
200
|
+
# override the default output from pydantic by calling `to_dict()` of info
|
|
201
|
+
if self.info:
|
|
202
|
+
_dict["info"] = self.info.to_dict()
|
|
203
|
+
# puts key-value pairs in additional_properties in the top level
|
|
204
|
+
if self.additional_properties is not None:
|
|
205
|
+
for _key, _value in self.additional_properties.items():
|
|
206
|
+
_dict[_key] = _value
|
|
207
|
+
|
|
208
|
+
return _dict
|
|
209
|
+
|
|
210
|
+
@classmethod
|
|
211
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
212
|
+
"""Create an instance of Workspace from a dict"""
|
|
213
|
+
if obj is None:
|
|
214
|
+
return None
|
|
215
|
+
|
|
216
|
+
if not isinstance(obj, dict):
|
|
217
|
+
return cls.model_validate(obj)
|
|
218
|
+
|
|
219
|
+
_obj = cls.model_validate(
|
|
220
|
+
{
|
|
221
|
+
"id": obj.get("id"),
|
|
222
|
+
"organizationId": obj.get("organizationId"),
|
|
223
|
+
"snapshot": obj.get("snapshot"),
|
|
224
|
+
"user": obj.get("user"),
|
|
225
|
+
"env": obj.get("env"),
|
|
226
|
+
"labels": obj.get("labels"),
|
|
227
|
+
"public": obj.get("public"),
|
|
228
|
+
"target": obj.get("target"),
|
|
229
|
+
"cpu": obj.get("cpu"),
|
|
230
|
+
"gpu": obj.get("gpu"),
|
|
231
|
+
"memory": obj.get("memory"),
|
|
232
|
+
"disk": obj.get("disk"),
|
|
233
|
+
"state": obj.get("state"),
|
|
234
|
+
"errorReason": obj.get("errorReason"),
|
|
235
|
+
"backupState": obj.get("backupState"),
|
|
236
|
+
"backupCreatedAt": obj.get("backupCreatedAt"),
|
|
237
|
+
"autoStopInterval": obj.get("autoStopInterval"),
|
|
238
|
+
"autoArchiveInterval": obj.get("autoArchiveInterval"),
|
|
239
|
+
"runnerDomain": obj.get("runnerDomain"),
|
|
240
|
+
"volumes": [SandboxVolume.from_dict(_item) for _item in obj["volumes"]]
|
|
241
|
+
if obj.get("volumes") is not None
|
|
242
|
+
else None,
|
|
243
|
+
"buildInfo": BuildInfo.from_dict(obj["buildInfo"]) if obj.get("buildInfo") is not None else None,
|
|
244
|
+
"createdAt": obj.get("createdAt"),
|
|
245
|
+
"updatedAt": obj.get("updatedAt"),
|
|
246
|
+
"class": obj.get("class"),
|
|
247
|
+
"name": obj.get("name") if obj.get("name") is not None else "",
|
|
248
|
+
"image": obj.get("image"),
|
|
249
|
+
"snapshotState": obj.get("snapshotState"),
|
|
250
|
+
"snapshotCreatedAt": obj.get("snapshotCreatedAt"),
|
|
251
|
+
"info": SandboxInfo.from_dict(obj["info"]) if obj.get("info") is not None else None,
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
# store additional fields in additional_properties
|
|
255
|
+
for _key in obj.keys():
|
|
256
|
+
if _key not in cls.__properties:
|
|
257
|
+
_obj.additional_properties[_key] = obj.get(_key)
|
|
258
|
+
|
|
259
|
+
return _obj
|
|
File without changes
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Daytona
|
|
5
|
+
|
|
6
|
+
Daytona AI platform API Docs
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0
|
|
9
|
+
Contact: support@daytona.com
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import io
|
|
17
|
+
import json
|
|
18
|
+
import re
|
|
19
|
+
import ssl
|
|
20
|
+
|
|
21
|
+
import urllib3
|
|
22
|
+
|
|
23
|
+
from daytona_api_client.exceptions import ApiException, ApiValueError
|
|
24
|
+
|
|
25
|
+
SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
|
|
26
|
+
RESTResponseType = urllib3.HTTPResponse
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def is_socks_proxy_url(url):
|
|
30
|
+
if url is None:
|
|
31
|
+
return False
|
|
32
|
+
split_section = url.split("://")
|
|
33
|
+
if len(split_section) < 2:
|
|
34
|
+
return False
|
|
35
|
+
else:
|
|
36
|
+
return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class RESTResponse(io.IOBase):
|
|
40
|
+
def __init__(self, resp) -> None:
|
|
41
|
+
self.response = resp
|
|
42
|
+
self.status = resp.status
|
|
43
|
+
self.reason = resp.reason
|
|
44
|
+
self.data = None
|
|
45
|
+
|
|
46
|
+
def read(self):
|
|
47
|
+
if self.data is None:
|
|
48
|
+
self.data = self.response.data
|
|
49
|
+
return self.data
|
|
50
|
+
|
|
51
|
+
def getheaders(self):
|
|
52
|
+
"""Returns a dictionary of the response headers."""
|
|
53
|
+
return self.response.headers
|
|
54
|
+
|
|
55
|
+
def getheader(self, name, default=None):
|
|
56
|
+
"""Returns a given response header."""
|
|
57
|
+
return self.response.headers.get(name, default)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class RESTClientObject:
|
|
61
|
+
def __init__(self, configuration) -> None:
|
|
62
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
|
63
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
|
64
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
|
65
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
|
66
|
+
|
|
67
|
+
# cert_reqs
|
|
68
|
+
if configuration.verify_ssl:
|
|
69
|
+
cert_reqs = ssl.CERT_REQUIRED
|
|
70
|
+
else:
|
|
71
|
+
cert_reqs = ssl.CERT_NONE
|
|
72
|
+
|
|
73
|
+
pool_args = {
|
|
74
|
+
"cert_reqs": cert_reqs,
|
|
75
|
+
"ca_certs": configuration.ssl_ca_cert,
|
|
76
|
+
"cert_file": configuration.cert_file,
|
|
77
|
+
"key_file": configuration.key_file,
|
|
78
|
+
"ca_cert_data": configuration.ca_cert_data,
|
|
79
|
+
}
|
|
80
|
+
if configuration.assert_hostname is not None:
|
|
81
|
+
pool_args["assert_hostname"] = configuration.assert_hostname
|
|
82
|
+
|
|
83
|
+
if configuration.retries is not None:
|
|
84
|
+
pool_args["retries"] = configuration.retries
|
|
85
|
+
|
|
86
|
+
if configuration.tls_server_name:
|
|
87
|
+
pool_args["server_hostname"] = configuration.tls_server_name
|
|
88
|
+
|
|
89
|
+
if configuration.socket_options is not None:
|
|
90
|
+
pool_args["socket_options"] = configuration.socket_options
|
|
91
|
+
|
|
92
|
+
if configuration.connection_pool_maxsize is not None:
|
|
93
|
+
pool_args["maxsize"] = configuration.connection_pool_maxsize
|
|
94
|
+
|
|
95
|
+
# https pool manager
|
|
96
|
+
self.pool_manager: urllib3.PoolManager
|
|
97
|
+
|
|
98
|
+
if configuration.proxy:
|
|
99
|
+
if is_socks_proxy_url(configuration.proxy):
|
|
100
|
+
from urllib3.contrib.socks import SOCKSProxyManager
|
|
101
|
+
|
|
102
|
+
pool_args["proxy_url"] = configuration.proxy
|
|
103
|
+
pool_args["headers"] = configuration.proxy_headers
|
|
104
|
+
self.pool_manager = SOCKSProxyManager(**pool_args)
|
|
105
|
+
else:
|
|
106
|
+
pool_args["proxy_url"] = configuration.proxy
|
|
107
|
+
pool_args["proxy_headers"] = configuration.proxy_headers
|
|
108
|
+
self.pool_manager = urllib3.ProxyManager(**pool_args)
|
|
109
|
+
else:
|
|
110
|
+
self.pool_manager = urllib3.PoolManager(**pool_args)
|
|
111
|
+
|
|
112
|
+
def request(self, method, url, headers=None, body=None, post_params=None, _request_timeout=None):
|
|
113
|
+
"""Perform requests.
|
|
114
|
+
|
|
115
|
+
:param method: http request method
|
|
116
|
+
:param url: http request url
|
|
117
|
+
:param headers: http request headers
|
|
118
|
+
:param body: request json body, for `application/json`
|
|
119
|
+
:param post_params: request post parameters,
|
|
120
|
+
`application/x-www-form-urlencoded`
|
|
121
|
+
and `multipart/form-data`
|
|
122
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
123
|
+
number provided, it will be total request
|
|
124
|
+
timeout. It can also be a pair (tuple) of
|
|
125
|
+
(connection, read) timeouts.
|
|
126
|
+
"""
|
|
127
|
+
method = method.upper()
|
|
128
|
+
assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]
|
|
129
|
+
|
|
130
|
+
if post_params and body:
|
|
131
|
+
raise ApiValueError("body parameter cannot be used with post_params parameter.")
|
|
132
|
+
|
|
133
|
+
post_params = post_params or {}
|
|
134
|
+
headers = headers or {}
|
|
135
|
+
|
|
136
|
+
timeout = None
|
|
137
|
+
if _request_timeout:
|
|
138
|
+
if isinstance(_request_timeout, (int, float)):
|
|
139
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
|
140
|
+
elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2:
|
|
141
|
+
timeout = urllib3.Timeout(connect=_request_timeout[0], read=_request_timeout[1])
|
|
142
|
+
|
|
143
|
+
try:
|
|
144
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
145
|
+
if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
|
|
146
|
+
# no content type provided or payload is json
|
|
147
|
+
content_type = headers.get("Content-Type")
|
|
148
|
+
if not content_type or re.search("json", content_type, re.IGNORECASE):
|
|
149
|
+
request_body = None
|
|
150
|
+
if body is not None:
|
|
151
|
+
request_body = json.dumps(body)
|
|
152
|
+
r = self.pool_manager.request(
|
|
153
|
+
method, url, body=request_body, timeout=timeout, headers=headers, preload_content=False
|
|
154
|
+
)
|
|
155
|
+
elif content_type == "application/x-www-form-urlencoded":
|
|
156
|
+
r = self.pool_manager.request(
|
|
157
|
+
method,
|
|
158
|
+
url,
|
|
159
|
+
fields=post_params,
|
|
160
|
+
encode_multipart=False,
|
|
161
|
+
timeout=timeout,
|
|
162
|
+
headers=headers,
|
|
163
|
+
preload_content=False,
|
|
164
|
+
)
|
|
165
|
+
elif content_type == "multipart/form-data":
|
|
166
|
+
# must del headers['Content-Type'], or the correct
|
|
167
|
+
# Content-Type which generated by urllib3 will be
|
|
168
|
+
# overwritten.
|
|
169
|
+
del headers["Content-Type"]
|
|
170
|
+
# Ensures that dict objects are serialized
|
|
171
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a, b) for a, b in post_params]
|
|
172
|
+
r = self.pool_manager.request(
|
|
173
|
+
method,
|
|
174
|
+
url,
|
|
175
|
+
fields=post_params,
|
|
176
|
+
encode_multipart=True,
|
|
177
|
+
timeout=timeout,
|
|
178
|
+
headers=headers,
|
|
179
|
+
preload_content=False,
|
|
180
|
+
)
|
|
181
|
+
# Pass a `string` parameter directly in the body to support
|
|
182
|
+
# other content types than JSON when `body` argument is
|
|
183
|
+
# provided in serialized form.
|
|
184
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
|
185
|
+
r = self.pool_manager.request(
|
|
186
|
+
method, url, body=body, timeout=timeout, headers=headers, preload_content=False
|
|
187
|
+
)
|
|
188
|
+
elif headers["Content-Type"].startswith("text/") and isinstance(body, bool):
|
|
189
|
+
request_body = "true" if body else "false"
|
|
190
|
+
r = self.pool_manager.request(
|
|
191
|
+
method, url, body=request_body, preload_content=False, timeout=timeout, headers=headers
|
|
192
|
+
)
|
|
193
|
+
else:
|
|
194
|
+
# Cannot generate the request from given parameters
|
|
195
|
+
msg = """Cannot prepare a request message for provided
|
|
196
|
+
arguments. Please check that your arguments match
|
|
197
|
+
declared content type."""
|
|
198
|
+
raise ApiException(status=0, reason=msg)
|
|
199
|
+
# For `GET`, `HEAD`
|
|
200
|
+
else:
|
|
201
|
+
r = self.pool_manager.request(
|
|
202
|
+
method, url, fields={}, timeout=timeout, headers=headers, preload_content=False
|
|
203
|
+
)
|
|
204
|
+
except urllib3.exceptions.SSLError as e:
|
|
205
|
+
msg = "\n".join([type(e).__name__, str(e)])
|
|
206
|
+
raise ApiException(status=0, reason=msg)
|
|
207
|
+
|
|
208
|
+
return RESTResponse(r)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: daytona_api_client
|
|
3
|
+
Version: 0.21.3a0
|
|
4
|
+
Summary: Daytona
|
|
5
|
+
Home-page:
|
|
6
|
+
Author: Daytona Platforms Inc.
|
|
7
|
+
Author-email: support@daytona.com
|
|
8
|
+
Keywords: OpenAPI,OpenAPI-Generator,Daytona
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: urllib3<3.0.0,>=1.25.3
|
|
11
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
12
|
+
Requires-Dist: pydantic>=2
|
|
13
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: author-email
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: description-content-type
|
|
18
|
+
Dynamic: keywords
|
|
19
|
+
Dynamic: requires-dist
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
Daytona AI platform API Docs
|
|
23
|
+
|