@scaleway/sdk 3.0.0-alpha.0 → 3.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.
Files changed (214) hide show
  1. package/dist/index.gen.d.ts +362 -0
  2. package/dist/index.gen.js +323 -0
  3. package/package.json +71 -25
  4. package/README.md +0 -46
  5. package/dist/api/account/index.js +0 -4
  6. package/dist/api/account/v2/api.gen.js +0 -147
  7. package/dist/api/account/v2/index.gen.js +0 -4
  8. package/dist/api/account/v2/marshalling.gen.js +0 -39
  9. package/dist/api/account/v3/api.gen.js +0 -129
  10. package/dist/api/account/v3/index.gen.js +0 -6
  11. package/dist/api/account/v3/marshalling.gen.js +0 -39
  12. package/dist/api/account/v3/validation-rules.gen.js +0 -39
  13. package/dist/api/applesilicon/index.js +0 -2
  14. package/dist/api/applesilicon/v1alpha1/api.gen.js +0 -220
  15. package/dist/api/applesilicon/v1alpha1/content.gen.js +0 -7
  16. package/dist/api/applesilicon/v1alpha1/index.gen.js +0 -5
  17. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +0 -113
  18. package/dist/api/baremetal/index.js +0 -2
  19. package/dist/api/baremetal/v1/api.gen.js +0 -523
  20. package/dist/api/baremetal/v1/api.utils.js +0 -27
  21. package/dist/api/baremetal/v1/content.gen.js +0 -13
  22. package/dist/api/baremetal/v1/index.js +0 -5
  23. package/dist/api/baremetal/v1/marshalling.gen.js +0 -395
  24. package/dist/api/baremetal/v1/validation-rules.gen.js +0 -109
  25. package/dist/api/billing/index.js +0 -2
  26. package/dist/api/billing/v2alpha1/api.gen.js +0 -80
  27. package/dist/api/billing/v2alpha1/index.gen.js +0 -4
  28. package/dist/api/billing/v2alpha1/marshalling.gen.js +0 -53
  29. package/dist/api/block/index.js +0 -2
  30. package/dist/api/block/v1alpha1/api.gen.js +0 -245
  31. package/dist/api/block/v1alpha1/content.gen.js +0 -13
  32. package/dist/api/block/v1alpha1/index.gen.js +0 -7
  33. package/dist/api/block/v1alpha1/marshalling.gen.js +0 -175
  34. package/dist/api/block/v1alpha1/validation-rules.gen.js +0 -42
  35. package/dist/api/cockpit/index.js +0 -2
  36. package/dist/api/cockpit/v1beta1/api.gen.js +0 -448
  37. package/dist/api/cockpit/v1beta1/content.gen.js +0 -7
  38. package/dist/api/cockpit/v1beta1/index.gen.js +0 -5
  39. package/dist/api/cockpit/v1beta1/marshalling.gen.js +0 -220
  40. package/dist/api/container/index.js +0 -2
  41. package/dist/api/container/v1beta1/api.gen.js +0 -549
  42. package/dist/api/container/v1beta1/content.gen.js +0 -22
  43. package/dist/api/container/v1beta1/index.gen.js +0 -5
  44. package/dist/api/container/v1beta1/marshalling.gen.js +0 -330
  45. package/dist/api/document_db/index.js +0 -2
  46. package/dist/api/document_db/v1beta1/api.gen.js +0 -830
  47. package/dist/api/document_db/v1beta1/content.gen.js +0 -19
  48. package/dist/api/document_db/v1beta1/index.gen.js +0 -7
  49. package/dist/api/document_db/v1beta1/marshalling.gen.js +0 -580
  50. package/dist/api/document_db/v1beta1/validation-rules.gen.js +0 -10
  51. package/dist/api/domain/index.js +0 -2
  52. package/dist/api/domain/v2beta1/api.gen.js +0 -875
  53. package/dist/api/domain/v2beta1/content.gen.js +0 -28
  54. package/dist/api/domain/v2beta1/index.gen.js +0 -7
  55. package/dist/api/domain/v2beta1/marshalling.gen.js +0 -958
  56. package/dist/api/flexibleip/index.js +0 -2
  57. package/dist/api/flexibleip/v1alpha1/api.gen.js +0 -203
  58. package/dist/api/flexibleip/v1alpha1/content.gen.js +0 -10
  59. package/dist/api/flexibleip/v1alpha1/index.gen.js +0 -7
  60. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +0 -97
  61. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +0 -14
  62. package/dist/api/function/index.js +0 -2
  63. package/dist/api/function/v1beta1/api.gen.js +0 -560
  64. package/dist/api/function/v1beta1/content.gen.js +0 -22
  65. package/dist/api/function/v1beta1/index.gen.js +0 -5
  66. package/dist/api/function/v1beta1/marshalling.gen.js +0 -368
  67. package/dist/api/iam/index.js +0 -2
  68. package/dist/api/iam/v1alpha1/api.gen.js +0 -799
  69. package/dist/api/iam/v1alpha1/index.gen.js +0 -6
  70. package/dist/api/iam/v1alpha1/marshalling.gen.js +0 -373
  71. package/dist/api/iam/v1alpha1/validation-rules.gen.js +0 -207
  72. package/dist/api/instance/index.js +0 -2
  73. package/dist/api/instance/v1/api.gen.js +0 -1003
  74. package/dist/api/instance/v1/api.utils.js +0 -369
  75. package/dist/api/instance/v1/content.gen.js +0 -31
  76. package/dist/api/instance/v1/index.js +0 -2
  77. package/dist/api/instance/v1/marshalling.gen.js +0 -1206
  78. package/dist/api/instance/v1/marshalling.utils.js +0 -63
  79. package/dist/api/iot/index.js +0 -2
  80. package/dist/api/iot/v1/api.gen.js +0 -581
  81. package/dist/api/iot/v1/content.gen.js +0 -7
  82. package/dist/api/iot/v1/index.gen.js +0 -5
  83. package/dist/api/iot/v1/marshalling.gen.js +0 -388
  84. package/dist/api/ipfs/index.js +0 -2
  85. package/dist/api/ipfs/v1alpha1/api.gen.js +0 -197
  86. package/dist/api/ipfs/v1alpha1/content.gen.js +0 -7
  87. package/dist/api/ipfs/v1alpha1/index.gen.js +0 -5
  88. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +0 -121
  89. package/dist/api/k8s/index.js +0 -2
  90. package/dist/api/k8s/v1/api.gen.js +0 -454
  91. package/dist/api/k8s/v1/api.utils.js +0 -13
  92. package/dist/api/k8s/v1/content.gen.js +0 -13
  93. package/dist/api/k8s/v1/index.js +0 -4
  94. package/dist/api/k8s/v1/marshalling.gen.js +0 -333
  95. package/dist/api/k8s/v1/validation-rules.gen.js +0 -101
  96. package/dist/api/lb/index.js +0 -2
  97. package/dist/api/lb/v1/api.gen.js +0 -1669
  98. package/dist/api/lb/v1/api.utils.js +0 -81
  99. package/dist/api/lb/v1/content.gen.js +0 -16
  100. package/dist/api/lb/v1/index.js +0 -2
  101. package/dist/api/lb/v1/marshalling.gen.js +0 -923
  102. package/dist/api/marketplace/index.js +0 -4
  103. package/dist/api/marketplace/v1/api.gen.js +0 -60
  104. package/dist/api/marketplace/v1/index.gen.js +0 -4
  105. package/dist/api/marketplace/v1/marshalling.gen.js +0 -92
  106. package/dist/api/marketplace/v2/api.gen.js +0 -162
  107. package/dist/api/marketplace/v2/index.gen.js +0 -4
  108. package/dist/api/marketplace/v2/marshalling.gen.js +0 -94
  109. package/dist/api/mnq/index.js +0 -2
  110. package/dist/api/mnq/v1alpha1/api.gen.js +0 -205
  111. package/dist/api/mnq/v1alpha1/index.gen.js +0 -4
  112. package/dist/api/mnq/v1alpha1/marshalling.gen.js +0 -121
  113. package/dist/api/rdb/index.js +0 -2
  114. package/dist/api/rdb/v1/api.gen.js +0 -972
  115. package/dist/api/rdb/v1/content.gen.js +0 -22
  116. package/dist/api/rdb/v1/index.gen.js +0 -7
  117. package/dist/api/rdb/v1/marshalling.gen.js +0 -636
  118. package/dist/api/rdb/v1/validation-rules.gen.js +0 -10
  119. package/dist/api/redis/index.js +0 -2
  120. package/dist/api/redis/v1/api.gen.js +0 -389
  121. package/dist/api/redis/v1/content.gen.js +0 -7
  122. package/dist/api/redis/v1/index.gen.js +0 -5
  123. package/dist/api/redis/v1/marshalling.gen.js +0 -259
  124. package/dist/api/registry/index.js +0 -2
  125. package/dist/api/registry/v1/api.gen.js +0 -252
  126. package/dist/api/registry/v1/content.gen.js +0 -13
  127. package/dist/api/registry/v1/index.gen.js +0 -5
  128. package/dist/api/registry/v1/marshalling.gen.js +0 -106
  129. package/dist/api/secret/index.js +0 -2
  130. package/dist/api/secret/v1alpha1/api.gen.js +0 -415
  131. package/dist/api/secret/v1alpha1/index.gen.js +0 -4
  132. package/dist/api/secret/v1alpha1/marshalling.gen.js +0 -143
  133. package/dist/api/tem/index.js +0 -2
  134. package/dist/api/tem/v1alpha1/api.gen.js +0 -229
  135. package/dist/api/tem/v1alpha1/content.gen.js +0 -10
  136. package/dist/api/tem/v1alpha1/index.gen.js +0 -5
  137. package/dist/api/tem/v1alpha1/marshalling.gen.js +0 -159
  138. package/dist/api/test/index.js +0 -2
  139. package/dist/api/test/v1/api.gen.js +0 -152
  140. package/dist/api/test/v1/content.gen.js +0 -7
  141. package/dist/api/test/v1/index.gen.js +0 -5
  142. package/dist/api/test/v1/marshalling.gen.js +0 -79
  143. package/dist/api/vpc/index.js +0 -4
  144. package/dist/api/vpc/v1/api.gen.js +0 -110
  145. package/dist/api/vpc/v1/index.gen.js +0 -4
  146. package/dist/api/vpc/v1/marshalling.gen.js +0 -44
  147. package/dist/api/vpc/v2/api.gen.js +0 -276
  148. package/dist/api/vpc/v2/index.gen.js +0 -4
  149. package/dist/api/vpc/v2/marshalling.gen.js +0 -135
  150. package/dist/api/vpcgw/index.js +0 -2
  151. package/dist/api/vpcgw/v1/api.gen.js +0 -669
  152. package/dist/api/vpcgw/v1/content.gen.js +0 -10
  153. package/dist/api/vpcgw/v1/index.gen.js +0 -5
  154. package/dist/api/vpcgw/v1/marshalling.gen.js +0 -336
  155. package/dist/api/webhosting/index.js +0 -2
  156. package/dist/api/webhosting/v1alpha1/api.gen.js +0 -210
  157. package/dist/api/webhosting/v1alpha1/content.gen.js +0 -7
  158. package/dist/api/webhosting/v1alpha1/index.gen.js +0 -7
  159. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +0 -173
  160. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +0 -23
  161. package/dist/helpers/is-browser.js +0 -5
  162. package/dist/helpers/is-response.js +0 -10
  163. package/dist/helpers/json.js +0 -11
  164. package/dist/helpers/marshalling.js +0 -130
  165. package/dist/index.cjs +0 -24364
  166. package/dist/index.d.ts +0 -27584
  167. package/dist/index.js +0 -69
  168. package/dist/internal/async/interval-retrier.js +0 -105
  169. package/dist/internal/async/sleep.js +0 -13
  170. package/dist/internal/interceptors/composer.js +0 -46
  171. package/dist/internal/interceptors/helpers.js +0 -32
  172. package/dist/internal/logger/console-logger.js +0 -38
  173. package/dist/internal/logger/index.js +0 -41
  174. package/dist/internal/logger/level-resolver.js +0 -13
  175. package/dist/internal/validations/string-validation.js +0 -38
  176. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js +0 -13
  177. package/dist/scw/api.js +0 -12
  178. package/dist/scw/auth.js +0 -68
  179. package/dist/scw/client-ini-factory.js +0 -174
  180. package/dist/scw/client-ini-profile.js +0 -54
  181. package/dist/scw/client-settings.js +0 -78
  182. package/dist/scw/client.js +0 -98
  183. package/dist/scw/constants.js +0 -4
  184. package/dist/scw/custom-marshalling.js +0 -131
  185. package/dist/scw/errors/error-parser.js +0 -107
  186. package/dist/scw/errors/non-standard/invalid-request-mapper.js +0 -36
  187. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +0 -27
  188. package/dist/scw/errors/scw-error.js +0 -66
  189. package/dist/scw/errors/standard/already-exists-error.js +0 -26
  190. package/dist/scw/errors/standard/denied-authentication-error.js +0 -52
  191. package/dist/scw/errors/standard/index.js +0 -13
  192. package/dist/scw/errors/standard/invalid-arguments-error.js +0 -67
  193. package/dist/scw/errors/standard/out-of-stock-error.js +0 -22
  194. package/dist/scw/errors/standard/permissions-denied-error.js +0 -48
  195. package/dist/scw/errors/standard/precondition-failed-error.js +0 -42
  196. package/dist/scw/errors/standard/quotas-exceeded-error.js +0 -68
  197. package/dist/scw/errors/standard/resource-expired-error.js +0 -26
  198. package/dist/scw/errors/standard/resource-locked-error.js +0 -25
  199. package/dist/scw/errors/standard/resource-not-found-error.js +0 -25
  200. package/dist/scw/errors/standard/too-many-requests-error.js +0 -70
  201. package/dist/scw/errors/standard/transient-state-error.js +0 -26
  202. package/dist/scw/errors/types.js +0 -23
  203. package/dist/scw/fetch/build-fetcher.js +0 -72
  204. package/dist/scw/fetch/http-dumper.js +0 -54
  205. package/dist/scw/fetch/http-interceptors.js +0 -99
  206. package/dist/scw/fetch/resource-paginator.js +0 -84
  207. package/dist/scw/fetch/response-parser.js +0 -72
  208. package/node_modules/@scaleway/random-name/.npmignore +0 -4
  209. package/node_modules/@scaleway/random-name/CHANGELOG.md +0 -129
  210. package/node_modules/@scaleway/random-name/LICENSE.md +0 -21
  211. package/node_modules/@scaleway/random-name/README.md +0 -26
  212. package/node_modules/@scaleway/random-name/dist/index.d.ts +0 -3
  213. package/node_modules/@scaleway/random-name/dist/index.js +0 -13
  214. package/node_modules/@scaleway/random-name/package.json +0 -23
