@scaleway/sdk 0.1.0-beta.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +1 -1
  2. package/dist/api/account/index.js +2 -2
  3. package/dist/api/account/v2/api.gen.js +5 -18
  4. package/dist/api/account/v2/index.gen.js +3 -0
  5. package/dist/api/account/v2/marshalling.gen.js +0 -2
  6. package/dist/api/account/v2alpha1/api.gen.js +3 -13
  7. package/dist/api/account/v2alpha1/marshalling.gen.js +0 -5
  8. package/dist/api/applesilicon/index.js +2 -2
  9. package/dist/api/applesilicon/v1alpha1/api.gen.js +7 -27
  10. package/dist/api/applesilicon/v1alpha1/index.gen.js +4 -0
  11. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +1 -14
  12. package/dist/api/baremetal/v1/api.gen.js +47 -49
  13. package/dist/api/baremetal/v1/api.utils.js +2 -10
  14. package/dist/api/baremetal/v1/content.gen.js +6 -3
  15. package/dist/api/baremetal/v1/index.js +4 -1
  16. package/dist/api/baremetal/v1/marshalling.gen.js +44 -45
  17. package/dist/api/baremetal/v1/validation-rules.gen.js +109 -0
  18. package/dist/api/container/index.js +2 -2
  19. package/dist/api/container/v1beta1/api.gen.js +5 -51
  20. package/dist/api/container/v1beta1/content.gen.js +4 -4
  21. package/dist/api/container/v1beta1/{index.js → index.gen.js} +3 -1
  22. package/dist/api/container/v1beta1/marshalling.gen.js +12 -26
  23. package/dist/api/domain/index.js +2 -2
  24. package/dist/api/domain/v2beta1/api.gen.js +55 -85
  25. package/dist/api/domain/v2beta1/content.gen.js +22 -1
  26. package/dist/api/domain/v2beta1/index.gen.js +4 -0
  27. package/dist/api/domain/v2beta1/marshalling.gen.js +47 -165
  28. package/dist/api/flexibleip/index.js +2 -2
  29. package/dist/api/flexibleip/v1alpha1/api.gen.js +5 -22
  30. package/dist/api/flexibleip/v1alpha1/content.gen.js +1 -1
  31. package/dist/api/flexibleip/v1alpha1/index.gen.js +6 -0
  32. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +0 -7
  33. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +14 -0
  34. package/dist/api/function/index.js +2 -2
  35. package/dist/api/function/v1beta1/api.gen.js +54 -57
  36. package/dist/api/function/v1beta1/content.gen.js +8 -5
  37. package/dist/api/function/v1beta1/index.gen.js +4 -0
  38. package/dist/api/function/v1beta1/marshalling.gen.js +125 -33
  39. package/dist/api/iam/index.js +2 -2
  40. package/dist/api/iam/v1alpha1/api.gen.js +15 -62
  41. package/dist/api/iam/v1alpha1/index.gen.js +5 -0
  42. package/dist/api/iam/v1alpha1/marshalling.gen.js +7 -29
  43. package/dist/api/iam/v1alpha1/validation-rules.gen.js +184 -0
  44. package/dist/api/instance/v1/api.gen.js +38 -118
  45. package/dist/api/instance/v1/api.utils.js +59 -51
  46. package/dist/api/instance/v1/content.gen.js +7 -7
  47. package/dist/api/instance/v1/marshalling.gen.js +46 -168
  48. package/dist/api/instance/v1/marshalling.utils.js +63 -0
  49. package/dist/api/iot/index.js +2 -2
  50. package/dist/api/iot/v1/api.gen.js +5 -56
  51. package/dist/api/iot/v1/index.gen.js +4 -0
  52. package/dist/api/iot/v1/marshalling.gen.js +2 -51
  53. package/dist/api/k8s/index.js +2 -2
  54. package/dist/api/k8s/v1/api.gen.js +17 -43
  55. package/dist/api/k8s/v1/content.gen.js +2 -2
  56. package/dist/api/k8s/v1/index.gen.js +6 -0
  57. package/dist/api/k8s/v1/marshalling.gen.js +18 -36
  58. package/dist/api/k8s/v1/validation-rules.gen.js +92 -0
  59. package/dist/api/lb/v1/api.gen.js +8 -163
  60. package/dist/api/lb/v1/api.utils.js +3 -9
  61. package/dist/api/lb/v1/content.gen.js +3 -3
  62. package/dist/api/lb/v1/marshalling.gen.js +74 -101
  63. package/dist/api/marketplace/index.js +4 -2
  64. package/dist/api/marketplace/v1/api.gen.js +3 -13
  65. package/dist/api/marketplace/v1/index.gen.js +3 -0
  66. package/dist/api/marketplace/v1/marshalling.gen.js +0 -13
  67. package/dist/api/marketplace/v2/api.gen.js +85 -0
  68. package/dist/api/marketplace/v2/index.gen.js +3 -0
  69. package/dist/api/marketplace/v2/marshalling.gen.js +92 -0
  70. package/dist/api/mnq/index.js +2 -2
  71. package/dist/api/mnq/v1alpha1/api.gen.js +7 -25
  72. package/dist/api/mnq/v1alpha1/index.gen.js +3 -0
  73. package/dist/api/mnq/v1alpha1/marshalling.gen.js +7 -46
  74. package/dist/api/rdb/index.js +2 -2
  75. package/dist/api/rdb/v1/api.gen.js +15 -89
  76. package/dist/api/rdb/v1/content.gen.js +10 -4
  77. package/dist/api/rdb/v1/index.gen.js +4 -0
  78. package/dist/api/rdb/v1/marshalling.gen.js +25 -81
  79. package/dist/api/redis/index.js +2 -2
  80. package/dist/api/redis/{v1alpha1 → v1}/api.gen.js +45 -77
  81. package/dist/api/redis/{v1alpha1 → v1}/content.gen.js +1 -1
  82. package/dist/api/redis/v1/index.gen.js +4 -0
  83. package/dist/api/redis/{v1alpha1 → v1}/marshalling.gen.js +42 -59
  84. package/dist/api/registry/index.js +2 -2
  85. package/dist/api/registry/v1/api.gen.js +5 -29
  86. package/dist/api/registry/v1/content.gen.js +2 -2
  87. package/dist/api/registry/v1/{index.js → index.gen.js} +3 -1
  88. package/dist/api/registry/v1/marshalling.gen.js +2 -8
  89. package/dist/api/secret/index.js +2 -0
  90. package/dist/api/secret/v1alpha1/api.gen.js +135 -0
  91. package/dist/api/secret/v1alpha1/index.gen.js +3 -0
  92. package/dist/api/secret/v1alpha1/marshalling.gen.js +82 -0
  93. package/dist/api/tem/index.js +2 -0
  94. package/dist/api/tem/v1alpha1/api.gen.js +109 -0
  95. package/dist/api/tem/v1alpha1/content.gen.js +10 -0
  96. package/dist/api/tem/v1alpha1/index.gen.js +4 -0
  97. package/dist/api/tem/v1alpha1/marshalling.gen.js +132 -0
  98. package/dist/api/test/index.js +2 -2
  99. package/dist/api/test/v1/api.gen.js +6 -20
  100. package/dist/api/test/v1/index.gen.js +4 -0
  101. package/dist/api/test/v1/marshalling.gen.js +2 -5
  102. package/dist/api/vpc/index.js +2 -2
  103. package/dist/api/vpc/v1/api.gen.js +6 -17
  104. package/dist/api/vpc/v1/index.gen.js +3 -0
  105. package/dist/api/vpc/v1/marshalling.gen.js +1 -3
  106. package/dist/api/vpcgw/index.js +2 -2
  107. package/dist/api/vpcgw/v1/api.gen.js +5 -64
  108. package/dist/api/vpcgw/v1/content.gen.js +2 -2
  109. package/dist/api/vpcgw/v1/{index.js → index.gen.js} +3 -1
  110. package/dist/api/vpcgw/v1/marshalling.gen.js +3 -24
  111. package/dist/helpers/json.js +1 -2
  112. package/dist/helpers/marshalling.js +7 -20
  113. package/dist/index.cjs +3864 -2945
  114. package/dist/index.d.ts +7212 -4332
  115. package/dist/index.js +10 -6
  116. package/dist/internal/async/interval-retrier.js +10 -16
  117. package/dist/internal/interceptors/interceptor.js +3 -1
  118. package/dist/internal/interceptors/request.js +1 -3
  119. package/dist/internal/logger/console-logger.js +3 -5
  120. package/dist/internal/logger/index.js +3 -5
  121. package/dist/internal/logger/level-resolver.js +0 -3
  122. package/dist/internal/validations/string-validation.js +8 -10
  123. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js +13 -0
  124. package/dist/scw/api.js +3 -4
  125. package/dist/scw/auth.js +3 -5
  126. package/dist/scw/client-ini-factory.js +32 -15
  127. package/dist/scw/client-ini-profile.js +10 -4
  128. package/dist/scw/client-settings.js +32 -15
  129. package/dist/scw/client.js +5 -6
  130. package/dist/scw/constants.js +1 -1
  131. package/dist/scw/custom-marshalling.js +8 -14
  132. package/dist/scw/errors/error-parser.js +2 -21
  133. package/dist/scw/errors/non-standard/invalid-request-mapper.js +17 -15
  134. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +7 -6
  135. package/dist/scw/errors/scw-error.js +20 -20
  136. package/dist/scw/errors/standard/already-exists-error.js +3 -4
  137. package/dist/scw/errors/standard/denied-authentication-error.js +4 -11
  138. package/dist/scw/errors/standard/invalid-arguments-error.js +1 -10
  139. package/dist/scw/errors/standard/out-of-stock-error.js +0 -3
  140. package/dist/scw/errors/standard/permissions-denied-error.js +1 -4
  141. package/dist/scw/errors/standard/precondition-failed-error.js +4 -8
  142. package/dist/scw/errors/standard/quotas-exceeded-error.js +14 -14
  143. package/dist/scw/errors/standard/resource-expired-error.js +3 -4
  144. package/dist/scw/errors/standard/resource-locked-error.js +3 -4
  145. package/dist/scw/errors/standard/resource-not-found-error.js +3 -4
  146. package/dist/scw/errors/standard/too-many-requests-error.js +3 -16
  147. package/dist/scw/errors/standard/transient-state-error.js +3 -4
  148. package/dist/scw/errors/types.js +0 -3
  149. package/dist/scw/fetch/build-fetcher.js +1 -9
  150. package/dist/scw/fetch/http-dumper.js +4 -7
  151. package/dist/scw/fetch/http-interceptors.js +9 -12
  152. package/dist/scw/fetch/resource-paginator.js +18 -16
  153. package/dist/scw/fetch/response-parser.js +17 -23
  154. package/node_modules/@scaleway/random-name/CHANGELOG.md +42 -63
  155. package/node_modules/@scaleway/random-name/dist/index.js +5 -246
  156. package/node_modules/@scaleway/random-name/package.json +6 -5
  157. package/package.json +4 -5
  158. package/dist/api/account/v2/index.js +0 -1
  159. package/dist/api/applesilicon/v1alpha1/index.js +0 -2
  160. package/dist/api/domain/v2beta1/index.js +0 -2
  161. package/dist/api/flexibleip/v1alpha1/index.js +0 -2
  162. package/dist/api/function/v1beta1/index.js +0 -2
  163. package/dist/api/iam/v1alpha1/index.js +0 -1
  164. package/dist/api/iot/v1/index.js +0 -2
  165. package/dist/api/k8s/v1/index.js +0 -2
  166. package/dist/api/marketplace/v1/index.js +0 -1
  167. package/dist/api/mnq/v1alpha1/index.js +0 -1
  168. package/dist/api/rdb/v1/index.js +0 -2
  169. package/dist/api/redis/v1alpha1/index.js +0 -2
  170. package/dist/api/test/v1/index.js +0 -1
  171. package/dist/api/vpc/v1/index.js +0 -1
  172. package/dist/node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js +0 -254
  173. package/node_modules/@scaleway/random-name/dist/index.browser.js +0 -256
