Skip to content

Commit 8786477

Browse files
feat(api): add readiness_timeout field to service spec types
1 parent c731392 commit 8786477

7 files changed

Lines changed: 142 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 193
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-439cda23bbab7cb3207b4350637971f50e98624270abba0e636cef39b54d34bd.yml
3-
openapi_spec_hash: 5b2ead9eced70d525d4348b2ed3f1387
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-c1f318f2e8413e0195faf5e4216a17cf106cf942e2c51c5174476e801c097e2b.yml
3+
openapi_spec_hash: d6ec53f1cd8364bb6261cd3c0a5d2869
44
config_hash: 4447d1e1149a80d1bec70d353fb8acbf

src/gitpod/types/environments/automations/service_spec.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ class ServiceSpec(BaseModel):
6262
env: Optional[List[EnvironmentVariableItem]] = None
6363
"""env specifies environment variables for the service."""
6464

65+
readiness_timeout: Optional[str] = FieldInfo(alias="readinessTimeout", default=None)
66+
"""
67+
readiness_timeout is the maximum duration a service may remain in the Starting
68+
phase while readiness checks run. 0s disables the timeout.
69+
"""
70+
6571
runs_on: Optional[RunsOn] = FieldInfo(alias="runsOn", default=None)
6672
"""runs_on specifies the environment the service should run on."""
6773

src/gitpod/types/environments/automations/service_spec_param.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ class ServiceSpecParam(TypedDict, total=False):
6363
env: Iterable[EnvironmentVariableItem]
6464
"""env specifies environment variables for the service."""
6565

66+
readiness_timeout: Annotated[str, PropertyInfo(alias="readinessTimeout")]
67+
"""
68+
readiness_timeout is the maximum duration a service may remain in the Starting
69+
phase while readiness checks run. 0s disables the timeout.
70+
"""
71+
6672
runs_on: Annotated[RunsOn, PropertyInfo(alias="runsOn")]
6773
"""runs_on specifies the environment the service should run on."""
6874

src/gitpod/types/environments/automations/service_update_params.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,67 @@ class Spec(TypedDict, total=False):
6969

7070
env: Iterable[EnvironmentVariableItem]
7171

72+
readiness_timeout: Annotated[str, PropertyInfo(alias="readinessTimeout")]
73+
"""
74+
A Duration represents a signed, fixed-length span of time represented as a count
75+
of seconds and fractions of seconds at nanosecond resolution. It is independent
76+
of any calendar and concepts like "day" or "month". It is related to Timestamp
77+
in that the difference between two Timestamp values is a Duration and it can be
78+
added or subtracted from a Timestamp. Range is approximately +-10,000 years.
79+
80+
# Examples
81+
82+
Example 1: Compute Duration from two Timestamps in pseudo code.
83+
84+
Timestamp start = ...;
85+
Timestamp end = ...;
86+
Duration duration = ...;
87+
88+
duration.seconds = end.seconds - start.seconds;
89+
duration.nanos = end.nanos - start.nanos;
90+
91+
if (duration.seconds < 0 && duration.nanos > 0) {
92+
duration.seconds += 1;
93+
duration.nanos -= 1000000000;
94+
} else if (duration.seconds > 0 && duration.nanos < 0) {
95+
duration.seconds -= 1;
96+
duration.nanos += 1000000000;
97+
}
98+
99+
Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
100+
101+
Timestamp start = ...;
102+
Duration duration = ...;
103+
Timestamp end = ...;
104+
105+
end.seconds = start.seconds + duration.seconds;
106+
end.nanos = start.nanos + duration.nanos;
107+
108+
if (end.nanos < 0) {
109+
end.seconds -= 1;
110+
end.nanos += 1000000000;
111+
} else if (end.nanos >= 1000000000) {
112+
end.seconds += 1;
113+
end.nanos -= 1000000000;
114+
}
115+
116+
Example 3: Compute Duration from datetime.timedelta in Python.
117+
118+
td = datetime.timedelta(days=3, minutes=10)
119+
duration = Duration()
120+
duration.FromTimedelta(td)
121+
122+
# JSON Mapping
123+
124+
In JSON format, the Duration type is encoded as a string rather than an object,
125+
where the string ends in the suffix "s" (indicating seconds) and is preceded by
126+
the number of seconds, with nanoseconds expressed as fractional seconds. For
127+
example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s",
128+
while 3 seconds and 1 nanosecond should be expressed in JSON format as
129+
"3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON
130+
format as "3.000001s".
131+
"""
132+
72133
runs_on: Annotated[Optional[RunsOn], PropertyInfo(alias="runsOn")]
73134

