@scaleway/sdk-marketplace 1.0.1
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/v2/api.gen.cjs +159 -0
- package/dist/v2/api.gen.d.ts +81 -0
- package/dist/v2/api.gen.js +159 -0
- package/dist/v2/index.gen.cjs +13 -0
- package/dist/v2/index.gen.d.ts +3 -0
- package/dist/v2/index.gen.js +13 -0
- package/dist/v2/marshalling.gen.cjs +114 -0
- package/dist/v2/marshalling.gen.d.ts +9 -0
- package/dist/v2/marshalling.gen.js +114 -0
- package/dist/v2/types.gen.d.ts +204 -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,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sdkClient = require("@scaleway/sdk-client");
|
|
4
|
+
const marshalling_gen = require("./marshalling.gen.cjs");
|
|
5
|
+
class API extends sdkClient.API {
|
|
6
|
+
pageOfListImages = (request) => this.client.fetch(
|
|
7
|
+
{
|
|
8
|
+
method: "GET",
|
|
9
|
+
path: `/marketplace/v2/images`,
|
|
10
|
+
urlParams: sdkClient.urlParams(
|
|
11
|
+
["arch", request.arch],
|
|
12
|
+
["category", request.category],
|
|
13
|
+
["include_eol", request.includeEol],
|
|
14
|
+
["order_by", request.orderBy],
|
|
15
|
+
["page", request.page],
|
|
16
|
+
[
|
|
17
|
+
"page_size",
|
|
18
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
19
|
+
]
|
|
20
|
+
)
|
|
21
|
+
},
|
|
22
|
+
marshalling_gen.unmarshalListImagesResponse
|
|
23
|
+
);
|
|
24
|
+
/**
|
|
25
|
+
* List marketplace images. List all available images on the marketplace, their UUID, CPU architecture and description.
|
|
26
|
+
*
|
|
27
|
+
* @param request - The request {@link ListImagesRequest}
|
|
28
|
+
* @returns A Promise of ListImagesResponse
|
|
29
|
+
*/
|
|
30
|
+
listImages = (request) => sdkClient.enrichForPagination("images", this.pageOfListImages, request);
|
|
31
|
+
/**
|
|
32
|
+
* Get a specific marketplace image. Get detailed information about a marketplace image, specified by its `image_id` (UUID format).
|
|
33
|
+
*
|
|
34
|
+
* @param request - The request {@link GetImageRequest}
|
|
35
|
+
* @returns A Promise of Image
|
|
36
|
+
*/
|
|
37
|
+
getImage = (request) => this.client.fetch(
|
|
38
|
+
{
|
|
39
|
+
method: "GET",
|
|
40
|
+
path: `/marketplace/v2/images/${sdkClient.validatePathParam("imageId", request.imageId)}`
|
|
41
|
+
},
|
|
42
|
+
marshalling_gen.unmarshalImage
|
|
43
|
+
);
|
|
44
|
+
pageOfListVersions = (request) => this.client.fetch(
|
|
45
|
+
{
|
|
46
|
+
method: "GET",
|
|
47
|
+
path: `/marketplace/v2/versions`,
|
|
48
|
+
urlParams: sdkClient.urlParams(
|
|
49
|
+
["image_id", request.imageId],
|
|
50
|
+
["order_by", request.orderBy],
|
|
51
|
+
["page", request.page],
|
|
52
|
+
[
|
|
53
|
+
"page_size",
|
|
54
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
55
|
+
]
|
|
56
|
+
)
|
|
57
|
+
},
|
|
58
|
+
marshalling_gen.unmarshalListVersionsResponse
|
|
59
|
+
);
|
|
60
|
+
/**
|
|
61
|
+
* List versions of an Image. Get a list of all available version of an image, specified by its `image_id` (UUID format).
|
|
62
|
+
*
|
|
63
|
+
* @param request - The request {@link ListVersionsRequest}
|
|
64
|
+
* @returns A Promise of ListVersionsResponse
|
|
65
|
+
*/
|
|
66
|
+
listVersions = (request) => sdkClient.enrichForPagination("versions", this.pageOfListVersions, request);
|
|
67
|
+
/**
|
|
68
|
+
* Get a specific image version. Get information such as the name, creation date, last update and published date for an image version specified by its `version_id` (UUID format).
|
|
69
|
+
*
|
|
70
|
+
* @param request - The request {@link GetVersionRequest}
|
|
71
|
+
* @returns A Promise of Version
|
|
72
|
+
*/
|
|
73
|
+
getVersion = (request) => this.client.fetch(
|
|
74
|
+
{
|
|
75
|
+
method: "GET",
|
|
76
|
+
path: `/marketplace/v2/versions/${sdkClient.validatePathParam("versionId", request.versionId)}`
|
|
77
|
+
},
|
|
78
|
+
marshalling_gen.unmarshalVersion
|
|
79
|
+
);
|
|
80
|
+
pageOfListLocalImages = (request = {}) => this.client.fetch(
|
|
81
|
+
{
|
|
82
|
+
method: "GET",
|
|
83
|
+
path: `/marketplace/v2/local-images`,
|
|
84
|
+
urlParams: sdkClient.urlParams(
|
|
85
|
+
["order_by", request.orderBy],
|
|
86
|
+
["page", request.page],
|
|
87
|
+
[
|
|
88
|
+
"page_size",
|
|
89
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
90
|
+
],
|
|
91
|
+
["type", request.type],
|
|
92
|
+
["zone", request.zone],
|
|
93
|
+
...Object.entries(
|
|
94
|
+
sdkClient.resolveOneOf([
|
|
95
|
+
{ param: "image_id", value: request.imageId },
|
|
96
|
+
{ param: "version_id", value: request.versionId },
|
|
97
|
+
{ param: "image_label", value: request.imageLabel }
|
|
98
|
+
])
|
|
99
|
+
)
|
|
100
|
+
)
|
|
101
|
+
},
|
|
102
|
+
marshalling_gen.unmarshalListLocalImagesResponse
|
|
103
|
+
);
|
|
104
|
+
/**
|
|
105
|
+
* List local images from a specific image or version. List information about local images in a specific Availability Zone, specified by its `image_id` (UUID format), `version_id` (UUID format) or `image_label`. Only one of these three parameters may be set.
|
|
106
|
+
*
|
|
107
|
+
* @param request - The request {@link ListLocalImagesRequest}
|
|
108
|
+
* @returns A Promise of ListLocalImagesResponse
|
|
109
|
+
*/
|
|
110
|
+
listLocalImages = (request = {}) => sdkClient.enrichForPagination("localImages", this.pageOfListLocalImages, request);
|
|
111
|
+
/**
|
|
112
|
+
* Get a specific local image by ID. Get detailed information about a local image, including compatible commercial types, supported architecture, labels and the Availability Zone of the image, specified by its `local_image_id` (UUID format).
|
|
113
|
+
*
|
|
114
|
+
* @param request - The request {@link GetLocalImageRequest}
|
|
115
|
+
* @returns A Promise of LocalImage
|
|
116
|
+
*/
|
|
117
|
+
getLocalImage = (request) => this.client.fetch(
|
|
118
|
+
{
|
|
119
|
+
method: "GET",
|
|
120
|
+
path: `/marketplace/v2/local-images/${sdkClient.validatePathParam("localImageId", request.localImageId)}`
|
|
121
|
+
},
|
|
122
|
+
marshalling_gen.unmarshalLocalImage
|
|
123
|
+
);
|
|
124
|
+
pageOfListCategories = (request = {}) => this.client.fetch(
|
|
125
|
+
{
|
|
126
|
+
method: "GET",
|
|
127
|
+
path: `/marketplace/v2/categories`,
|
|
128
|
+
urlParams: sdkClient.urlParams(
|
|
129
|
+
["page", request.page],
|
|
130
|
+
[
|
|
131
|
+
"page_size",
|
|
132
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
133
|
+
]
|
|
134
|
+
)
|
|
135
|
+
},
|
|
136
|
+
marshalling_gen.unmarshalListCategoriesResponse
|
|
137
|
+
);
|
|
138
|
+
/**
|
|
139
|
+
* List existing image categories. Get a list of all existing categories. The output can be paginated.
|
|
140
|
+
*
|
|
141
|
+
* @param request - The request {@link ListCategoriesRequest}
|
|
142
|
+
* @returns A Promise of ListCategoriesResponse
|
|
143
|
+
*/
|
|
144
|
+
listCategories = (request = {}) => sdkClient.enrichForPagination("categories", this.pageOfListCategories, request);
|
|
145
|
+
/**
|
|
146
|
+
* Get a specific category. Get information about a specific category of the marketplace catalog, specified by its `category_id` (UUID format).
|
|
147
|
+
*
|
|
148
|
+
* @param request - The request {@link GetCategoryRequest}
|
|
149
|
+
* @returns A Promise of Category
|
|
150
|
+
*/
|
|
151
|
+
getCategory = (request) => this.client.fetch(
|
|
152
|
+
{
|
|
153
|
+
method: "GET",
|
|
154
|
+
path: `/marketplace/v2/categories/${sdkClient.validatePathParam("categoryId", request.categoryId)}`
|
|
155
|
+
},
|
|
156
|
+
marshalling_gen.unmarshalCategory
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
exports.API = API;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
|
+
import type { Category, GetCategoryRequest, GetImageRequest, GetLocalImageRequest, GetVersionRequest, Image, ListCategoriesRequest, ListCategoriesResponse, ListImagesRequest, ListImagesResponse, ListLocalImagesRequest, ListLocalImagesResponse, ListVersionsRequest, ListVersionsResponse, LocalImage, Version } from './types.gen';
|
|
3
|
+
/**
|
|
4
|
+
* Marketplace API.
|
|
5
|
+
|
|
6
|
+
This API allows you to find available images for use when launching a Scaleway Instance.
|
|
7
|
+
*/
|
|
8
|
+
export declare class API extends ParentAPI {
|
|
9
|
+
protected pageOfListImages: (request: Readonly<ListImagesRequest>) => Promise<ListImagesResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* List marketplace images. List all available images on the marketplace, their UUID, CPU architecture and description.
|
|
12
|
+
*
|
|
13
|
+
* @param request - The request {@link ListImagesRequest}
|
|
14
|
+
* @returns A Promise of ListImagesResponse
|
|
15
|
+
*/
|
|
16
|
+
listImages: (request: Readonly<ListImagesRequest>) => Promise<ListImagesResponse> & {
|
|
17
|
+
all: () => Promise<Image[]>;
|
|
18
|
+
[Symbol.asyncIterator]: () => AsyncGenerator<Image[], void, void>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Get a specific marketplace image. Get detailed information about a marketplace image, specified by its `image_id` (UUID format).
|
|
22
|
+
*
|
|
23
|
+
* @param request - The request {@link GetImageRequest}
|
|
24
|
+
* @returns A Promise of Image
|
|
25
|
+
*/
|
|
26
|
+
getImage: (request: Readonly<GetImageRequest>) => Promise<Image>;
|
|
27
|
+
protected pageOfListVersions: (request: Readonly<ListVersionsRequest>) => Promise<ListVersionsResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* List versions of an Image. Get a list of all available version of an image, specified by its `image_id` (UUID format).
|
|
30
|
+
*
|
|
31
|
+
* @param request - The request {@link ListVersionsRequest}
|
|
32
|
+
* @returns A Promise of ListVersionsResponse
|
|
33
|
+
*/
|
|
34
|
+
listVersions: (request: Readonly<ListVersionsRequest>) => Promise<ListVersionsResponse> & {
|
|
35
|
+
all: () => Promise<Version[]>;
|
|
36
|
+
[Symbol.asyncIterator]: () => AsyncGenerator<Version[], void, void>;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Get a specific image version. Get information such as the name, creation date, last update and published date for an image version specified by its `version_id` (UUID format).
|
|
40
|
+
*
|
|
41
|
+
* @param request - The request {@link GetVersionRequest}
|
|
42
|
+
* @returns A Promise of Version
|
|
43
|
+
*/
|
|
44
|
+
getVersion: (request: Readonly<GetVersionRequest>) => Promise<Version>;
|
|
45
|
+
protected pageOfListLocalImages: (request?: Readonly<ListLocalImagesRequest>) => Promise<ListLocalImagesResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* List local images from a specific image or version. List information about local images in a specific Availability Zone, specified by its `image_id` (UUID format), `version_id` (UUID format) or `image_label`. Only one of these three parameters may be set.
|
|
48
|
+
*
|
|
49
|
+
* @param request - The request {@link ListLocalImagesRequest}
|
|
50
|
+
* @returns A Promise of ListLocalImagesResponse
|
|
51
|
+
*/
|
|
52
|
+
listLocalImages: (request?: Readonly<ListLocalImagesRequest>) => Promise<ListLocalImagesResponse> & {
|
|
53
|
+
all: () => Promise<LocalImage[]>;
|
|
54
|
+
[Symbol.asyncIterator]: () => AsyncGenerator<LocalImage[], void, void>;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Get a specific local image by ID. Get detailed information about a local image, including compatible commercial types, supported architecture, labels and the Availability Zone of the image, specified by its `local_image_id` (UUID format).
|
|
58
|
+
*
|
|
59
|
+
* @param request - The request {@link GetLocalImageRequest}
|
|
60
|
+
* @returns A Promise of LocalImage
|
|
61
|
+
*/
|
|
62
|
+
getLocalImage: (request: Readonly<GetLocalImageRequest>) => Promise<LocalImage>;
|
|
63
|
+
protected pageOfListCategories: (request?: Readonly<ListCategoriesRequest>) => Promise<ListCategoriesResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* List existing image categories. Get a list of all existing categories. The output can be paginated.
|
|
66
|
+
*
|
|
67
|
+
* @param request - The request {@link ListCategoriesRequest}
|
|
68
|
+
* @returns A Promise of ListCategoriesResponse
|
|
69
|
+
*/
|
|
70
|
+
listCategories: (request?: Readonly<ListCategoriesRequest>) => Promise<ListCategoriesResponse> & {
|
|
71
|
+
all: () => Promise<Category[]>;
|
|
72
|
+
[Symbol.asyncIterator]: () => AsyncGenerator<Category[], void, void>;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Get a specific category. Get information about a specific category of the marketplace catalog, specified by its `category_id` (UUID format).
|
|
76
|
+
*
|
|
77
|
+
* @param request - The request {@link GetCategoryRequest}
|
|
78
|
+
* @returns A Promise of Category
|
|
79
|
+
*/
|
|
80
|
+
getCategory: (request: Readonly<GetCategoryRequest>) => Promise<Category>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { API as API$1, urlParams, enrichForPagination, validatePathParam, resolveOneOf } from "@scaleway/sdk-client";
|
|
2
|
+
import { unmarshalListImagesResponse, unmarshalImage, unmarshalListVersionsResponse, unmarshalVersion, unmarshalListLocalImagesResponse, unmarshalLocalImage, unmarshalListCategoriesResponse, unmarshalCategory } from "./marshalling.gen.js";
|
|
3
|
+
class API extends API$1 {
|
|
4
|
+
pageOfListImages = (request) => this.client.fetch(
|
|
5
|
+
{
|
|
6
|
+
method: "GET",
|
|
7
|
+
path: `/marketplace/v2/images`,
|
|
8
|
+
urlParams: urlParams(
|
|
9
|
+
["arch", request.arch],
|
|
10
|
+
["category", request.category],
|
|
11
|
+
["include_eol", request.includeEol],
|
|
12
|
+
["order_by", request.orderBy],
|
|
13
|
+
["page", request.page],
|
|
14
|
+
[
|
|
15
|
+
"page_size",
|
|
16
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
17
|
+
]
|
|
18
|
+
)
|
|
19
|
+
},
|
|
20
|
+
unmarshalListImagesResponse
|
|
21
|
+
);
|
|
22
|
+
/**
|
|
23
|
+
* List marketplace images. List all available images on the marketplace, their UUID, CPU architecture and description.
|
|
24
|
+
*
|
|
25
|
+
* @param request - The request {@link ListImagesRequest}
|
|
26
|
+
* @returns A Promise of ListImagesResponse
|
|
27
|
+
*/
|
|
28
|
+
listImages = (request) => enrichForPagination("images", this.pageOfListImages, request);
|
|
29
|
+
/**
|
|
30
|
+
* Get a specific marketplace image. Get detailed information about a marketplace image, specified by its `image_id` (UUID format).
|
|
31
|
+
*
|
|
32
|
+
* @param request - The request {@link GetImageRequest}
|
|
33
|
+
* @returns A Promise of Image
|
|
34
|
+
*/
|
|
35
|
+
getImage = (request) => this.client.fetch(
|
|
36
|
+
{
|
|
37
|
+
method: "GET",
|
|
38
|
+
path: `/marketplace/v2/images/${validatePathParam("imageId", request.imageId)}`
|
|
39
|
+
},
|
|
40
|
+
unmarshalImage
|
|
41
|
+
);
|
|
42
|
+
pageOfListVersions = (request) => this.client.fetch(
|
|
43
|
+
{
|
|
44
|
+
method: "GET",
|
|
45
|
+
path: `/marketplace/v2/versions`,
|
|
46
|
+
urlParams: urlParams(
|
|
47
|
+
["image_id", request.imageId],
|
|
48
|
+
["order_by", request.orderBy],
|
|
49
|
+
["page", request.page],
|
|
50
|
+
[
|
|
51
|
+
"page_size",
|
|
52
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
53
|
+
]
|
|
54
|
+
)
|
|
55
|
+
},
|
|
56
|
+
unmarshalListVersionsResponse
|
|
57
|
+
);
|
|
58
|
+
/**
|
|
59
|
+
* List versions of an Image. Get a list of all available version of an image, specified by its `image_id` (UUID format).
|
|
60
|
+
*
|
|
61
|
+
* @param request - The request {@link ListVersionsRequest}
|
|
62
|
+
* @returns A Promise of ListVersionsResponse
|
|
63
|
+
*/
|
|
64
|
+
listVersions = (request) => enrichForPagination("versions", this.pageOfListVersions, request);
|
|
65
|
+
/**
|
|
66
|
+
* Get a specific image version. Get information such as the name, creation date, last update and published date for an image version specified by its `version_id` (UUID format).
|
|
67
|
+
*
|
|
68
|
+
* @param request - The request {@link GetVersionRequest}
|
|
69
|
+
* @returns A Promise of Version
|
|
70
|
+
*/
|
|
71
|
+
getVersion = (request) => this.client.fetch(
|
|
72
|
+
{
|
|
73
|
+
method: "GET",
|
|
74
|
+
path: `/marketplace/v2/versions/${validatePathParam("versionId", request.versionId)}`
|
|
75
|
+
},
|
|
76
|
+
unmarshalVersion
|
|
77
|
+
);
|
|
78
|
+
pageOfListLocalImages = (request = {}) => this.client.fetch(
|
|
79
|
+
{
|
|
80
|
+
method: "GET",
|
|
81
|
+
path: `/marketplace/v2/local-images`,
|
|
82
|
+
urlParams: urlParams(
|
|
83
|
+
["order_by", request.orderBy],
|
|
84
|
+
["page", request.page],
|
|
85
|
+
[
|
|
86
|
+
"page_size",
|
|
87
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
88
|
+
],
|
|
89
|
+
["type", request.type],
|
|
90
|
+
["zone", request.zone],
|
|
91
|
+
...Object.entries(
|
|
92
|
+
resolveOneOf([
|
|
93
|
+
{ param: "image_id", value: request.imageId },
|
|
94
|
+
{ param: "version_id", value: request.versionId },
|
|
95
|
+
{ param: "image_label", value: request.imageLabel }
|
|
96
|
+
])
|
|
97
|
+
)
|
|
98
|
+
)
|
|
99
|
+
},
|
|
100
|
+
unmarshalListLocalImagesResponse
|
|
101
|
+
);
|
|
102
|
+
/**
|
|
103
|
+
* List local images from a specific image or version. List information about local images in a specific Availability Zone, specified by its `image_id` (UUID format), `version_id` (UUID format) or `image_label`. Only one of these three parameters may be set.
|
|
104
|
+
*
|
|
105
|
+
* @param request - The request {@link ListLocalImagesRequest}
|
|
106
|
+
* @returns A Promise of ListLocalImagesResponse
|
|
107
|
+
*/
|
|
108
|
+
listLocalImages = (request = {}) => enrichForPagination("localImages", this.pageOfListLocalImages, request);
|
|
109
|
+
/**
|
|
110
|
+
* Get a specific local image by ID. Get detailed information about a local image, including compatible commercial types, supported architecture, labels and the Availability Zone of the image, specified by its `local_image_id` (UUID format).
|
|
111
|
+
*
|
|
112
|
+
* @param request - The request {@link GetLocalImageRequest}
|
|
113
|
+
* @returns A Promise of LocalImage
|
|
114
|
+
*/
|
|
115
|
+
getLocalImage = (request) => this.client.fetch(
|
|
116
|
+
{
|
|
117
|
+
method: "GET",
|
|
118
|
+
path: `/marketplace/v2/local-images/${validatePathParam("localImageId", request.localImageId)}`
|
|
119
|
+
},
|
|
120
|
+
unmarshalLocalImage
|
|
121
|
+
);
|
|
122
|
+
pageOfListCategories = (request = {}) => this.client.fetch(
|
|
123
|
+
{
|
|
124
|
+
method: "GET",
|
|
125
|
+
path: `/marketplace/v2/categories`,
|
|
126
|
+
urlParams: urlParams(
|
|
127
|
+
["page", request.page],
|
|
128
|
+
[
|
|
129
|
+
"page_size",
|
|
130
|
+
request.pageSize ?? this.client.settings.defaultPageSize
|
|
131
|
+
]
|
|
132
|
+
)
|
|
133
|
+
},
|
|
134
|
+
unmarshalListCategoriesResponse
|
|
135
|
+
);
|
|
136
|
+
/**
|
|
137
|
+
* List existing image categories. Get a list of all existing categories. The output can be paginated.
|
|
138
|
+
*
|
|
139
|
+
* @param request - The request {@link ListCategoriesRequest}
|
|
140
|
+
* @returns A Promise of ListCategoriesResponse
|
|
141
|
+
*/
|
|
142
|
+
listCategories = (request = {}) => enrichForPagination("categories", this.pageOfListCategories, request);
|
|
143
|
+
/**
|
|
144
|
+
* Get a specific category. Get information about a specific category of the marketplace catalog, specified by its `category_id` (UUID format).
|
|
145
|
+
*
|
|
146
|
+
* @param request - The request {@link GetCategoryRequest}
|
|
147
|
+
* @returns A Promise of Category
|
|
148
|
+
*/
|
|
149
|
+
getCategory = (request) => this.client.fetch(
|
|
150
|
+
{
|
|
151
|
+
method: "GET",
|
|
152
|
+
path: `/marketplace/v2/categories/${validatePathParam("categoryId", request.categoryId)}`
|
|
153
|
+
},
|
|
154
|
+
unmarshalCategory
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
API
|
|
159
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const api_gen = require("./api.gen.cjs");
|
|
4
|
+
const marshalling_gen = require("./marshalling.gen.cjs");
|
|
5
|
+
exports.API = api_gen.API;
|
|
6
|
+
exports.unmarshalCategory = marshalling_gen.unmarshalCategory;
|
|
7
|
+
exports.unmarshalImage = marshalling_gen.unmarshalImage;
|
|
8
|
+
exports.unmarshalListCategoriesResponse = marshalling_gen.unmarshalListCategoriesResponse;
|
|
9
|
+
exports.unmarshalListImagesResponse = marshalling_gen.unmarshalListImagesResponse;
|
|
10
|
+
exports.unmarshalListLocalImagesResponse = marshalling_gen.unmarshalListLocalImagesResponse;
|
|
11
|
+
exports.unmarshalListVersionsResponse = marshalling_gen.unmarshalListVersionsResponse;
|
|
12
|
+
exports.unmarshalLocalImage = marshalling_gen.unmarshalLocalImage;
|
|
13
|
+
exports.unmarshalVersion = marshalling_gen.unmarshalVersion;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { API } from './api.gen';
|
|
2
|
+
export * from './marshalling.gen';
|
|
3
|
+
export type { Category, GetCategoryRequest, GetImageRequest, GetLocalImageRequest, GetVersionRequest, Image, ListCategoriesRequest, ListCategoriesResponse, ListImagesRequest, ListImagesRequestOrderBy, ListImagesResponse, ListLocalImagesRequest, ListLocalImagesRequestOrderBy, ListLocalImagesResponse, ListVersionsRequest, ListVersionsRequestOrderBy, ListVersionsResponse, LocalImage, LocalImageType, Version, } from './types.gen';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { API } from "./api.gen.js";
|
|
2
|
+
import { unmarshalCategory, unmarshalImage, unmarshalListCategoriesResponse, unmarshalListImagesResponse, unmarshalListLocalImagesResponse, unmarshalListVersionsResponse, unmarshalLocalImage, unmarshalVersion } from "./marshalling.gen.js";
|
|
3
|
+
export {
|
|
4
|
+
API,
|
|
5
|
+
unmarshalCategory,
|
|
6
|
+
unmarshalImage,
|
|
7
|
+
unmarshalListCategoriesResponse,
|
|
8
|
+
unmarshalListImagesResponse,
|
|
9
|
+
unmarshalListLocalImagesResponse,
|
|
10
|
+
unmarshalListVersionsResponse,
|
|
11
|
+
unmarshalLocalImage,
|
|
12
|
+
unmarshalVersion
|
|
13
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sdkClient = require("@scaleway/sdk-client");
|
|
4
|
+
const unmarshalCategory = (data) => {
|
|
5
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
6
|
+
throw new TypeError(
|
|
7
|
+
`Unmarshalling the type 'Category' failed as data isn't a dictionary.`
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
description: data.description,
|
|
12
|
+
id: data.id,
|
|
13
|
+
name: data.name
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const unmarshalImage = (data) => {
|
|
17
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
18
|
+
throw new TypeError(
|
|
19
|
+
`Unmarshalling the type 'Image' failed as data isn't a dictionary.`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
categories: data.categories,
|
|
24
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
25
|
+
description: data.description,
|
|
26
|
+
id: data.id,
|
|
27
|
+
label: data.label,
|
|
28
|
+
logo: data.logo,
|
|
29
|
+
name: data.name,
|
|
30
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at),
|
|
31
|
+
validUntil: sdkClient.unmarshalDate(data.valid_until)
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const unmarshalLocalImage = (data) => {
|
|
35
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
36
|
+
throw new TypeError(
|
|
37
|
+
`Unmarshalling the type 'LocalImage' failed as data isn't a dictionary.`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
arch: data.arch,
|
|
42
|
+
compatibleCommercialTypes: data.compatible_commercial_types,
|
|
43
|
+
id: data.id,
|
|
44
|
+
label: data.label,
|
|
45
|
+
type: data.type,
|
|
46
|
+
zone: data.zone
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const unmarshalVersion = (data) => {
|
|
50
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
51
|
+
throw new TypeError(
|
|
52
|
+
`Unmarshalling the type 'Version' failed as data isn't a dictionary.`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
57
|
+
id: data.id,
|
|
58
|
+
name: data.name,
|
|
59
|
+
publishedAt: sdkClient.unmarshalDate(data.published_at),
|
|
60
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at)
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const unmarshalListCategoriesResponse = (data) => {
|
|
64
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
65
|
+
throw new TypeError(
|
|
66
|
+
`Unmarshalling the type 'ListCategoriesResponse' failed as data isn't a dictionary.`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
categories: sdkClient.unmarshalArrayOfObject(data.categories, unmarshalCategory),
|
|
71
|
+
totalCount: data.total_count
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
const unmarshalListImagesResponse = (data) => {
|
|
75
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
76
|
+
throw new TypeError(
|
|
77
|
+
`Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
images: sdkClient.unmarshalArrayOfObject(data.images, unmarshalImage),
|
|
82
|
+
totalCount: data.total_count
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const unmarshalListLocalImagesResponse = (data) => {
|
|
86
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
87
|
+
throw new TypeError(
|
|
88
|
+
`Unmarshalling the type 'ListLocalImagesResponse' failed as data isn't a dictionary.`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
localImages: sdkClient.unmarshalArrayOfObject(data.local_images, unmarshalLocalImage),
|
|
93
|
+
totalCount: data.total_count
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const unmarshalListVersionsResponse = (data) => {
|
|
97
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
98
|
+
throw new TypeError(
|
|
99
|
+
`Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
totalCount: data.total_count,
|
|
104
|
+
versions: sdkClient.unmarshalArrayOfObject(data.versions, unmarshalVersion)
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
exports.unmarshalCategory = unmarshalCategory;
|
|
108
|
+
exports.unmarshalImage = unmarshalImage;
|
|
109
|
+
exports.unmarshalListCategoriesResponse = unmarshalListCategoriesResponse;
|
|
110
|
+
exports.unmarshalListImagesResponse = unmarshalListImagesResponse;
|
|
111
|
+
exports.unmarshalListLocalImagesResponse = unmarshalListLocalImagesResponse;
|
|
112
|
+
exports.unmarshalListVersionsResponse = unmarshalListVersionsResponse;
|
|
113
|
+
exports.unmarshalLocalImage = unmarshalLocalImage;
|
|
114
|
+
exports.unmarshalVersion = unmarshalVersion;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Category, Image, ListCategoriesResponse, ListImagesResponse, ListLocalImagesResponse, ListVersionsResponse, LocalImage, Version } from './types.gen';
|
|
2
|
+
export declare const unmarshalCategory: (data: unknown) => Category;
|
|
3
|
+
export declare const unmarshalImage: (data: unknown) => Image;
|
|
4
|
+
export declare const unmarshalLocalImage: (data: unknown) => LocalImage;
|
|
5
|
+
export declare const unmarshalVersion: (data: unknown) => Version;
|
|
6
|
+
export declare const unmarshalListCategoriesResponse: (data: unknown) => ListCategoriesResponse;
|
|
7
|
+
export declare const unmarshalListImagesResponse: (data: unknown) => ListImagesResponse;
|
|
8
|
+
export declare const unmarshalListLocalImagesResponse: (data: unknown) => ListLocalImagesResponse;
|
|
9
|
+
export declare const unmarshalListVersionsResponse: (data: unknown) => ListVersionsResponse;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { isJSONObject, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
|
|
2
|
+
const unmarshalCategory = (data) => {
|
|
3
|
+
if (!isJSONObject(data)) {
|
|
4
|
+
throw new TypeError(
|
|
5
|
+
`Unmarshalling the type 'Category' failed as data isn't a dictionary.`
|
|
6
|
+
);
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
description: data.description,
|
|
10
|
+
id: data.id,
|
|
11
|
+
name: data.name
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const unmarshalImage = (data) => {
|
|
15
|
+
if (!isJSONObject(data)) {
|
|
16
|
+
throw new TypeError(
|
|
17
|
+
`Unmarshalling the type 'Image' failed as data isn't a dictionary.`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
categories: data.categories,
|
|
22
|
+
createdAt: unmarshalDate(data.created_at),
|
|
23
|
+
description: data.description,
|
|
24
|
+
id: data.id,
|
|
25
|
+
label: data.label,
|
|
26
|
+
logo: data.logo,
|
|
27
|
+
name: data.name,
|
|
28
|
+
updatedAt: unmarshalDate(data.updated_at),
|
|
29
|
+
validUntil: unmarshalDate(data.valid_until)
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const unmarshalLocalImage = (data) => {
|
|
33
|
+
if (!isJSONObject(data)) {
|
|
34
|
+
throw new TypeError(
|
|
35
|
+
`Unmarshalling the type 'LocalImage' failed as data isn't a dictionary.`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
arch: data.arch,
|
|
40
|
+
compatibleCommercialTypes: data.compatible_commercial_types,
|
|
41
|
+
id: data.id,
|
|
42
|
+
label: data.label,
|
|
43
|
+
type: data.type,
|
|
44
|
+
zone: data.zone
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const unmarshalVersion = (data) => {
|
|
48
|
+
if (!isJSONObject(data)) {
|
|
49
|
+
throw new TypeError(
|
|
50
|
+
`Unmarshalling the type 'Version' failed as data isn't a dictionary.`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
createdAt: unmarshalDate(data.created_at),
|
|
55
|
+
id: data.id,
|
|
56
|
+
name: data.name,
|
|
57
|
+
publishedAt: unmarshalDate(data.published_at),
|
|
58
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const unmarshalListCategoriesResponse = (data) => {
|
|
62
|
+
if (!isJSONObject(data)) {
|
|
63
|
+
throw new TypeError(
|
|
64
|
+
`Unmarshalling the type 'ListCategoriesResponse' failed as data isn't a dictionary.`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
categories: unmarshalArrayOfObject(data.categories, unmarshalCategory),
|
|
69
|
+
totalCount: data.total_count
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const unmarshalListImagesResponse = (data) => {
|
|
73
|
+
if (!isJSONObject(data)) {
|
|
74
|
+
throw new TypeError(
|
|
75
|
+
`Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
images: unmarshalArrayOfObject(data.images, unmarshalImage),
|
|
80
|
+
totalCount: data.total_count
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const unmarshalListLocalImagesResponse = (data) => {
|
|
84
|
+
if (!isJSONObject(data)) {
|
|
85
|
+
throw new TypeError(
|
|
86
|
+
`Unmarshalling the type 'ListLocalImagesResponse' failed as data isn't a dictionary.`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
localImages: unmarshalArrayOfObject(data.local_images, unmarshalLocalImage),
|
|
91
|
+
totalCount: data.total_count
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
const unmarshalListVersionsResponse = (data) => {
|
|
95
|
+
if (!isJSONObject(data)) {
|
|
96
|
+
throw new TypeError(
|
|
97
|
+
`Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
totalCount: data.total_count,
|
|
102
|
+
versions: unmarshalArrayOfObject(data.versions, unmarshalVersion)
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export {
|
|
106
|
+
unmarshalCategory,
|
|
107
|
+
unmarshalImage,
|
|
108
|
+
unmarshalListCategoriesResponse,
|
|
109
|
+
unmarshalListImagesResponse,
|
|
110
|
+
unmarshalListLocalImagesResponse,
|
|
111
|
+
unmarshalListVersionsResponse,
|
|
112
|
+
unmarshalLocalImage,
|
|
113
|
+
unmarshalVersion
|
|
114
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { Zone as ScwZone } from '@scaleway/sdk-client';
|
|
2
|
+
export type ListImagesRequestOrderBy = 'name_asc' | 'name_desc' | 'created_at_asc' | 'created_at_desc' | 'updated_at_asc' | 'updated_at_desc';
|
|
3
|
+
export type ListLocalImagesRequestOrderBy = 'type_asc' | 'type_desc' | 'created_at_asc' | 'created_at_desc';
|
|
4
|
+
export type ListVersionsRequestOrderBy = 'created_at_asc' | 'created_at_desc';
|
|
5
|
+
export type LocalImageType = 'unknown_type' | 'instance_local' | 'instance_sbs';
|
|
6
|
+
export interface Category {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Image {
|
|
12
|
+
/**
|
|
13
|
+
* UUID of this image.
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
16
|
+
/**
|
|
17
|
+
* Name of the image.
|
|
18
|
+
*/
|
|
19
|
+
name: string;
|
|
20
|
+
/**
|
|
21
|
+
* Text description of this image.
|
|
22
|
+
*/
|
|
23
|
+
description: string;
|
|
24
|
+
/**
|
|
25
|
+
* URL of this image's logo.
|
|
26
|
+
*/
|
|
27
|
+
logo: string;
|
|
28
|
+
/**
|
|
29
|
+
* List of categories this image belongs to.
|
|
30
|
+
*/
|
|
31
|
+
categories: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Creation date of this image.
|
|
34
|
+
*/
|
|
35
|
+
createdAt?: Date;
|
|
36
|
+
/**
|
|
37
|
+
* Date of the last modification of this image.
|
|
38
|
+
*/
|
|
39
|
+
updatedAt?: Date;
|
|
40
|
+
/**
|
|
41
|
+
* Expiration date of this image.
|
|
42
|
+
*/
|
|
43
|
+
validUntil?: Date;
|
|
44
|
+
/**
|
|
45
|
+
* Typically an identifier for a distribution (ex. "ubuntu_focal").
|
|
46
|
+
This label can be used in the image field of the server creation request.
|
|
47
|
+
*/
|
|
48
|
+
label: string;
|
|
49
|
+
}
|
|
50
|
+
export interface LocalImage {
|
|
51
|
+
/**
|
|
52
|
+
* Version you will typically use to define an image in an API call.
|
|
53
|
+
*/
|
|
54
|
+
id: string;
|
|
55
|
+
/**
|
|
56
|
+
* List of all commercial types that are compatible with this local image.
|
|
57
|
+
*/
|
|
58
|
+
compatibleCommercialTypes: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Supported architecture for this local image.
|
|
61
|
+
*/
|
|
62
|
+
arch: string;
|
|
63
|
+
/**
|
|
64
|
+
* Availability Zone where this local image is available.
|
|
65
|
+
*/
|
|
66
|
+
zone: ScwZone;
|
|
67
|
+
/**
|
|
68
|
+
* This label can be used in the image field of the server creation request.
|
|
69
|
+
*/
|
|
70
|
+
label: string;
|
|
71
|
+
/**
|
|
72
|
+
* Type of this local image.
|
|
73
|
+
*/
|
|
74
|
+
type: LocalImageType;
|
|
75
|
+
}
|
|
76
|
+
export interface Version {
|
|
77
|
+
/**
|
|
78
|
+
* UUID of this version.
|
|
79
|
+
*/
|
|
80
|
+
id: string;
|
|
81
|
+
/**
|
|
82
|
+
* Name of this version.
|
|
83
|
+
*/
|
|
84
|
+
name: string;
|
|
85
|
+
/**
|
|
86
|
+
* Creation date of this image version.
|
|
87
|
+
*/
|
|
88
|
+
createdAt?: Date;
|
|
89
|
+
/**
|
|
90
|
+
* Date of the last modification of this version.
|
|
91
|
+
*/
|
|
92
|
+
updatedAt?: Date;
|
|
93
|
+
/**
|
|
94
|
+
* Date this version was officially published.
|
|
95
|
+
*/
|
|
96
|
+
publishedAt?: Date;
|
|
97
|
+
}
|
|
98
|
+
export type GetCategoryRequest = {
|
|
99
|
+
categoryId: string;
|
|
100
|
+
};
|
|
101
|
+
export type GetImageRequest = {
|
|
102
|
+
/**
|
|
103
|
+
* Display the image name.
|
|
104
|
+
*/
|
|
105
|
+
imageId: string;
|
|
106
|
+
};
|
|
107
|
+
export type GetLocalImageRequest = {
|
|
108
|
+
localImageId: string;
|
|
109
|
+
};
|
|
110
|
+
export type GetVersionRequest = {
|
|
111
|
+
versionId: string;
|
|
112
|
+
};
|
|
113
|
+
export type ListCategoriesRequest = {
|
|
114
|
+
pageSize?: number;
|
|
115
|
+
page?: number;
|
|
116
|
+
};
|
|
117
|
+
export interface ListCategoriesResponse {
|
|
118
|
+
categories: Category[];
|
|
119
|
+
totalCount: number;
|
|
120
|
+
}
|
|
121
|
+
export type ListImagesRequest = {
|
|
122
|
+
/**
|
|
123
|
+
* A positive integer lower or equal to 100 to select the number of items to display.
|
|
124
|
+
*/
|
|
125
|
+
pageSize?: number;
|
|
126
|
+
/**
|
|
127
|
+
* A positive integer to choose the page to display.
|
|
128
|
+
*/
|
|
129
|
+
page?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Ordering to use.
|
|
132
|
+
*/
|
|
133
|
+
orderBy?: ListImagesRequestOrderBy;
|
|
134
|
+
/**
|
|
135
|
+
* Choose for which machine architecture to return images.
|
|
136
|
+
*/
|
|
137
|
+
arch?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Choose the category of images to get.
|
|
140
|
+
*/
|
|
141
|
+
category?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Choose to include end-of-life images.
|
|
144
|
+
*/
|
|
145
|
+
includeEol: boolean;
|
|
146
|
+
};
|
|
147
|
+
export interface ListImagesResponse {
|
|
148
|
+
images: Image[];
|
|
149
|
+
totalCount: number;
|
|
150
|
+
}
|
|
151
|
+
export type ListLocalImagesRequest = {
|
|
152
|
+
/**
|
|
153
|
+
* A positive integer lower or equal to 100 to select the number of items to display.
|
|
154
|
+
*/
|
|
155
|
+
pageSize?: number;
|
|
156
|
+
/**
|
|
157
|
+
* A positive integer to choose the page to display.
|
|
158
|
+
*/
|
|
159
|
+
page?: number;
|
|
160
|
+
/**
|
|
161
|
+
* Ordering to use.
|
|
162
|
+
*/
|
|
163
|
+
orderBy?: ListLocalImagesRequestOrderBy;
|
|
164
|
+
/**
|
|
165
|
+
* Filter local images available on this Availability Zone.
|
|
166
|
+
*/
|
|
167
|
+
zone?: ScwZone;
|
|
168
|
+
/**
|
|
169
|
+
* Filter by image id.
|
|
170
|
+
*
|
|
171
|
+
* One-of ('scope'): at most one of 'imageId', 'versionId', 'imageLabel' could be set.
|
|
172
|
+
*/
|
|
173
|
+
imageId?: string;
|
|
174
|
+
/**
|
|
175
|
+
* Filter by version id.
|
|
176
|
+
*
|
|
177
|
+
* One-of ('scope'): at most one of 'imageId', 'versionId', 'imageLabel' could be set.
|
|
178
|
+
*/
|
|
179
|
+
versionId?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Filter by image label.
|
|
182
|
+
*
|
|
183
|
+
* One-of ('scope'): at most one of 'imageId', 'versionId', 'imageLabel' could be set.
|
|
184
|
+
*/
|
|
185
|
+
imageLabel?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Filter by type.
|
|
188
|
+
*/
|
|
189
|
+
type?: LocalImageType;
|
|
190
|
+
};
|
|
191
|
+
export interface ListLocalImagesResponse {
|
|
192
|
+
localImages: LocalImage[];
|
|
193
|
+
totalCount: number;
|
|
194
|
+
}
|
|
195
|
+
export type ListVersionsRequest = {
|
|
196
|
+
imageId: string;
|
|
197
|
+
pageSize?: number;
|
|
198
|
+
page?: number;
|
|
199
|
+
orderBy?: ListVersionsRequestOrderBy;
|
|
200
|
+
};
|
|
201
|
+
export interface ListVersionsResponse {
|
|
202
|
+
versions: Version[];
|
|
203
|
+
totalCount: number;
|
|
204
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@scaleway/sdk-marketplace",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Scaleway SDK marketplace",
|
|
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/marketplace"
|
|
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
|
+
}
|