@scaleway/sdk 2.0.0-alpha.13 → 2.0.0-alpha.15

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 (215) hide show
  1. package/dist/api/account/index.js +4 -0
  2. package/dist/api/account/v2/api.gen.js +147 -0
  3. package/dist/api/account/v2/index.gen.js +4 -0
  4. package/dist/api/account/v2/marshalling.gen.js +39 -0
  5. package/dist/api/account/v3/api.gen.js +129 -0
  6. package/dist/api/account/v3/index.gen.js +6 -0
  7. package/dist/api/account/v3/marshalling.gen.js +39 -0
  8. package/dist/api/account/v3/validation-rules.gen.js +39 -0
  9. package/dist/api/applesilicon/index.js +2 -0
  10. package/dist/api/applesilicon/v1alpha1/api.gen.js +220 -0
  11. package/dist/api/applesilicon/v1alpha1/content.gen.js +7 -0
  12. package/dist/api/applesilicon/v1alpha1/index.gen.js +5 -0
  13. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +113 -0
  14. package/dist/api/baremetal/index.js +2 -0
  15. package/dist/api/baremetal/v1/api.gen.js +523 -0
  16. package/dist/api/baremetal/v1/api.utils.js +27 -0
  17. package/dist/api/baremetal/v1/content.gen.js +13 -0
  18. package/dist/api/baremetal/v1/index.js +5 -0
  19. package/dist/api/baremetal/v1/marshalling.gen.js +406 -0
  20. package/dist/api/baremetal/v1/validation-rules.gen.js +109 -0
  21. package/dist/api/billing/index.js +2 -0
  22. package/dist/api/billing/v2alpha1/api.gen.js +80 -0
  23. package/dist/api/billing/v2alpha1/index.gen.js +4 -0
  24. package/dist/api/billing/v2alpha1/marshalling.gen.js +53 -0
  25. package/dist/api/block/index.js +2 -0
  26. package/dist/api/block/v1alpha1/api.gen.js +249 -0
  27. package/dist/api/block/v1alpha1/content.gen.js +13 -0
  28. package/dist/api/block/v1alpha1/index.gen.js +7 -0
  29. package/dist/api/block/v1alpha1/marshalling.gen.js +182 -0
  30. package/dist/api/block/v1alpha1/validation-rules.gen.js +52 -0
  31. package/dist/api/cockpit/index.js +2 -0
  32. package/dist/api/cockpit/v1beta1/api.gen.js +543 -0
  33. package/dist/api/cockpit/v1beta1/content.gen.js +7 -0
  34. package/dist/api/cockpit/v1beta1/index.gen.js +5 -0
  35. package/dist/api/cockpit/v1beta1/marshalling.gen.js +271 -0
  36. package/dist/api/container/index.js +2 -0
  37. package/dist/api/container/v1beta1/api.gen.js +549 -0
  38. package/dist/api/container/v1beta1/content.gen.js +22 -0
  39. package/dist/api/container/v1beta1/index.gen.js +7 -0
  40. package/dist/api/container/v1beta1/marshalling.gen.js +358 -0
  41. package/dist/api/container/v1beta1/validation-rules.gen.js +44 -0
  42. package/dist/api/document_db/index.js +2 -0
  43. package/dist/api/document_db/v1beta1/api.gen.js +830 -0
  44. package/dist/api/document_db/v1beta1/content.gen.js +19 -0
  45. package/dist/api/document_db/v1beta1/index.gen.js +7 -0
  46. package/dist/api/document_db/v1beta1/marshalling.gen.js +636 -0
  47. package/dist/api/document_db/v1beta1/validation-rules.gen.js +10 -0
  48. package/dist/api/domain/index.js +2 -0
  49. package/dist/api/domain/v2beta1/api.gen.js +867 -0
  50. package/dist/api/domain/v2beta1/content.gen.js +28 -0
  51. package/dist/api/domain/v2beta1/index.gen.js +5 -0
  52. package/dist/api/domain/v2beta1/marshalling.gen.js +1172 -0
  53. package/dist/api/flexibleip/index.js +2 -0
  54. package/dist/api/flexibleip/v1alpha1/api.gen.js +195 -0
  55. package/dist/api/flexibleip/v1alpha1/content.gen.js +10 -0
  56. package/dist/api/flexibleip/v1alpha1/index.gen.js +7 -0
  57. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +97 -0
  58. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +14 -0
  59. package/dist/api/function/index.js +2 -0
  60. package/dist/api/function/v1beta1/api.gen.js +560 -0
  61. package/dist/api/function/v1beta1/content.gen.js +22 -0
  62. package/dist/api/function/v1beta1/index.gen.js +7 -0
  63. package/dist/api/function/v1beta1/marshalling.gen.js +396 -0
  64. package/dist/api/function/v1beta1/validation-rules.gen.js +44 -0
  65. package/dist/api/iam/index.js +2 -0
  66. package/dist/api/iam/v1alpha1/api.gen.js +783 -0
  67. package/dist/api/iam/v1alpha1/index.gen.js +6 -0
  68. package/dist/api/iam/v1alpha1/marshalling.gen.js +384 -0
  69. package/dist/api/iam/v1alpha1/validation-rules.gen.js +207 -0
  70. package/dist/api/instance/index.js +2 -0
  71. package/dist/api/instance/v1/api.gen.js +1003 -0
  72. package/dist/api/instance/v1/api.utils.js +369 -0
  73. package/dist/api/instance/v1/content.gen.js +31 -0
  74. package/dist/api/instance/v1/index.js +2 -0
  75. package/dist/api/instance/v1/marshalling.gen.js +1415 -0
  76. package/dist/api/instance/v1/marshalling.utils.js +63 -0
  77. package/dist/api/iot/index.js +2 -0
  78. package/dist/api/iot/v1/api.gen.js +573 -0
  79. package/dist/api/iot/v1/content.gen.js +7 -0
  80. package/dist/api/iot/v1/index.gen.js +5 -0
  81. package/dist/api/iot/v1/marshalling.gen.js +439 -0
  82. package/dist/api/ipam/index.js +2 -0
  83. package/dist/api/ipam/v1/api.gen.js +113 -0
  84. package/dist/api/ipam/v1/index.gen.js +6 -0
  85. package/dist/api/ipam/v1/marshalling.gen.js +77 -0
  86. package/dist/api/ipam/v1/validation-rules.gen.js +11 -0
  87. package/dist/api/ipfs/index.js +2 -0
  88. package/dist/api/ipfs/v1alpha1/api.gen.js +314 -0
  89. package/dist/api/ipfs/v1alpha1/content.gen.js +10 -0
  90. package/dist/api/ipfs/v1alpha1/index.gen.js +5 -0
  91. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +180 -0
  92. package/dist/api/k8s/index.js +2 -0
  93. package/dist/api/k8s/v1/api.gen.js +454 -0
  94. package/dist/api/k8s/v1/api.utils.js +13 -0
  95. package/dist/api/k8s/v1/content.gen.js +13 -0
  96. package/dist/api/k8s/v1/index.js +4 -0
  97. package/dist/api/k8s/v1/marshalling.gen.js +421 -0
  98. package/dist/api/k8s/v1/validation-rules.gen.js +101 -0
  99. package/dist/api/lb/index.js +2 -0
  100. package/dist/api/lb/v1/api.gen.js +1669 -0
  101. package/dist/api/lb/v1/api.utils.js +81 -0
  102. package/dist/api/lb/v1/content.gen.js +16 -0
  103. package/dist/api/lb/v1/index.js +2 -0
  104. package/dist/api/lb/v1/marshalling.gen.js +1039 -0
  105. package/dist/api/marketplace/index.js +4 -0
  106. package/dist/api/marketplace/v1/api.gen.js +60 -0
  107. package/dist/api/marketplace/v1/index.gen.js +4 -0
  108. package/dist/api/marketplace/v1/marshalling.gen.js +92 -0
  109. package/dist/api/marketplace/v2/api.gen.js +162 -0
  110. package/dist/api/marketplace/v2/index.gen.js +4 -0
  111. package/dist/api/marketplace/v2/marshalling.gen.js +94 -0
  112. package/dist/api/mnq/index.js +4 -0
  113. package/dist/api/mnq/v1alpha1/api.gen.js +197 -0
  114. package/dist/api/mnq/v1alpha1/index.gen.js +4 -0
  115. package/dist/api/mnq/v1alpha1/marshalling.gen.js +126 -0
  116. package/dist/api/mnq/v1beta1/api.gen.js +529 -0
  117. package/dist/api/mnq/v1beta1/index.gen.js +6 -0
  118. package/dist/api/mnq/v1beta1/marshalling.gen.js +212 -0
  119. package/dist/api/mnq/v1beta1/validation-rules.gen.js +77 -0
  120. package/dist/api/rdb/index.js +2 -0
  121. package/dist/api/rdb/v1/api.gen.js +972 -0
  122. package/dist/api/rdb/v1/content.gen.js +22 -0
  123. package/dist/api/rdb/v1/index.gen.js +7 -0
  124. package/dist/api/rdb/v1/marshalling.gen.js +694 -0
  125. package/dist/api/rdb/v1/validation-rules.gen.js +10 -0
  126. package/dist/api/redis/index.js +2 -0
  127. package/dist/api/redis/v1/api.gen.js +389 -0
  128. package/dist/api/redis/v1/content.gen.js +7 -0
  129. package/dist/api/redis/v1/index.gen.js +5 -0
  130. package/dist/api/redis/v1/marshalling.gen.js +283 -0
  131. package/dist/api/registry/index.js +2 -0
  132. package/dist/api/registry/v1/api.gen.js +252 -0
  133. package/dist/api/registry/v1/content.gen.js +13 -0
  134. package/dist/api/registry/v1/index.gen.js +5 -0
  135. package/dist/api/registry/v1/marshalling.gen.js +108 -0
  136. package/dist/api/secret/index.js +2 -0
  137. package/dist/api/secret/v1alpha1/api.gen.js +415 -0
  138. package/dist/api/secret/v1alpha1/index.gen.js +4 -0
  139. package/dist/api/secret/v1alpha1/marshalling.gen.js +150 -0
  140. package/dist/api/tem/index.js +2 -0
  141. package/dist/api/tem/v1alpha1/api.gen.js +229 -0
  142. package/dist/api/tem/v1alpha1/content.gen.js +10 -0
  143. package/dist/api/tem/v1alpha1/index.gen.js +5 -0
  144. package/dist/api/tem/v1alpha1/marshalling.gen.js +168 -0
  145. package/dist/api/test/index.js +2 -0
  146. package/dist/api/test/v1/api.gen.js +152 -0
  147. package/dist/api/test/v1/content.gen.js +7 -0
  148. package/dist/api/test/v1/index.gen.js +5 -0
  149. package/dist/api/test/v1/marshalling.gen.js +81 -0
  150. package/dist/api/vpc/index.js +4 -0
  151. package/dist/api/vpc/v1/api.gen.js +110 -0
  152. package/dist/api/vpc/v1/index.gen.js +4 -0
  153. package/dist/api/vpc/v1/marshalling.gen.js +44 -0
  154. package/dist/api/vpc/v2/api.gen.js +276 -0
  155. package/dist/api/vpc/v2/index.gen.js +4 -0
  156. package/dist/api/vpc/v2/marshalling.gen.js +137 -0
  157. package/dist/api/vpcgw/index.js +2 -0
  158. package/dist/api/vpcgw/v1/api.gen.js +669 -0
  159. package/dist/api/vpcgw/v1/content.gen.js +10 -0
  160. package/dist/api/vpcgw/v1/index.gen.js +5 -0
  161. package/dist/api/vpcgw/v1/marshalling.gen.js +359 -0
  162. package/dist/api/webhosting/index.js +2 -0
  163. package/dist/api/webhosting/v1alpha1/api.gen.js +158 -0
  164. package/dist/api/webhosting/v1alpha1/content.gen.js +7 -0
  165. package/dist/api/webhosting/v1alpha1/index.gen.js +7 -0
  166. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +146 -0
  167. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +14 -0
  168. package/dist/helpers/is-browser.js +5 -0
  169. package/dist/helpers/is-response.js +10 -0
  170. package/dist/helpers/json.js +11 -0
  171. package/dist/helpers/marshalling.js +130 -0
  172. package/dist/index.cjs +26484 -0
  173. package/dist/index.d.ts +31184 -0
  174. package/dist/index.js +71 -0
  175. package/dist/internal/async/interval-retrier.js +105 -0
  176. package/dist/internal/async/sleep.js +13 -0
  177. package/dist/internal/interceptors/composer.js +46 -0
  178. package/dist/internal/interceptors/helpers.js +32 -0
  179. package/dist/internal/logger/console-logger.js +38 -0
  180. package/dist/internal/logger/index.js +41 -0
  181. package/dist/internal/logger/level-resolver.js +13 -0
  182. package/dist/internal/validations/string-validation.js +38 -0
  183. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js +13 -0
  184. package/dist/scw/api.js +12 -0
  185. package/dist/scw/auth.js +68 -0
  186. package/dist/scw/client-ini-factory.js +174 -0
  187. package/dist/scw/client-ini-profile.js +54 -0
  188. package/dist/scw/client-settings.js +78 -0
  189. package/dist/scw/client.js +98 -0
  190. package/dist/scw/constants.js +4 -0
  191. package/dist/scw/custom-marshalling.js +131 -0
  192. package/dist/scw/errors/error-parser.js +107 -0
  193. package/dist/scw/errors/non-standard/invalid-request-mapper.js +36 -0
  194. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +27 -0
  195. package/dist/scw/errors/scw-error.js +66 -0
  196. package/dist/scw/errors/standard/already-exists-error.js +26 -0
  197. package/dist/scw/errors/standard/denied-authentication-error.js +52 -0
  198. package/dist/scw/errors/standard/index.js +13 -0
  199. package/dist/scw/errors/standard/invalid-arguments-error.js +67 -0
  200. package/dist/scw/errors/standard/out-of-stock-error.js +22 -0
  201. package/dist/scw/errors/standard/permissions-denied-error.js +48 -0
  202. package/dist/scw/errors/standard/precondition-failed-error.js +42 -0
  203. package/dist/scw/errors/standard/quotas-exceeded-error.js +68 -0
  204. package/dist/scw/errors/standard/resource-expired-error.js +26 -0
  205. package/dist/scw/errors/standard/resource-locked-error.js +25 -0
  206. package/dist/scw/errors/standard/resource-not-found-error.js +25 -0
  207. package/dist/scw/errors/standard/too-many-requests-error.js +70 -0
  208. package/dist/scw/errors/standard/transient-state-error.js +26 -0
  209. package/dist/scw/errors/types.js +23 -0
  210. package/dist/scw/fetch/build-fetcher.js +72 -0
  211. package/dist/scw/fetch/http-dumper.js +54 -0
  212. package/dist/scw/fetch/http-interceptors.js +99 -0
  213. package/dist/scw/fetch/resource-paginator.js +84 -0
  214. package/dist/scw/fetch/response-parser.js +72 -0
  215. package/package.json +2 -2
