@scaleway/sdk-registry 1.2.0 → 2.1.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/README.md +96 -0
- package/dist/v1/api.gen.d.ts +1 -1
- package/dist/v1/api.gen.js +14 -23
- package/dist/v1/content.gen.js +9 -3
- package/dist/v1/index.gen.d.ts +1 -1
- package/package.json +6 -9
- package/dist/index.gen.cjs +0 -4
- package/dist/v1/api.gen.cjs +0 -267
- package/dist/v1/content.gen.cjs +0 -8
- package/dist/v1/index.gen.cjs +0 -18
- package/dist/v1/marshalling.gen.cjs +0 -128
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @scaleway/sdk-registry
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@scaleway/sdk-registry)
|
|
4
|
+
[](https://www.npmjs.com/package/@scaleway/sdk-registry)
|
|
5
|
+
[](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
|
|
6
|
+
|
|
7
|
+
Scaleway SDK for Registry API.
|
|
8
|
+
|
|
9
|
+
> **Note**
|
|
10
|
+
> This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @scaleway/sdk-registry @scaleway/sdk-client
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
or with pnpm:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm add @scaleway/sdk-registry @scaleway/sdk-client
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
or with yarn:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
yarn add @scaleway/sdk-registry @scaleway/sdk-client
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Getting Started
|
|
31
|
+
|
|
32
|
+
You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
|
|
33
|
+
|
|
34
|
+
### Basic Usage
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { createClient } from '@scaleway/sdk-client'
|
|
38
|
+
import { Registry } from '@scaleway/sdk-registry'
|
|
39
|
+
|
|
40
|
+
const client = createClient({
|
|
41
|
+
accessKey: 'SCWXXXXXXXXXXXXXXXXX',
|
|
42
|
+
secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
43
|
+
defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
|
|
44
|
+
defaultRegion: 'fr-par',
|
|
45
|
+
defaultZone: 'fr-par-1',
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const api = new Registry.v1.API(client)
|
|
49
|
+
|
|
50
|
+
// Use the API
|
|
51
|
+
// Example: await api.listServers()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Using Configuration Loader
|
|
55
|
+
|
|
56
|
+
For a simpler setup, you can load credentials from the configuration file or environment variables:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { createClient } from '@scaleway/sdk-client'
|
|
60
|
+
import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
|
|
61
|
+
import { Registry } from '@scaleway/sdk-registry'
|
|
62
|
+
|
|
63
|
+
const profile = loadProfileFromConfigurationFile()
|
|
64
|
+
const client = createClient(profile)
|
|
65
|
+
const api = new Registry.v1.API(client)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Documentation
|
|
69
|
+
|
|
70
|
+
- 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
|
|
71
|
+
- 🌐 [Scaleway Registry API Documentation](https://www.scaleway.com/en/developers/api/registry/)
|
|
72
|
+
- 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
|
|
73
|
+
- 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
- ✅ Full TypeScript support with complete type definitions
|
|
78
|
+
- ✅ Promise-based API
|
|
79
|
+
- ✅ Automatic pagination helpers
|
|
80
|
+
- ✅ Built-in error handling
|
|
81
|
+
- ✅ Compatible with Node.js ≥ 20
|
|
82
|
+
|
|
83
|
+
## Support
|
|
84
|
+
|
|
85
|
+
We love feedback! Feel free to reach us on:
|
|
86
|
+
- [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
|
|
87
|
+
- [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
|
|
96
|
+
|
package/dist/v1/api.gen.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
1
|
import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client';
|
|
2
|
+
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
3
3
|
import type { CreateNamespaceRequest, DeleteImageRequest, DeleteNamespaceRequest, DeleteTagRequest, GetImageRequest, GetNamespaceRequest, GetTagRequest, Image, ListImagesRequest, ListImagesResponse, ListNamespacesRequest, ListNamespacesResponse, ListTagsRequest, ListTagsResponse, Namespace, Tag, UpdateImageRequest, UpdateNamespaceRequest } from './types.gen.js';
|
|
4
4
|
/**
|
|
5
5
|
* Container Registry API.
|
package/dist/v1/api.gen.js
CHANGED
|
@@ -10,7 +10,11 @@ class API extends API$1 {
|
|
|
10
10
|
* type ∈ {'zone','region','global','unspecified'}
|
|
11
11
|
*/
|
|
12
12
|
static LOCALITY = toApiLocality({
|
|
13
|
-
regions: [
|
|
13
|
+
regions: [
|
|
14
|
+
"fr-par",
|
|
15
|
+
"nl-ams",
|
|
16
|
+
"pl-waw"
|
|
17
|
+
]
|
|
14
18
|
});
|
|
15
19
|
pageOfListNamespaces = (request = {}) => this.client.fetch(
|
|
16
20
|
{
|
|
@@ -21,10 +25,7 @@ class API extends API$1 {
|
|
|
21
25
|
["order_by", request.orderBy],
|
|
22
26
|
["organization_id", request.organizationId],
|
|
23
27
|
["page", request.page],
|
|
24
|
-
[
|
|
25
|
-
"page_size",
|
|
26
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
27
|
-
],
|
|
28
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
|
|
28
29
|
["project_id", request.projectId]
|
|
29
30
|
)
|
|
30
31
|
},
|
|
@@ -58,9 +59,7 @@ class API extends API$1 {
|
|
|
58
59
|
* @returns A Promise of Namespace
|
|
59
60
|
*/
|
|
60
61
|
waitForNamespace = (request, options) => waitForResource(
|
|
61
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
62
|
-
!NAMESPACE_TRANSIENT_STATUSES.includes(res.status)
|
|
63
|
-
)),
|
|
62
|
+
options?.stop ?? ((res) => Promise.resolve(!NAMESPACE_TRANSIENT_STATUSES.includes(res.status))),
|
|
64
63
|
this.getNamespace,
|
|
65
64
|
request,
|
|
66
65
|
options
|
|
@@ -122,10 +121,7 @@ class API extends API$1 {
|
|
|
122
121
|
["order_by", request.orderBy],
|
|
123
122
|
["organization_id", request.organizationId],
|
|
124
123
|
["page", request.page],
|
|
125
|
-
[
|
|
126
|
-
"page_size",
|
|
127
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
128
|
-
],
|
|
124
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
|
|
129
125
|
["project_id", request.projectId]
|
|
130
126
|
)
|
|
131
127
|
},
|
|
@@ -159,9 +155,7 @@ class API extends API$1 {
|
|
|
159
155
|
* @returns A Promise of Image
|
|
160
156
|
*/
|
|
161
157
|
waitForImage = (request, options) => waitForResource(
|
|
162
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
163
|
-
!IMAGE_TRANSIENT_STATUSES.includes(res.status)
|
|
164
|
-
)),
|
|
158
|
+
options?.stop ?? ((res) => Promise.resolve(!IMAGE_TRANSIENT_STATUSES.includes(res.status))),
|
|
165
159
|
this.getImage,
|
|
166
160
|
request,
|
|
167
161
|
options
|
|
@@ -204,10 +198,7 @@ class API extends API$1 {
|
|
|
204
198
|
["name", request.name],
|
|
205
199
|
["order_by", request.orderBy],
|
|
206
200
|
["page", request.page],
|
|
207
|
-
[
|
|
208
|
-
"page_size",
|
|
209
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
210
|
-
]
|
|
201
|
+
["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
|
|
211
202
|
)
|
|
212
203
|
},
|
|
213
204
|
unmarshalListTagsResponse
|
|
@@ -240,9 +231,7 @@ class API extends API$1 {
|
|
|
240
231
|
* @returns A Promise of Tag
|
|
241
232
|
*/
|
|
242
233
|
waitForTag = (request, options) => waitForResource(
|
|
243
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
244
|
-
!TAG_TRANSIENT_STATUSES.includes(res.status)
|
|
245
|
-
)),
|
|
234
|
+
options?.stop ?? ((res) => Promise.resolve(!TAG_TRANSIENT_STATUSES.includes(res.status))),
|
|
246
235
|
this.getTag,
|
|
247
236
|
request,
|
|
248
237
|
options
|
|
@@ -257,7 +246,9 @@ class API extends API$1 {
|
|
|
257
246
|
{
|
|
258
247
|
method: "DELETE",
|
|
259
248
|
path: `/registry/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tags/${validatePathParam("tagId", request.tagId)}`,
|
|
260
|
-
urlParams: urlParams(
|
|
249
|
+
urlParams: urlParams(
|
|
250
|
+
["force", request.force]
|
|
251
|
+
)
|
|
261
252
|
},
|
|
262
253
|
unmarshalTag
|
|
263
254
|
);
|
package/dist/v1/content.gen.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
const IMAGE_TRANSIENT_STATUSES = [
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const IMAGE_TRANSIENT_STATUSES = [
|
|
2
|
+
"deleting"
|
|
3
|
+
];
|
|
4
|
+
const NAMESPACE_TRANSIENT_STATUSES = [
|
|
5
|
+
"deleting"
|
|
6
|
+
];
|
|
7
|
+
const TAG_TRANSIENT_STATUSES = [
|
|
8
|
+
"deleting"
|
|
9
|
+
];
|
|
4
10
|
export {
|
|
5
11
|
IMAGE_TRANSIENT_STATUSES,
|
|
6
12
|
NAMESPACE_TRANSIENT_STATUSES,
|
package/dist/v1/index.gen.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { API } from './api.gen.js';
|
|
1
|
+
export { API, } from './api.gen.js';
|
|
2
2
|
export * from './content.gen.js';
|
|
3
3
|
export * from './marshalling.gen.js';
|
|
4
4
|
export type { CreateNamespaceRequest, DeleteImageRequest, DeleteNamespaceRequest, DeleteTagRequest, GetImageRequest, GetNamespaceRequest, GetTagRequest, Image, ImageStatus, ImageVisibility, ListImagesRequest, ListImagesRequestOrderBy, ListImagesResponse, ListNamespacesRequest, ListNamespacesRequestOrderBy, ListNamespacesResponse, ListTagsRequest, ListTagsRequestOrderBy, ListTagsResponse, Namespace, NamespaceStatus, Tag, TagStatus, UpdateImageRequest, UpdateNamespaceRequest, } from './types.gen.js';
|
package/package.json
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/sdk-registry",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Scaleway SDK registry",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
7
|
+
"README.md",
|
|
7
8
|
"dist"
|
|
8
9
|
],
|
|
9
10
|
"type": "module",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"types": "./dist/index.gen.d.ts",
|
|
13
|
-
"import": "./dist/index.gen.js",
|
|
14
|
-
"require": "./dist/index.gen.cjs",
|
|
15
14
|
"default": "./dist/index.gen.js"
|
|
16
15
|
},
|
|
17
16
|
"./*": {
|
|
18
17
|
"types": "./dist/*/index.gen.d.ts",
|
|
19
|
-
"import": "./dist/*/index.gen.js",
|
|
20
|
-
"require": "./dist/*/index.gen.cjs",
|
|
21
18
|
"default": "./dist/*/index.gen.js"
|
|
22
19
|
}
|
|
23
20
|
},
|
|
@@ -26,17 +23,17 @@
|
|
|
26
23
|
"directory": "packages_generated/registry"
|
|
27
24
|
},
|
|
28
25
|
"engines": {
|
|
29
|
-
"node": ">=20.19.
|
|
26
|
+
"node": ">=20.19.6"
|
|
30
27
|
},
|
|
31
28
|
"dependencies": {
|
|
32
29
|
"@scaleway/random-name": "5.1.2",
|
|
33
|
-
"@scaleway/sdk-std": "1.
|
|
30
|
+
"@scaleway/sdk-std": "2.1.0"
|
|
34
31
|
},
|
|
35
32
|
"peerDependencies": {
|
|
36
|
-
"@scaleway/sdk-client": "^1.
|
|
33
|
+
"@scaleway/sdk-client": "^2.1.0"
|
|
37
34
|
},
|
|
38
35
|
"devDependencies": {
|
|
39
|
-
"@scaleway/sdk-client": "^1.
|
|
36
|
+
"@scaleway/sdk-client": "^2.1.0"
|
|
40
37
|
},
|
|
41
38
|
"scripts": {
|
|
42
39
|
"package:check": "pnpm publint",
|
package/dist/index.gen.cjs
DELETED
package/dist/v1/api.gen.cjs
DELETED
|
@@ -1,267 +0,0 @@
|
|
|
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
|
-
/**
|
|
11
|
-
* Locality of this API.
|
|
12
|
-
* type ∈ {'zone','region','global','unspecified'}
|
|
13
|
-
*/
|
|
14
|
-
static LOCALITY = sdkClient.toApiLocality({
|
|
15
|
-
regions: ["fr-par", "nl-ams", "pl-waw"]
|
|
16
|
-
});
|
|
17
|
-
pageOfListNamespaces = (request = {}) => this.client.fetch(
|
|
18
|
-
{
|
|
19
|
-
method: "GET",
|
|
20
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces`,
|
|
21
|
-
urlParams: sdkClient.urlParams(
|
|
22
|
-
["name", request.name],
|
|
23
|
-
["order_by", request.orderBy],
|
|
24
|
-
["organization_id", request.organizationId],
|
|
25
|
-
["page", request.page],
|
|
26
|
-
[
|
|
27
|
-
"page_size",
|
|
28
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
29
|
-
],
|
|
30
|
-
["project_id", request.projectId]
|
|
31
|
-
)
|
|
32
|
-
},
|
|
33
|
-
marshalling_gen.unmarshalListNamespacesResponse
|
|
34
|
-
);
|
|
35
|
-
/**
|
|
36
|
-
* List namespaces. List all namespaces in a specified region. By default, the namespaces listed are ordered by creation date in ascending order. This can be modified via the order_by field. You can also define additional parameters for your query, such as the `instance_id` and `project_id` parameters.
|
|
37
|
-
*
|
|
38
|
-
* @param request - The request {@link ListNamespacesRequest}
|
|
39
|
-
* @returns A Promise of ListNamespacesResponse
|
|
40
|
-
*/
|
|
41
|
-
listNamespaces = (request = {}) => sdkClient.enrichForPagination("namespaces", this.pageOfListNamespaces, request);
|
|
42
|
-
/**
|
|
43
|
-
* Get a namespace. Retrieve information about a given namespace, specified by its `namespace_id` and region. Full details about the namespace, such as `description`, `project_id`, `status`, `endpoint`, `is_public`, `size`, and `image_count` are returned in the response.
|
|
44
|
-
*
|
|
45
|
-
* @param request - The request {@link GetNamespaceRequest}
|
|
46
|
-
* @returns A Promise of Namespace
|
|
47
|
-
*/
|
|
48
|
-
getNamespace = (request) => this.client.fetch(
|
|
49
|
-
{
|
|
50
|
-
method: "GET",
|
|
51
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces/${sdkClient.validatePathParam("namespaceId", request.namespaceId)}`
|
|
52
|
-
},
|
|
53
|
-
marshalling_gen.unmarshalNamespace
|
|
54
|
-
);
|
|
55
|
-
/**
|
|
56
|
-
* Waits for {@link Namespace} to be in a final state.
|
|
57
|
-
*
|
|
58
|
-
* @param request - The request {@link GetNamespaceRequest}
|
|
59
|
-
* @param options - The waiting options
|
|
60
|
-
* @returns A Promise of Namespace
|
|
61
|
-
*/
|
|
62
|
-
waitForNamespace = (request, options) => sdkClient.waitForResource(
|
|
63
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
64
|
-
!content_gen.NAMESPACE_TRANSIENT_STATUSES.includes(res.status)
|
|
65
|
-
)),
|
|
66
|
-
this.getNamespace,
|
|
67
|
-
request,
|
|
68
|
-
options
|
|
69
|
-
);
|
|
70
|
-
/**
|
|
71
|
-
* Create a namespace. Create a new Container Registry namespace. You must specify the namespace name and region in which you want it to be created. Optionally, you can specify the `project_id` and `is_public` in the request payload.
|
|
72
|
-
*
|
|
73
|
-
* @param request - The request {@link CreateNamespaceRequest}
|
|
74
|
-
* @returns A Promise of Namespace
|
|
75
|
-
*/
|
|
76
|
-
createNamespace = (request) => this.client.fetch(
|
|
77
|
-
{
|
|
78
|
-
body: JSON.stringify(
|
|
79
|
-
marshalling_gen.marshalCreateNamespaceRequest(request, this.client.settings)
|
|
80
|
-
),
|
|
81
|
-
headers: jsonContentHeaders,
|
|
82
|
-
method: "POST",
|
|
83
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces`
|
|
84
|
-
},
|
|
85
|
-
marshalling_gen.unmarshalNamespace
|
|
86
|
-
);
|
|
87
|
-
/**
|
|
88
|
-
* Update a namespace. Update the parameters of a given namespace, specified by its `namespace_id` and `region`. You can update the `description` and `is_public` parameters.
|
|
89
|
-
*
|
|
90
|
-
* @param request - The request {@link UpdateNamespaceRequest}
|
|
91
|
-
* @returns A Promise of Namespace
|
|
92
|
-
*/
|
|
93
|
-
updateNamespace = (request) => this.client.fetch(
|
|
94
|
-
{
|
|
95
|
-
body: JSON.stringify(
|
|
96
|
-
marshalling_gen.marshalUpdateNamespaceRequest(request, this.client.settings)
|
|
97
|
-
),
|
|
98
|
-
headers: jsonContentHeaders,
|
|
99
|
-
method: "PATCH",
|
|
100
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces/${sdkClient.validatePathParam("namespaceId", request.namespaceId)}`
|
|
101
|
-
},
|
|
102
|
-
marshalling_gen.unmarshalNamespace
|
|
103
|
-
);
|
|
104
|
-
/**
|
|
105
|
-
* Delete a namespace. Delete a given namespace. You must specify, in the endpoint, the `region` and `namespace_id` parameters of the namespace you want to delete.
|
|
106
|
-
*
|
|
107
|
-
* @param request - The request {@link DeleteNamespaceRequest}
|
|
108
|
-
* @returns A Promise of Namespace
|
|
109
|
-
*/
|
|
110
|
-
deleteNamespace = (request) => this.client.fetch(
|
|
111
|
-
{
|
|
112
|
-
method: "DELETE",
|
|
113
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/namespaces/${sdkClient.validatePathParam("namespaceId", request.namespaceId)}`
|
|
114
|
-
},
|
|
115
|
-
marshalling_gen.unmarshalNamespace
|
|
116
|
-
);
|
|
117
|
-
pageOfListImages = (request = {}) => this.client.fetch(
|
|
118
|
-
{
|
|
119
|
-
method: "GET",
|
|
120
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/images`,
|
|
121
|
-
urlParams: sdkClient.urlParams(
|
|
122
|
-
["name", request.name],
|
|
123
|
-
["namespace_id", request.namespaceId],
|
|
124
|
-
["order_by", request.orderBy],
|
|
125
|
-
["organization_id", request.organizationId],
|
|
126
|
-
["page", request.page],
|
|
127
|
-
[
|
|
128
|
-
"page_size",
|
|
129
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
130
|
-
],
|
|
131
|
-
["project_id", request.projectId]
|
|
132
|
-
)
|
|
133
|
-
},
|
|
134
|
-
marshalling_gen.unmarshalListImagesResponse
|
|
135
|
-
);
|
|
136
|
-
/**
|
|
137
|
-
* List images. List all images in a specified region. By default, the images listed are ordered by creation date in ascending order. This can be modified via the order_by field. You can also define additional parameters for your query, such as the `namespace_id` and `project_id` parameters.
|
|
138
|
-
*
|
|
139
|
-
* @param request - The request {@link ListImagesRequest}
|
|
140
|
-
* @returns A Promise of ListImagesResponse
|
|
141
|
-
*/
|
|
142
|
-
listImages = (request = {}) => sdkClient.enrichForPagination("images", this.pageOfListImages, request);
|
|
143
|
-
/**
|
|
144
|
-
* Get an image. Retrieve information about a given container image, specified by its `image_id` and region. Full details about the image, such as `name`, `namespace_id`, `status`, `visibility`, and `size` are returned in the response.
|
|
145
|
-
*
|
|
146
|
-
* @param request - The request {@link GetImageRequest}
|
|
147
|
-
* @returns A Promise of Image
|
|
148
|
-
*/
|
|
149
|
-
getImage = (request) => this.client.fetch(
|
|
150
|
-
{
|
|
151
|
-
method: "GET",
|
|
152
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/images/${sdkClient.validatePathParam("imageId", request.imageId)}`
|
|
153
|
-
},
|
|
154
|
-
marshalling_gen.unmarshalImage
|
|
155
|
-
);
|
|
156
|
-
/**
|
|
157
|
-
* Waits for {@link Image} to be in a final state.
|
|
158
|
-
*
|
|
159
|
-
* @param request - The request {@link GetImageRequest}
|
|
160
|
-
* @param options - The waiting options
|
|
161
|
-
* @returns A Promise of Image
|
|
162
|
-
*/
|
|
163
|
-
waitForImage = (request, options) => sdkClient.waitForResource(
|
|
164
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
165
|
-
!content_gen.IMAGE_TRANSIENT_STATUSES.includes(res.status)
|
|
166
|
-
)),
|
|
167
|
-
this.getImage,
|
|
168
|
-
request,
|
|
169
|
-
options
|
|
170
|
-
);
|
|
171
|
-
/**
|
|
172
|
-
* Update an image. Update the parameters of a given image, specified by its `image_id` and `region`. You can update the `visibility` parameter.
|
|
173
|
-
*
|
|
174
|
-
* @param request - The request {@link UpdateImageRequest}
|
|
175
|
-
* @returns A Promise of Image
|
|
176
|
-
*/
|
|
177
|
-
updateImage = (request) => this.client.fetch(
|
|
178
|
-
{
|
|
179
|
-
body: JSON.stringify(
|
|
180
|
-
marshalling_gen.marshalUpdateImageRequest(request, this.client.settings)
|
|
181
|
-
),
|
|
182
|
-
headers: jsonContentHeaders,
|
|
183
|
-
method: "PATCH",
|
|
184
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/images/${sdkClient.validatePathParam("imageId", request.imageId)}`
|
|
185
|
-
},
|
|
186
|
-
marshalling_gen.unmarshalImage
|
|
187
|
-
);
|
|
188
|
-
/**
|
|
189
|
-
* Delete an image. Delete a given image. You must specify, in the endpoint, the `region` and `image_id` parameters of the image you want to delete.
|
|
190
|
-
*
|
|
191
|
-
* @param request - The request {@link DeleteImageRequest}
|
|
192
|
-
* @returns A Promise of Image
|
|
193
|
-
*/
|
|
194
|
-
deleteImage = (request) => this.client.fetch(
|
|
195
|
-
{
|
|
196
|
-
method: "DELETE",
|
|
197
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/images/${sdkClient.validatePathParam("imageId", request.imageId)}`
|
|
198
|
-
},
|
|
199
|
-
marshalling_gen.unmarshalImage
|
|
200
|
-
);
|
|
201
|
-
pageOfListTags = (request) => this.client.fetch(
|
|
202
|
-
{
|
|
203
|
-
method: "GET",
|
|
204
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/images/${sdkClient.validatePathParam("imageId", request.imageId)}/tags`,
|
|
205
|
-
urlParams: sdkClient.urlParams(
|
|
206
|
-
["name", request.name],
|
|
207
|
-
["order_by", request.orderBy],
|
|
208
|
-
["page", request.page],
|
|
209
|
-
[
|
|
210
|
-
"page_size",
|
|
211
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
212
|
-
]
|
|
213
|
-
)
|
|
214
|
-
},
|
|
215
|
-
marshalling_gen.unmarshalListTagsResponse
|
|
216
|
-
);
|
|
217
|
-
/**
|
|
218
|
-
* List tags. List all tags for a given image, specified by region. By default, the tags listed are ordered by creation date in ascending order. This can be modified via the order_by field. You can also define additional parameters for your query, such as the `name`.
|
|
219
|
-
*
|
|
220
|
-
* @param request - The request {@link ListTagsRequest}
|
|
221
|
-
* @returns A Promise of ListTagsResponse
|
|
222
|
-
*/
|
|
223
|
-
listTags = (request) => sdkClient.enrichForPagination("tags", this.pageOfListTags, request);
|
|
224
|
-
/**
|
|
225
|
-
* Get a tag. Retrieve information about a given image tag, specified by its `tag_id` and region. Full details about the tag, such as `name`, `image_id`, `status`, and `digest` are returned in the response.
|
|
226
|
-
*
|
|
227
|
-
* @param request - The request {@link GetTagRequest}
|
|
228
|
-
* @returns A Promise of Tag
|
|
229
|
-
*/
|
|
230
|
-
getTag = (request) => this.client.fetch(
|
|
231
|
-
{
|
|
232
|
-
method: "GET",
|
|
233
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tags/${sdkClient.validatePathParam("tagId", request.tagId)}`
|
|
234
|
-
},
|
|
235
|
-
marshalling_gen.unmarshalTag
|
|
236
|
-
);
|
|
237
|
-
/**
|
|
238
|
-
* Waits for {@link Tag} to be in a final state.
|
|
239
|
-
*
|
|
240
|
-
* @param request - The request {@link GetTagRequest}
|
|
241
|
-
* @param options - The waiting options
|
|
242
|
-
* @returns A Promise of Tag
|
|
243
|
-
*/
|
|
244
|
-
waitForTag = (request, options) => sdkClient.waitForResource(
|
|
245
|
-
options?.stop ?? ((res) => Promise.resolve(
|
|
246
|
-
!content_gen.TAG_TRANSIENT_STATUSES.includes(res.status)
|
|
247
|
-
)),
|
|
248
|
-
this.getTag,
|
|
249
|
-
request,
|
|
250
|
-
options
|
|
251
|
-
);
|
|
252
|
-
/**
|
|
253
|
-
* Delete a tag. Delete a given image tag. You must specify, in the endpoint, the `region` and `tag_id` parameters of the tag you want to delete.
|
|
254
|
-
*
|
|
255
|
-
* @param request - The request {@link DeleteTagRequest}
|
|
256
|
-
* @returns A Promise of Tag
|
|
257
|
-
*/
|
|
258
|
-
deleteTag = (request) => this.client.fetch(
|
|
259
|
-
{
|
|
260
|
-
method: "DELETE",
|
|
261
|
-
path: `/registry/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/tags/${sdkClient.validatePathParam("tagId", request.tagId)}`,
|
|
262
|
-
urlParams: sdkClient.urlParams(["force", request.force])
|
|
263
|
-
},
|
|
264
|
-
marshalling_gen.unmarshalTag
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
exports.API = API;
|
package/dist/v1/content.gen.cjs
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const IMAGE_TRANSIENT_STATUSES = ["deleting"];
|
|
4
|
-
const NAMESPACE_TRANSIENT_STATUSES = ["deleting"];
|
|
5
|
-
const TAG_TRANSIENT_STATUSES = ["deleting"];
|
|
6
|
-
exports.IMAGE_TRANSIENT_STATUSES = IMAGE_TRANSIENT_STATUSES;
|
|
7
|
-
exports.NAMESPACE_TRANSIENT_STATUSES = NAMESPACE_TRANSIENT_STATUSES;
|
|
8
|
-
exports.TAG_TRANSIENT_STATUSES = TAG_TRANSIENT_STATUSES;
|
package/dist/v1/index.gen.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
exports.API = api_gen.API;
|
|
7
|
-
exports.IMAGE_TRANSIENT_STATUSES = content_gen.IMAGE_TRANSIENT_STATUSES;
|
|
8
|
-
exports.NAMESPACE_TRANSIENT_STATUSES = content_gen.NAMESPACE_TRANSIENT_STATUSES;
|
|
9
|
-
exports.TAG_TRANSIENT_STATUSES = content_gen.TAG_TRANSIENT_STATUSES;
|
|
10
|
-
exports.marshalCreateNamespaceRequest = marshalling_gen.marshalCreateNamespaceRequest;
|
|
11
|
-
exports.marshalUpdateImageRequest = marshalling_gen.marshalUpdateImageRequest;
|
|
12
|
-
exports.marshalUpdateNamespaceRequest = marshalling_gen.marshalUpdateNamespaceRequest;
|
|
13
|
-
exports.unmarshalImage = marshalling_gen.unmarshalImage;
|
|
14
|
-
exports.unmarshalListImagesResponse = marshalling_gen.unmarshalListImagesResponse;
|
|
15
|
-
exports.unmarshalListNamespacesResponse = marshalling_gen.unmarshalListNamespacesResponse;
|
|
16
|
-
exports.unmarshalListTagsResponse = marshalling_gen.unmarshalListTagsResponse;
|
|
17
|
-
exports.unmarshalNamespace = marshalling_gen.unmarshalNamespace;
|
|
18
|
-
exports.unmarshalTag = marshalling_gen.unmarshalTag;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const randomName = require("@scaleway/random-name");
|
|
4
|
-
const sdkClient = require("@scaleway/sdk-client");
|
|
5
|
-
const unmarshalImage = (data) => {
|
|
6
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
7
|
-
throw new TypeError(
|
|
8
|
-
`Unmarshalling the type 'Image' failed as data isn't a dictionary.`
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
return {
|
|
12
|
-
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
13
|
-
id: data.id,
|
|
14
|
-
name: data.name,
|
|
15
|
-
namespaceId: data.namespace_id,
|
|
16
|
-
size: data.size,
|
|
17
|
-
status: data.status,
|
|
18
|
-
statusMessage: data.status_message,
|
|
19
|
-
tags: data.tags,
|
|
20
|
-
updatedAt: sdkClient.unmarshalDate(data.updated_at),
|
|
21
|
-
visibility: data.visibility
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
const unmarshalNamespace = (data) => {
|
|
25
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
26
|
-
throw new TypeError(
|
|
27
|
-
`Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
32
|
-
description: data.description,
|
|
33
|
-
endpoint: data.endpoint,
|
|
34
|
-
id: data.id,
|
|
35
|
-
imageCount: data.image_count,
|
|
36
|
-
isPublic: data.is_public,
|
|
37
|
-
name: data.name,
|
|
38
|
-
organizationId: data.organization_id,
|
|
39
|
-
projectId: data.project_id,
|
|
40
|
-
region: data.region,
|
|
41
|
-
size: data.size,
|
|
42
|
-
status: data.status,
|
|
43
|
-
statusMessage: data.status_message,
|
|
44
|
-
updatedAt: sdkClient.unmarshalDate(data.updated_at)
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
const unmarshalTag = (data) => {
|
|
48
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
49
|
-
throw new TypeError(
|
|
50
|
-
`Unmarshalling the type 'Tag' failed as data isn't a dictionary.`
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
55
|
-
digest: data.digest,
|
|
56
|
-
id: data.id,
|
|
57
|
-
imageId: data.image_id,
|
|
58
|
-
name: data.name,
|
|
59
|
-
status: data.status,
|
|
60
|
-
updatedAt: sdkClient.unmarshalDate(data.updated_at)
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
const unmarshalListImagesResponse = (data) => {
|
|
64
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
65
|
-
throw new TypeError(
|
|
66
|
-
`Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
images: sdkClient.unmarshalArrayOfObject(data.images, unmarshalImage),
|
|
71
|
-
totalCount: data.total_count
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
const unmarshalListNamespacesResponse = (data) => {
|
|
75
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
76
|
-
throw new TypeError(
|
|
77
|
-
`Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
namespaces: sdkClient.unmarshalArrayOfObject(data.namespaces, unmarshalNamespace),
|
|
82
|
-
totalCount: data.total_count
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
const unmarshalListTagsResponse = (data) => {
|
|
86
|
-
if (!sdkClient.isJSONObject(data)) {
|
|
87
|
-
throw new TypeError(
|
|
88
|
-
`Unmarshalling the type 'ListTagsResponse' failed as data isn't a dictionary.`
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
tags: sdkClient.unmarshalArrayOfObject(data.tags, unmarshalTag),
|
|
93
|
-
totalCount: data.total_count
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
const marshalCreateNamespaceRequest = (request, defaults) => ({
|
|
97
|
-
description: request.description,
|
|
98
|
-
is_public: request.isPublic,
|
|
99
|
-
name: request.name || randomName("ns"),
|
|
100
|
-
...sdkClient.resolveOneOf([
|
|
101
|
-
{
|
|
102
|
-
default: defaults.defaultProjectId,
|
|
103
|
-
param: "project_id",
|
|
104
|
-
value: request.projectId
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
default: defaults.defaultOrganizationId,
|
|
108
|
-
param: "organization_id",
|
|
109
|
-
value: request.organizationId
|
|
110
|
-
}
|
|
111
|
-
])
|
|
112
|
-
});
|
|
113
|
-
const marshalUpdateImageRequest = (request, defaults) => ({
|
|
114
|
-
visibility: request.visibility
|
|
115
|
-
});
|
|
116
|
-
const marshalUpdateNamespaceRequest = (request, defaults) => ({
|
|
117
|
-
description: request.description,
|
|
118
|
-
is_public: request.isPublic
|
|
119
|
-
});
|
|
120
|
-
exports.marshalCreateNamespaceRequest = marshalCreateNamespaceRequest;
|
|
121
|
-
exports.marshalUpdateImageRequest = marshalUpdateImageRequest;
|
|
122
|
-
exports.marshalUpdateNamespaceRequest = marshalUpdateNamespaceRequest;
|
|
123
|
-
exports.unmarshalImage = unmarshalImage;
|
|
124
|
-
exports.unmarshalListImagesResponse = unmarshalListImagesResponse;
|
|
125
|
-
exports.unmarshalListNamespacesResponse = unmarshalListNamespacesResponse;
|
|
126
|
-
exports.unmarshalListTagsResponse = unmarshalListTagsResponse;
|
|
127
|
-
exports.unmarshalNamespace = unmarshalNamespace;
|
|
128
|
-
exports.unmarshalTag = unmarshalTag;
|