phala-cloud 0.1.1__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.
- phala_cloud/__init__.py +36 -0
- phala_cloud/action_responses.py +222 -0
- phala_cloud/actions.py +583 -0
- phala_cloud/blockchains.py +32 -0
- phala_cloud/client.py +462 -0
- phala_cloud/errors.py +32 -0
- phala_cloud/full_client.py +1711 -0
- phala_cloud/models/__init__.py +23 -0
- phala_cloud/models/auth.py +51 -0
- phala_cloud/models/base.py +9 -0
- phala_cloud/models/cvms.py +70 -0
- phala_cloud/models/kms.py +29 -0
- phala_cloud/models/nodes.py +44 -0
- phala_cloud/result.py +20 -0
- phala_cloud/utils.py +51 -0
- phala_cloud-0.1.1.dist-info/METADATA +150 -0
- phala_cloud-0.1.1.dist-info/RECORD +18 -0
- phala_cloud-0.1.1.dist-info/WHEEL +4 -0
phala_cloud/__init__.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from .actions import * # noqa: F403
|
|
2
|
+
from .blockchains import add_compose_hash, deploy_app_auth
|
|
3
|
+
from .client import DEFAULT_API_VERSION, SUPPORTED_API_VERSIONS, ApiVersion
|
|
4
|
+
from .errors import ApiError, PhalaCloudError, RequestError, ValidationError
|
|
5
|
+
from .full_client import AsyncPhalaCloud, PhalaCloud, create_async_client, create_client
|
|
6
|
+
from .models import * # noqa: F403
|
|
7
|
+
from .result import SafeResult
|
|
8
|
+
from .utils import (
|
|
9
|
+
encrypt_env_vars,
|
|
10
|
+
get_compose_hash,
|
|
11
|
+
parse_env,
|
|
12
|
+
parse_env_vars,
|
|
13
|
+
verify_env_encrypt_public_key,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"ApiError",
|
|
18
|
+
"ApiVersion",
|
|
19
|
+
"AsyncPhalaCloud",
|
|
20
|
+
"DEFAULT_API_VERSION",
|
|
21
|
+
"PhalaCloud",
|
|
22
|
+
"PhalaCloudError",
|
|
23
|
+
"RequestError",
|
|
24
|
+
"SUPPORTED_API_VERSIONS",
|
|
25
|
+
"SafeResult",
|
|
26
|
+
"ValidationError",
|
|
27
|
+
"add_compose_hash",
|
|
28
|
+
"deploy_app_auth",
|
|
29
|
+
"encrypt_env_vars",
|
|
30
|
+
"get_compose_hash",
|
|
31
|
+
"parse_env",
|
|
32
|
+
"parse_env_vars",
|
|
33
|
+
"verify_env_encrypt_public_key",
|
|
34
|
+
"create_async_client",
|
|
35
|
+
"create_client",
|
|
36
|
+
]
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from .models.auth import CurrentUserV20251028, CurrentUserV20260121
|
|
6
|
+
from .models.base import CloudModel
|
|
7
|
+
from .models.cvms import PaginatedCvmInfosV20251028, PaginatedCvmInfosV20260121
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class GenericObject(CloudModel):
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class WorkspaceResponse(CloudModel):
|
|
15
|
+
id: str
|
|
16
|
+
name: str
|
|
17
|
+
slug: str | None = None
|
|
18
|
+
tier: str | None = None
|
|
19
|
+
role: str | None = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ListWorkspacesResponse(CloudModel):
|
|
23
|
+
data: list[WorkspaceResponse] = Field(default_factory=list)
|
|
24
|
+
pagination: GenericObject | None = None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class InstanceTypesAllResponse(CloudModel):
|
|
28
|
+
result: list[GenericObject] = Field(default_factory=list)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class InstanceTypesFamilyResponse(CloudModel):
|
|
32
|
+
items: list[GenericObject] = Field(default_factory=list)
|
|
33
|
+
total: int | None = None
|
|
34
|
+
family: str | None = None
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ProvisionCvmResponse(CloudModel):
|
|
38
|
+
app_id: str | None = None
|
|
39
|
+
app_env_encrypt_pubkey: str | None = None
|
|
40
|
+
compose_hash: str
|
|
41
|
+
kms_info: GenericObject | None = None
|
|
42
|
+
fmspc: str | None = None
|
|
43
|
+
device_id: str | None = None
|
|
44
|
+
os_image_hash: str | None = None
|
|
45
|
+
instance_type: str | None = None
|
|
46
|
+
node_id: int | None = None
|
|
47
|
+
kms_id: str | None = None
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class CommitCvmProvisionResponse(CloudModel):
|
|
51
|
+
id: int | str
|
|
52
|
+
name: str
|
|
53
|
+
status: str
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class ComposeHashPreconditionResponse(CloudModel):
|
|
57
|
+
status: str = "precondition_required"
|
|
58
|
+
message: str
|
|
59
|
+
compose_hash: str
|
|
60
|
+
app_id: str
|
|
61
|
+
device_id: str
|
|
62
|
+
kms_info: GenericObject | None = None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class InProgressResponse(CloudModel):
|
|
66
|
+
status: str = "in_progress"
|
|
67
|
+
message: str | None = None
|
|
68
|
+
correlation_id: str | None = None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class CvmStateResponse(CloudModel):
|
|
72
|
+
id: str | None = None
|
|
73
|
+
instance_id: str | None = None
|
|
74
|
+
name: str | None = None
|
|
75
|
+
status: str
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class AppFilterOptionsResponse(CloudModel):
|
|
79
|
+
statuses: list[str] = Field(default_factory=list)
|
|
80
|
+
image_versions: list[str] = Field(default_factory=list)
|
|
81
|
+
instance_types: list[str] = Field(default_factory=list)
|
|
82
|
+
kms_slugs: list[str] = Field(default_factory=list)
|
|
83
|
+
kms_types: list[str] = Field(default_factory=list)
|
|
84
|
+
regions: list[str] = Field(default_factory=list)
|
|
85
|
+
nodes: list[str] = Field(default_factory=list)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class SshKeyResponse(CloudModel):
|
|
89
|
+
id: str
|
|
90
|
+
name: str
|
|
91
|
+
public_key: str
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class ImportGithubProfileResponse(CloudModel):
|
|
95
|
+
github_username: str
|
|
96
|
+
keys_added: int
|
|
97
|
+
keys_skipped: int
|
|
98
|
+
errors: list[str] = Field(default_factory=list)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class SyncGithubSshKeysResponse(CloudModel):
|
|
102
|
+
synced_count: int
|
|
103
|
+
keys_added: int
|
|
104
|
+
keys_updated: int
|
|
105
|
+
keys_removed: int
|
|
106
|
+
errors: list[str] = Field(default_factory=list)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class AppEnvPubkeyResponse(CloudModel):
|
|
110
|
+
public_key: str
|
|
111
|
+
signature: str
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class NextAppIdsResponse(CloudModel):
|
|
115
|
+
app_ids: list[GenericObject] = Field(default_factory=list)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class WorkspaceNodesResponse(CloudModel):
|
|
119
|
+
items: list[GenericObject] = Field(default_factory=list)
|
|
120
|
+
total: int | None = None
|
|
121
|
+
page: int | None = None
|
|
122
|
+
page_size: int | None = None
|
|
123
|
+
pages: int | None = None
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class WorkspaceQuotasResponse(CloudModel):
|
|
127
|
+
team_slug: str | None = None
|
|
128
|
+
tier: str | None = None
|
|
129
|
+
quotas: GenericObject | None = None
|
|
130
|
+
reserved_nodes: GenericObject | None = None
|
|
131
|
+
reserved_gpu: GenericObject | None = None
|
|
132
|
+
as_of: str | None = None
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class CvmInfoResponse(CloudModel):
|
|
136
|
+
id: str | int | None = None
|
|
137
|
+
name: str | None = None
|
|
138
|
+
status: str | None = None
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class ComposeFileResponse(CloudModel):
|
|
142
|
+
docker_compose_file: str | None = None
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class CvmActionResponse(CloudModel):
|
|
146
|
+
id: int | str | None = None
|
|
147
|
+
name: str | None = None
|
|
148
|
+
status: str | None = None
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class CvmStatsResponse(CloudModel):
|
|
152
|
+
is_online: bool | None = None
|
|
153
|
+
status: str | None = None
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class CvmNetworkResponse(CloudModel):
|
|
157
|
+
is_online: bool | None = None
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class CvmContainersResponse(CloudModel):
|
|
161
|
+
is_online: bool | None = None
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class CvmAttestationResponse(CloudModel):
|
|
165
|
+
is_online: bool | None = None
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
class CvmVisibilityResponse(CloudModel):
|
|
169
|
+
status: str | None = None
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class CvmUserConfigResponse(CloudModel):
|
|
173
|
+
hostname: str | None = None
|
|
174
|
+
ssh_authorized_keys: list[str] = Field(default_factory=list)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class RefreshInstanceIdResponse(CloudModel):
|
|
178
|
+
status: str | None = None
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class RefreshInstanceIdsResponse(CloudModel):
|
|
182
|
+
total: int
|
|
183
|
+
scanned: int
|
|
184
|
+
updated: int
|
|
185
|
+
unchanged: int
|
|
186
|
+
skipped: int
|
|
187
|
+
conflicts: int
|
|
188
|
+
errors: int
|
|
189
|
+
items: list[GenericObject] = Field(default_factory=list)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class AppListResponse(CloudModel):
|
|
193
|
+
items: list[GenericObject] = Field(default_factory=list)
|
|
194
|
+
total: int | None = None
|
|
195
|
+
page: int | None = None
|
|
196
|
+
page_size: int | None = None
|
|
197
|
+
pages: int | None = None
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
class AppInfoResponse(CloudModel):
|
|
201
|
+
id: str | None = None
|
|
202
|
+
name: str | None = None
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class AppRevisionsResponse(CloudModel):
|
|
206
|
+
items: list[GenericObject] = Field(default_factory=list)
|
|
207
|
+
total: int | None = None
|
|
208
|
+
page: int | None = None
|
|
209
|
+
page_size: int | None = None
|
|
210
|
+
pages: int | None = None
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
class AppRevisionDetailResponse(CloudModel):
|
|
214
|
+
id: str | None = None
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class AppAttestationResponse(CloudModel):
|
|
218
|
+
instances: list[GenericObject] = Field(default_factory=list)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
CurrentUserResponse = CurrentUserV20260121 | CurrentUserV20251028
|
|
222
|
+
PaginatedCvmListResponse = PaginatedCvmInfosV20260121 | PaginatedCvmInfosV20251028
|