@@ -0,0 +1,283 @@
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js';
2
+ import { isJSONObject } from '../../../helpers/json.js';
3
+ import { unmarshalTimeSeries } from '../../../scw/custom-marshalling.js';
4
+ import { unmarshalArrayOfObject, unmarshalDate, resolveOneOf } from '../../../helpers/marshalling.js';
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.
8
+ const unmarshalACLRule = data => {
9
+ if (!isJSONObject(data)) {
10
+ throw new TypeError(`Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`);
11
+ }
12
+ return {
13
+ description: data.description,
14
+ id: data.id,
15
+ ipCidr: data.ip_cidr
16
+ };
17
+ };
18
+ const unmarshalPrivateNetwork = data => {
19
+ if (!isJSONObject(data)) {
20
+ throw new TypeError(`Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`);
21
+ }
22
+ return {
23
+ id: data.id,
24
+ provisioningMode: data.provisioning_mode,
25
+ serviceIps: data.service_ips,
26
+ zone: data.zone
27
+ };
28
+ };
29
+ const unmarshalPublicNetwork = data => {
30
+ if (!isJSONObject(data)) {
31
+ throw new TypeError(`Unmarshalling the type 'PublicNetwork' failed as data isn't a dictionary.`);
32
+ }
33
+ return {};
34
+ };
35
+ const unmarshalEndpoint = data => {
36
+ if (!isJSONObject(data)) {
37
+ throw new TypeError(`Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`);
38
+ }
39
+ return {
40
+ id: data.id,
41
+ ips: data.ips,
42
+ port: data.port,
43
+ privateNetwork: data.private_network ? unmarshalPrivateNetwork(data.private_network) : undefined,
44
+ publicNetwork: data.public_network ? unmarshalPublicNetwork(data.public_network) : undefined
45
+ };
46
+ };
47
+ const unmarshalClusterSetting = data => {
48
+ if (!isJSONObject(data)) {
49
+ throw new TypeError(`Unmarshalling the type 'ClusterSetting' failed as data isn't a dictionary.`);
50
+ }
51
+ return {
52
+ name: data.name,
53
+ value: data.value
54
+ };
55
+ };
56
+ const unmarshalCluster = data => {
57
+ if (!isJSONObject(data)) {
58
+ throw new TypeError(`Unmarshalling the type 'Cluster' failed as data isn't a dictionary.`);
59
+ }
60
+ return {
61
+ aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule),
62
+ clusterSettings: unmarshalArrayOfObject(data.cluster_settings, unmarshalClusterSetting),
63
+ clusterSize: data.cluster_size,
64
+ createdAt: unmarshalDate(data.created_at),
65
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
66
+ id: data.id,
67
+ name: data.name,
68
+ nodeType: data.node_type,
69
+ projectId: data.project_id,
70
+ status: data.status,
71
+ tags: data.tags,
72
+ tlsEnabled: data.tls_enabled,
73
+ updatedAt: unmarshalDate(data.updated_at),
74
+ upgradableVersions: data.upgradable_versions,
75
+ userName: data.user_name,
76
+ version: data.version,
77
+ zone: data.zone
78
+ };
79
+ };
80
+ const unmarshalAddAclRulesResponse = data => {
81
+ if (!isJSONObject(data)) {
82
+ throw new TypeError(`Unmarshalling the type 'AddAclRulesResponse' failed as data isn't a dictionary.`);
83
+ }
84
+ return {
85
+ aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule),
86
+ totalCount: data.total_count
87
+ };
88
+ };
89
+ const unmarshalAddEndpointsResponse = data => {
90
+ if (!isJSONObject(data)) {
91
+ throw new TypeError(`Unmarshalling the type 'AddEndpointsResponse' failed as data isn't a dictionary.`);
92
+ }
93
+ return {
94
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
95
+ totalCount: data.total_count
96
+ };
97
+ };
98
+ const unmarshalClusterMetricsResponse = data => {
99
+ if (!isJSONObject(data)) {
100
+ throw new TypeError(`Unmarshalling the type 'ClusterMetricsResponse' failed as data isn't a dictionary.`);
101
+ }
102
+ return {
103
+ timeseries: unmarshalArrayOfObject(data.timeseries, unmarshalTimeSeries)
104
+ };
105
+ };
106
+ const unmarshalClusterSettingsResponse = data => {
107
+ if (!isJSONObject(data)) {
108
+ throw new TypeError(`Unmarshalling the type 'ClusterSettingsResponse' failed as data isn't a dictionary.`);
109
+ }
110
+ return {
111
+ settings: unmarshalArrayOfObject(data.settings, unmarshalClusterSetting)
112
+ };
113
+ };
114
+ const unmarshalAvailableClusterSetting = data => {
115
+ if (!isJSONObject(data)) {
116
+ throw new TypeError(`Unmarshalling the type 'AvailableClusterSetting' failed as data isn't a dictionary.`);
117
+ }
118
+ return {
119
+ defaultValue: data.default_value,
120
+ deprecated: data.deprecated,
121
+ description: data.description,
122
+ maxValue: data.max_value,
123
+ minValue: data.min_value,
124
+ name: data.name,
125
+ regex: data.regex,
126
+ type: data.type
127
+ };
128
+ };
129
+ const unmarshalClusterVersion = data => {
130
+ if (!isJSONObject(data)) {
131
+ throw new TypeError(`Unmarshalling the type 'ClusterVersion' failed as data isn't a dictionary.`);
132
+ }
133
+ return {
134
+ availableSettings: unmarshalArrayOfObject(data.available_settings, unmarshalAvailableClusterSetting),
135
+ endOfLifeAt: unmarshalDate(data.end_of_life_at),
136
+ logoUrl: data.logo_url,
137
+ version: data.version,
138
+ zone: data.zone
139
+ };
140
+ };
141
+ const unmarshalListClusterVersionsResponse = data => {
142
+ if (!isJSONObject(data)) {
143
+ throw new TypeError(`Unmarshalling the type 'ListClusterVersionsResponse' failed as data isn't a dictionary.`);
144
+ }
145
+ return {
146
+ totalCount: data.total_count,
147
+ versions: unmarshalArrayOfObject(data.versions, unmarshalClusterVersion)
148
+ };
149
+ };
150
+ const unmarshalListClustersResponse = data => {
151
+ if (!isJSONObject(data)) {
152
+ throw new TypeError(`Unmarshalling the type 'ListClustersResponse' failed as data isn't a dictionary.`);
153
+ }
154
+ return {
155
+ clusters: unmarshalArrayOfObject(data.clusters, unmarshalCluster),
156
+ totalCount: data.total_count
157
+ };
158
+ };
159
+ const unmarshalNodeType = data => {
160
+ if (!isJSONObject(data)) {
161
+ throw new TypeError(`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`);
162
+ }
163
+ return {
164
+ beta: data.beta,
165
+ description: data.description,
166
+ disabled: data.disabled,
167
+ memory: data.memory,
168
+ name: data.name,
169
+ stockStatus: data.stock_status,
170
+ vcpus: data.vcpus,
171
+ zone: data.zone
172
+ };
173
+ };
174
+ const unmarshalListNodeTypesResponse = data => {
175
+ if (!isJSONObject(data)) {
176
+ throw new TypeError(`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`);
177
+ }
178
+ return {
179
+ nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
180
+ totalCount: data.total_count
181
+ };
182
+ };
183
+ const unmarshalSetAclRulesResponse = data => {
184
+ if (!isJSONObject(data)) {
185
+ throw new TypeError(`Unmarshalling the type 'SetAclRulesResponse' failed as data isn't a dictionary.`);
186
+ }
187
+ return {
188
+ aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule)
189
+ };
190
+ };
191
+ const unmarshalSetEndpointsResponse = data => {
192
+ if (!isJSONObject(data)) {
193
+ throw new TypeError(`Unmarshalling the type 'SetEndpointsResponse' failed as data isn't a dictionary.`);
194
+ }
195
+ return {
196
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint)
197
+ };
198
+ };
199
+ const marshalACLRuleSpec = (request, defaults) => ({
200
+ description: request.description,
201
+ ip_cidr: request.ipCidr
202
+ });
203
+ const marshalAddAclRulesRequest = (request, defaults) => ({
204
+ acl_rules: request.aclRules.map(elt => marshalACLRuleSpec(elt))
205
+ });
206
+ const marshalClusterSetting = (request, defaults) => ({
207
+ name: request.name,
208
+ value: request.value
209
+ });
210
+ const marshalAddClusterSettingsRequest = (request, defaults) => ({
211
+ settings: request.settings.map(elt => marshalClusterSetting(elt))
212
+ });
213
+ const marshalEndpointSpecPrivateNetworkSpecIpamConfig = (request, defaults) => ({});
214
+ const marshalEndpointSpecPrivateNetworkSpec = (request, defaults) => ({
215
+ id: request.id,
216
+ ipam_config: request.ipamConfig !== undefined ? marshalEndpointSpecPrivateNetworkSpecIpamConfig(request.ipamConfig) : undefined,
217
+ service_ips: request.serviceIps
218
+ });
219
+ const marshalEndpointSpecPublicNetworkSpec = (request, defaults) => ({});
220
+ const marshalEndpointSpec = (request, defaults) => ({
221
+ ...resolveOneOf([{
222
+ param: 'private_network',
223
+ value: request.privateNetwork !== undefined ? marshalEndpointSpecPrivateNetworkSpec(request.privateNetwork) : undefined
224
+ }, {
225
+ param: 'public_network',
226
+ value: request.publicNetwork !== undefined ? marshalEndpointSpecPublicNetworkSpec(request.publicNetwork) : undefined
227
+ }])
228
+ });
229
+ const marshalAddEndpointsRequest = (request, defaults) => ({
230
+ endpoints: request.endpoints.map(elt => marshalEndpointSpec(elt))
231
+ });
232
+ const marshalCreateClusterRequest = (request, defaults) => ({
233
+ acl_rules: request.aclRules !== undefined ? request.aclRules.map(elt => marshalACLRuleSpec(elt)) : undefined,
234
+ cluster_settings: request.clusterSettings !== undefined ? request.clusterSettings.map(elt => marshalClusterSetting(elt)) : undefined,
235
+ cluster_size: request.clusterSize,
236
+ endpoints: request.endpoints !== undefined ? request.endpoints.map(elt => marshalEndpointSpec(elt)) : undefined,
237
+ name: request.name || randomName('ins'),
238
+ node_type: request.nodeType,
239
+ password: request.password,
240
+ project_id: request.projectId ?? defaults.defaultProjectId,
241
+ tags: request.tags,
242
+ tls_enabled: request.tlsEnabled,
243
+ user_name: request.userName,
244
+ version: request.version
245
+ });
246
+ const marshalMigrateClusterRequest = (request, defaults) => ({
247
+ ...resolveOneOf([{
248
+ param: 'version',
249
+ value: request.version
250
+ }, {
251
+ param: 'node_type',
252
+ value: request.nodeType
253
+ }, {
254
+ param: 'cluster_size',
255
+ value: request.clusterSize
256
+ }])
257
+ });
258
+ const marshalSetAclRulesRequest = (request, defaults) => ({
259
+ acl_rules: request.aclRules.map(elt => marshalACLRuleSpec(elt))
260
+ });
261
+ const marshalSetClusterSettingsRequest = (request, defaults) => ({
262
+ settings: request.settings.map(elt => marshalClusterSetting(elt))
263
+ });
264
+ const marshalSetEndpointsRequest = (request, defaults) => ({
265
+ endpoints: request.endpoints.map(elt => marshalEndpointSpec(elt))
266
+ });
267
+ const marshalUpdateClusterRequest = (request, defaults) => ({
268
+ name: request.name,
269
+ password: request.password,
270
+ tags: request.tags,
271
+ user_name: request.userName
272
+ });
273
+ const marshalUpdateEndpointRequest = (request, defaults) => ({
274
+ ...resolveOneOf([{
275
+ param: 'private_network',
276
+ value: request.privateNetwork !== undefined ? marshalEndpointSpecPrivateNetworkSpec(request.privateNetwork) : undefined
277
+ }, {
278
+ param: 'public_network',
279
+ value: request.publicNetwork !== undefined ? marshalEndpointSpecPublicNetworkSpec(request.publicNetwork) : undefined
280
+ }])
281
+ });
282
+
283
+ export { marshalAddAclRulesRequest, marshalAddClusterSettingsRequest, marshalAddEndpointsRequest, marshalCreateClusterRequest, marshalMigrateClusterRequest, marshalSetAclRulesRequest, marshalSetClusterSettingsRequest, marshalSetEndpointsRequest, marshalUpdateClusterRequest, marshalUpdateEndpointRequest, unmarshalACLRule, unmarshalAddAclRulesResponse, unmarshalAddEndpointsResponse, unmarshalCluster, unmarshalClusterMetricsResponse, unmarshalClusterSettingsResponse, unmarshalEndpoint, unmarshalListClusterVersionsResponse, unmarshalListClustersResponse, unmarshalListNodeTypesResponse, unmarshalSetAclRulesResponse, unmarshalSetEndpointsResponse };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1/index.gen.js';
2
+ export { index_gen as v1 };
@@ -0,0 +1,252 @@
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 { NAMESPACE_TRANSIENT_STATUSES, IMAGE_TRANSIENT_STATUSES, TAG_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { unmarshalListNamespacesResponse, unmarshalNamespace, marshalCreateNamespaceRequest, marshalUpdateNamespaceRequest, unmarshalListImagesResponse, unmarshalImage, marshalUpdateImageRequest, unmarshalListTagsResponse, unmarshalTag } 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
+ /** Container Registry 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
+ pageOfListNamespaces = (() => {
19
+ var _this = this;
20
+ return function (request) {
21
+ if (request === void 0) {
22
+ request = {};
23
+ }
24
+ return _this.client.fetch({
25
+ method: 'GET',
26
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/namespaces`,
27
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId])
28
+ }, unmarshalListNamespacesResponse);
29
+ };
30
+ })();
31
+
32
+ /**
33
+ * List namespaces. List all namespaces in a specified region. By default, the
34
+ * namespaces listed are ordered by creation date in ascending order. This can
35
+ * be modified via the order_by field. You can also define additional
36
+ * parameters for your query, such as the `instance_id` and `project_id`
37
+ * parameters.
38
+ *
39
+ * @param request - The request {@link ListNamespacesRequest}
40
+ * @returns A Promise of ListNamespacesResponse
41
+ */
42
+ listNamespaces = (() => {
43
+ var _this2 = this;
44
+ return function (request) {
45
+ if (request === void 0) {
46
+ request = {};
47
+ }
48
+ return enrichForPagination('namespaces', _this2.pageOfListNamespaces, request);
49
+ };
50
+ })();
51
+
52
+ /**
53
+ * Get a namespace. Retrieve information about a given namespace, specified by
54
+ * its `namespace_id` and region. Full details about the namespace, such as
55
+ * `description`, `project_id`, `status`, `endpoint`, `is_public`, `size`, and
56
+ * `image_count` are returned in the response.
57
+ *
58
+ * @param request - The request {@link GetNamespaceRequest}
59
+ * @returns A Promise of Namespace
60
+ */
61
+ getNamespace = request => this.client.fetch({
62
+ method: 'GET',
63
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam('namespaceId', request.namespaceId)}`
64
+ }, unmarshalNamespace);
65
+
66
+ /**
67
+ * Waits for {@link Namespace} to be in a final state.
68
+ *
69
+ * @param request - The request {@link GetNamespaceRequest}
70
+ * @param options - The waiting options
71
+ * @returns A Promise of Namespace
72
+ */
73
+ waitForNamespace = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!NAMESPACE_TRANSIENT_STATUSES.includes(res.status))), this.getNamespace, request, options);
74
+
75
+ /**
76
+ * Create a namespace. Create a new Container Registry namespace. You must
77
+ * specify the namespace name and region in which you want it to be created.
78
+ * Optionally, you can specify the `project_id` and `is_public` in the request
79
+ * payload.
80
+ *
81
+ * @param request - The request {@link CreateNamespaceRequest}
82
+ * @returns A Promise of Namespace
83
+ */
84
+ createNamespace = request => this.client.fetch({
85
+ body: JSON.stringify(marshalCreateNamespaceRequest(request, this.client.settings)),
86
+ headers: jsonContentHeaders,
87
+ method: 'POST',
88
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces`
89
+ }, unmarshalNamespace);
90
+
91
+ /**
92
+ * Update a namespace. Update the parameters of a given namespace, specified
93
+ * by its `namespace_id` and `region`. You can update the `description` and
94
+ * `is_public` parameters.
95
+ *
96
+ * @param request - The request {@link UpdateNamespaceRequest}
97
+ * @returns A Promise of Namespace
98
+ */
99
+ updateNamespace = request => this.client.fetch({
100
+ body: JSON.stringify(marshalUpdateNamespaceRequest(request, this.client.settings)),
101
+ headers: jsonContentHeaders,
102
+ method: 'PATCH',
103
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam('namespaceId', request.namespaceId)}`
104
+ }, unmarshalNamespace);
105
+
106
+ /**
107
+ * Delete a namespace. Delete a given namespace. You must specify, in the
108
+ * endpoint, the `region` and `namespace_id` parameters of the namespace you
109
+ * want to delete.
110
+ *
111
+ * @param request - The request {@link DeleteNamespaceRequest}
112
+ * @returns A Promise of Namespace
113
+ */
114
+ deleteNamespace = request => this.client.fetch({
115
+ method: 'DELETE',
116
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam('namespaceId', request.namespaceId)}`
117
+ }, unmarshalNamespace);
118
+ pageOfListImages = (() => {
119
+ var _this3 = this;
120
+ return function (request) {
121
+ if (request === void 0) {
122
+ request = {};
123
+ }
124
+ return _this3.client.fetch({
125
+ method: 'GET',
126
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/images`,
127
+ urlParams: urlParams(['name', request.name], ['namespace_id', request.namespaceId], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['project_id', request.projectId])
128
+ }, unmarshalListImagesResponse);
129
+ };
130
+ })();
131
+
132
+ /**
133
+ * List images. List all images in a specified region. By default, the images
134
+ * listed are ordered by creation date in ascending order. This can be
135
+ * modified via the order_by field. You can also define additional parameters
136
+ * for your query, such as the `namespace_id` and `project_id` parameters.
137
+ *
138
+ * @param request - The request {@link ListImagesRequest}
139
+ * @returns A Promise of ListImagesResponse
140
+ */
141
+ listImages = (() => {
142
+ var _this4 = this;
143
+ return function (request) {
144
+ if (request === void 0) {
145
+ request = {};
146
+ }
147
+ return enrichForPagination('images', _this4.pageOfListImages, request);
148
+ };
149
+ })();
150
+
151
+ /**
152
+ * Get an image. Retrieve information about a given container image, specified
153
+ * by its `image_id` and region. Full details about the image, such as `name`,
154
+ * `namespace_id`, `status`, `visibility`, and `size` are returned in the
155
+ * response.
156
+ *
157
+ * @param request - The request {@link GetImageRequest}
158
+ * @returns A Promise of Image
159
+ */
160
+ getImage = request => this.client.fetch({
161
+ method: 'GET',
162
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/images/${validatePathParam('imageId', request.imageId)}`
163
+ }, unmarshalImage);
164
+
165
+ /**
166
+ * Waits for {@link Image} to be in a final state.
167
+ *
168
+ * @param request - The request {@link GetImageRequest}
169
+ * @param options - The waiting options
170
+ * @returns A Promise of Image
171
+ */
172
+ waitForImage = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!IMAGE_TRANSIENT_STATUSES.includes(res.status))), this.getImage, request, options);
173
+
174
+ /**
175
+ * Update an image. Update the parameters of a given image, specified by its
176
+ * `image_id` and `region`. You can update the `visibility` parameter.
177
+ *
178
+ * @param request - The request {@link UpdateImageRequest}
179
+ * @returns A Promise of Image
180
+ */
181
+ updateImage = request => this.client.fetch({
182
+ body: JSON.stringify(marshalUpdateImageRequest(request, this.client.settings)),
183
+ headers: jsonContentHeaders,
184
+ method: 'PATCH',
185
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/images/${validatePathParam('imageId', request.imageId)}`
186
+ }, unmarshalImage);
187
+
188
+ /**
189
+ * Delete an image. Delete a given image. You must specify, in the endpoint,
190
+ * the `region` and `image_id` parameters of the image you want to delete.
191
+ *
192
+ * @param request - The request {@link DeleteImageRequest}
193
+ * @returns A Promise of Image
194
+ */
195
+ deleteImage = request => this.client.fetch({
196
+ method: 'DELETE',
197
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/images/${validatePathParam('imageId', request.imageId)}`
198
+ }, unmarshalImage);
199
+ pageOfListTags = request => this.client.fetch({
200
+ method: 'GET',
201
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/images/${validatePathParam('imageId', request.imageId)}/tags`,
202
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
203
+ }, unmarshalListTagsResponse);
204
+
205
+ /**
206
+ * List tags. List all tags for a given image, specified by region. By
207
+ * default, the tags listed are ordered by creation date in ascending order.
208
+ * This can be modified via the order_by field. You can also define additional
209
+ * parameters for your query, such as the `name`.
210
+ *
211
+ * @param request - The request {@link ListTagsRequest}
212
+ * @returns A Promise of ListTagsResponse
213
+ */
214
+ listTags = request => enrichForPagination('tags', this.pageOfListTags, request);
215
+
216
+ /**
217
+ * Get a tag. Retrieve information about a given image tag, specified by its
218
+ * `tag_id` and region. Full details about the tag, such as `name`,
219
+ * `image_id`, `status`, and `digest` are returned in the response.
220
+ *
221
+ * @param request - The request {@link GetTagRequest}
222
+ * @returns A Promise of Tag
223
+ */
224
+ getTag = request => this.client.fetch({
225
+ method: 'GET',
226
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/tags/${validatePathParam('tagId', request.tagId)}`
227
+ }, unmarshalTag);
228
+
229
+ /**
230
+ * Waits for {@link Tag} to be in a final state.
231
+ *
232
+ * @param request - The request {@link GetTagRequest}
233
+ * @param options - The waiting options
234
+ * @returns A Promise of Tag
235
+ */
236
+ waitForTag = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!TAG_TRANSIENT_STATUSES.includes(res.status))), this.getTag, request, options);
237
+
238
+ /**
239
+ * Delete a tag. Delete a given image tag. You must specify, in the endpoint,
240
+ * the `region` and `tag_id` parameters of the tag you want to delete.
241
+ *
242
+ * @param request - The request {@link DeleteTagRequest}
243
+ * @returns A Promise of Tag
244
+ */
245
+ deleteTag = request => this.client.fetch({
246
+ method: 'DELETE',
247
+ path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/tags/${validatePathParam('tagId', request.tagId)}`,
248
+ urlParams: urlParams(['force', request.force])
249
+ }, unmarshalTag);
250
+ }
251
+
252
+ export { API };
@@ -0,0 +1,13 @@
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 ImageStatus}. */
5
+ const IMAGE_TRANSIENT_STATUSES = ['deleting'];
6
+
7
+ /** Lists transient statutes of the enum {@link NamespaceStatus}. */
8
+ const NAMESPACE_TRANSIENT_STATUSES = ['deleting'];
9
+
10
+ /** Lists transient statutes of the enum {@link TagStatus}. */
11
+ const TAG_TRANSIENT_STATUSES = ['deleting'];
12
+
13
+ export { IMAGE_TRANSIENT_STATUSES, NAMESPACE_TRANSIENT_STATUSES, TAG_TRANSIENT_STATUSES };
@@ -0,0 +1,5 @@
1
+ export { API } from './api.gen.js';
2
+ export { IMAGE_TRANSIENT_STATUSES, NAMESPACE_TRANSIENT_STATUSES, TAG_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,108 @@
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js';
2
+ import { isJSONObject } from '../../../helpers/json.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 unmarshalImage = data => {
8
+ if (!isJSONObject(data)) {
9
+ throw new TypeError(`Unmarshalling the type 'Image' failed as data isn't a dictionary.`);
10
+ }
11
+ return {
12
+ createdAt: 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: unmarshalDate(data.updated_at),
21
+ visibility: data.visibility
22
+ };
23
+ };
24
+ const unmarshalNamespace = data => {
25
+ if (!isJSONObject(data)) {
26
+ throw new TypeError(`Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`);
27
+ }
28
+ return {
29
+ createdAt: unmarshalDate(data.created_at),
30
+ description: data.description,
31
+ endpoint: data.endpoint,
32
+ id: data.id,
33
+ imageCount: data.image_count,
34
+ isPublic: data.is_public,
35
+ name: data.name,
36
+ organizationId: data.organization_id,
37
+ projectId: data.project_id,
38
+ region: data.region,
39
+ size: data.size,
40
+ status: data.status,
41
+ statusMessage: data.status_message,
42
+ updatedAt: unmarshalDate(data.updated_at)
43
+ };
44
+ };
45
+ const unmarshalTag = data => {
46
+ if (!isJSONObject(data)) {
47
+ throw new TypeError(`Unmarshalling the type 'Tag' failed as data isn't a dictionary.`);
48
+ }
49
+ return {
50
+ createdAt: unmarshalDate(data.created_at),
51
+ digest: data.digest,
52
+ id: data.id,
53
+ imageId: data.image_id,
54
+ name: data.name,
55
+ status: data.status,
56
+ updatedAt: unmarshalDate(data.updated_at)
57
+ };
58
+ };
59
+ const unmarshalListImagesResponse = data => {
60
+ if (!isJSONObject(data)) {
61
+ throw new TypeError(`Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`);
62
+ }
63
+ return {
64
+ images: unmarshalArrayOfObject(data.images, unmarshalImage),
65
+ totalCount: data.total_count
66
+ };
67
+ };
68
+ const unmarshalListNamespacesResponse = data => {
69
+ if (!isJSONObject(data)) {
70
+ throw new TypeError(`Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`);
71
+ }
72
+ return {
73
+ namespaces: unmarshalArrayOfObject(data.namespaces, unmarshalNamespace),
74
+ totalCount: data.total_count
75
+ };
76
+ };
77
+ const unmarshalListTagsResponse = data => {
78
+ if (!isJSONObject(data)) {
79
+ throw new TypeError(`Unmarshalling the type 'ListTagsResponse' failed as data isn't a dictionary.`);
80
+ }
81
+ return {
82
+ tags: unmarshalArrayOfObject(data.tags, unmarshalTag),
83
+ totalCount: data.total_count
84
+ };
85
+ };
86
+ const marshalCreateNamespaceRequest = (request, defaults) => ({
87
+ description: request.description,
88
+ is_public: request.isPublic,
89
+ name: request.name || randomName('ns'),
90
+ ...resolveOneOf([{
91
+ default: defaults.defaultOrganizationId,
92
+ param: 'organization_id',
93
+ value: request.organizationId
94
+ }, {
95
+ default: defaults.defaultProjectId,
96
+ param: 'project_id',
97
+ value: request.projectId
98
+ }])
99
+ });
100
+ const marshalUpdateImageRequest = (request, defaults) => ({
101
+ visibility: request.visibility
102
+ });
103
+ const marshalUpdateNamespaceRequest = (request, defaults) => ({
104
+ description: request.description,
105
+ is_public: request.isPublic
106
+ });
107
+
108
+ export { marshalCreateNamespaceRequest, marshalUpdateImageRequest, marshalUpdateNamespaceRequest, unmarshalImage, unmarshalListImagesResponse, unmarshalListNamespacesResponse, unmarshalListTagsResponse, unmarshalNamespace, unmarshalTag };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };