Skip to content

Commit 549ddec

Browse files
feat: Revert template state model
1 parent 09a28d5 commit 549ddec

4 files changed

Lines changed: 8 additions & 100 deletions

File tree

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 54
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/hypeman-48b300e51c488f55e3f36024515bdb78a8fa5fe44c6fbde99d3f8a34c16df1cb.yml
3-
openapi_spec_hash: 1b53b5b26006f74ccbbb8facc57a9d44
4-
config_hash: dfacce742631adb22616891760f57888
1+
configured_endpoints: 52
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/hypeman-0aececd4fa79c47cb7222167d6746064c53b69eb70ee14252be71ccc31e6d2a2.yml
3+
openapi_spec_hash: c514624af74c74835e3187b857184ff2
4+
config_hash: ed668fae8826ff533f38df16c9664f44

api.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@ Methods:
5454
- <code title="patch /instances/{id}">client.instances.<a href="./src/resources/instances/instances.ts">update</a>(id, { ...params }) -> Instance</code>
5555
- <code title="get /instances">client.instances.<a href="./src/resources/instances/instances.ts">list</a>({ ...params }) -> InstanceListResponse</code>
5656
- <code title="delete /instances/{id}">client.instances.<a href="./src/resources/instances/instances.ts">delete</a>(id) -> void</code>
57-
- <code title="post /instances/{id}/demote-template">client.instances.<a href="./src/resources/instances/instances.ts">demoteTemplate</a>(id) -> Instance</code>
5857
- <code title="post /instances/{id}/fork">client.instances.<a href="./src/resources/instances/instances.ts">fork</a>(id, { ...params }) -> Instance</code>
5958
- <code title="get /instances/{id}">client.instances.<a href="./src/resources/instances/instances.ts">get</a>(id) -> Instance</code>
6059
- <code title="get /instances/{id}/logs">client.instances.<a href="./src/resources/instances/instances.ts">logs</a>(id, { ...params }) -> string</code>
61-
- <code title="post /instances/{id}/promote-template">client.instances.<a href="./src/resources/instances/instances.ts">promoteTemplate</a>(id) -> Instance</code>
6260
- <code title="post /instances/{id}/restore">client.instances.<a href="./src/resources/instances/instances.ts">restore</a>(id) -> Instance</code>
6361
- <code title="post /instances/{id}/standby">client.instances.<a href="./src/resources/instances/instances.ts">standby</a>(id, { ...params }) -> Instance</code>
6462
- <code title="post /instances/{id}/start">client.instances.<a href="./src/resources/instances/instances.ts">start</a>(id, { ...params }) -> Instance</code>

src/resources/instances/instances.ts

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,6 @@ export class Instances extends APIResource {
8383
});
8484
}
8585

86-
/**
87-
* Demote a template back to standby so it can be restored or deleted
88-
*
89-
* @example
90-
* ```ts
91-
* const instance = await client.instances.demoteTemplate(
92-
* 'id',
93-
* );
94-
* ```
95-
*/
96-
demoteTemplate(id: string, options?: RequestOptions): APIPromise<Instance> {
97-
return this._client.post(path`/instances/${id}/demote-template`, options);
98-
}
99-
10086
/**
10187
* Fork an instance from stopped, standby, or running (with from_running=true)
10288
*
@@ -152,20 +138,6 @@ export class Instances extends APIResource {
152138
}) as APIPromise<Stream<InstanceLogsResponse>>;
153139
}
154140

155-
/**
156-
* Promote a standby instance into a fork-only template
157-
*
158-
* @example
159-
* ```ts
160-
* const instance = await client.instances.promoteTemplate(
161-
* 'id',
162-
* );
163-
* ```
164-
*/
165-
promoteTemplate(id: string, options?: RequestOptions): APIPromise<Instance> {
166-
return this._client.post(path`/instances/${id}/promote-template`, options);
167-
}
168-
169141
/**
170142
* Restore instance from standby
171143
*
@@ -405,20 +377,9 @@ export interface Instance {
405377
* - Shutdown: VM shut down but VMM exists (Cloud Hypervisor native)
406378
* - Stopped: No VMM running, no snapshot exists
407379
* - Standby: No VMM running, snapshot exists (can be restored)
408-
* - Template: Standby snapshot promoted to a fork-only parent; cannot wake while
409-
* forks exist
410380
* - Unknown: Failed to determine state (see state_error for details)
411381
*/
412-
state:
413-
| 'Created'
414-
| 'Initializing'
415-
| 'Running'
416-
| 'Paused'
417-
| 'Shutdown'
418-
| 'Stopped'
419-
| 'Standby'
420-
| 'Template'
421-
| 'Unknown';
382+
state: 'Created' | 'Initializing' | 'Running' | 'Paused' | 'Shutdown' | 'Stopped' | 'Standby' | 'Unknown';
422383

