@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,359 @@
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 unmarshalDHCP = data => {
8
+ if (!isJSONObject(data)) {
9
+ throw new TypeError(`Unmarshalling the type 'DHCP' failed as data isn't a dictionary.`);
10
+ }
11
+ return {
12
+ address: data.address,
13
+ createdAt: unmarshalDate(data.created_at),
14
+ dnsLocalName: data.dns_local_name,
15
+ dnsSearch: data.dns_search,
16
+ dnsServersOverride: data.dns_servers_override,
17
+ enableDynamic: data.enable_dynamic,
18
+ id: data.id,
19
+ organizationId: data.organization_id,
20
+ poolHigh: data.pool_high,
21
+ poolLow: data.pool_low,
22
+ projectId: data.project_id,
23
+ pushDefaultRoute: data.push_default_route,
24
+ pushDnsServer: data.push_dns_server,
25
+ rebindTimer: data.rebind_timer,
26
+ renewTimer: data.renew_timer,
27
+ subnet: data.subnet,
28
+ updatedAt: unmarshalDate(data.updated_at),
29
+ validLifetime: data.valid_lifetime,
30
+ zone: data.zone
31
+ };
32
+ };
33
+ const unmarshalIpamConfig = data => {
34
+ if (!isJSONObject(data)) {
35
+ throw new TypeError(`Unmarshalling the type 'IpamConfig' failed as data isn't a dictionary.`);
36
+ }
37
+ return {
38
+ pushDefaultRoute: data.push_default_route
39
+ };
40
+ };
41
+ const unmarshalGatewayNetwork = data => {
42
+ if (!isJSONObject(data)) {
43
+ throw new TypeError(`Unmarshalling the type 'GatewayNetwork' failed as data isn't a dictionary.`);
44
+ }
45
+ return {
46
+ address: data.address,
47
+ createdAt: unmarshalDate(data.created_at),
48
+ dhcp: data.dhcp ? unmarshalDHCP(data.dhcp) : undefined,
49
+ enableDhcp: data.enable_dhcp,
50
+ enableMasquerade: data.enable_masquerade,
51
+ gatewayId: data.gateway_id,
52
+ id: data.id,
53
+ ipamConfig: data.ipam_config ? unmarshalIpamConfig(data.ipam_config) : undefined,
54
+ macAddress: data.mac_address,
55
+ privateNetworkId: data.private_network_id,
56
+ status: data.status,
57
+ updatedAt: unmarshalDate(data.updated_at),
58
+ zone: data.zone
59
+ };
60
+ };
61
+ const unmarshalIP = data => {
62
+ if (!isJSONObject(data)) {
63
+ throw new TypeError(`Unmarshalling the type 'IP' failed as data isn't a dictionary.`);
64
+ }
65
+ return {
66
+ address: data.address,
67
+ createdAt: unmarshalDate(data.created_at),
68
+ gatewayId: data.gateway_id,
69
+ id: data.id,
70
+ organizationId: data.organization_id,
71
+ projectId: data.project_id,
72
+ reverse: data.reverse,
73
+ tags: data.tags,
74
+ updatedAt: unmarshalDate(data.updated_at),
75
+ zone: data.zone
76
+ };
77
+ };
78
+ const unmarshalDHCPEntry = data => {
79
+ if (!isJSONObject(data)) {
80
+ throw new TypeError(`Unmarshalling the type 'DHCPEntry' failed as data isn't a dictionary.`);
81
+ }
82
+ return {
83
+ createdAt: unmarshalDate(data.created_at),
84
+ gatewayNetworkId: data.gateway_network_id,
85
+ hostname: data.hostname,
86
+ id: data.id,
87
+ ipAddress: data.ip_address,
88
+ macAddress: data.mac_address,
89
+ type: data.type,
90
+ updatedAt: unmarshalDate(data.updated_at),
91
+ zone: data.zone
92
+ };
93
+ };
94
+ const unmarshalGatewayType = data => {
95
+ if (!isJSONObject(data)) {
96
+ throw new TypeError(`Unmarshalling the type 'GatewayType' failed as data isn't a dictionary.`);
97
+ }
98
+ return {
99
+ bandwidth: data.bandwidth,
100
+ name: data.name,
101
+ zone: data.zone
102
+ };
103
+ };
104
+ const unmarshalGateway = data => {
105
+ if (!isJSONObject(data)) {
106
+ throw new TypeError(`Unmarshalling the type 'Gateway' failed as data isn't a dictionary.`);
107
+ }
108
+ return {
109
+ bastionEnabled: data.bastion_enabled,
110
+ bastionPort: data.bastion_port,
111
+ canUpgradeTo: data.can_upgrade_to,
112
+ createdAt: unmarshalDate(data.created_at),
113
+ gatewayNetworks: unmarshalArrayOfObject(data.gateway_networks, unmarshalGatewayNetwork),
114
+ id: data.id,
115
+ ip: data.ip ? unmarshalIP(data.ip) : undefined,
116
+ isLegacy: data.is_legacy,
117
+ name: data.name,
118
+ organizationId: data.organization_id,
119
+ projectId: data.project_id,
120
+ smtpEnabled: data.smtp_enabled,
121
+ status: data.status,
122
+ tags: data.tags,
123
+ type: data.type ? unmarshalGatewayType(data.type) : undefined,
124
+ updatedAt: unmarshalDate(data.updated_at),
125
+ upstreamDnsServers: data.upstream_dns_servers,
126
+ version: data.version,
127
+ zone: data.zone
128
+ };
129
+ };
130
+ const unmarshalPATRule = data => {
131
+ if (!isJSONObject(data)) {
132
+ throw new TypeError(`Unmarshalling the type 'PATRule' failed as data isn't a dictionary.`);
133
+ }
134
+ return {
135
+ createdAt: unmarshalDate(data.created_at),
136
+ gatewayId: data.gateway_id,
137
+ id: data.id,
138
+ privateIp: data.private_ip,
139
+ privatePort: data.private_port,
140
+ protocol: data.protocol,
141
+ publicPort: data.public_port,
142
+ updatedAt: unmarshalDate(data.updated_at),
143
+ zone: data.zone
144
+ };
145
+ };
146
+ const unmarshalListDHCPEntriesResponse = data => {
147
+ if (!isJSONObject(data)) {
148
+ throw new TypeError(`Unmarshalling the type 'ListDHCPEntriesResponse' failed as data isn't a dictionary.`);
149
+ }
150
+ return {
151
+ dhcpEntries: unmarshalArrayOfObject(data.dhcp_entries, unmarshalDHCPEntry),
152
+ totalCount: data.total_count
153
+ };
154
+ };
155
+ const unmarshalListDHCPsResponse = data => {
156
+ if (!isJSONObject(data)) {
157
+ throw new TypeError(`Unmarshalling the type 'ListDHCPsResponse' failed as data isn't a dictionary.`);
158
+ }
159
+ return {
160
+ dhcps: unmarshalArrayOfObject(data.dhcps, unmarshalDHCP),
161
+ totalCount: data.total_count
162
+ };
163
+ };
164
+ const unmarshalListGatewayNetworksResponse = data => {
165
+ if (!isJSONObject(data)) {
166
+ throw new TypeError(`Unmarshalling the type 'ListGatewayNetworksResponse' failed as data isn't a dictionary.`);
167
+ }
168
+ return {
169
+ gatewayNetworks: unmarshalArrayOfObject(data.gateway_networks, unmarshalGatewayNetwork),
170
+ totalCount: data.total_count
171
+ };
172
+ };
173
+ const unmarshalListGatewayTypesResponse = data => {
174
+ if (!isJSONObject(data)) {
175
+ throw new TypeError(`Unmarshalling the type 'ListGatewayTypesResponse' failed as data isn't a dictionary.`);
176
+ }
177
+ return {
178
+ types: unmarshalArrayOfObject(data.types, unmarshalGatewayType)
179
+ };
180
+ };
181
+ const unmarshalListGatewaysResponse = data => {
182
+ if (!isJSONObject(data)) {
183
+ throw new TypeError(`Unmarshalling the type 'ListGatewaysResponse' failed as data isn't a dictionary.`);
184
+ }
185
+ return {
186
+ gateways: unmarshalArrayOfObject(data.gateways, unmarshalGateway),
187
+ totalCount: data.total_count
188
+ };
189
+ };
190
+ const unmarshalListIPsResponse = data => {
191
+ if (!isJSONObject(data)) {
192
+ throw new TypeError(`Unmarshalling the type 'ListIPsResponse' failed as data isn't a dictionary.`);
193
+ }
194
+ return {
195
+ ips: unmarshalArrayOfObject(data.ips, unmarshalIP),
196
+ totalCount: data.total_count
197
+ };
198
+ };
199
+ const unmarshalListPATRulesResponse = data => {
200
+ if (!isJSONObject(data)) {
201
+ throw new TypeError(`Unmarshalling the type 'ListPATRulesResponse' failed as data isn't a dictionary.`);
202
+ }
203
+ return {
204
+ patRules: unmarshalArrayOfObject(data.pat_rules, unmarshalPATRule),
205
+ totalCount: data.total_count
206
+ };
207
+ };
208
+ const unmarshalSetDHCPEntriesResponse = data => {
209
+ if (!isJSONObject(data)) {
210
+ throw new TypeError(`Unmarshalling the type 'SetDHCPEntriesResponse' failed as data isn't a dictionary.`);
211
+ }
212
+ return {
213
+ dhcpEntries: unmarshalArrayOfObject(data.dhcp_entries, unmarshalDHCPEntry)
214
+ };
215
+ };
216
+ const unmarshalSetPATRulesResponse = data => {
217
+ if (!isJSONObject(data)) {
218
+ throw new TypeError(`Unmarshalling the type 'SetPATRulesResponse' failed as data isn't a dictionary.`);
219
+ }
220
+ return {
221
+ patRules: unmarshalArrayOfObject(data.pat_rules, unmarshalPATRule)
222
+ };
223
+ };
224
+ const marshalCreateDHCPRequest = (request, defaults) => ({
225
+ address: request.address,
226
+ dns_local_name: request.dnsLocalName,
227
+ dns_search: request.dnsSearch,
228
+ dns_servers_override: request.dnsServersOverride,
229
+ enable_dynamic: request.enableDynamic,
230
+ pool_high: request.poolHigh,
231
+ pool_low: request.poolLow,
232
+ project_id: request.projectId ?? defaults.defaultProjectId,
233
+ push_default_route: request.pushDefaultRoute,
234
+ push_dns_server: request.pushDnsServer,
235
+ rebind_timer: request.rebindTimer,
236
+ renew_timer: request.renewTimer,
237
+ subnet: request.subnet,
238
+ valid_lifetime: request.validLifetime
239
+ });
240
+ const marshalCreateDHCPEntryRequest = (request, defaults) => ({
241
+ gateway_network_id: request.gatewayNetworkId,
242
+ ip_address: request.ipAddress,
243
+ mac_address: request.macAddress
244
+ });
245
+ const marshalIpamConfig = (request, defaults) => ({
246
+ push_default_route: request.pushDefaultRoute
247
+ });
248
+ const marshalCreateGatewayNetworkRequest = (request, defaults) => ({
249
+ enable_dhcp: request.enableDhcp,
250
+ enable_masquerade: request.enableMasquerade,
251
+ gateway_id: request.gatewayId,
252
+ private_network_id: request.privateNetworkId,
253
+ ...resolveOneOf([{
254
+ param: 'dhcp_id',
255
+ value: request.dhcpId
256
+ }, {
257
+ param: 'dhcp',
258
+ value: request.dhcp !== undefined ? marshalCreateDHCPRequest(request.dhcp, defaults) : undefined
259
+ }, {
260
+ param: 'address',
261
+ value: request.address
262
+ }, {
263
+ param: 'ipam_config',
264
+ value: request.ipamConfig !== undefined ? marshalIpamConfig(request.ipamConfig) : undefined
265
+ }])
266
+ });
267
+ const marshalCreateGatewayRequest = (request, defaults) => ({
268
+ bastion_port: request.bastionPort,
269
+ enable_bastion: request.enableBastion,
270
+ enable_smtp: request.enableSmtp,
271
+ ip_id: request.ipId,
272
+ name: request.name || randomName('gw'),
273
+ project_id: request.projectId ?? defaults.defaultProjectId,
274
+ tags: request.tags,
275
+ type: request.type,
276
+ upstream_dns_servers: request.upstreamDnsServers
277
+ });
278
+ const marshalCreateIPRequest = (request, defaults) => ({
279
+ project_id: request.projectId ?? defaults.defaultProjectId,
280
+ tags: request.tags
281
+ });
282
+ const marshalCreatePATRuleRequest = (request, defaults) => ({
283
+ gateway_id: request.gatewayId,
284
+ private_ip: request.privateIp,
285
+ private_port: request.privatePort,
286
+ protocol: request.protocol,
287
+ public_port: request.publicPort
288
+ });
289
+ const marshalSetDHCPEntriesRequestEntry = (request, defaults) => ({
290
+ ip_address: request.ipAddress,
291
+ mac_address: request.macAddress
292
+ });
293
+ const marshalSetDHCPEntriesRequest = (request, defaults) => ({
294
+ dhcp_entries: request.dhcpEntries !== undefined ? request.dhcpEntries.map(elt => marshalSetDHCPEntriesRequestEntry(elt)) : undefined,
295
+ gateway_network_id: request.gatewayNetworkId
296
+ });
297
+ const marshalSetPATRulesRequestRule = (request, defaults) => ({
298
+ private_ip: request.privateIp,
299
+ private_port: request.privatePort,
300
+ protocol: request.protocol,
301
+ public_port: request.publicPort
302
+ });
303
+ const marshalSetPATRulesRequest = (request, defaults) => ({
304
+ gateway_id: request.gatewayId,
305
+ pat_rules: request.patRules.map(elt => marshalSetPATRulesRequestRule(elt))
306
+ });
307
+ const marshalUpdateDHCPEntryRequest = (request, defaults) => ({
308
+ ip_address: request.ipAddress
309
+ });
310
+ const marshalUpdateDHCPRequest = (request, defaults) => ({
311
+ address: request.address,
312
+ dns_local_name: request.dnsLocalName,
313
+ dns_search: request.dnsSearch,
314
+ dns_servers_override: request.dnsServersOverride,
315
+ enable_dynamic: request.enableDynamic,
316
+ pool_high: request.poolHigh,
317
+ pool_low: request.poolLow,
318
+ push_default_route: request.pushDefaultRoute,
319
+ push_dns_server: request.pushDnsServer,
320
+ rebind_timer: request.rebindTimer,
321
+ renew_timer: request.renewTimer,
322
+ subnet: request.subnet,
323
+ valid_lifetime: request.validLifetime
324
+ });
325
+ const marshalUpdateGatewayNetworkRequest = (request, defaults) => ({
326
+ enable_dhcp: request.enableDhcp,
327
+ enable_masquerade: request.enableMasquerade,
328
+ ...resolveOneOf([{
329
+ param: 'dhcp_id',
330
+ value: request.dhcpId
331
+ }, {
332
+ param: 'address',
333
+ value: request.address
334
+ }, {
335
+ param: 'ipam_config',
336
+ value: request.ipamConfig !== undefined ? marshalIpamConfig(request.ipamConfig) : undefined
337
+ }])
338
+ });
339
+ const marshalUpdateGatewayRequest = (request, defaults) => ({
340
+ bastion_port: request.bastionPort,
341
+ enable_bastion: request.enableBastion,
342
+ enable_smtp: request.enableSmtp,
343
+ name: request.name,
344
+ tags: request.tags,
345
+ upstream_dns_servers: request.upstreamDnsServers
346
+ });
347
+ const marshalUpdateIPRequest = (request, defaults) => ({
348
+ gateway_id: request.gatewayId,
349
+ reverse: request.reverse,
350
+ tags: request.tags
351
+ });
352
+ const marshalUpdatePATRuleRequest = (request, defaults) => ({
353
+ private_ip: request.privateIp,
354
+ private_port: request.privatePort,
355
+ protocol: request.protocol,
356
+ public_port: request.publicPort
357
+ });
358
+
359
+ export { marshalCreateDHCPEntryRequest, marshalCreateDHCPRequest, marshalCreateGatewayNetworkRequest, marshalCreateGatewayRequest, marshalCreateIPRequest, marshalCreatePATRuleRequest, marshalSetDHCPEntriesRequest, marshalSetPATRulesRequest, marshalUpdateDHCPEntryRequest, marshalUpdateDHCPRequest, marshalUpdateGatewayNetworkRequest, marshalUpdateGatewayRequest, marshalUpdateIPRequest, marshalUpdatePATRuleRequest, unmarshalDHCP, unmarshalDHCPEntry, unmarshalGateway, unmarshalGatewayNetwork, unmarshalIP, unmarshalListDHCPEntriesResponse, unmarshalListDHCPsResponse, unmarshalListGatewayNetworksResponse, unmarshalListGatewayTypesResponse, unmarshalListGatewaysResponse, unmarshalListIPsResponse, unmarshalListPATRulesResponse, unmarshalPATRule, unmarshalSetDHCPEntriesResponse, unmarshalSetPATRulesResponse };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };
@@ -0,0 +1,158 @@
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 { HOSTING_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { marshalCreateHostingRequest, unmarshalHosting, unmarshalListHostingsResponse, marshalUpdateHostingRequest, unmarshalDnsRecords, unmarshalListOffersResponse } 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
+ /** Web Hosting API. */
15
+ class API extends API$1 {
16
+ /** Lists the available regions of the API. */
17
+ static LOCALITIES = ['fr-par'];
18
+
19
+ /**
20
+ * Order a Web Hosting plan. Order a Web Hosting plan, specifying the offer
21
+ * type required via the `offer_id` parameter.
22
+ *
23
+ * @param request - The request {@link CreateHostingRequest}
24
+ * @returns A Promise of Hosting
25
+ */
26
+ createHosting = request => this.client.fetch({
27
+ body: JSON.stringify(marshalCreateHostingRequest(request, this.client.settings)),
28
+ headers: jsonContentHeaders,
29
+ method: 'POST',
30
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings`
31
+ }, unmarshalHosting);
32
+ pageOfListHostings = (() => {
33
+ var _this = this;
34
+ return function (request) {
35
+ if (request === void 0) {
36
+ request = {};
37
+ }
38
+ return _this.client.fetch({
39
+ method: 'GET',
40
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/hostings`,
41
+ urlParams: urlParams(['domain', request.domain], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId], ['statuses', request.statuses], ['tags', request.tags])
42
+ }, unmarshalListHostingsResponse);
43
+ };
44
+ })();
45
+
46
+ /**
47
+ * List all Web Hosting plans. List all of your existing Web Hosting plans.
48
+ * Various filters are available to limit the results, including filtering by
49
+ * domain, status, tag and Project ID.
50
+ *
51
+ * @param request - The request {@link ListHostingsRequest}
52
+ * @returns A Promise of ListHostingsResponse
53
+ */
54
+ listHostings = (() => {
55
+ var _this2 = this;
56
+ return function (request) {
57
+ if (request === void 0) {
58
+ request = {};
59
+ }
60
+ return enrichForPagination('hostings', _this2.pageOfListHostings, request);
61
+ };
62
+ })();
63
+
64
+ /**
65
+ * Get a Web Hosting plan. Get the details of one of your existing Web Hosting
66
+ * plans, specified by its `hosting_id`.
67
+ *
68
+ * @param request - The request {@link GetHostingRequest}
69
+ * @returns A Promise of Hosting
70
+ */
71
+ getHosting = request => this.client.fetch({
72
+ method: 'GET',
73
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}`
74
+ }, unmarshalHosting);
75
+
76
+ /**
77
+ * Waits for {@link Hosting} to be in a final state.
78
+ *
79
+ * @param request - The request {@link GetHostingRequest}
80
+ * @param options - The waiting options
81
+ * @returns A Promise of Hosting
82
+ */
83
+ waitForHosting = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!HOSTING_TRANSIENT_STATUSES.includes(res.status))), this.getHosting, request, options);
84
+
85
+ /**
86
+ * Update a Web Hosting plan. Update the details of one of your existing Web
87
+ * Hosting plans, specified by its `hosting_id`. You can update parameters
88
+ * including the contact email address, tags, options and offer.
89
+ *
90
+ * @param request - The request {@link UpdateHostingRequest}
91
+ * @returns A Promise of Hosting
92
+ */
93
+ updateHosting = request => this.client.fetch({
94
+ body: JSON.stringify(marshalUpdateHostingRequest(request, this.client.settings)),
95
+ headers: jsonContentHeaders,
96
+ method: 'PATCH',
97
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}`
98
+ }, unmarshalHosting);
99
+
100
+ /**
101
+ * Delete a Web Hosting plan. Delete a Web Hosting plan, specified by its
102
+ * `hosting_id`. Note that deletion is not immediate: it will take place at
103
+ * the end of the calendar month, after which time your Web Hosting plan and
104
+ * all its data (files and emails) will be irreversibly lost.
105
+ *
106
+ * @param request - The request {@link DeleteHostingRequest}
107
+ * @returns A Promise of Hosting
108
+ */
109
+ deleteHosting = request => this.client.fetch({
110
+ method: 'DELETE',
111
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}`
112
+ }, unmarshalHosting);
113
+
114
+ /**
115
+ * Restore a Web Hosting plan. When you [delete a Web Hosting
116
+ * plan](#path-hostings-delete-a-hosting), definitive deletion does not take
117
+ * place until the end of the calendar month. In the time between initiating
118
+ * the deletion, and definitive deletion at the end of the month, you can
119
+ * choose to **restore** the Web Hosting plan, using this endpoint and
120
+ * specifying its `hosting_id`.
121
+ *
122
+ * @param request - The request {@link RestoreHostingRequest}
123
+ * @returns A Promise of Hosting
124
+ */
125
+ restoreHosting = request => this.client.fetch({
126
+ body: '{}',
127
+ headers: jsonContentHeaders,
128
+ method: 'POST',
129
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/hostings/${validatePathParam('hostingId', request.hostingId)}/restore`
130
+ }, unmarshalHosting);
131
+
132
+ /**
133
+ * Get DNS records. Get the set of DNS records of a specified domain
134
+ * associated with a Web Hosting plan.
135
+ *
136
+ * @param request - The request {@link GetDomainDnsRecordsRequest}
137
+ * @returns A Promise of DnsRecords
138
+ */
139
+ getDomainDnsRecords = request => this.client.fetch({
140
+ method: 'GET',
141
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domain', request.domain)}/dns-records`
142
+ }, unmarshalDnsRecords);
143
+
144
+ /**
145
+ * List all offers. List the different Web Hosting offers, and their options,
146
+ * available to order from Scaleway.
147
+ *
148
+ * @param request - The request {@link ListOffersRequest}
149
+ * @returns A Promise of ListOffersResponse
150
+ */
151
+ listOffers = request => this.client.fetch({
152
+ method: 'GET',
153
+ path: `/webhosting/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/offers`,
154
+ urlParams: urlParams(['hosting_id', request.hostingId], ['only_options', request.onlyOptions], ['order_by', request.orderBy], ['without_options', request.withoutOptions])
155
+ }, unmarshalListOffersResponse);
156
+ }
157
+
158
+ 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 HostingStatus}. */
5
+ const HOSTING_TRANSIENT_STATUSES = ['delivering', 'deleting', 'migrating'];
6
+
7
+ export { HOSTING_TRANSIENT_STATUSES };
@@ -0,0 +1,7 @@
1
+ export { API } from './api.gen.js';
2
+ export { HOSTING_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.
@@ -0,0 +1,146 @@
1
+ import { isJSONObject } from '../../../helpers/json.js';
2
+ import { unmarshalMoney } from '../../../scw/custom-marshalling.js';
3
+ import { unmarshalDate, unmarshalArrayOfObject } 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 unmarshalHostingCpanelUrls = data => {
8
+ if (!isJSONObject(data)) {
9
+ throw new TypeError(`Unmarshalling the type 'HostingCpanelUrls' failed as data isn't a dictionary.`);
10
+ }
11
+ return {
12
+ dashboard: data.dashboard,
13
+ webmail: data.webmail
14
+ };
15
+ };
16
+ const unmarshalHostingOption = data => {
17
+ if (!isJSONObject(data)) {
18
+ throw new TypeError(`Unmarshalling the type 'HostingOption' failed as data isn't a dictionary.`);
19
+ }
20
+ return {
21
+ id: data.id,
22
+ name: data.name
23
+ };
24
+ };
25
+ const unmarshalHosting = data => {
26
+ if (!isJSONObject(data)) {
27
+ throw new TypeError(`Unmarshalling the type 'Hosting' failed as data isn't a dictionary.`);
28
+ }
29
+ return {
30
+ cpanelUrls: data.cpanel_urls ? unmarshalHostingCpanelUrls(data.cpanel_urls) : undefined,
31
+ createdAt: unmarshalDate(data.created_at),
32
+ dnsStatus: data.dns_status,
33
+ domain: data.domain,
34
+ id: data.id,
35
+ offerEndOfLife: data.offer_end_of_life,
36
+ offerId: data.offer_id,
37
+ offerName: data.offer_name,
38
+ options: unmarshalArrayOfObject(data.options, unmarshalHostingOption),
39
+ organizationId: data.organization_id,
40
+ platformHostname: data.platform_hostname,
41
+ platformNumber: data.platform_number,
42
+ projectId: data.project_id,
43
+ region: data.region,
44
+ status: data.status,
45
+ tags: data.tags,
46
+ updatedAt: unmarshalDate(data.updated_at),
47
+ username: data.username
48
+ };
49
+ };
50
+ const unmarshalDnsRecord = data => {
51
+ if (!isJSONObject(data)) {
52
+ throw new TypeError(`Unmarshalling the type 'DnsRecord' failed as data isn't a dictionary.`);
53
+ }
54
+ return {
55
+ name: data.name,
56
+ priority: data.priority,
57
+ status: data.status,
58
+ ttl: data.ttl,
59
+ type: data.type,
60
+ value: data.value
61
+ };
62
+ };
63
+ const unmarshalNameserver = data => {
64
+ if (!isJSONObject(data)) {
65
+ throw new TypeError(`Unmarshalling the type 'Nameserver' failed as data isn't a dictionary.`);
66
+ }
67
+ return {
68
+ hostname: data.hostname,
69
+ isDefault: data.is_default,
70
+ status: data.status
71
+ };
72
+ };
73
+ const unmarshalDnsRecords = data => {
74
+ if (!isJSONObject(data)) {
75
+ throw new TypeError(`Unmarshalling the type 'DnsRecords' failed as data isn't a dictionary.`);
76
+ }
77
+ return {
78
+ nameServers: unmarshalArrayOfObject(data.name_servers, unmarshalNameserver),
79
+ records: unmarshalArrayOfObject(data.records, unmarshalDnsRecord),
80
+ status: data.status
81
+ };
82
+ };
83
+ const unmarshalListHostingsResponse = data => {
84
+ if (!isJSONObject(data)) {
85
+ throw new TypeError(`Unmarshalling the type 'ListHostingsResponse' failed as data isn't a dictionary.`);
86
+ }
87
+ return {
88
+ hostings: unmarshalArrayOfObject(data.hostings, unmarshalHosting),
89
+ totalCount: data.total_count
90
+ };
91
+ };
92
+ const unmarshalOfferProduct = data => {
93
+ if (!isJSONObject(data)) {
94
+ throw new TypeError(`Unmarshalling the type 'OfferProduct' failed as data isn't a dictionary.`);
95
+ }
96
+ return {
97
+ databasesQuota: data.databases_quota,
98
+ emailAccountsQuota: data.email_accounts_quota,
99
+ emailStorageQuota: data.email_storage_quota,
100
+ hostingStorageQuota: data.hosting_storage_quota,
101
+ maxAddonDomains: data.max_addon_domains,
102
+ name: data.name,
103
+ option: data.option,
104
+ ram: data.ram,
105
+ supportIncluded: data.support_included,
106
+ vCpu: data.v_cpu
107
+ };
108
+ };
109
+ const unmarshalOffer = data => {
110
+ if (!isJSONObject(data)) {
111
+ throw new TypeError(`Unmarshalling the type 'Offer' failed as data isn't a dictionary.`);
112
+ }
113
+ return {
114
+ available: data.available,
115
+ billingOperationPath: data.billing_operation_path,
116
+ endOfLife: data.end_of_life,
117
+ id: data.id,
118
+ price: data.price ? unmarshalMoney(data.price) : undefined,
119
+ product: data.product ? unmarshalOfferProduct(data.product) : undefined,
120
+ quotaWarnings: data.quota_warnings
121
+ };
122
+ };
123
+ const unmarshalListOffersResponse = data => {
124
+ if (!isJSONObject(data)) {
125
+ throw new TypeError(`Unmarshalling the type 'ListOffersResponse' failed as data isn't a dictionary.`);
126
+ }
127
+ return {
128
+ offers: unmarshalArrayOfObject(data.offers, unmarshalOffer)
129
+ };
130
+ };
131
+ const marshalCreateHostingRequest = (request, defaults) => ({
132
+ domain: request.domain,
133
+ email: request.email,
134
+ offer_id: request.offerId,
135
+ option_ids: request.optionIds,
136
+ project_id: request.projectId ?? defaults.defaultProjectId,
137
+ tags: request.tags
138
+ });
139
+ const marshalUpdateHostingRequest = (request, defaults) => ({
140
+ email: request.email,
141
+ offer_id: request.offerId,
142
+ option_ids: request.optionIds,
143
+ tags: request.tags
144
+ });
145
+
146
+ export { marshalCreateHostingRequest, marshalUpdateHostingRequest, unmarshalDnsRecords, unmarshalHosting, unmarshalListHostingsResponse, unmarshalListOffersResponse };