|
9 | 9 |
|
10 | 10 | from __future__ import annotations
|
11 | 11 |
|
12 |
| -from datetime import datetime |
13 | 12 | from typing import Literal, Union
|
14 | 13 |
|
15 | 14 | from pydantic import Field
|
16 | 15 |
|
17 | 16 | from githubkit.compat import GitHubModel, model_rebuild
|
18 |
| -from githubkit.typing import Missing |
19 |
| -from githubkit.utils import UNSET |
20 | 17 |
|
21 |
| -from .group_0003 import SimpleUser |
22 |
| -from .group_0168 import MinimalRepository |
23 |
| -from .group_0177 import CodespaceMachine |
24 | 18 |
|
| 19 | +class CodespaceMachine(GitHubModel): |
| 20 | + """Codespace machine |
25 | 21 |
|
26 |
| -class Codespace(GitHubModel): |
27 |
| - """Codespace |
28 |
| -
|
29 |
| - A codespace. |
30 |
| - """ |
31 |
| - |
32 |
| - id: int = Field() |
33 |
| - name: str = Field(description="Automatically generated name of this codespace.") |
34 |
| - display_name: Missing[Union[str, None]] = Field( |
35 |
| - default=UNSET, description="Display name for this codespace." |
36 |
| - ) |
37 |
| - environment_id: Union[str, None] = Field( |
38 |
| - description="UUID identifying this codespace's environment." |
39 |
| - ) |
40 |
| - owner: SimpleUser = Field(title="Simple User", description="A GitHub user.") |
41 |
| - billable_owner: SimpleUser = Field( |
42 |
| - title="Simple User", description="A GitHub user." |
43 |
| - ) |
44 |
| - repository: MinimalRepository = Field( |
45 |
| - title="Minimal Repository", description="Minimal Repository" |
46 |
| - ) |
47 |
| - machine: Union[None, CodespaceMachine] = Field() |
48 |
| - devcontainer_path: Missing[Union[str, None]] = Field( |
49 |
| - default=UNSET, |
50 |
| - description="Path to devcontainer.json from repo root used to create Codespace.", |
51 |
| - ) |
52 |
| - prebuild: Union[bool, None] = Field( |
53 |
| - description="Whether the codespace was created from a prebuild." |
54 |
| - ) |
55 |
| - created_at: datetime = Field() |
56 |
| - updated_at: datetime = Field() |
57 |
| - last_used_at: datetime = Field( |
58 |
| - description="Last known time this codespace was started." |
59 |
| - ) |
60 |
| - state: Literal[ |
61 |
| - "Unknown", |
62 |
| - "Created", |
63 |
| - "Queued", |
64 |
| - "Provisioning", |
65 |
| - "Available", |
66 |
| - "Awaiting", |
67 |
| - "Unavailable", |
68 |
| - "Deleted", |
69 |
| - "Moved", |
70 |
| - "Shutdown", |
71 |
| - "Archived", |
72 |
| - "Starting", |
73 |
| - "ShuttingDown", |
74 |
| - "Failed", |
75 |
| - "Exporting", |
76 |
| - "Updating", |
77 |
| - "Rebuilding", |
78 |
| - ] = Field(description="State of this codespace.") |
79 |
| - url: str = Field(description="API URL for this codespace.") |
80 |
| - git_status: CodespacePropGitStatus = Field( |
81 |
| - description="Details about the codespace's git repository." |
82 |
| - ) |
83 |
| - location: Literal["EastUs", "SouthEastAsia", "WestEurope", "WestUs2"] = Field( |
84 |
| - description="The initally assigned location of a new codespace." |
85 |
| - ) |
86 |
| - idle_timeout_minutes: Union[int, None] = Field( |
87 |
| - description="The number of minutes of inactivity after which this codespace will be automatically stopped." |
88 |
| - ) |
89 |
| - web_url: str = Field(description="URL to access this codespace on the web.") |
90 |
| - machines_url: str = Field( |
91 |
| - description="API URL to access available alternate machine types for this codespace." |
92 |
| - ) |
93 |
| - start_url: str = Field(description="API URL to start this codespace.") |
94 |
| - stop_url: str = Field(description="API URL to stop this codespace.") |
95 |
| - publish_url: Missing[Union[str, None]] = Field( |
96 |
| - default=UNSET, |
97 |
| - description="API URL to publish this codespace to a new repository.", |
98 |
| - ) |
99 |
| - pulls_url: Union[str, None] = Field( |
100 |
| - description="API URL for the Pull Request associated with this codespace, if any." |
101 |
| - ) |
102 |
| - recent_folders: list[str] = Field() |
103 |
| - runtime_constraints: Missing[CodespacePropRuntimeConstraints] = Field(default=UNSET) |
104 |
| - pending_operation: Missing[Union[bool, None]] = Field( |
105 |
| - default=UNSET, |
106 |
| - description="Whether or not a codespace has a pending async operation. This would mean that the codespace is temporarily unavailable. The only thing that you can do with a codespace in this state is delete it.", |
107 |
| - ) |
108 |
| - pending_operation_disabled_reason: Missing[Union[str, None]] = Field( |
109 |
| - default=UNSET, |
110 |
| - description="Text to show user when codespace is disabled by a pending operation", |
111 |
| - ) |
112 |
| - idle_timeout_notice: Missing[Union[str, None]] = Field( |
113 |
| - default=UNSET, |
114 |
| - description="Text to show user when codespace idle timeout minutes has been overriden by an organization policy", |
115 |
| - ) |
116 |
| - retention_period_minutes: Missing[Union[int, None]] = Field( |
117 |
| - default=UNSET, |
118 |
| - description="Duration in minutes after codespace has gone idle in which it will be deleted. Must be integer minutes between 0 and 43200 (30 days).", |
119 |
| - ) |
120 |
| - retention_expires_at: Missing[Union[datetime, None]] = Field( |
121 |
| - default=UNSET, |
122 |
| - description='When a codespace will be auto-deleted based on the "retention_period_minutes" and "last_used_at"', |
123 |
| - ) |
124 |
| - last_known_stop_notice: Missing[Union[str, None]] = Field( |
125 |
| - default=UNSET, |
126 |
| - description="The text to display to a user when a codespace has been stopped for a potentially actionable reason.", |
127 |
| - ) |
128 |
| - |
129 |
| - |
130 |
| -class CodespacePropGitStatus(GitHubModel): |
131 |
| - """CodespacePropGitStatus |
132 |
| -
|
133 |
| - Details about the codespace's git repository. |
| 22 | + A description of the machine powering a codespace. |
134 | 23 | """
|
135 | 24 |
|
136 |
| - ahead: Missing[int] = Field( |
137 |
| - default=UNSET, |
138 |
| - description="The number of commits the local repository is ahead of the remote.", |
139 |
| - ) |
140 |
| - behind: Missing[int] = Field( |
141 |
| - default=UNSET, |
142 |
| - description="The number of commits the local repository is behind the remote.", |
143 |
| - ) |
144 |
| - has_unpushed_changes: Missing[bool] = Field( |
145 |
| - default=UNSET, description="Whether the local repository has unpushed changes." |
| 25 | + name: str = Field(description="The name of the machine.") |
| 26 | + display_name: str = Field( |
| 27 | + description="The display name of the machine includes cores, memory, and storage." |
146 | 28 | )
|
147 |
| - has_uncommitted_changes: Missing[bool] = Field( |
148 |
| - default=UNSET, |
149 |
| - description="Whether the local repository has uncommitted changes.", |
| 29 | + operating_system: str = Field(description="The operating system of the machine.") |
| 30 | + storage_in_bytes: int = Field( |
| 31 | + description="How much storage is available to the codespace." |
150 | 32 | )
|
151 |
| - ref: Missing[str] = Field( |
152 |
| - default=UNSET, |
153 |
| - description="The current branch (or SHA if in detached HEAD state) of the local repository.", |
| 33 | + memory_in_bytes: int = Field( |
| 34 | + description="How much memory is available to the codespace." |
154 | 35 | )
|
155 |
| - |
156 |
| - |
157 |
| -class CodespacePropRuntimeConstraints(GitHubModel): |
158 |
| - """CodespacePropRuntimeConstraints""" |
159 |
| - |
160 |
| - allowed_port_privacy_settings: Missing[Union[list[str], None]] = Field( |
161 |
| - default=UNSET, |
162 |
| - description="The privacy settings a user can select from when forwarding a port.", |
| 36 | + cpus: int = Field(description="How many cores are available to the codespace.") |
| 37 | + prebuild_availability: Union[None, Literal["none", "ready", "in_progress"]] = Field( |
| 38 | + description='Whether a prebuild is currently available when creating a codespace for this machine and repository. If a branch was not specified as a ref, the default branch will be assumed. Value will be "null" if prebuilds are not supported or prebuild availability could not be determined. Value will be "none" if no prebuild is available. Latest values "ready" and "in_progress" indicate the prebuild availability status.' |
163 | 39 | )
|
164 | 40 |
|
165 | 41 |
|
166 |
| -model_rebuild(Codespace) |
167 |
| -model_rebuild(CodespacePropGitStatus) |
168 |
| -model_rebuild(CodespacePropRuntimeConstraints) |
| 42 | +model_rebuild(CodespaceMachine) |
169 | 43 |
|
170 |
| -__all__ = ( |
171 |
| - "Codespace", |
172 |
| - "CodespacePropGitStatus", |
173 |
| - "CodespacePropRuntimeConstraints", |
174 |
| -) |
| 44 | +__all__ = ("CodespaceMachine",) |
0 commit comments