74135

src/gitpod/types/environments/automations_file_param.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,67 @@ class Services(TypedDict, total=False):
4949

5050
name: str
5151

52+
readiness_timeout: Annotated[str, PropertyInfo(alias="readinessTimeout")]
53+
"""
54+
A Duration represents a signed, fixed-length span of time represented as a count
55+
of seconds and fractions of seconds at nanosecond resolution. It is independent
56+
of any calendar and concepts like "day" or "month". It is related to Timestamp
57+
in that the difference between two Timestamp values is a Duration and it can be
58+
added or subtracted from a Timestamp. Range is approximately +-10,000 years.
59+
60+
# Examples
61+
62+
Example 1: Compute Duration from two Timestamps in pseudo code.
63+
64+
Timestamp start = ...;
65+
Timestamp end = ...;
66+
Duration duration = ...;
67+
68+
duration.seconds = end.seconds - start.seconds;
69+
duration.nanos = end.nanos - start.nanos;
70+
71+
if (duration.seconds < 0 && duration.nanos > 0) {
72+
duration.seconds += 1;
73+
duration.nanos -= 1000000000;
74+
} else if (duration.seconds > 0 && duration.nanos < 0) {
75+
duration.seconds -= 1;
76+
duration.nanos += 1000000000;
77+
}
78+
79+
Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
80+
81+
Timestamp start = ...;
82+
Duration duration = ...;
83+
Timestamp end = ...;
84+
85+
end.seconds = start.seconds + duration.seconds;
86+
end.nanos = start.nanos + duration.nanos;
87+
88+
if (end.nanos < 0) {
89+
end.seconds -= 1;
90+
end.nanos += 1000000000;
91+
} else if (end.nanos >= 1000000000) {
92+
end.seconds += 1;
93+
end.nanos -= 1000000000;
94+
}
95+
96+
Example 3: Compute Duration from datetime.timedelta in Python.
97+
98+
td = datetime.timedelta(days=3, minutes=10)
99+
duration = Duration()
100+
duration.FromTimedelta(td)
101+
102+
# JSON Mapping
103+
104+
In JSON format, the Duration type is encoded as a string rather than an object,
105+
where the string ends in the suffix "s" (indicating seconds) and is preceded by
106+
the number of seconds, with nanoseconds expressed as fractional seconds. For
107+
example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s",
108+
while 3 seconds and 1 nanosecond should be expressed in JSON format as
109+
"3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON
110+
format as "3.000001s".
111+
"""
112+
52113
role: Literal["", "default", "editor", "ai-agent"]
53114

54115
runs_on: Annotated[RunsOn, PropertyInfo(alias="runsOn")]

tests/api_resources/environments/automations/test_services.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def test_method_create_with_all_params(self, client: Gitpod) -> None:
6969
"value_from": {"secret_ref": {"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}},
7070
}
7171
],
72+
"readiness_timeout": "+9125115.360s",
7273
"runs_on": {
7374
"docker": {
7475
"environment": ["string"],
@@ -181,6 +182,7 @@ def test_method_update_with_all_params(self, client: Gitpod) -> None:
181182
"value_from": {"secret_ref": {"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}},
182183
}
183184
],
185+
"readiness_timeout": "+9125115.360s",
184186
"runs_on": {
185187
"docker": {
186188
"environment": ["string"],
@@ -429,6 +431,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGitpod) ->
429431
"value_from": {"secret_ref": {"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}},
430432
}
431433
],
434+
"readiness_timeout": "+9125115.360s",
432435
"runs_on": {
433436
"docker": {
434437
"environment": ["string"],
@@ -541,6 +544,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncGitpod) ->
541544
"value_from": {"secret_ref": {"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"}},
542545
}
543546
],
547+
"readiness_timeout": "+9125115.360s",
544548
"runs_on": {
545549
"docker": {
546550
"environment": ["string"],

tests/api_resources/environments/test_automations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def test_method_upsert_with_all_params(self, client: Gitpod) -> None:
3737
},
3838
"description": "Development web server",
3939
"name": "Web Server",
40+
"readiness_timeout": "+9125115.360s",
4041
"role": "",
4142
"runs_on": {
4243
"docker": {
@@ -117,6 +118,7 @@ async def test_method_upsert_with_all_params(self, async_client: AsyncGitpod) ->
117118
},
118119
"description": "Development web server",
119120
"name": "Web Server",
121+
"readiness_timeout": "+9125115.360s",
120122
"role": "",
121123
"runs_on": {
122124
"docker": {

0 commit comments

Comments
 (0)