@scaleway/sdk 1.14.0 → 1.16.0

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.
Files changed (54) hide show
  1. package/dist/api/account/v2/api.gen.js +77 -60
  2. package/dist/api/applesilicon/v1alpha1/api.gen.js +174 -152
  3. package/dist/api/baremetal/v1/api.gen.js +434 -378
  4. package/dist/api/baremetal/v1/api.utils.js +19 -22
  5. package/dist/api/billing/v2alpha1/api.gen.js +21 -17
  6. package/dist/api/cockpit/v1beta1/api.gen.js +308 -232
  7. package/dist/api/container/v1beta1/api.gen.js +384 -337
  8. package/dist/api/domain/v2beta1/api.gen.js +754 -668
  9. package/dist/api/flexibleip/v1alpha1/api.gen.js +164 -151
  10. package/dist/api/function/v1beta1/api.gen.js +467 -407
  11. package/dist/api/iam/v1alpha1/api.gen.js +641 -557
  12. package/dist/api/instance/v1/api.gen.js +803 -677
  13. package/dist/api/instance/v1/api.utils.js +337 -325
  14. package/dist/api/instance/v1/content.gen.js +4 -1
  15. package/dist/api/instance/v1/index.js +1 -1
  16. package/dist/api/instance/v1/marshalling.gen.js +27 -4
  17. package/dist/api/iot/v1/api.gen.js +508 -452
  18. package/dist/api/ipfs/index.js +2 -0
  19. package/dist/api/ipfs/v1alpha1/api.gen.js +197 -0
  20. package/dist/api/ipfs/v1alpha1/content.gen.js +7 -0
  21. package/dist/api/ipfs/v1alpha1/index.gen.js +5 -0
  22. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +125 -0
  23. package/dist/api/k8s/v1/api.gen.js +403 -342
  24. package/dist/api/k8s/v1/api.utils.js +7 -10
  25. package/dist/api/k8s/v1/marshalling.gen.js +19 -1
  26. package/dist/api/k8s/v1/validation-rules.gen.js +10 -1
  27. package/dist/api/lb/v1/api.gen.js +1501 -1363
  28. package/dist/api/lb/v1/api.utils.js +71 -75
  29. package/dist/api/lb/v1/marshalling.gen.js +6 -0
  30. package/dist/api/marketplace/v1/api.gen.js +35 -32
  31. package/dist/api/marketplace/v2/api.gen.js +117 -102
  32. package/dist/api/mnq/v1alpha1/api.gen.js +154 -137
  33. package/dist/api/rdb/v1/api.gen.js +897 -819
  34. package/dist/api/redis/v1/api.gen.js +358 -333
  35. package/dist/api/redis/v1/marshalling.gen.js +1 -0
  36. package/dist/api/registry/v1/api.gen.js +211 -189
  37. package/dist/api/secret/v1alpha1/api.gen.js +295 -246
  38. package/dist/api/secret/v1alpha1/marshalling.gen.js +10 -1
  39. package/dist/api/tem/v1alpha1/api.gen.js +182 -147
  40. package/dist/api/tem/v1alpha1/marshalling.gen.js +32 -1
  41. package/dist/api/test/v1/api.gen.js +116 -104
  42. package/dist/api/vpc/v1/api.gen.js +74 -65
  43. package/dist/api/vpc/v2/api.gen.js +200 -178
  44. package/dist/api/vpc/v2/marshalling.gen.js +1 -0
  45. package/dist/api/vpcgw/v1/api.gen.js +575 -501
  46. package/dist/api/webhosting/v1alpha1/api.gen.js +127 -117
  47. package/dist/api/webhosting/v1alpha1/content.gen.js +1 -1
  48. package/dist/index.cjs +924 -453
  49. package/dist/index.d.ts +2152 -1558
  50. package/dist/index.js +28 -26
  51. package/dist/internal/logger/console-logger.js +4 -5
  52. package/dist/scw/constants.js +1 -1
  53. package/dist/scw/errors/scw-error.js +2 -2
  54. package/package.json +2 -2
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };
@@ -0,0 +1,197 @@
1
+ import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
+ import { API as API$1 } from '../../../scw/api.js';
3
+ import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
+ import { PIN_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { marshalCreateVolumeRequest, unmarshalVolume, unmarshalListVolumesResponse, marshalUpdateVolumeRequest, marshalCreatePinByURLRequest, unmarshalPin, marshalCreatePinByCIDRequest, marshalReplacePinRequest, unmarshalReplacePinResponse, unmarshalListPinsResponse } from './marshalling.gen.js';
7
+
8
+ // This file was automatically generated. DO NOT EDIT.
9
+ // If you have any remark or suggestion do not hesitate to open an issue.
10
+ const jsonContentHeaders = {
11
+ 'Content-Type': 'application/json; charset=utf-8'
12
+ };
13
+
14
+ /** IPFS Pinning service API. */
15
+ class API extends API$1 {
16
+ /** Lists the available regions of the API. */
17
+ static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
18
+
19
+ /**
20
+ * Create a new volume. Create a new volume from a Project ID. Volume is
21
+ * identified by an ID and used to host pin references. Volume is personal (at
22
+ * least to your organization) even if IPFS blocks and CID are available to
23
+ * anyone. Should be the first command you made because every pin must be
24
+ * attached to a volume.
25
+ *
26
+ * @param request - The request {@link CreateVolumeRequest}
27
+ * @returns A Promise of Volume
28
+ */
29
+ createVolume = request => this.client.fetch({
30
+ body: JSON.stringify(marshalCreateVolumeRequest(request, this.client.settings)),
31
+ headers: jsonContentHeaders,
32
+ method: 'POST',
33
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/volumes`
34
+ }, unmarshalVolume);
35
+
36
+ /**
37
+ * Get information about a volume. Retrieve information about a specific
38
+ * volume.
39
+ *
40
+ * @param request - The request {@link GetVolumeRequest}
41
+ * @returns A Promise of Volume
42
+ */
43
+ getVolume = request => this.client.fetch({
44
+ method: 'GET',
45
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/volumes/${validatePathParam('volumeId', request.volumeId)}`
46
+ }, unmarshalVolume);
47
+ pageOfListVolumes = (() => {
48
+ var _this = this;
49
+ return function (request) {
50
+ if (request === void 0) {
51
+ request = {};
52
+ }
53
+ return _this.client.fetch({
54
+ method: 'GET',
55
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/volumes`,
56
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
57
+ }, unmarshalListVolumesResponse);
58
+ };
59
+ })();
60
+
61
+ /**
62
+ * List all volumes by a Project ID. Retrieve information about all volumes
63
+ * from a Project ID.
64
+ *
65
+ * @param request - The request {@link ListVolumesRequest}
66
+ * @returns A Promise of ListVolumesResponse
67
+ */
68
+ listVolumes = (() => {
69
+ var _this2 = this;
70
+ return function (request) {
71
+ if (request === void 0) {
72
+ request = {};
73
+ }
74
+ return enrichForPagination('volumes', _this2.pageOfListVolumes, request);
75
+ };
76
+ })();
77
+
78
+ /**
79
+ * Update volume information. Update volume information (tag, name...).
80
+ *
81
+ * @param request - The request {@link UpdateVolumeRequest}
82
+ * @returns A Promise of Volume
83
+ */
84
+ updateVolume = request => this.client.fetch({
85
+ body: JSON.stringify(marshalUpdateVolumeRequest(request, this.client.settings)),
86
+ headers: jsonContentHeaders,
87
+ method: 'PATCH',
88
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/volumes/${validatePathParam('volumeId', request.volumeId)}`
89
+ }, unmarshalVolume);
90
+
91
+ /**
92
+ * Delete an existing volume. Delete a volume by its ID and every pin attached
93
+ * to this volume. This process can take a while to conclude, depending on the
94
+ * size of your pinned content.
95
+ *
96
+ * @param request - The request {@link DeleteVolumeRequest}
97
+ */
98
+ deleteVolume = request => this.client.fetch({
99
+ method: 'DELETE',
100
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/volumes/${validatePathParam('volumeId', request.volumeId)}`
101
+ });
102
+
103
+ /**
104
+ * Create a pin by URL. Will fetch and store the content pointed by the
105
+ * provided URL. The content must be available on the public IPFS network. The
106
+ * content (IPFS blocks) will be host by the pinning service until pin
107
+ * deletion. From that point, any other IPFS peer can fetch and host your
108
+ * content: Make sure to pin public or encrypted content. Many pin requests
109
+ * (from different users) can target the same CID. A pin is defined by its ID
110
+ * (UUID), its status (queued, pinning, pinned or failed) and target CID.
111
+ *
112
+ * @param request - The request {@link CreatePinByURLRequest}
113
+ * @returns A Promise of Pin
114
+ */
115
+ createPinByURL = request => this.client.fetch({
116
+ body: JSON.stringify(marshalCreatePinByURLRequest(request, this.client.settings)),
117
+ headers: jsonContentHeaders,
118
+ method: 'POST',
119
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/create-by-url`
120
+ }, unmarshalPin);
121
+
122
+ /**
123
+ * Create a pin by CID. Will fetch and store the content pointed by the
124
+ * provided CID. The content must be available on the public IPFS network. The
125
+ * content (IPFS blocks) will be host by the pinning service until pin
126
+ * deletion. From that point, any other IPFS peer can fetch and host your
127
+ * content: Make sure to pin public or encrypted content. Many pin requests
128
+ * (from different users) can target the same CID. A pin is defined by its ID
129
+ * (UUID), its status (queued, pinning, pinned or failed) and target CID.
130
+ *
131
+ * @param request - The request {@link CreatePinByCIDRequest}
132
+ * @returns A Promise of Pin
133
+ */
134
+ createPinByCID = request => this.client.fetch({
135
+ body: JSON.stringify(marshalCreatePinByCIDRequest(request, this.client.settings)),
136
+ headers: jsonContentHeaders,
137
+ method: 'POST',
138
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/create-by-cid`
139
+ }, unmarshalPin);
140
+ replacePin = request => this.client.fetch({
141
+ body: JSON.stringify(marshalReplacePinRequest(request, this.client.settings)),
142
+ headers: jsonContentHeaders,
143
+ method: 'POST',
144
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/${validatePathParam('pinId', request.pinId)}/replace`
145
+ }, unmarshalReplacePinResponse);
146
+
147
+ /**
148
+ * Get pin information. Retrieve information about the provided **pin ID**,
149
+ * such as status, last modification, and CID.
150
+ *
151
+ * @param request - The request {@link GetPinRequest}
152
+ * @returns A Promise of Pin
153
+ */
154
+ getPin = request => this.client.fetch({
155
+ method: 'GET',
156
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/${validatePathParam('pinId', request.pinId)}`,
157
+ urlParams: urlParams(['volume_id', request.volumeId])
158
+ }, unmarshalPin);
159
+
160
+ /**
161
+ * Waits for {@link Pin} to be in a final state.
162
+ *
163
+ * @param request - The request {@link GetPinRequest}
164
+ * @param options - The waiting options
165
+ * @returns A Promise of Pin
166
+ */
167
+ waitForPin = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!PIN_TRANSIENT_STATUSES.includes(res.status))), this.getPin, request, options);
168
+ pageOfListPins = request => this.client.fetch({
169
+ method: 'GET',
170
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins`,
171
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId], ['status', request.status ?? 'unknown_status'], ['volume_id', request.volumeId])
172
+ }, unmarshalListPinsResponse);
173
+
174
+ /**
175
+ * List all pins within a volume. Retrieve information about all pins into a
176
+ * volume.
177
+ *
178
+ * @param request - The request {@link ListPinsRequest}
179
+ * @returns A Promise of ListPinsResponse
180
+ */
181
+ listPins = request => enrichForPagination('pins', this.pageOfListPins, request);
182
+
183
+ /**
184
+ * Create an unpin request. An unpin request means that you no longer own the
185
+ * content. This content can therefore be removed and no longer provided on
186
+ * the IPFS network.
187
+ *
188
+ * @param request - The request {@link DeletePinRequest}
189
+ */
190
+ deletePin = request => this.client.fetch({
191
+ method: 'DELETE',
192
+ path: `/ipfs/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/pins/${validatePathParam('pinId', request.pinId)}`,
193
+ urlParams: urlParams(['volume_id', request.volumeId])
194
+ });
195
+ }
196
+
197
+ export { API };
@@ -0,0 +1,7 @@
1
+ // This file was automatically generated. DO NOT EDIT.
2
+ // If you have any remark or suggestion do not hesitate to open an issue.
3
+
4
+ /** Lists transient statutes of the enum {@link PinStatus}. */
5
+ const PIN_TRANSIENT_STATUSES = ['queued', 'pinning'];
6
+
7
+ export { PIN_TRANSIENT_STATUSES };
@@ -0,0 +1,5 @@
1
+ export { API } from './api.gen.js';
2
+ export { PIN_TRANSIENT_STATUSES } from './content.gen.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
5
+ // If you have any remark or suggestion do not hesitate to open an issue.
@@ -0,0 +1,125 @@
1
+ import { isJSONObject } from '../../../helpers/json.js';
2
+ import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
5
+ // If you have any remark or suggestion do not hesitate to open an issue.
6
+ const unmarshalPinCIDMeta = data => {
7
+ if (!isJSONObject(data)) {
8
+ throw new TypeError(`Unmarshalling the type 'PinCIDMeta' failed as data isn't a dictionary.`);
9
+ }
10
+ return {
11
+ id: data.id
12
+ };
13
+ };
14
+ const unmarshalPinCID = data => {
15
+ if (!isJSONObject(data)) {
16
+ throw new TypeError(`Unmarshalling the type 'PinCID' failed as data isn't a dictionary.`);
17
+ }
18
+ return {
19
+ cid: data.cid,
20
+ meta: data.meta ? unmarshalPinCIDMeta(data.meta) : undefined,
21
+ name: data.name,
22
+ origins: data.origins
23
+ };
24
+ };
25
+ const unmarshalPinInfo = data => {
26
+ if (!isJSONObject(data)) {
27
+ throw new TypeError(`Unmarshalling the type 'PinInfo' failed as data isn't a dictionary.`);
28
+ }
29
+ return {
30
+ id: data.id,
31
+ progress: data.progress,
32
+ size: data.size,
33
+ statusDetails: data.status_details,
34
+ url: data.url
35
+ };
36
+ };
37
+ const unmarshalPin = data => {
38
+ if (!isJSONObject(data)) {
39
+ throw new TypeError(`Unmarshalling the type 'Pin' failed as data isn't a dictionary.`);
40
+ }
41
+ return {
42
+ cid: data.cid ? unmarshalPinCID(data.cid) : undefined,
43
+ createdAt: unmarshalDate(data.created_at),
44
+ delegates: data.delegates,
45
+ info: data.info ? unmarshalPinInfo(data.info) : undefined,
46
+ pinId: data.pin_id,
47
+ status: data.status
48
+ };
49
+ };
50
+ const unmarshalVolume = data => {
51
+ if (!isJSONObject(data)) {
52
+ throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
53
+ }
54
+ return {
55
+ countPin: data.count_pin,
56
+ createdAt: unmarshalDate(data.created_at),
57
+ id: data.id,
58
+ name: data.name,
59
+ projectId: data.project_id,
60
+ region: data.region,
61
+ size: data.size,
62
+ tags: data.tags,
63
+ updatedAt: unmarshalDate(data.updated_at)
64
+ };
65
+ };
66
+ const unmarshalListPinsResponse = data => {
67
+ if (!isJSONObject(data)) {
68
+ throw new TypeError(`Unmarshalling the type 'ListPinsResponse' failed as data isn't a dictionary.`);
69
+ }
70
+ return {
71
+ pins: unmarshalArrayOfObject(data.pins, unmarshalPin),
72
+ totalCount: data.total_count
73
+ };
74
+ };
75
+ const unmarshalListVolumesResponse = data => {
76
+ if (!isJSONObject(data)) {
77
+ throw new TypeError(`Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`);
78
+ }
79
+ return {
80
+ totalCount: data.total_count,
81
+ volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
82
+ };
83
+ };
84
+ const unmarshalReplacePinResponse = data => {
85
+ if (!isJSONObject(data)) {
86
+ throw new TypeError(`Unmarshalling the type 'ReplacePinResponse' failed as data isn't a dictionary.`);
87
+ }
88
+ return {
89
+ pin: data.pin ? unmarshalPin(data.pin) : undefined
90
+ };
91
+ };
92
+ const marshalPinOptions = (request, defaults) => ({
93
+ replication_count: request.replicationCount,
94
+ required_zones: request.requiredZones
95
+ });
96
+ const marshalCreatePinByCIDRequest = (request, defaults) => ({
97
+ cid: request.cid,
98
+ name: request.name,
99
+ origins: request.origins,
100
+ pin_options: request.pinOptions ? marshalPinOptions(request.pinOptions) : undefined,
101
+ volume_id: request.volumeId
102
+ });
103
+ const marshalCreatePinByURLRequest = (request, defaults) => ({
104
+ name: request.name,
105
+ pin_options: request.pinOptions ? marshalPinOptions(request.pinOptions) : undefined,
106
+ url: request.url,
107
+ volume_id: request.volumeId
108
+ });
109
+ const marshalCreateVolumeRequest = (request, defaults) => ({
110
+ name: request.name,
111
+ project_id: request.projectId ?? defaults.defaultProjectId
112
+ });
113
+ const marshalReplacePinRequest = (request, defaults) => ({
114
+ cid: request.cid,
115
+ name: request.name,
116
+ origins: request.origins,
117
+ pin_options: request.pinOptions ? marshalPinOptions(request.pinOptions) : undefined,
118
+ volume_id: request.volumeId
119
+ });
120
+ const marshalUpdateVolumeRequest = (request, defaults) => ({
121
+ name: request.name,
122
+ tags: request.tags
123
+ });
124
+
125
+ export { marshalCreatePinByCIDRequest, marshalCreatePinByURLRequest, marshalCreateVolumeRequest, marshalReplacePinRequest, marshalUpdateVolumeRequest, unmarshalListPinsResponse, unmarshalListVolumesResponse, unmarshalPin, unmarshalReplacePinResponse, unmarshalVolume };