@scaleway/sdk-file 1.0.3
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.
- package/LICENSE +191 -0
- package/dist/index.gen.cjs +4 -0
- package/dist/index.gen.d.ts +5 -0
- package/dist/index.gen.js +4 -0
- package/dist/v1alpha1/api.gen.cjs +137 -0
- package/dist/v1alpha1/api.gen.d.ts +72 -0
- package/dist/v1alpha1/api.gen.js +137 -0
- package/dist/v1alpha1/content.gen.cjs +7 -0
- package/dist/v1alpha1/content.gen.d.ts +3 -0
- package/dist/v1alpha1/content.gen.js +7 -0
- package/dist/v1alpha1/index.gen.cjs +14 -0
- package/dist/v1alpha1/index.gen.d.ts +5 -0
- package/dist/v1alpha1/index.gen.js +14 -0
- package/dist/v1alpha1/marshalling.gen.cjs +75 -0
- package/dist/v1alpha1/marshalling.gen.d.ts +7 -0
- package/dist/v1alpha1/marshalling.gen.js +75 -0
- package/dist/v1alpha1/types.gen.d.ts +247 -0
- package/dist/v1alpha1/validation-rules.gen.cjs +40 -0
- package/dist/v1alpha1/validation-rules.gen.d.ts +34 -0
- package/dist/v1alpha1/validation-rules.gen.js +40 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
https://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2019 Scaleway.
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sdkClient = require("@scaleway/sdk-client");
|
|
4
|
+
const content_gen = require("./content.gen.cjs");
|
|
5
|
+
const marshalling_gen = require("./marshalling.gen.cjs");
|
|
6
|
+
const jsonContentHeaders = {
|
|
7
|
+
"Content-Type": "application/json; charset=utf-8"
|
|
8
|
+
};
|
|
9
|
+
class API extends sdkClient.API {
|
|
10
|
+
/** Lists the available regions of the API. */
|
|
11
|
+
static LOCALITIES = ["fr-par"];
|
|
12
|
+
/**
|
|
13
|
+
* Get filesystem details. Retrieve all properties and current status of a specific filesystem identified by its ID.
|
|
14
|
+
*
|
|
15
|
+
* @param request - The request {@link GetFileSystemRequest}
|
|
16
|
+
* @returns A Promise of FileSystem
|
|
17
|
+
*/
|
|
18
|
+
getFileSystem = (request) => this.client.fetch(
|
|
19
|
+
{
|
|
20
|
+
method: "GET",
|
|
21
|
+
path: `/file/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/filesystems/${sdkClient.validatePathParam("filesystemId", request.filesystemId)}`
|
|
22
|
+
},
|
|
23
|
+
marshalling_gen.unmarshalFileSystem
|
|
24
|
+
);
|
|
25
|
+
/**
|
|
26
|
+
* Waits for {@link FileSystem} to be in a final state.
|
|
27
|
+
*
|
|
28
|
+
* @param request - The request {@link GetFileSystemRequest}
|
|
29
|
+
* @param options - The waiting options
|
|
30
|
+
* @returns A Promise of FileSystem
|
|
31
|
+
*/
|
|
32
|
+
waitForFileSystem = (request, options) => sdkClient.waitForResource(
|
|
33
|
+
options?.stop ?? ((res) => Promise.resolve(
|
|
34
|
+
!content_gen.FILE_SYSTEM_TRANSIENT_STATUSES.includes(res.status)
|
|
35
|
+
)),
|
|
36
|
+
this.getFileSystem,
|
|
37
|
+
request,
|
|
38
|
+
options
|
|
39
|
+
);
|
|
40
|
+
pageOfListFileSystems = (request = {}) => this.client.fetch(
|
|
41
|
+
{
|
|
42
|
+
method: "GET",
|
|
43
|
+
path: `/file/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/filesystems`,
|
|
44
|
+
urlParams: sdkClient.urlParams(
|
|
45
|
+
["name", request.name],
|
|
46
|
+
["order_by", request.orderBy],
|
|
47
|
+
["page", request.page],
|
|
48
|
+
[
|
|
49
|
+
"page_size",
|
|
50
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
51
|
+
],
|
|
52
|
+
["project_id", request.projectId],
|
|
53
|
+
["tags", request.tags]
|
|
54
|
+
)
|
|
55
|
+
},
|
|
56
|
+
marshalling_gen.unmarshalListFileSystemsResponse
|
|
57
|
+
);
|
|
58
|
+
/**
|
|
59
|
+
* List all filesystems. Retrieve all filesystems in the specified region. Results are ordered by creation date in ascending order by default.
|
|
60
|
+
Use the order_by parameter to modify the sorting behavior.
|
|
61
|
+
*
|
|
62
|
+
* @param request - The request {@link ListFileSystemsRequest}
|
|
63
|
+
* @returns A Promise of ListFileSystemsResponse
|
|
64
|
+
*/
|
|
65
|
+
listFileSystems = (request = {}) => sdkClient.enrichForPagination("filesystems", this.pageOfListFileSystems, request);
|
|
66
|
+
pageOfListAttachments = (request = {}) => this.client.fetch(
|
|
67
|
+
{
|
|
68
|
+
method: "GET",
|
|
69
|
+
path: `/file/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/attachments`,
|
|
70
|
+
urlParams: sdkClient.urlParams(
|
|
71
|
+
["filesystem_id", request.filesystemId],
|
|
72
|
+
["page", request.page],
|
|
73
|
+
[
|
|
74
|
+
"page_size",
|
|
75
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
76
|
+
],
|
|
77
|
+
["resource_id", request.resourceId],
|
|
78
|
+
["resource_type", request.resourceType],
|
|
79
|
+
["zone", request.zone]
|
|
80
|
+
)
|
|
81
|
+
},
|
|
82
|
+
marshalling_gen.unmarshalListAttachmentsResponse
|
|
83
|
+
);
|
|
84
|
+
/**
|
|
85
|
+
* List filesystems attachments. List all existing attachments in a specified region.
|
|
86
|
+
By default, the attachments listed are ordered by creation date in ascending order.
|
|
87
|
+
This can be modified using the `order_by` field.
|
|
88
|
+
*
|
|
89
|
+
* @param request - The request {@link ListAttachmentsRequest}
|
|
90
|
+
* @returns A Promise of ListAttachmentsResponse
|
|
91
|
+
*/
|
|
92
|
+
listAttachments = (request = {}) => sdkClient.enrichForPagination("attachments", this.pageOfListAttachments, request);
|
|
93
|
+
/**
|
|
94
|
+
* Create a new filesystem. To create a new filesystem, you need to provide a name, a size, and a project ID.
|
|
95
|
+
*
|
|
96
|
+
* @param request - The request {@link CreateFileSystemRequest}
|
|
97
|
+
* @returns A Promise of FileSystem
|
|
98
|
+
*/
|
|
99
|
+
createFileSystem = (request) => this.client.fetch(
|
|
100
|
+
{
|
|
101
|
+
body: JSON.stringify(
|
|
102
|
+
marshalling_gen.marshalCreateFileSystemRequest(request, this.client.settings)
|
|
103
|
+
),
|
|
104
|
+
headers: jsonContentHeaders,
|
|
105
|
+
method: "POST",
|
|
106
|
+
path: `/file/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/filesystems`
|
|
107
|
+
},
|
|
108
|
+
marshalling_gen.unmarshalFileSystem
|
|
109
|
+
);
|
|
110
|
+
/**
|
|
111
|
+
* Delete a detached filesystem. You must specify the `filesystem_id` of the filesystem you want to delete.
|
|
112
|
+
*
|
|
113
|
+
* @param request - The request {@link DeleteFileSystemRequest}
|
|
114
|
+
*/
|
|
115
|
+
deleteFileSystem = (request) => this.client.fetch({
|
|
116
|
+
method: "DELETE",
|
|
117
|
+
path: `/file/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/filesystems/${sdkClient.validatePathParam("filesystemId", request.filesystemId)}`
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* Update filesystem properties. Update the technical details of a filesystem, such as its name, tags or its new size.
|
|
121
|
+
*
|
|
122
|
+
* @param request - The request {@link UpdateFileSystemRequest}
|
|
123
|
+
* @returns A Promise of FileSystem
|
|
124
|
+
*/
|
|
125
|
+
updateFileSystem = (request) => this.client.fetch(
|
|
126
|
+
{
|
|
127
|
+
body: JSON.stringify(
|
|
128
|
+
marshalling_gen.marshalUpdateFileSystemRequest(request, this.client.settings)
|
|
129
|
+
),
|
|
130
|
+
headers: jsonContentHeaders,
|
|
131
|
+
method: "PATCH",
|
|
132
|
+
path: `/file/v1alpha1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/filesystems/${sdkClient.validatePathParam("filesystemId", request.filesystemId)}`
|
|
133
|
+
},
|
|
134
|
+
marshalling_gen.unmarshalFileSystem
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
exports.API = API;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
|
+
import type { Region as ScwRegion, WaitForOptions } from '@scaleway/sdk-client';
|
|
3
|
+
import type { CreateFileSystemRequest, DeleteFileSystemRequest, FileSystem, GetFileSystemRequest, ListAttachmentsRequest, ListAttachmentsResponse, ListFileSystemsRequest, ListFileSystemsResponse, UpdateFileSystemRequest } from './types.gen';
|
|
4
|
+
/**
|
|
5
|
+
* File Storage API.
|
|
6
|
+
|
|
7
|
+
This API allows you to manage your File Storage resources.
|
|
8
|
+
*/
|
|
9
|
+
export declare class API extends ParentAPI {
|
|
10
|
+
/** Lists the available regions of the API. */
|
|
11
|
+
static readonly LOCALITIES: ScwRegion[];
|
|
12
|
+
/**
|
|
13
|
+
* Get filesystem details. Retrieve all properties and current status of a specific filesystem identified by its ID.
|
|
14
|
+
*
|
|
15
|
+
* @param request - The request {@link GetFileSystemRequest}
|
|
16
|
+
* @returns A Promise of FileSystem
|
|
17
|
+
*/
|
|
18
|
+
getFileSystem: (request: Readonly<GetFileSystemRequest>) => Promise<FileSystem>;
|
|
19
|
+
/**
|
|
20
|
+
* Waits for {@link FileSystem} to be in a final state.
|
|
21
|
+
*
|
|
22
|
+
* @param request - The request {@link GetFileSystemRequest}
|
|
23
|
+
* @param options - The waiting options
|
|
24
|
+
* @returns A Promise of FileSystem
|
|
25
|
+
*/
|
|
26
|
+
waitForFileSystem: (request: Readonly<GetFileSystemRequest>, options?: Readonly<WaitForOptions<FileSystem>>) => Promise<FileSystem>;
|
|
27
|
+
protected pageOfListFileSystems: (request?: Readonly<ListFileSystemsRequest>) => Promise<ListFileSystemsResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* List all filesystems. Retrieve all filesystems in the specified region. Results are ordered by creation date in ascending order by default.
|
|
30
|
+
Use the order_by parameter to modify the sorting behavior.
|
|
31
|
+
*
|
|
32
|
+
* @param request - The request {@link ListFileSystemsRequest}
|
|
33
|
+
* @returns A Promise of ListFileSystemsResponse
|
|
34
|
+
*/
|
|
35
|
+
listFileSystems: (request?: Readonly<ListFileSystemsRequest>) => Promise<ListFileSystemsResponse> & {
|
|
36
|
+
all: () => Promise<FileSystem[]>;
|
|
37
|
+
[Symbol.asyncIterator]: () => AsyncGenerator<FileSystem[], void, void>;
|
|
38
|
+
};
|
|
39
|
+
protected pageOfListAttachments: (request?: Readonly<ListAttachmentsRequest>) => Promise<ListAttachmentsResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* List filesystems attachments. List all existing attachments in a specified region.
|
|
42
|
+
By default, the attachments listed are ordered by creation date in ascending order.
|
|
43
|
+
This can be modified using the `order_by` field.
|
|
44
|
+
*
|
|
45
|
+
* @param request - The request {@link ListAttachmentsRequest}
|
|
46
|
+
* @returns A Promise of ListAttachmentsResponse
|
|
47
|
+
*/
|
|
48
|
+
listAttachments: (request?: Readonly<ListAttachmentsRequest>) => Promise<ListAttachmentsResponse> & {
|
|
49
|
+
all: () => Promise<import("./types.gen").Attachment[]>;
|
|
50
|
+
[Symbol.asyncIterator]: () => AsyncGenerator<import("./types.gen").Attachment[], void, void>;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Create a new filesystem. To create a new filesystem, you need to provide a name, a size, and a project ID.
|
|
54
|
+
*
|
|
55
|
+
* @param request - The request {@link CreateFileSystemRequest}
|
|
56
|
+
* @returns A Promise of FileSystem
|
|
57
|
+
*/
|
|
58
|
+
createFileSystem: (request: Readonly<CreateFileSystemRequest>) => Promise<FileSystem>;
|
|
59
|
+
/**
|
|
60
|
+
* Delete a detached filesystem. You must specify the `filesystem_id` of the filesystem you want to delete.
|
|
61
|
+
*
|
|
62
|
+
* @param request - The request {@link DeleteFileSystemRequest}
|
|
63
|
+
*/
|
|
64
|
+
deleteFileSystem: (request: Readonly<DeleteFileSystemRequest>) => Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Update filesystem properties. Update the technical details of a filesystem, such as its name, tags or its new size.
|
|
67
|
+
*
|
|
68
|
+
* @param request - The request {@link UpdateFileSystemRequest}
|
|
69
|
+
* @returns A Promise of FileSystem
|
|
70
|
+
*/
|
|
71
|
+
updateFileSystem: (request: Readonly<UpdateFileSystemRequest>) => Promise<FileSystem>;
|
|
72
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { API as API$1, validatePathParam, waitForResource, urlParams, enrichForPagination } from "@scaleway/sdk-client";
|
|
2
|
+
import { FILE_SYSTEM_TRANSIENT_STATUSES } from "./content.gen.js";
|
|
3
|
+
import { unmarshalFileSystem, unmarshalListFileSystemsResponse, unmarshalListAttachmentsResponse, marshalCreateFileSystemRequest, marshalUpdateFileSystemRequest } from "./marshalling.gen.js";
|
|
4
|
+
const jsonContentHeaders = {
|
|
5
|
+
"Content-Type": "application/json; charset=utf-8"
|
|
6
|
+
};
|
|
7
|
+
class API extends API$1 {
|
|
8
|
+
/** Lists the available regions of the API. */
|
|
9
|
+
static LOCALITIES = ["fr-par"];
|
|
10
|
+
/**
|
|
11
|
+
* Get filesystem details. Retrieve all properties and current status of a specific filesystem identified by its ID.
|
|
12
|
+
*
|
|
13
|
+
* @param request - The request {@link GetFileSystemRequest}
|
|
14
|
+
* @returns A Promise of FileSystem
|
|
15
|
+
*/
|
|
16
|
+
getFileSystem = (request) => this.client.fetch(
|
|
17
|
+
{
|
|
18
|
+
method: "GET",
|
|
19
|
+
path: `/file/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/filesystems/${validatePathParam("filesystemId", request.filesystemId)}`
|
|
20
|
+
},
|
|
21
|
+
unmarshalFileSystem
|
|
22
|
+
);
|
|
23
|
+
/**
|
|
24
|
+
* Waits for {@link FileSystem} to be in a final state.
|
|
25
|
+
*
|
|
26
|
+
* @param request - The request {@link GetFileSystemRequest}
|
|
27
|
+
* @param options - The waiting options
|
|
28
|
+
* @returns A Promise of FileSystem
|
|
29
|
+
*/
|
|
30
|
+
waitForFileSystem = (request, options) => waitForResource(
|
|
31
|
+
options?.stop ?? ((res) => Promise.resolve(
|
|
32
|
+
!FILE_SYSTEM_TRANSIENT_STATUSES.includes(res.status)
|
|
33
|
+
)),
|
|
34
|
+
this.getFileSystem,
|
|
35
|
+
request,
|
|
36
|
+
options
|
|
37
|
+
);
|
|
38
|
+
pageOfListFileSystems = (request = {}) => this.client.fetch(
|
|
39
|
+
{
|
|
40
|
+
method: "GET",
|
|
41
|
+
path: `/file/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/filesystems`,
|
|
42
|
+
urlParams: urlParams(
|
|
43
|
+
["name", request.name],
|
|
44
|
+
["order_by", request.orderBy],
|
|
45
|
+
["page", request.page],
|
|
46
|
+
[
|
|
47
|
+
"page_size",
|
|
48
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
49
|
+
],
|
|
50
|
+
["project_id", request.projectId],
|
|
51
|
+
["tags", request.tags]
|
|
52
|
+
)
|
|
53
|
+
},
|
|
54
|
+
unmarshalListFileSystemsResponse
|
|
55
|
+
);
|
|
56
|
+
/**
|
|
57
|
+
* List all filesystems. Retrieve all filesystems in the specified region. Results are ordered by creation date in ascending order by default.
|
|
58
|
+
Use the order_by parameter to modify the sorting behavior.
|
|
59
|
+
*
|
|
60
|
+
* @param request - The request {@link ListFileSystemsRequest}
|
|
61
|
+
* @returns A Promise of ListFileSystemsResponse
|
|
62
|
+
*/
|
|
63
|
+
listFileSystems = (request = {}) => enrichForPagination("filesystems", this.pageOfListFileSystems, request);
|
|
64
|
+
pageOfListAttachments = (request = {}) => this.client.fetch(
|
|
65
|
+
{
|
|
66
|
+
method: "GET",
|
|
67
|
+
path: `/file/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/attachments`,
|
|
68
|
+
urlParams: urlParams(
|
|
69
|
+
["filesystem_id", request.filesystemId],
|
|
70
|
+
["page", request.page],
|
|
71
|
+
[
|
|
72
|
+
"page_size",
|
|
73
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
74
|
+
],
|
|
75
|
+
["resource_id", request.resourceId],
|
|
76
|
+
["resource_type", request.resourceType],
|
|
77
|
+
["zone", request.zone]
|
|
78
|
+
)
|
|
79
|
+
},
|
|
80
|
+
unmarshalListAttachmentsResponse
|
|
81
|
+
);
|
|
82
|
+
/**
|
|
83
|
+
* List filesystems attachments. List all existing attachments in a specified region.
|
|
84
|
+
By default, the attachments listed are ordered by creation date in ascending order.
|
|
85
|
+
This can be modified using the `order_by` field.
|
|
86
|
+
*
|
|
87
|
+
* @param request - The request {@link ListAttachmentsRequest}
|
|
88
|
+
* @returns A Promise of ListAttachmentsResponse
|
|
89
|
+
*/
|
|
90
|
+
listAttachments = (request = {}) => enrichForPagination("attachments", this.pageOfListAttachments, request);
|
|
91
|
+
/**
|
|
92
|
+
* Create a new filesystem. To create a new filesystem, you need to provide a name, a size, and a project ID.
|
|
93
|
+
*
|
|
94
|
+
* @param request - The request {@link CreateFileSystemRequest}
|
|
95
|
+
* @returns A Promise of FileSystem
|
|
96
|
+
*/
|
|
97
|
+
createFileSystem = (request) => this.client.fetch(
|
|
98
|
+
{
|
|
99
|
+
body: JSON.stringify(
|
|
100
|
+
marshalCreateFileSystemRequest(request, this.client.settings)
|
|
101
|
+
),
|
|
102
|
+
headers: jsonContentHeaders,
|
|
103
|
+
method: "POST",
|
|
104
|
+
path: `/file/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/filesystems`
|
|
105
|
+
},
|
|
106
|
+
unmarshalFileSystem
|
|
107
|
+
);
|
|
108
|
+
/**
|
|
109
|
+
* Delete a detached filesystem. You must specify the `filesystem_id` of the filesystem you want to delete.
|
|
110
|
+
*
|
|
111
|
+
* @param request - The request {@link DeleteFileSystemRequest}
|
|
112
|
+
*/
|
|
113
|
+
deleteFileSystem = (request) => this.client.fetch({
|
|
114
|
+
method: "DELETE",
|
|
115
|
+
path: `/file/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/filesystems/${validatePathParam("filesystemId", request.filesystemId)}`
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* Update filesystem properties. Update the technical details of a filesystem, such as its name, tags or its new size.
|
|
119
|
+
*
|
|
120
|
+
* @param request - The request {@link UpdateFileSystemRequest}
|
|
121
|
+
* @returns A Promise of FileSystem
|
|
122
|
+
*/
|
|
123
|
+
updateFileSystem = (request) => this.client.fetch(
|
|
124
|
+
{
|
|
125
|
+
body: JSON.stringify(
|
|
126
|
+
marshalUpdateFileSystemRequest(request, this.client.settings)
|
|
127
|
+
),
|
|
128
|
+
headers: jsonContentHeaders,
|
|
129
|
+
method: "PATCH",
|
|
130
|
+
path: `/file/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/filesystems/${validatePathParam("filesystemId", request.filesystemId)}`
|
|
131
|
+
},
|
|
132
|
+
unmarshalFileSystem
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
API
|
|
137
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const api_gen = require("./api.gen.cjs");
|
|
4
|
+
const content_gen = require("./content.gen.cjs");
|
|
5
|
+
const marshalling_gen = require("./marshalling.gen.cjs");
|
|
6
|
+
const validationRules_gen = require("./validation-rules.gen.cjs");
|
|
7
|
+
exports.API = api_gen.API;
|
|
8
|
+
exports.FILE_SYSTEM_TRANSIENT_STATUSES = content_gen.FILE_SYSTEM_TRANSIENT_STATUSES;
|
|
9
|
+
exports.marshalCreateFileSystemRequest = marshalling_gen.marshalCreateFileSystemRequest;
|
|
10
|
+
exports.marshalUpdateFileSystemRequest = marshalling_gen.marshalUpdateFileSystemRequest;
|
|
11
|
+
exports.unmarshalFileSystem = marshalling_gen.unmarshalFileSystem;
|
|
12
|
+
exports.unmarshalListAttachmentsResponse = marshalling_gen.unmarshalListAttachmentsResponse;
|
|
13
|
+
exports.unmarshalListFileSystemsResponse = marshalling_gen.unmarshalListFileSystemsResponse;
|
|
14
|
+
exports.ValidationRules = validationRules_gen;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { API } from './api.gen';
|
|
2
|
+
export * from './content.gen';
|
|
3
|
+
export * from './marshalling.gen';
|
|
4
|
+
export type { Attachment, AttachmentResourceType, CreateFileSystemRequest, DeleteFileSystemRequest, FileSystem, FileSystemStatus, GetFileSystemRequest, ListAttachmentsRequest, ListAttachmentsResponse, ListFileSystemsRequest, ListFileSystemsRequestOrderBy, ListFileSystemsResponse, UpdateFileSystemRequest, } from './types.gen';
|
|
5
|
+
export * as ValidationRules from './validation-rules.gen';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { API } from "./api.gen.js";
|
|
2
|
+
import { FILE_SYSTEM_TRANSIENT_STATUSES } from "./content.gen.js";
|
|
3
|
+
import { marshalCreateFileSystemRequest, marshalUpdateFileSystemRequest, unmarshalFileSystem, unmarshalListAttachmentsResponse, unmarshalListFileSystemsResponse } from "./marshalling.gen.js";
|
|
4
|
+
import * as validationRules_gen from "./validation-rules.gen.js";
|
|
5
|
+
export {
|
|
6
|
+
API,
|
|
7
|
+
FILE_SYSTEM_TRANSIENT_STATUSES,
|
|
8
|
+
validationRules_gen as ValidationRules,
|
|
9
|
+
marshalCreateFileSystemRequest,
|
|
10
|
+
marshalUpdateFileSystemRequest,
|
|
11
|
+
unmarshalFileSystem,
|
|
12
|
+
unmarshalListAttachmentsResponse,
|
|
13
|
+
unmarshalListFileSystemsResponse
|
|
14
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sdkClient = require("@scaleway/sdk-client");
|
|
4
|
+
const unmarshalFileSystem = (data) => {
|
|
5
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
6
|
+
throw new TypeError(
|
|
7
|
+
`Unmarshalling the type 'FileSystem' failed as data isn't a dictionary.`
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
12
|
+
id: data.id,
|
|
13
|
+
name: data.name,
|
|
14
|
+
numberOfAttachments: data.number_of_attachments,
|
|
15
|
+
organizationId: data.organization_id,
|
|
16
|
+
projectId: data.project_id,
|
|
17
|
+
region: data.region,
|
|
18
|
+
size: data.size,
|
|
19
|
+
status: data.status,
|
|
20
|
+
tags: data.tags,
|
|
21
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at)
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const unmarshalAttachment = (data) => {
|
|
25
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
26
|
+
throw new TypeError(
|
|
27
|
+
`Unmarshalling the type 'Attachment' failed as data isn't a dictionary.`
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
filesystemId: data.filesystem_id,
|
|
32
|
+
id: data.id,
|
|
33
|
+
resourceId: data.resource_id,
|
|
34
|
+
resourceType: data.resource_type,
|
|
35
|
+
zone: data.zone
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const unmarshalListAttachmentsResponse = (data) => {
|
|
39
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
40
|
+
throw new TypeError(
|
|
41
|
+
`Unmarshalling the type 'ListAttachmentsResponse' failed as data isn't a dictionary.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
attachments: sdkClient.unmarshalArrayOfObject(data.attachments, unmarshalAttachment),
|
|
46
|
+
totalCount: data.total_count
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const unmarshalListFileSystemsResponse = (data) => {
|
|
50
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
51
|
+
throw new TypeError(
|
|
52
|
+
`Unmarshalling the type 'ListFileSystemsResponse' failed as data isn't a dictionary.`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
filesystems: sdkClient.unmarshalArrayOfObject(data.filesystems, unmarshalFileSystem),
|
|
57
|
+
totalCount: data.total_count
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const marshalCreateFileSystemRequest = (request, defaults) => ({
|
|
61
|
+
name: request.name,
|
|
62
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
63
|
+
size: request.size,
|
|
64
|
+
tags: request.tags
|
|
65
|
+
});
|
|
66
|
+
const marshalUpdateFileSystemRequest = (request, defaults) => ({
|
|
67
|
+
name: request.name,
|
|
68
|
+
size: request.size,
|
|
69
|
+
tags: request.tags
|
|
70
|
+
});
|
|
71
|
+
exports.marshalCreateFileSystemRequest = marshalCreateFileSystemRequest;
|
|
72
|
+
exports.marshalUpdateFileSystemRequest = marshalUpdateFileSystemRequest;
|
|
73
|
+
exports.unmarshalFileSystem = unmarshalFileSystem;
|
|
74
|
+
exports.unmarshalListAttachmentsResponse = unmarshalListAttachmentsResponse;
|
|
75
|
+
exports.unmarshalListFileSystemsResponse = unmarshalListFileSystemsResponse;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DefaultValues } from '@scaleway/sdk-client';
|
|
2
|
+
import type { CreateFileSystemRequest, FileSystem, ListAttachmentsResponse, ListFileSystemsResponse, UpdateFileSystemRequest } from './types.gen';
|
|
3
|
+
export declare const unmarshalFileSystem: (data: unknown) => FileSystem;
|
|
4
|
+
export declare const unmarshalListAttachmentsResponse: (data: unknown) => ListAttachmentsResponse;
|
|
5
|
+
export declare const unmarshalListFileSystemsResponse: (data: unknown) => ListFileSystemsResponse;
|
|
6
|
+
export declare const marshalCreateFileSystemRequest: (request: CreateFileSystemRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
7
|
+
export declare const marshalUpdateFileSystemRequest: (request: UpdateFileSystemRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
|
|
2
|
+
const unmarshalFileSystem = (data) => {
|
|
3
|
+
if (!isJSONObject(data)) {
|
|
4
|
+
throw new TypeError(
|
|
5
|
+
`Unmarshalling the type 'FileSystem' failed as data isn't a dictionary.`
|
|
6
|
+
);
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
createdAt: unmarshalDate(data.created_at),
|
|
10
|
+
id: data.id,
|
|
11
|
+
name: data.name,
|
|
12
|
+
numberOfAttachments: data.number_of_attachments,
|
|
13
|
+
organizationId: data.organization_id,
|
|
14
|
+
projectId: data.project_id,
|
|
15
|
+
region: data.region,
|
|
16
|
+
size: data.size,
|
|
17
|
+
status: data.status,
|
|
18
|
+
tags: data.tags,
|
|
19
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const unmarshalAttachment = (data) => {
|
|
23
|
+
if (!isJSONObject(data)) {
|
|
24
|
+
throw new TypeError(
|
|
25
|
+
`Unmarshalling the type 'Attachment' failed as data isn't a dictionary.`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
filesystemId: data.filesystem_id,
|
|
30
|
+
id: data.id,
|
|
31
|
+
resourceId: data.resource_id,
|
|
32
|
+
resourceType: data.resource_type,
|
|
33
|
+
zone: data.zone
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const unmarshalListAttachmentsResponse = (data) => {
|
|
37
|
+
if (!isJSONObject(data)) {
|
|
38
|
+
throw new TypeError(
|
|
39
|
+
`Unmarshalling the type 'ListAttachmentsResponse' failed as data isn't a dictionary.`
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
attachments: unmarshalArrayOfObject(data.attachments, unmarshalAttachment),
|
|
44
|
+
totalCount: data.total_count
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const unmarshalListFileSystemsResponse = (data) => {
|
|
48
|
+
if (!isJSONObject(data)) {
|
|
49
|
+
throw new TypeError(
|
|
50
|
+
`Unmarshalling the type 'ListFileSystemsResponse' failed as data isn't a dictionary.`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
filesystems: unmarshalArrayOfObject(data.filesystems, unmarshalFileSystem),
|
|
55
|
+
totalCount: data.total_count
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const marshalCreateFileSystemRequest = (request, defaults) => ({
|
|
59
|
+
name: request.name,
|
|
60
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
61
|
+
size: request.size,
|
|
62
|
+
tags: request.tags
|
|
63
|
+
});
|
|
64
|
+
const marshalUpdateFileSystemRequest = (request, defaults) => ({
|
|
65
|
+
name: request.name,
|
|
66
|
+
size: request.size,
|
|
67
|
+
tags: request.tags
|
|
68
|
+
});
|
|
69
|
+
export {
|
|
70
|
+
marshalCreateFileSystemRequest,
|
|
71
|
+
marshalUpdateFileSystemRequest,
|
|
72
|
+
unmarshalFileSystem,
|
|
73
|
+
unmarshalListAttachmentsResponse,
|
|
74
|
+
unmarshalListFileSystemsResponse
|
|
75
|
+
};
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import type { Region as ScwRegion, Zone as ScwZone } from '@scaleway/sdk-client';
|
|
2
|
+
export type AttachmentResourceType = 'unknown_resource_type' | 'instance_server';
|
|
3
|
+
export type FileSystemStatus = 'unknown_status' | 'available' | 'error' | 'creating' | 'updating';
|
|
4
|
+
export type ListFileSystemsRequestOrderBy = 'created_at_asc' | 'created_at_desc' | 'name_asc' | 'name_desc';
|
|
5
|
+
/**
|
|
6
|
+
* Represents an attachment between a filesystem and a resource.
|
|
7
|
+
*/
|
|
8
|
+
export interface Attachment {
|
|
9
|
+
/**
|
|
10
|
+
* UUID of the attachment.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* UUID of the filesystem.
|
|
15
|
+
*/
|
|
16
|
+
filesystemId: string;
|
|
17
|
+
/**
|
|
18
|
+
* UUID of the attached resource.
|
|
19
|
+
*/
|
|
20
|
+
resourceId: string;
|
|
21
|
+
/**
|
|
22
|
+
* The type of the attached resource.
|
|
23
|
+
*/
|
|
24
|
+
resourceType: AttachmentResourceType;
|
|
25
|
+
/**
|
|
26
|
+
* The zone where the resource is located.
|
|
27
|
+
*/
|
|
28
|
+
zone?: ScwZone;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Represents a filesystem resource and its properties.
|
|
32
|
+
*/
|
|
33
|
+
export interface FileSystem {
|
|
34
|
+
/**
|
|
35
|
+
* UUID of the filesystem.
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Name of the filesystem.
|
|
40
|
+
*/
|
|
41
|
+
name: string;
|
|
42
|
+
/**
|
|
43
|
+
* Filesystem size in bytes.
|
|
44
|
+
*/
|
|
45
|
+
size: number;
|
|
46
|
+
/**
|
|
47
|
+
* Current status of the filesystem (e.g. creating, available, ...).
|
|
48
|
+
*/
|
|
49
|
+
status: FileSystemStatus;
|
|
50
|
+
/**
|
|
51
|
+
* UUID of the project to which the filesystem belongs.
|
|
52
|
+
*/
|
|
53
|
+
projectId: string;
|
|
54
|
+
/**
|
|
55
|
+
* UUID of the organization to which the filesystem belongs.
|
|
56
|
+
*/
|
|
57
|
+
organizationId: string;
|
|
58
|
+
/**
|
|
59
|
+
* List of tags assigned to the filesystem.
|
|
60
|
+
*/
|
|
61
|
+
tags: string[];
|
|
62
|
+
/**
|
|
63
|
+
* The current number of attachments (mounts) that the filesystem has.
|
|
64
|
+
*/
|
|
65
|
+
numberOfAttachments: number;
|
|
66
|
+
/**
|
|
67
|
+
* Region where the filesystem is located.
|
|
68
|
+
*/
|
|
69
|
+
region: ScwRegion;
|
|
70
|
+
/**
|
|
71
|
+
* Creation date of the filesystem.
|
|
72
|
+
*/
|
|
73
|
+
createdAt?: Date;
|
|
74
|
+
/**
|
|
75
|
+
* Last update date of the properties of the filesystem.
|
|
76
|
+
*/
|
|
77
|
+
updatedAt?: Date;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Request to create a new filesystem.
|
|
81
|
+
*/
|
|
82
|
+
export type CreateFileSystemRequest = {
|
|
83
|
+
/**
|
|
84
|
+
* Region to target. If none is passed will use default region from the config.
|
|
85
|
+
*/
|
|
86
|
+
region?: ScwRegion;
|
|
87
|
+
/**
|
|
88
|
+
* Name of the filesystem.
|
|
89
|
+
*/
|
|
90
|
+
name: string;
|
|
91
|
+
/**
|
|
92
|
+
* UUID of the project the filesystem belongs to.
|
|
93
|
+
*/
|
|
94
|
+
projectId?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Must be compliant with the minimum (100 GB) and maximum (10 TB) allowed size.
|
|
97
|
+
*/
|
|
98
|
+
size: number;
|
|
99
|
+
/**
|
|
100
|
+
* List of tags assigned to the filesystem.
|
|
101
|
+
*/
|
|
102
|
+
tags?: string[];
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Request to delete a specific filesystem.
|
|
106
|
+
*/
|
|
107
|
+
export type DeleteFileSystemRequest = {
|
|
108
|
+
/**
|
|
109
|
+
* Region to target. If none is passed will use default region from the config.
|
|
110
|
+
*/
|
|
111
|
+
region?: ScwRegion;
|
|
112
|
+
/**
|
|
113
|
+
* UUID of the filesystem.
|
|
114
|
+
*/
|
|
115
|
+
filesystemId: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Request to retrieve a specific filesystem.
|
|
119
|
+
*/
|
|
120
|
+
export type GetFileSystemRequest = {
|
|
121
|
+
/**
|
|
122
|
+
* Region to target. If none is passed will use default region from the config.
|
|
123
|
+
*/
|
|
124
|
+
region?: ScwRegion;
|
|
125
|
+
/**
|
|
126
|
+
* UUID of the filesystem.
|
|
127
|
+
*/
|
|
128
|
+
filesystemId: string;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Request to list filesystem attachments with filtering and pagination options.
|
|
132
|
+
*/
|
|
133
|
+
export type ListAttachmentsRequest = {
|
|
134
|
+
/**
|
|
135
|
+
* Region to target. If none is passed will use default region from the config.
|
|
136
|
+
*/
|
|
137
|
+
region?: ScwRegion;
|
|
138
|
+
/**
|
|
139
|
+
* UUID of the File Storage volume.
|
|
140
|
+
*/
|
|
141
|
+
filesystemId?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Filter by resource ID.
|
|
144
|
+
*/
|
|
145
|
+
resourceId?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Filter by resource type.
|
|
148
|
+
*/
|
|
149
|
+
resourceType?: AttachmentResourceType;
|
|
150
|
+
/**
|
|
151
|
+
* Filter by resource zone.
|
|
152
|
+
*/
|
|
153
|
+
zone?: ScwZone;
|
|
154
|
+
/**
|
|
155
|
+
* Page number (starting at 1).
|
|
156
|
+
*/
|
|
157
|
+
page?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Number of entries per page (default: 20, max: 100).
|
|
160
|
+
*/
|
|
161
|
+
pageSize?: number;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Response containing a list of filesystem attachments and total count.
|
|
165
|
+
*/
|
|
166
|
+
export interface ListAttachmentsResponse {
|
|
167
|
+
/**
|
|
168
|
+
* List of filesystem attachments matching the request criteria.
|
|
169
|
+
*/
|
|
170
|
+
attachments: Attachment[];
|
|
171
|
+
/**
|
|
172
|
+
* Total number of filesystem attachments matching the criteria.
|
|
173
|
+
*/
|
|
174
|
+
totalCount: number;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Request to list filesystems with filtering and pagination options.
|
|
178
|
+
*/
|
|
179
|
+
export type ListFileSystemsRequest = {
|
|
180
|
+
/**
|
|
181
|
+
* Region to target. If none is passed will use default region from the config.
|
|
182
|
+
*/
|
|
183
|
+
region?: ScwRegion;
|
|
184
|
+
/**
|
|
185
|
+
* Criteria to use when ordering the list.
|
|
186
|
+
*/
|
|
187
|
+
orderBy?: ListFileSystemsRequestOrderBy;
|
|
188
|
+
/**
|
|
189
|
+
* Filter by project ID.
|
|
190
|
+
*/
|
|
191
|
+
projectId?: string;
|
|
192
|
+
/**
|
|
193
|
+
* Page number (starting at 1).
|
|
194
|
+
*/
|
|
195
|
+
page?: number;
|
|
196
|
+
/**
|
|
197
|
+
* Number of entries per page (default: 20, max: 100).
|
|
198
|
+
*/
|
|
199
|
+
pageSize?: number;
|
|
200
|
+
/**
|
|
201
|
+
* Filter the return filesystems by their names.
|
|
202
|
+
*/
|
|
203
|
+
name?: string;
|
|
204
|
+
/**
|
|
205
|
+
* Filter by tags. Only filesystems with one or more matching tags will be returned.
|
|
206
|
+
*/
|
|
207
|
+
tags?: string[];
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Response containing a list of filesystems and total count.
|
|
211
|
+
*/
|
|
212
|
+
export interface ListFileSystemsResponse {
|
|
213
|
+
/**
|
|
214
|
+
* List of filesystems matching the request criteria.
|
|
215
|
+
*/
|
|
216
|
+
filesystems: FileSystem[];
|
|
217
|
+
/**
|
|
218
|
+
* Total number of filesystems matching the criteria.
|
|
219
|
+
*/
|
|
220
|
+
totalCount: number;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Request to update a specific filesystem.
|
|
224
|
+
*/
|
|
225
|
+
export type UpdateFileSystemRequest = {
|
|
226
|
+
/**
|
|
227
|
+
* Region to target. If none is passed will use default region from the config.
|
|
228
|
+
*/
|
|
229
|
+
region?: ScwRegion;
|
|
230
|
+
/**
|
|
231
|
+
* UUID of the filesystem.
|
|
232
|
+
*/
|
|
233
|
+
filesystemId: string;
|
|
234
|
+
/**
|
|
235
|
+
* When defined, is the new name of the filesystem.
|
|
236
|
+
*/
|
|
237
|
+
name?: string;
|
|
238
|
+
/**
|
|
239
|
+
* Size in bytes, with a granularity of 100 GB (10^11 bytes).
|
|
240
|
+
Must be compliant with the minimum (100 GB) and maximum (10 TB) allowed size.
|
|
241
|
+
*/
|
|
242
|
+
size?: number;
|
|
243
|
+
/**
|
|
244
|
+
* List of tags assigned to the filesystem.
|
|
245
|
+
*/
|
|
246
|
+
tags?: string[];
|
|
247
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const CreateFileSystemRequest = {
|
|
4
|
+
name: {
|
|
5
|
+
minLength: 1
|
|
6
|
+
},
|
|
7
|
+
size: {
|
|
8
|
+
greaterThan: 0
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const ListAttachmentsRequest = {
|
|
12
|
+
page: {
|
|
13
|
+
greaterThan: 0
|
|
14
|
+
},
|
|
15
|
+
pageSize: {
|
|
16
|
+
greaterThan: 0,
|
|
17
|
+
lessThanOrEqual: 100
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const ListFileSystemsRequest = {
|
|
21
|
+
page: {
|
|
22
|
+
greaterThan: 0
|
|
23
|
+
},
|
|
24
|
+
pageSize: {
|
|
25
|
+
greaterThan: 0,
|
|
26
|
+
lessThanOrEqual: 100
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const UpdateFileSystemRequest = {
|
|
30
|
+
name: {
|
|
31
|
+
minLength: 1
|
|
32
|
+
},
|
|
33
|
+
size: {
|
|
34
|
+
greaterThan: 0
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.CreateFileSystemRequest = CreateFileSystemRequest;
|
|
38
|
+
exports.ListAttachmentsRequest = ListAttachmentsRequest;
|
|
39
|
+
exports.ListFileSystemsRequest = ListFileSystemsRequest;
|
|
40
|
+
exports.UpdateFileSystemRequest = UpdateFileSystemRequest;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const CreateFileSystemRequest: {
|
|
2
|
+
name: {
|
|
3
|
+
minLength: number;
|
|
4
|
+
};
|
|
5
|
+
size: {
|
|
6
|
+
greaterThan: number;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const ListAttachmentsRequest: {
|
|
10
|
+
page: {
|
|
11
|
+
greaterThan: number;
|
|
12
|
+
};
|
|
13
|
+
pageSize: {
|
|
14
|
+
greaterThan: number;
|
|
15
|
+
lessThanOrEqual: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const ListFileSystemsRequest: {
|
|
19
|
+
page: {
|
|
20
|
+
greaterThan: number;
|
|
21
|
+
};
|
|
22
|
+
pageSize: {
|
|
23
|
+
greaterThan: number;
|
|
24
|
+
lessThanOrEqual: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const UpdateFileSystemRequest: {
|
|
28
|
+
name: {
|
|
29
|
+
minLength: number;
|
|
30
|
+
};
|
|
31
|
+
size: {
|
|
32
|
+
greaterThan: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const CreateFileSystemRequest = {
|
|
2
|
+
name: {
|
|
3
|
+
minLength: 1
|
|
4
|
+
},
|
|
5
|
+
size: {
|
|
6
|
+
greaterThan: 0
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
const ListAttachmentsRequest = {
|
|
10
|
+
page: {
|
|
11
|
+
greaterThan: 0
|
|
12
|
+
},
|
|
13
|
+
pageSize: {
|
|
14
|
+
greaterThan: 0,
|
|
15
|
+
lessThanOrEqual: 100
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const ListFileSystemsRequest = {
|
|
19
|
+
page: {
|
|
20
|
+
greaterThan: 0
|
|
21
|
+
},
|
|
22
|
+
pageSize: {
|
|
23
|
+
greaterThan: 0,
|
|
24
|
+
lessThanOrEqual: 100
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const UpdateFileSystemRequest = {
|
|
28
|
+
name: {
|
|
29
|
+
minLength: 1
|
|
30
|
+
},
|
|
31
|
+
size: {
|
|
32
|
+
greaterThan: 0
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
CreateFileSystemRequest,
|
|
37
|
+
ListAttachmentsRequest,
|
|
38
|
+
ListFileSystemsRequest,
|
|
39
|
+
UpdateFileSystemRequest
|
|
40
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@scaleway/sdk-file",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Scaleway SDK file",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.gen.d.ts",
|
|
13
|
+
"import": "./dist/index.gen.js",
|
|
14
|
+
"require": "./dist/index.gen.cjs",
|
|
15
|
+
"default": "./dist/index.gen.js"
|
|
16
|
+
},
|
|
17
|
+
"./*": {
|
|
18
|
+
"types": "./dist/*/index.gen.d.ts",
|
|
19
|
+
"import": "./dist/*/index.gen.js",
|
|
20
|
+
"require": "./dist/*/index.gen.cjs",
|
|
21
|
+
"default": "./dist/*/index.gen.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"directory": "packages_generated/file"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=20.18.3"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@scaleway/random-name": "5.1.1",
|
|
33
|
+
"@scaleway/sdk-std": "1.0.1"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@scaleway/sdk-client": "^1.2.1"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@scaleway/sdk-client": "^1.2.1"
|
|
40
|
+
},
|
|
41
|
+
"bundledDependencies": [
|
|
42
|
+
"@scaleway/random-name"
|
|
43
|
+
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"package:check": "pnpm publint",
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
|
+
"type:generate": "tsc --declaration -p tsconfig.build.json",
|
|
48
|
+
"build": "vite build --config vite.config.ts && pnpm run type:generate",
|
|
49
|
+
"build:profile": "npx vite-bundle-visualizer -c vite.config.ts"
|
|
50
|
+
}
|
|
51
|
+
}
|