-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvolumes.ts
More file actions
77 lines (69 loc) · 1.79 KB
/
volumes.ts
File metadata and controls
77 lines (69 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as InstancesAPI from './instances';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class Volumes extends APIResource {
/**
* Attach volume to instance
*
* @example
* ```ts
* const instance = await client.instances.volumes.attach(
* 'volumeId',
* { id: 'id', mount_path: '/mnt/data' },
* );
* ```
*/
attach(
volumeID: string,
params: VolumeAttachParams,
options?: RequestOptions,
): APIPromise<InstancesAPI.Instance> {
const { id, ...body } = params;
return this._client.post(path`/instances/${id}/volumes/${volumeID}`, { body, ...options });
}
/**
* Detach volume from instance
*
* @example
* ```ts
* const instance = await client.instances.volumes.detach(
* 'volumeId',
* { id: 'id' },
* );
* ```
*/
detach(
volumeID: string,
params: VolumeDetachParams,
options?: RequestOptions,
): APIPromise<InstancesAPI.Instance> {
const { id } = params;
return this._client.delete(path`/instances/${id}/volumes/${volumeID}`, options);
}
}
export interface VolumeAttachParams {
/**
* Path param: Instance ID or name
*/
id: string;
/**
* Body param: Path where volume should be mounted
*/
mount_path: string;
/**
* Body param: Mount as read-only
*/
readonly?: boolean;
}
export interface VolumeDetachParams {
/**
* Instance ID or name
*/
id: string;
}
export declare namespace Volumes {
export { type VolumeAttachParams as VolumeAttachParams, type VolumeDetachParams as VolumeDetachParams };
}