@@ -1,245 +0,0 @@
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 { VOLUME_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES } from './content.gen.js';
6
- import { unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, marshalCreateVolumeRequest, unmarshalVolume, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalSnapshot, marshalCreateSnapshotRequest, marshalUpdateSnapshotRequest } 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
- /**
15
- * Scaleway Block Storage (SBS) API.
16
- *
17
- * This API allows you to use and manage your Block Storage volumes. Scaleway
18
- * Block Storage (SBS) API.
19
- */
20
- class API extends API$1 {
21
- /** Lists the available zones of the API. */
22
- static LOCALITIES = ['fr-par-1', 'pl-waw-3'];
23
- pageOfListVolumeTypes = (() => {
24
- var _this = this;
25
- return function (request) {
26
- if (request === void 0) {
27
- request = {};
28
- }
29
- return _this.client.fetch({
30
- method: 'GET',
31
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this.client.settings.defaultZone)}/volume-types`,
32
- urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
33
- }, unmarshalListVolumeTypesResponse);
34
- };
35
- })();
36
-
37
- /**
38
- * List volume types. List all available volume types in a specified zone. The
39
- * volume types listed are ordered by name in ascending order.
40
- *
41
- * @param request - The request {@link ListVolumeTypesRequest}
42
- * @returns A Promise of ListVolumeTypesResponse
43
- */
44
- listVolumeTypes = (() => {
45
- var _this2 = this;
46
- return function (request) {
47
- if (request === void 0) {
48
- request = {};
49
- }
50
- return enrichForPagination('volumeTypes', _this2.pageOfListVolumeTypes, request);
51
- };
52
- })();
53
- pageOfListVolumes = (() => {
54
- var _this3 = this;
55
- return function (request) {
56
- if (request === void 0) {
57
- request = {};
58
- }
59
- return _this3.client.fetch({
60
- method: 'GET',
61
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this3.client.settings.defaultZone)}/volumes`,
62
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['product_resource_id', request.productResourceId], ['project_id', request.projectId])
63
- }, unmarshalListVolumesResponse);
64
- };
65
- })();
66
-
67
- /**
68
- * List volumes. List all existing volumes in a specified zone. By default,
69
- * the volume listed are ordered by creation date in ascending order. This can
70
- * be modified via the `order_by` field.
71
- *
72
- * @param request - The request {@link ListVolumesRequest}
73
- * @returns A Promise of ListVolumesResponse
74
- */
75
- listVolumes = (() => {
76
- var _this4 = this;
77
- return function (request) {
78
- if (request === void 0) {
79
- request = {};
80
- }
81
- return enrichForPagination('volumes', _this4.pageOfListVolumes, request);
82
- };
83
- })();
84
-
85
- /**
86
- * Create a new empty volume by specifying the `size`. To create a volume from
87
- * an existing snapshot, specify the `snapshot_id` in the request payload
88
- * instead, size is optional and can be specified if you need to extend the
89
- * original size. In that case the created volume will have the same volume
90
- * class (and underlying IOPS limitations) as the originating snapshot. You
91
- * can specify the desired performance of the volume by setting `requirements`
92
- * accordingly.
93
- *
94
- * @param request - The request {@link CreateVolumeRequest}
95
- * @returns A Promise of Volume
96
- */
97
- createVolume = request => this.client.fetch({
98
- body: JSON.stringify(marshalCreateVolumeRequest(request, this.client.settings)),
99
- headers: jsonContentHeaders,
100
- method: 'POST',
101
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/volumes`
102
- }, unmarshalVolume);
103
-
104
- /**
105
- * Get a volume. Retrieve technical information about a specific volume.
106
- * Details such as size, type, and status are returned in the response.
107
- *
108
- * @param request - The request {@link GetVolumeRequest}
109
- * @returns A Promise of Volume
110
- */
111
- getVolume = request => this.client.fetch({
112
- method: 'GET',
113
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam('volumeId', request.volumeId)}`
114
- }, unmarshalVolume);
115
-
116
- /**
117
- * Waits for {@link Volume} to be in a final state.
118
- *
119
- * @param request - The request {@link GetVolumeRequest}
120
- * @param options - The waiting options
121
- * @returns A Promise of Volume
122
- */
123
- waitForVolume = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!VOLUME_TRANSIENT_STATUSES.includes(res.status))), this.getVolume, request, options);
124
-
125
- /**
126
- * Delete a detached volume. You must specify the `volume_id` of the volume
127
- * you want to delete. The volume must not be in the `in_use` status.
128
- *
129
- * @param request - The request {@link DeleteVolumeRequest}
130
- */
131
- deleteVolume = request => this.client.fetch({
132
- method: 'DELETE',
133
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam('volumeId', request.volumeId)}`
134
- });
135
-
136
- /**
137
- * Update a volume. Update technical details about a volume, such as its name,
138
- * tags, or its new size and `volume_type` (within the same Block Storage
139
- * class). You can only resize a volume to a larger size. It is not possible
140
- * for now to change your Block Storage Class.
141
- *
142
- * @param request - The request {@link UpdateVolumeRequest}
143
- * @returns A Promise of Volume
144
- */
145
- updateVolume = request => this.client.fetch({
146
- body: JSON.stringify(marshalUpdateVolumeRequest(request, this.client.settings)),
147
- headers: jsonContentHeaders,
148
- method: 'PATCH',
149
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/volumes/${validatePathParam('volumeId', request.volumeId)}`
150
- }, unmarshalVolume);
151
- pageOfListSnapshots = (() => {
152
- var _this5 = this;
153
- return function (request) {
154
- if (request === void 0) {
155
- request = {};
156
- }
157
- return _this5.client.fetch({
158
- method: 'GET',
159
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? _this5.client.settings.defaultZone)}/snapshots`,
160
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this5.client.settings.defaultPageSize], ['project_id', request.projectId], ['volume_id', request.volumeId])
161
- }, unmarshalListSnapshotsResponse);
162
- };
163
- })();
164
-
165
- /**
166
- * List all snapshots. List all available snapshots in a specified zone. By
167
- * default, the snapshots listed are ordered by creation date in ascending
168
- * order. This can be modified via the `order_by` field.
169
- *
170
- * @param request - The request {@link ListSnapshotsRequest}
171
- * @returns A Promise of ListSnapshotsResponse
172
- */
173
- listSnapshots = (() => {
174
- var _this6 = this;
175
- return function (request) {
176
- if (request === void 0) {
177
- request = {};
178
- }
179
- return enrichForPagination('snapshots', _this6.pageOfListSnapshots, request);
180
- };
181
- })();
182
-
183
- /**
184
- * Get a snapshot. Retrieve technical information about a specific snapshot.
185
- * Details such as size, volume type, and status are returned in the
186
- * response.
187
- *
188
- * @param request - The request {@link GetSnapshotRequest}
189
- * @returns A Promise of Snapshot
190
- */
191
- getSnapshot = request => this.client.fetch({
192
- method: 'GET',
193
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`
194
- }, unmarshalSnapshot);
195
-
196
- /**
197
- * Waits for {@link Snapshot} to be in a final state.
198
- *
199
- * @param request - The request {@link GetSnapshotRequest}
200
- * @param options - The waiting options
201
- * @returns A Promise of Snapshot
202
- */
203
- waitForSnapshot = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!SNAPSHOT_TRANSIENT_STATUSES.includes(res.status))), this.getSnapshot, request, options);
204
-
205
- /**
206
- * Create a snapshot of a volume. To create a snapshot, the volume must be in
207
- * the `in_use` or the `available` status. If your volume is in a transient
208
- * state, you need to wait until the end of the current operation.
209
- *
210
- * @param request - The request {@link CreateSnapshotRequest}
211
- * @returns A Promise of Snapshot
212
- */
213
- createSnapshot = request => this.client.fetch({
214
- body: JSON.stringify(marshalCreateSnapshotRequest(request, this.client.settings)),
215
- headers: jsonContentHeaders,
216
- method: 'POST',
217
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/snapshots`
218
- }, unmarshalSnapshot);
219
-
220
- /**
221
- * Delete a snapshot. You must specify the `snapshot_id` of the snapshot you
222
- * want to delete. The snapshot must not be in use.
223
- *
224
- * @param request - The request {@link DeleteSnapshotRequest}
225
- */
226
- deleteSnapshot = request => this.client.fetch({
227
- method: 'DELETE',
228
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`
229
- });
230
-
231
- /**
232
- * Update a snapshot. Update name or tags of the snapshot.
233
- *
234
- * @param request - The request {@link UpdateSnapshotRequest}
235
- * @returns A Promise of Snapshot
236
- */
237
- updateSnapshot = request => this.client.fetch({
238
- body: JSON.stringify(marshalUpdateSnapshotRequest(request, this.client.settings)),
239
- headers: jsonContentHeaders,
240
- method: 'PATCH',
241
- path: `/block/v1alpha1/zones/${validatePathParam('zone', request.zone ?? this.client.settings.defaultZone)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`
242
- }, unmarshalSnapshot);
243
- }
244
-
245
- export { API };
@@ -1,13 +0,0 @@
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 ReferenceStatus}. */
5
- const REFERENCE_TRANSIENT_STATUSES = ['attaching', 'detaching', 'snapshotting'];
6
-
7
- /** Lists transient statutes of the enum {@link SnapshotStatus}. */
8
- const SNAPSHOT_TRANSIENT_STATUSES = ['creating', 'deleting'];
9
-
10
- /** Lists transient statutes of the enum {@link VolumeStatus}. */
11
- const VOLUME_TRANSIENT_STATUSES = ['creating', 'deleting', 'resizing', 'snapshotting'];
12
-
13
- export { REFERENCE_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES };
@@ -1,7 +0,0 @@
1
- export { API } from './api.gen.js';
2
- export { REFERENCE_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES, VOLUME_TRANSIENT_STATUSES } from './content.gen.js';
3
- import * as validationRules_gen from './validation-rules.gen.js';
4
- export { validationRules_gen as ValidationRules };
5
-
6
- // This file was automatically generated. DO NOT EDIT.
7
- // If you have any remark or suggestion do not hesitate to open an issue.
@@ -1,175 +0,0 @@
1
- import { isJSONObject } from '../../../helpers/json.js';
2
- import { unmarshalMoney } from '../../../scw/custom-marshalling.js';
3
- import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
4
-
5
- // This file was automatically generated. DO NOT EDIT.
6
- // If you have any remark or suggestion do not hesitate to open an issue.
7
- const unmarshalReference = data => {
8
- if (!isJSONObject(data)) {
9
- throw new TypeError(`Unmarshalling the type 'Reference' failed as data isn't a dictionary.`);
10
- }
11
- return {
12
- createdAt: unmarshalDate(data.created_at),
13
- id: data.id,
14
- productResourceId: data.product_resource_id,
15
- productResourceType: data.product_resource_type,
16
- status: data.status,
17
- type: data.type
18
- };
19
- };
20
- const unmarshalSnapshotParentVolume = data => {
21
- if (!isJSONObject(data)) {
22
- throw new TypeError(`Unmarshalling the type 'SnapshotParentVolume' failed as data isn't a dictionary.`);
23
- }
24
- return {
25
- id: data.id,
26
- name: data.name,
27
- status: data.status,
28
- type: data.type
29
- };
30
- };
31
- const unmarshalVolumeSpecifications = data => {
32
- if (!isJSONObject(data)) {
33
- throw new TypeError(`Unmarshalling the type 'VolumeSpecifications' failed as data isn't a dictionary.`);
34
- }
35
- return {
36
- class: data.class,
37
- perfIops: data.perf_iops
38
- };
39
- };
40
- const unmarshalSnapshotSummary = data => {
41
- if (!isJSONObject(data)) {
42
- throw new TypeError(`Unmarshalling the type 'SnapshotSummary' failed as data isn't a dictionary.`);
43
- }
44
- return {
45
- class: data.class,
46
- createdAt: unmarshalDate(data.created_at),
47
- id: data.id,
48
- name: data.name,
49
- parentVolume: data.parent_volume ? unmarshalSnapshotParentVolume(data.parent_volume) : undefined,
50
- projectId: data.project_id,
51
- size: data.size,
52
- status: data.status,
53
- tags: data.tags,
54
- updatedAt: unmarshalDate(data.updated_at),
55
- zone: data.zone
56
- };
57
- };
58
- const unmarshalVolume = data => {
59
- if (!isJSONObject(data)) {
60
- throw new TypeError(`Unmarshalling the type 'Volume' failed as data isn't a dictionary.`);
61
- }
62
- return {
63
- createdAt: unmarshalDate(data.created_at),
64
- id: data.id,
65
- name: data.name,
66
- parentSnapshotId: data.parent_snapshot_id,
67
- projectId: data.project_id,
68
- references: unmarshalArrayOfObject(data.references, unmarshalReference),
69
- size: data.size,
70
- specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : undefined,
71
- status: data.status,
72
- tags: data.tags,
73
- type: data.type,
74
- updatedAt: unmarshalDate(data.updated_at),
75
- zone: data.zone
76
- };
77
- };
78
- const unmarshalVolumeType = data => {
79
- if (!isJSONObject(data)) {
80
- throw new TypeError(`Unmarshalling the type 'VolumeType' failed as data isn't a dictionary.`);
81
- }
82
- return {
83
- pricing: data.pricing ? unmarshalMoney(data.pricing) : undefined,
84
- snapshotPricing: data.snapshot_pricing ? unmarshalMoney(data.snapshot_pricing) : undefined,
85
- specs: data.specs ? unmarshalVolumeSpecifications(data.specs) : undefined,
86
- type: data.type
87
- };
88
- };
89
- const unmarshalListSnapshotsResponse = data => {
90
- if (!isJSONObject(data)) {
91
- throw new TypeError(`Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary.`);
92
- }
93
- return {
94
- snapshots: unmarshalArrayOfObject(data.snapshots, unmarshalSnapshotSummary),
95
- totalCount: data.total_count
96
- };
97
- };
98
- const unmarshalListVolumeTypesResponse = data => {
99
- if (!isJSONObject(data)) {
100
- throw new TypeError(`Unmarshalling the type 'ListVolumeTypesResponse' failed as data isn't a dictionary.`);
101
- }
102
- return {
103
- totalCount: data.total_count,
104
- volumeTypes: unmarshalArrayOfObject(data.volume_types, unmarshalVolumeType)
105
- };
106
- };
107
- const unmarshalListVolumesResponse = data => {
108
- if (!isJSONObject(data)) {
109
- throw new TypeError(`Unmarshalling the type 'ListVolumesResponse' failed as data isn't a dictionary.`);
110
- }
111
- return {
112
- totalCount: data.total_count,
113
- volumes: unmarshalArrayOfObject(data.volumes, unmarshalVolume)
114
- };
115
- };
116
- const unmarshalSnapshot = data => {
117
- if (!isJSONObject(data)) {
118
- throw new TypeError(`Unmarshalling the type 'Snapshot' failed as data isn't a dictionary.`);
119
- }
120
- return {
121
- class: data.class,
122
- createdAt: unmarshalDate(data.created_at),
123
- id: data.id,
124
- name: data.name,
125
- parentVolume: data.parent_volume ? unmarshalSnapshotParentVolume(data.parent_volume) : undefined,
126
- projectId: data.project_id,
127
- references: unmarshalArrayOfObject(data.references, unmarshalReference),
128
- size: data.size,
129
- status: data.status,
130
- tags: data.tags,
131
- updatedAt: unmarshalDate(data.updated_at),
132
- zone: data.zone
133
- };
134
- };
135
- const marshalCreateVolumeRequestFromEmpty = (request, defaults) => ({
136
- size: request.size
137
- });
138
- const marshalCreateVolumeRequestFromSnapshot = (request, defaults) => ({
139
- size: request.size,
140
- snapshot_id: request.snapshotId
141
- });
142
- const marshalCreateSnapshotRequest = (request, defaults) => ({
143
- name: request.name,
144
- project_id: request.projectId ?? defaults.defaultProjectId,
145
- tags: request.tags,
146
- volume_id: request.volumeId
147
- });
148
- const marshalCreateVolumeRequest = (request, defaults) => ({
149
- name: request.name,
150
- project_id: request.projectId ?? defaults.defaultProjectId,
151
- tags: request.tags,
152
- ...resolveOneOf([{
153
- param: 'from_empty',
154
- value: request.fromEmpty ? marshalCreateVolumeRequestFromEmpty(request.fromEmpty) : undefined
155
- }, {
156
- param: 'from_snapshot',
157
- value: request.fromSnapshot ? marshalCreateVolumeRequestFromSnapshot(request.fromSnapshot) : undefined
158
- }]),
159
- ...resolveOneOf([{
160
- param: 'perf_iops',
161
- value: request.perfIops
162
- }], true)
163
- });
164
- const marshalUpdateSnapshotRequest = (request, defaults) => ({
165
- name: request.name,
166
- tags: request.tags
167
- });
168
- const marshalUpdateVolumeRequest = (request, defaults) => ({
169
- name: request.name,
170
- perf_iops: request.perfIops,
171
- size: request.size,
172
- tags: request.tags
173
- });
174
-
175
- export { marshalCreateSnapshotRequest, marshalCreateVolumeRequest, marshalUpdateSnapshotRequest, marshalUpdateVolumeRequest, unmarshalListSnapshotsResponse, unmarshalListVolumeTypesResponse, unmarshalListVolumesResponse, unmarshalSnapshot, unmarshalVolume };
@@ -1,42 +0,0 @@
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
- const CreateSnapshotRequest = {
5
- name: {
6
- minLength: 1
7
- }
8
- };
9
- const CreateVolumeRequest = {
10
- name: {
11
- minLength: 1
12
- }
13
- };
14
- const ListSnapshotsRequest = {
15
- page: {
16
- greaterThan: 0
17
- },
18
- pageSize: {
19
- greaterThan: 0,
20
- lessThanOrEqual: 100
21
- }
22
- };
23
- const ListVolumeTypesRequest = {
24
- page: {
25
- greaterThan: 0
26
- },
27
- pageSize: {
28
- greaterThan: 0,
29
- lessThanOrEqual: 100
30
- }
31
- };
32
- const ListVolumesRequest = {
33
- page: {
34
- greaterThan: 0
35
- },
36
- pageSize: {
37
- greaterThan: 0,
38
- lessThanOrEqual: 100
39
- }
40
- };
41
-
42
- export { CreateSnapshotRequest, CreateVolumeRequest, ListSnapshotsRequest, ListVolumeTypesRequest, ListVolumesRequest };
@@ -1,2 +0,0 @@
1
- import * as index_gen from './v1beta1/index.gen.js';
2
- export { index_gen as v1beta1 };