@@ -1,2 +1,4 @@
1
- import * as index$1 from './v1/index.js';
2
- export { index$1 as v1 };
1
+ import * as index_gen from './v1/index.gen.js';
2
+ export { index_gen as v1 };
3
+ import * as index_gen$1 from './v2/index.gen.js';
4
+ export { index_gen$1 as v2 };
@@ -1,54 +1,44 @@
1
- import { API } from '../../../scw/api.js';
1
+ import { API as API$1 } from '../../../scw/api.js';
2
2
  import { urlParams, validatePathParam } from '../../../helpers/marshalling.js';
3
3
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
4
  import { unmarshalListImagesResponse, unmarshalGetImageResponse, unmarshalListVersionsResponse, unmarshalGetVersionResponse } from './marshalling.gen.js';
5
5
 
6
6
  // This file was automatically generated. DO NOT EDIT.
7
-
8
7
  /** Marketplace API. */
9
- class MarketplaceV1GenAPI extends API {
8
+ class API extends API$1 {
10
9
  constructor() {
11
10
  var _this;
12
-
13
11
  super(...arguments);
14
12
  _this = this;
15
-
16
13
  this.pageOfListImages = function (request) {
17
14
  if (request === void 0) {
18
15
  request = {};
19
16
  }
20
-
21
17
  return _this.client.fetch({
22
18
  method: 'GET',
23
19
  path: `/marketplace/v1/images`,
24
20
  urlParams: urlParams(['page', request.page], ['per_page', request.perPage ?? _this.client.settings.defaultPageSize])
25
21
  }, unmarshalListImagesResponse);
26
22
  };
27
-
28
23
  this.listImages = function (request) {
29
24
  if (request === void 0) {
30
25
  request = {};
31
26
  }
32
-
33
27
  return enrichForPagination('images', _this.pageOfListImages, request);
34
28
  };
35
-
36
29
  this.getImage = request => this.client.fetch({
37
30
  method: 'GET',
38
31
  path: `/marketplace/v1/images/${validatePathParam('imageId', request.imageId)}`
39
32
  }, unmarshalGetImageResponse);
40
-
41
33
  this.listVersions = request => this.client.fetch({
42
34
  method: 'GET',
43
35
  path: `/marketplace/v1/images/${validatePathParam('imageId', request.imageId)}/versions`
44
36
  }, unmarshalListVersionsResponse);
45
-
46
37
  this.getVersion = request => this.client.fetch({
47
38
  method: 'GET',
48
39
  path: `/marketplace/v1/images/${validatePathParam('imageId', request.imageId)}/versions/${validatePathParam('versionId', request.versionId)}`
49
40
  }, unmarshalGetVersionResponse);
50
41
  }
51
-
52
42
  }
53
43
 
54
- export { MarketplaceV1GenAPI };
44
+ export { API };
@@ -0,0 +1,3 @@
1
+ export { API } from './api.gen.js';
2
+
3
+ // This file was automatically generated. DO NOT EDIT.
@@ -2,12 +2,10 @@ import { isJSONObject } from '../../../helpers/json.js';
2
2
  import { unmarshalArrayOfObject, unmarshalDate } from '../../../helpers/marshalling.js';
3
3
 
4
4
  // This file was automatically generated. DO NOT EDIT.
5
-
6
5
  const unmarshalLocalImage = data => {
7
6
  if (!isJSONObject(data)) {
8
7
  throw new TypeError(`Unmarshalling the type 'LocalImage' failed as data isn't a dictionary.`);
9
8
  }
10
-
11
9
  return {
12
10
  arch: data.arch,
13
11
  compatibleCommercialTypes: data.compatible_commercial_types,
@@ -15,23 +13,19 @@ const unmarshalLocalImage = data => {
15
13
  zone: data.zone
16
14
  };
17
15
  };
18
-
19
16
  const unmarshalOrganization = data => {
20
17
  if (!isJSONObject(data)) {
21
18
  throw new TypeError(`Unmarshalling the type 'Organization' failed as data isn't a dictionary.`);
22
19
  }
23
-
24
20
  return {
25
21
  id: data.id,
26
22
  name: data.name
27
23
  };
28
24
  };
29
-
30
25
  const unmarshalVersion = data => {
31
26
  if (!isJSONObject(data)) {
32
27
  throw new TypeError(`Unmarshalling the type 'Version' failed as data isn't a dictionary.`);
33
28
  }
34
-
35
29
  return {
36
30
  creationDate: unmarshalDate(data.creation_date),
37
31
  id: data.id,
@@ -40,12 +34,10 @@ const unmarshalVersion = data => {
40
34
  name: data.name
41
35
  };
42
36
  };
43
-
44
37
  const unmarshalImage = data => {
45
38
  if (!isJSONObject(data)) {
46
39
  throw new TypeError(`Unmarshalling the type 'Image' failed as data isn't a dictionary.`);
47
40
  }
48
-
49
41
  return {
50
42
  categories: data.categories,
51
43
  creationDate: unmarshalDate(data.creation_date),
@@ -61,12 +53,10 @@ const unmarshalImage = data => {
61
53
  versions: unmarshalArrayOfObject(data.versions, unmarshalVersion)
62
54
  };
63
55
  };
64
-
65
56
  const unmarshalGetImageResponse = data => {
66
57
  if (!isJSONObject(data)) {
67
58
  throw new TypeError(`Unmarshalling the type 'GetImageResponse' failed as data isn't a dictionary.`);
68
59
  }
69
-
70
60
  return {
71
61
  image: data.image ? unmarshalImage(data.image) : undefined
72
62
  };
@@ -75,7 +65,6 @@ const unmarshalGetVersionResponse = data => {
75
65
  if (!isJSONObject(data)) {
76
66
  throw new TypeError(`Unmarshalling the type 'GetVersionResponse' failed as data isn't a dictionary.`);
77
67
  }
78
-
79
68
  return {
80
69
  version: data.version ? unmarshalVersion(data.version) : undefined
81
70
  };
@@ -84,7 +73,6 @@ const unmarshalListImagesResponse = data => {
84
73
  if (!isJSONObject(data)) {
85
74
  throw new TypeError(`Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`);
86
75
  }
87
-
88
76
  return {
89
77
  images: unmarshalArrayOfObject(data.images, unmarshalImage),
90
78
  totalCount: data.total_count
@@ -94,7 +82,6 @@ const unmarshalListVersionsResponse = data => {
94
82
  if (!isJSONObject(data)) {
95
83
  throw new TypeError(`Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`);
96
84
  }
97
-
98
85
  return {
99
86
  totalCount: data.total_count,
100
87
  versions: unmarshalArrayOfObject(data.versions, unmarshalVersion)
@@ -0,0 +1,85 @@
1
+ import { API as API$1 } from '../../../scw/api.js';
2
+ import { urlParams, validatePathParam, resolveOneOf } from '../../../helpers/marshalling.js';
3
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
+ import { unmarshalListImagesResponse, unmarshalImage, unmarshalListVersionsResponse, unmarshalVersion, unmarshalListLocalImagesResponse, unmarshalLocalImage, unmarshalListCategoriesResponse, unmarshalCategory } from './marshalling.gen.js';
5
+
6
+ // This file was automatically generated. DO NOT EDIT.
7
+ /** Marketplace API. */
8
+ class API extends API$1 {
9
+ constructor() {
10
+ var _this;
11
+ super(...arguments);
12
+ _this = this;
13
+ this.pageOfListImages = request => this.client.fetch({
14
+ method: 'GET',
15
+ path: `/marketplace/v2/images`,
16
+ urlParams: urlParams(['arch', request.arch], ['category', request.category], ['include_eol', request.includeEol], ['order_by', request.orderBy ?? 'name_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
17
+ }, unmarshalListImagesResponse);
18
+ this.listImages = request => enrichForPagination('images', this.pageOfListImages, request);
19
+ this.getImage = request => this.client.fetch({
20
+ method: 'GET',
21
+ path: `/marketplace/v2/images/${validatePathParam('imageId', request.imageId)}`
22
+ }, unmarshalImage);
23
+ this.pageOfListVersions = request => this.client.fetch({
24
+ method: 'GET',
25
+ path: `/marketplace/v2/versions`,
26
+ urlParams: urlParams(['image_id', request.imageId], ['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
27
+ }, unmarshalListVersionsResponse);
28
+ this.listVersions = request => enrichForPagination('versions', this.pageOfListVersions, request);
29
+ this.getVersion = request => this.client.fetch({
30
+ method: 'GET',
31
+ path: `/marketplace/v2/versions/${validatePathParam('versionId', request.versionId)}`
32
+ }, unmarshalVersion);
33
+ this.pageOfListLocalImages = function (request) {
34
+ if (request === void 0) {
35
+ request = {};
36
+ }
37
+ return _this.client.fetch({
38
+ method: 'GET',
39
+ path: `/marketplace/v2/local-images`,
40
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['zone', request.zone ?? _this.client.settings.defaultZone], ...Object.entries(resolveOneOf([{
41
+ param: 'image_id',
42
+ value: request.imageId
43
+ }, {
44
+ param: 'version_id',
45
+ value: request.versionId
46
+ }, {
47
+ param: 'image_label',
48
+ value: request.imageLabel
49
+ }])))
50
+ }, unmarshalListLocalImagesResponse);
51
+ };
52
+ this.listLocalImages = function (request) {
53
+ if (request === void 0) {
54
+ request = {};
55
+ }
56
+ return enrichForPagination('localImages', _this.pageOfListLocalImages, request);
57
+ };
58
+ this.getLocalImage = request => this.client.fetch({
59
+ method: 'GET',
60
+ path: `/marketplace/v2/local-images/${validatePathParam('localImageId', request.localImageId)}`
61
+ }, unmarshalLocalImage);
62
+ this.pageOfListCategories = function (request) {
63
+ if (request === void 0) {
64
+ request = {};
65
+ }
66
+ return _this.client.fetch({
67
+ method: 'GET',
68
+ path: `/marketplace/v2/categories`,
69
+ urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
70
+ }, unmarshalListCategoriesResponse);
71
+ };
72
+ this.listCategories = function (request) {
73
+ if (request === void 0) {
74
+ request = {};
75
+ }
76
+ return enrichForPagination('categories', _this.pageOfListCategories, request);
77
+ };
78
+ this.getCategory = request => this.client.fetch({
79
+ method: 'GET',
80
+ path: `/marketplace/v2/categories/${validatePathParam('categoryId', request.categoryId)}`
81
+ }, unmarshalCategory);
82
+ }
83
+ }
84
+
85
+ export { API };
@@ -0,0 +1,3 @@
1
+ export { API } from './api.gen.js';
2
+
3
+ // This file was automatically generated. DO NOT EDIT.
@@ -0,0 +1,92 @@
1
+ import { isJSONObject } from '../../../helpers/json.js';
2
+ import { unmarshalDate, unmarshalArrayOfObject } from '../../../helpers/marshalling.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.
5
+ const unmarshalCategory = data => {
6
+ if (!isJSONObject(data)) {
7
+ throw new TypeError(`Unmarshalling the type 'Category' failed as data isn't a dictionary.`);
8
+ }
9
+ return {
10
+ description: data.description,
11
+ id: data.id,
12
+ name: data.name
13
+ };
14
+ };
15
+ const unmarshalImage = data => {
16
+ if (!isJSONObject(data)) {
17
+ throw new TypeError(`Unmarshalling the type 'Image' failed as data isn't a dictionary.`);
18
+ }
19
+ return {
20
+ categories: data.categories,
21
+ createdAt: unmarshalDate(data.created_at),
22
+ description: data.description,
23
+ id: data.id,
24
+ label: data.label,
25
+ logo: data.logo,
26
+ name: data.name,
27
+ updatedAt: unmarshalDate(data.updated_at),
28
+ validUntil: unmarshalDate(data.valid_until)
29
+ };
30
+ };
31
+ const unmarshalLocalImage = data => {
32
+ if (!isJSONObject(data)) {
33
+ throw new TypeError(`Unmarshalling the type 'LocalImage' failed as data isn't a dictionary.`);
34
+ }
35
+ return {
36
+ arch: data.arch,
37
+ compatibleCommercialTypes: data.compatible_commercial_types,
38
+ id: data.id,
39
+ label: data.label,
40
+ zone: data.zone
41
+ };
42
+ };
43
+ const unmarshalVersion = data => {
44
+ if (!isJSONObject(data)) {
45
+ throw new TypeError(`Unmarshalling the type 'Version' failed as data isn't a dictionary.`);
46
+ }
47
+ return {
48
+ createdAt: unmarshalDate(data.created_at),
49
+ id: data.id,
50
+ name: data.name,
51
+ publishedAt: unmarshalDate(data.published_at),
52
+ updatedAt: unmarshalDate(data.updated_at)
53
+ };
54
+ };
55
+ const unmarshalListCategoriesResponse = data => {
56
+ if (!isJSONObject(data)) {
57
+ throw new TypeError(`Unmarshalling the type 'ListCategoriesResponse' failed as data isn't a dictionary.`);
58
+ }
59
+ return {
60
+ categories: unmarshalArrayOfObject(data.categories, unmarshalCategory),
61
+ totalCount: data.total_count
62
+ };
63
+ };
64
+ const unmarshalListImagesResponse = data => {
65
+ if (!isJSONObject(data)) {
66
+ throw new TypeError(`Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`);
67
+ }
68
+ return {
69
+ images: unmarshalArrayOfObject(data.images, unmarshalImage),
70
+ totalCount: data.total_count
71
+ };
72
+ };
73
+ const unmarshalListLocalImagesResponse = data => {
74
+ if (!isJSONObject(data)) {
75
+ throw new TypeError(`Unmarshalling the type 'ListLocalImagesResponse' failed as data isn't a dictionary.`);
76
+ }
77
+ return {
78
+ localImages: unmarshalArrayOfObject(data.local_images, unmarshalLocalImage),
79
+ totalCount: data.total_count
80
+ };
81
+ };
82
+ const unmarshalListVersionsResponse = data => {
83
+ if (!isJSONObject(data)) {
84
+ throw new TypeError(`Unmarshalling the type 'ListVersionsResponse' failed as data isn't a dictionary.`);
85
+ }
86
+ return {
87
+ totalCount: data.total_count,
88
+ versions: unmarshalArrayOfObject(data.versions, unmarshalVersion)
89
+ };
90
+ };
91
+
92
+ export { unmarshalCategory, unmarshalImage, unmarshalListCategoriesResponse, unmarshalListImagesResponse, unmarshalListLocalImagesResponse, unmarshalListVersionsResponse, unmarshalLocalImage, unmarshalVersion };
@@ -1,2 +1,2 @@
1
- import * as index$1 from './v1alpha1/index.js';
2
- export { index$1 as v1alpha1 };
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };
@@ -1,4 +1,4 @@
1
- import { API } from '../../../scw/api.js';
1
+ import { API as API$1 } from '../../../scw/api.js';
2
2
  import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
3
3
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
4
  import { unmarshalListNamespacesResponse, marshalCreateNamespaceRequest, unmarshalNamespace, marshalUpdateNamespaceRequest, marshalCreateCredentialRequest, unmarshalCredential, unmarshalListCredentialsResponse, marshalUpdateCredentialRequest } from './marshalling.gen.js';
@@ -7,109 +7,91 @@ import { unmarshalListNamespacesResponse, marshalCreateNamespaceRequest, unmarsh
7
7
  const jsonContentHeaders = {
8
8
  'Content-Type': 'application/json; charset=utf-8'
9
9
  };
10
+
10
11
  /**
11
- * MnQ API.
12
+ * MnQ API (beta).
12
13
  *
13
14
  * This API allows you to manage Messaging or Queueing brokers.
14
15
  */
15
-
16
- class MnqV1Alpha1GenAPI extends API {
16
+ class API extends API$1 {
17
17
  constructor() {
18
18
  var _this;
19
-
20
19
  super(...arguments);
21
20
  _this = this;
22
-
23
21
  this.pageOfListNamespaces = function (request) {
24
22
  if (request === void 0) {
25
23
  request = {};
26
24
  }
27
-
28
25
  return _this.client.fetch({
29
26
  method: 'GET',
30
27
  path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/namespaces`,
31
- urlParams: urlParams(['order_by', request.orderBy ?? 'id_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
28
+ urlParams: urlParams(['order_by', request.orderBy ?? 'created_at_asc'], ['organization_id', request.organizationId ?? _this.client.settings.defaultOrganizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId])
32
29
  }, unmarshalListNamespacesResponse);
33
30
  };
34
-
35
31
  this.listNamespaces = function (request) {
36
32
  if (request === void 0) {
37
33
  request = {};
38
34
  }
39
-
40
35
  return enrichForPagination('namespaces', _this.pageOfListNamespaces, request);
41
36
  };
42
-
43
37
  this.createNamespace = request => this.client.fetch({
44
38
  body: JSON.stringify(marshalCreateNamespaceRequest(request, this.client.settings)),
45
39
  headers: jsonContentHeaders,
46
40
  method: 'POST',
47
41
  path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces`
48
42
  }, unmarshalNamespace);
49
-
50
43
  this.updateNamespace = request => this.client.fetch({
51
44
  body: JSON.stringify(marshalUpdateNamespaceRequest(request, this.client.settings)),
52
45
  headers: jsonContentHeaders,
53
46
  method: 'PATCH',
54
47
  path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces`
55
48
  }, unmarshalNamespace);
56
-
57
49
  this.getNamespace = request => this.client.fetch({
58
50
  method: 'GET',
59
51
  path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam('namespaceId', request.namespaceId)}`
60
52
  }, unmarshalNamespace);
61
-
62
53
  this.deleteNamespace = request => this.client.fetch({
63
54
  method: 'DELETE',
64
55
  path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam('namespaceId', request.namespaceId)}`
65
56
  });
66
-
67
57
  this.createCredential = request => this.client.fetch({
68
58
  body: JSON.stringify(marshalCreateCredentialRequest(request, this.client.settings)),
69
59
  headers: jsonContentHeaders,
70
60
  method: 'POST',
71
61
  path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/credentials`
72
62
  }, unmarshalCredential);
73
-
74
63
  this.deleteCredential = request => this.client.fetch({
75
64
  method: 'DELETE',
76
65
  path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/credentials/${validatePathParam('credentialId', request.credentialId)}`
77
66
  });
78
-
79
67
  this.pageOfListCredentials = function (request) {
80
68
  if (request === void 0) {
81
69
  request = {};
82
70
  }
83
-
84
71
  return _this.client.fetch({
85
72
  method: 'GET',
86
73
  path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/credentials`,
87
74
  urlParams: urlParams(['namespace_id', request.namespaceId], ['order_by', request.orderBy ?? 'id_asc'], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize])
88
75
  }, unmarshalListCredentialsResponse);
89
76
  };
90
-
91
77
  this.listCredentials = function (request) {
92
78
  if (request === void 0) {
93
79
  request = {};
94
80
  }
95
-
96
81
  return enrichForPagination('credentials', _this.pageOfListCredentials, request);
97
82
  };
98
-
99
83
  this.updateCredential = request => this.client.fetch({
100
84
  body: JSON.stringify(marshalUpdateCredentialRequest(request, this.client.settings)),
101
85
  headers: jsonContentHeaders,
102
86
  method: 'PATCH',
103
87
  path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/credentials/${validatePathParam('credentialId', request.credentialId)}`
104
88
  }, unmarshalCredential);
105
-
106
89
  this.getCredential = request => this.client.fetch({
107
90
  method: 'GET',
108
91
  path: `/mnq/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/credentials/${validatePathParam('credentialId', request.credentialId)}`
109
92
  }, unmarshalCredential);
110
93
  }
111
-
112
94
  }
113
- MnqV1Alpha1GenAPI.LOCALITIES = ['fr-par'];
95
+ API.LOCALITIES = ['fr-par'];
114
96
 
115
- export { MnqV1Alpha1GenAPI };
97
+ export { API };
@@ -0,0 +1,3 @@
1
+ export { API } from './api.gen.js';
2
+
3
+ // This file was automatically generated. DO NOT EDIT.
@@ -1,83 +1,50 @@
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js';
1
2
  import { isJSONObject } from '../../../helpers/json.js';
2
- import { unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
3
+ import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
3
4
 
4
5
  // This file was automatically generated. DO NOT EDIT.
5
-
6
6
  const unmarshalPermissions = data => {
7
7
  if (!isJSONObject(data)) {
8
8
  throw new TypeError(`Unmarshalling the type 'Permissions' failed as data isn't a dictionary.`);
9
9
  }
10
-
11
10
  return {
12
11
  canManage: data.can_manage,
13
12
  canPublish: data.can_publish,
14
13
  canReceive: data.can_receive
15
14
  };
16
15
  };
17
-
18
- const unmarshalCredentialSummaryAMQPCreds = data => {
19
- if (!isJSONObject(data)) {
20
- throw new TypeError(`Unmarshalling the type 'CredentialSummaryAMQPCreds' failed as data isn't a dictionary.`);
21
- }
22
-
23
- return {
24
- permissions: data.permissions ? unmarshalPermissions(data.permissions) : undefined,
25
- username: data.username
26
- };
27
- };
28
-
29
16
  const unmarshalCredentialSummarySQSSNSCreds = data => {
30
17
  if (!isJSONObject(data)) {
31
18
  throw new TypeError(`Unmarshalling the type 'CredentialSummarySQSSNSCreds' failed as data isn't a dictionary.`);
32
19
  }
33
-
34
20
  return {
35
21
  accessKey: data.access_key,
36
22
  permissions: data.permissions ? unmarshalPermissions(data.permissions) : undefined
37
23
  };
38
24
  };
39
-
40
- const unmarshalCredentialAMQPCreds = data => {
41
- if (!isJSONObject(data)) {
42
- throw new TypeError(`Unmarshalling the type 'CredentialAMQPCreds' failed as data isn't a dictionary.`);
43
- }
44
-
45
- return {
46
- password: data.password,
47
- permissions: data.permissions ? unmarshalPermissions(data.permissions) : undefined,
48
- username: data.username
49
- };
50
- };
51
-
52
25
  const unmarshalCredentialNATSCredsFile = data => {
53
26
  if (!isJSONObject(data)) {
54
27
  throw new TypeError(`Unmarshalling the type 'CredentialNATSCredsFile' failed as data isn't a dictionary.`);
55
28
  }
56
-
57
29
  return {
58
30
  content: data.content
59
31
  };
60
32
  };
61
-
62
33
  const unmarshalCredentialSQSSNSCreds = data => {
63
34
  if (!isJSONObject(data)) {
64
35
  throw new TypeError(`Unmarshalling the type 'CredentialSQSSNSCreds' failed as data isn't a dictionary.`);
65
36
  }
66
-
67
37
  return {
68
38
  accessKey: data.access_key,
69
39
  permissions: data.permissions ? unmarshalPermissions(data.permissions) : undefined,
70
40
  secretKey: data.secret_key
71
41
  };
72
42
  };
73
-
74
43
  const unmarshalCredentialSummary = data => {
75
44
  if (!isJSONObject(data)) {
76
45
  throw new TypeError(`Unmarshalling the type 'CredentialSummary' failed as data isn't a dictionary.`);
77
46
  }
78
-
79
47
  return {
80
- amqpCredentials: data.amqp_credentials ? unmarshalCredentialSummaryAMQPCreds(data.amqp_credentials) : undefined,
81
48
  id: data.id,
82
49
  name: data.name,
83
50
  namespaceId: data.namespace_id,
@@ -85,28 +52,26 @@ const unmarshalCredentialSummary = data => {
85
52
  sqsSnsCredentials: data.sqs_sns_credentials ? unmarshalCredentialSummarySQSSNSCreds(data.sqs_sns_credentials) : undefined
86
53
  };
87
54
  };
88
-
89
55
  const unmarshalNamespace = data => {
90
56
  if (!isJSONObject(data)) {
91
57
  throw new TypeError(`Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`);
92
58
  }
93
-
94
59
  return {
60
+ createdAt: unmarshalDate(data.created_at),
95
61
  endpoint: data.endpoint,
96
62
  id: data.id,
97
63
  name: data.name,
98
64
  projectId: data.project_id,
99
65
  protocol: data.protocol,
100
- region: data.region
66
+ region: data.region,
67
+ updatedAt: unmarshalDate(data.updated_at)
101
68
  };
102
69
  };
103
70
  const unmarshalCredential = data => {
104
71
  if (!isJSONObject(data)) {
105
72
  throw new TypeError(`Unmarshalling the type 'Credential' failed as data isn't a dictionary.`);
106
73
  }
107
-
108
74
  return {
109
- amqpCredentials: data.amqp_credentials ? unmarshalCredentialAMQPCreds(data.amqp_credentials) : undefined,
110
75
  id: data.id,
111
76
  name: data.name,
112
77
  namespaceId: data.namespace_id,
@@ -119,7 +84,6 @@ const unmarshalListCredentialsResponse = data => {
119
84
  if (!isJSONObject(data)) {
120
85
  throw new TypeError(`Unmarshalling the type 'ListCredentialsResponse' failed as data isn't a dictionary.`);
121
86
  }
122
-
123
87
  return {
124
88
  credentials: unmarshalArrayOfObject(data.credentials, unmarshalCredentialSummary),
125
89
  totalCount: data.total_count
@@ -129,21 +93,18 @@ const unmarshalListNamespacesResponse = data => {
129
93
  if (!isJSONObject(data)) {
130
94
  throw new TypeError(`Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`);
131
95
  }
132
-
133
96
  return {
134
97
  namespaces: unmarshalArrayOfObject(data.namespaces, unmarshalNamespace),
135
98
  totalCount: data.total_count
136
99
  };
137
100
  };
138
-
139
101
  const marshalPermissions = (request, defaults) => ({
140
102
  can_manage: request.canManage,
141
103
  can_publish: request.canPublish,
142
104
  can_receive: request.canReceive
143
105
  });
144
-
145
106
  const marshalCreateCredentialRequest = (request, defaults) => ({
146
- name: request.name,
107
+ name: request.name || randomName('mnq'),
147
108
  namespace_id: request.namespaceId,
148
109
  ...resolveOneOf([{
149
110
  param: 'permissions',
@@ -151,7 +112,7 @@ const marshalCreateCredentialRequest = (request, defaults) => ({
151
112
  }])
152
113
  });
153
114
  const marshalCreateNamespaceRequest = (request, defaults) => ({
154
- name: request.name,
115
+ name: request.name || randomName('mnq'),
155
116
  project_id: request.projectId ?? defaults.defaultProjectId,
156
117
  protocol: request.protocol
157
118
  });
@@ -1,2 +1,2 @@
1
- import * as index$1 from './v1/index.js';
2
- export { index$1 as v1 };
1
+ import * as index_gen from './v1/index.gen.js';
2
+ export { index_gen as v1 };