423384
/**
424385
* Linux-only automatic standby policy based on active inbound TCP connections
@@ -851,16 +812,7 @@ export interface WaitForStateResponse {
851812
/**
852813
* Current instance state when the wait completed
853814
*/
854-
state:
855-
| 'Created'
856-
| 'Initializing'
857-
| 'Running'
858-
| 'Paused'
859-
| 'Shutdown'
860-
| 'Stopped'
861-
| 'Standby'
862-
| 'Template'
863-
| 'Unknown';
815+
state: 'Created' | 'Initializing' | 'Running' | 'Paused' | 'Shutdown' | 'Stopped' | 'Standby' | 'Unknown';
864816

865817
/**
866818
* Whether the timeout expired before the target state was reached
@@ -1143,16 +1095,7 @@ export interface InstanceListParams {
11431095
/**
11441096
* Filter instances by state (e.g., Running, Stopped)
11451097
*/
1146-
state?:
1147-
| 'Created'
1148-
| 'Initializing'
1149-
| 'Running'
1150-
| 'Paused'
1151-
| 'Shutdown'
1152-
| 'Stopped'
1153-
| 'Standby'
1154-
| 'Template'
1155-
| 'Unknown';
1098+
state?: 'Created' | 'Initializing' | 'Running' | 'Paused' | 'Shutdown' | 'Stopped' | 'Standby' | 'Unknown';
11561099

11571100
/**
11581101
* Filter instances by tag key-value pairs. Uses deepObject style:
@@ -1246,16 +1189,7 @@ export interface InstanceWaitParams {
12461189
/**
12471190
* Target state to wait for
12481191
*/
1249-
state:
1250-
| 'Created'
1251-
| 'Initializing'
1252-
| 'Running'
1253-
| 'Paused'
1254-
| 'Shutdown'
1255-
| 'Stopped'
1256-
| 'Standby'
1257-
| 'Template'
1258-
| 'Unknown';
1192+
state: 'Created' | 'Initializing' | 'Running' | 'Paused' | 'Shutdown' | 'Stopped' | 'Standby' | 'Unknown';
12591193

12601194
/**
12611195
* Maximum duration to wait (Go duration format, e.g. "30s", "2m"). Capped at 5

tests/api-resources/instances/instances.test.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,6 @@ describe('resource instances', () => {
138138
expect(dataAndResponse.response).toBe(rawResponse);
139139
});
140140

141-
// Mock server tests are disabled
142-
test.skip('demoteTemplate', async () => {
143-
const responsePromise = client.instances.demoteTemplate('id');
144-
const rawResponse = await responsePromise.asResponse();
145-
expect(rawResponse).toBeInstanceOf(Response);
146-
const response = await responsePromise;
147-
expect(response).not.toBeInstanceOf(Response);
148-
const dataAndResponse = await responsePromise.withResponse();
149-
expect(dataAndResponse.data).toBe(response);
150-
expect(dataAndResponse.response).toBe(rawResponse);
151-
});
152-
153141
// Mock server tests are disabled
154142
test.skip('fork: only required params', async () => {
155143
const responsePromise = client.instances.fork('id', { name: 'my-workload-1-fork' });
@@ -211,18 +199,6 @@ describe('resource instances', () => {
211199
).rejects.toThrow(Hypeman.NotFoundError);
212200
});
213201

214-
// Mock server tests are disabled
215-
test.skip('promoteTemplate', async () => {
216-
const responsePromise = client.instances.promoteTemplate('id');
217-
const rawResponse = await responsePromise.asResponse();
218-
expect(rawResponse).toBeInstanceOf(Response);
219-
const response = await responsePromise;
220-
expect(response).not.toBeInstanceOf(Response);
221-
const dataAndResponse = await responsePromise.withResponse();
222-
expect(dataAndResponse.data).toBe(response);
223-
expect(dataAndResponse.response).toBe(rawResponse);
224-
});
225-
226202
// Mock server tests are disabled
227203
test.skip('restore', async () => {
228204
const responsePromise = client.instances.restore('id');

0 commit comments

Comments
 (0)