@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,5 +1,5 @@
1
1
  import { waitForResource } from '../../../internal/async/interval-retrier.js';
2
- import { API } from '../../../scw/api.js';
2
+ import { API as API$1 } from '../../../scw/api.js';
3
3
  import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
4
4
  import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
5
5
  import { NAMESPACE_TRANSIENT_STATUSES, IMAGE_TRANSIENT_STATUSES, TAG_TRANSIENT_STATUSES } from './content.gen.js';
@@ -9,127 +9,103 @@ import { unmarshalListNamespacesResponse, unmarshalNamespace, marshalCreateNames
9
9
  const jsonContentHeaders = {
10
10
  'Content-Type': 'application/json; charset=utf-8'
11
11
  };
12
+
12
13
  /**
13
14
  * Registry API.
14
15
  *
15
16
  * Container registry API.
16
17
  */
17
-
18
- class RegistryV1GenAPI extends API {
18
+ class API extends API$1 {
19
19
  constructor() {
20
20
  var _this;
21
-
22
21
  super(...arguments);
23
22
  _this = this;
24
-
25
23
  this.pageOfListNamespaces = function (request) {
26
24
  if (request === void 0) {
27
25
  request = {};
28
26
  }
29
-
30
27
  return _this.client.fetch({
31
28
  method: 'GET',
32
29
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/namespaces`,
33
30
  urlParams: urlParams(['name', request.name], ['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])
34
31
  }, unmarshalListNamespacesResponse);
35
32
  };
36
-
37
33
  this.listNamespaces = function (request) {
38
34
  if (request === void 0) {
39
35
  request = {};
40
36
  }
41
-
42
37
  return enrichForPagination('namespaces', _this.pageOfListNamespaces, request);
43
38
  };
44
-
45
39
  this.getNamespace = request => this.client.fetch({
46
40
  method: 'GET',
47
41
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam('namespaceId', request.namespaceId)}`
48
42
  }, unmarshalNamespace);
49
-
50
43
  this.waitForNamespace = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!NAMESPACE_TRANSIENT_STATUSES.includes(res.status))), this.getNamespace, request, options);
51
-
52
44
  this.createNamespace = request => this.client.fetch({
53
45
  body: JSON.stringify(marshalCreateNamespaceRequest(request, this.client.settings)),
54
46
  headers: jsonContentHeaders,
55
47
  method: 'POST',
56
48
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces`
57
49
  }, unmarshalNamespace);
58
-
59
50
  this.updateNamespace = request => this.client.fetch({
60
51
  body: JSON.stringify(marshalUpdateNamespaceRequest(request, this.client.settings)),
61
52
  headers: jsonContentHeaders,
62
53
  method: 'PATCH',
63
54
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam('namespaceId', request.namespaceId)}`
64
55
  }, unmarshalNamespace);
65
-
66
56
  this.deleteNamespace = request => this.client.fetch({
67
57
  method: 'DELETE',
68
58
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/namespaces/${validatePathParam('namespaceId', request.namespaceId)}`
69
59
  }, unmarshalNamespace);
70
-
71
60
  this.pageOfListImages = function (request) {
72
61
  if (request === void 0) {
73
62
  request = {};
74
63
  }
75
-
76
64
  return _this.client.fetch({
77
65
  method: 'GET',
78
66
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/images`,
79
67
  urlParams: urlParams(['name', request.name], ['namespace_id', request.namespaceId], ['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])
80
68
  }, unmarshalListImagesResponse);
81
69
  };
82
-
83
70
  this.listImages = function (request) {
84
71
  if (request === void 0) {
85
72
  request = {};
86
73
  }
87
-
88
74
  return enrichForPagination('images', _this.pageOfListImages, request);
89
75
  };
90
-
91
76
  this.getImage = request => this.client.fetch({
92
77
  method: 'GET',
93
78
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/images/${validatePathParam('imageId', request.imageId)}`
94
79
  }, unmarshalImage);
95
-
96
80
  this.waitForImage = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!IMAGE_TRANSIENT_STATUSES.includes(res.status))), this.getImage, request, options);
97
-
98
81
  this.updateImage = request => this.client.fetch({
99
82
  body: JSON.stringify(marshalUpdateImageRequest(request, this.client.settings)),
100
83
  headers: jsonContentHeaders,
101
84
  method: 'PATCH',
102
85
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/images/${validatePathParam('imageId', request.imageId)}`
103
86
  }, unmarshalImage);
104
-
105
87
  this.deleteImage = request => this.client.fetch({
106
88
  method: 'DELETE',
107
89
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/images/${validatePathParam('imageId', request.imageId)}`
108
90
  }, unmarshalImage);
109
-
110
91
  this.pageOfListTags = request => this.client.fetch({
111
92
  method: 'GET',
112
93
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/images/${validatePathParam('imageId', request.imageId)}/tags`,
113
94
  urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'created_at_asc'], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
114
95
  }, unmarshalListTagsResponse);
115
-
116
96
  this.listTags = request => enrichForPagination('tags', this.pageOfListTags, request);
117
-
118
97
  this.getTag = request => this.client.fetch({
119
98
  method: 'GET',
120
99
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/tags/${validatePathParam('tagId', request.tagId)}`
121
100
  }, unmarshalTag);
122
-
123
101
  this.waitForTag = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!TAG_TRANSIENT_STATUSES.includes(res.status))), this.getTag, request, options);
124
-
125
102
  this.deleteTag = request => this.client.fetch({
126
103
  method: 'DELETE',
127
104
  path: `/registry/v1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/tags/${validatePathParam('tagId', request.tagId)}`,
128
105
  urlParams: urlParams(['force', request.force])
129
106
  }, unmarshalTag);
130
107
  }
131
-
132
108
  }
133
- RegistryV1GenAPI.LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
109
+ API.LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
134
110
 
135
- export { RegistryV1GenAPI };
111
+ export { API };
@@ -3,11 +3,11 @@
3
3
 
4
4
  /** Lists transient statutes of the enum {@link ImageStatus}. */
5
5
  const IMAGE_TRANSIENT_STATUSES = ['deleting'];
6
- /** Lists transient statutes of the enum {@link NamespaceStatus}. */
7
6
 
7
+ /** Lists transient statutes of the enum {@link NamespaceStatus}. */
8
8
  const NAMESPACE_TRANSIENT_STATUSES = ['deleting'];
9
- /** Lists transient statutes of the enum {@link TagStatus}. */
10
9
 
10
+ /** Lists transient statutes of the enum {@link TagStatus}. */
11
11
  const TAG_TRANSIENT_STATUSES = ['deleting'];
12
12
 
13
13
  export { IMAGE_TRANSIENT_STATUSES, NAMESPACE_TRANSIENT_STATUSES, TAG_TRANSIENT_STATUSES };
@@ -1,2 +1,4 @@
1
- export { RegistryV1GenAPI as API } from './api.gen.js';
1
+ export { API } from './api.gen.js';
2
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.
@@ -1,4 +1,4 @@
1
- import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@3.0.2/node_modules/@scaleway/random-name/dist/index.js';
1
+ import randomName from '../../../node_modules/.pnpm/@scaleway_random-name@4.0.1/node_modules/@scaleway/random-name/dist/index.js';
2
2
  import { isJSONObject } from '../../../helpers/json.js';
3
3
  import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from '../../../helpers/marshalling.js';
4
4
 
@@ -7,7 +7,6 @@ const unmarshalImage = data => {
7
7
  if (!isJSONObject(data)) {
8
8
  throw new TypeError(`Unmarshalling the type 'Image' failed as data isn't a dictionary.`);
9
9
  }
10
-
11
10
  return {
12
11
  createdAt: unmarshalDate(data.created_at),
13
12
  id: data.id,
@@ -25,7 +24,6 @@ const unmarshalNamespace = data => {
25
24
  if (!isJSONObject(data)) {
26
25
  throw new TypeError(`Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`);
27
26
  }
28
-
29
27
  return {
30
28
  createdAt: unmarshalDate(data.created_at),
31
29
  description: data.description,
@@ -47,7 +45,6 @@ const unmarshalTag = data => {
47
45
  if (!isJSONObject(data)) {
48
46
  throw new TypeError(`Unmarshalling the type 'Tag' failed as data isn't a dictionary.`);
49
47
  }
50
-
51
48
  return {
52
49
  createdAt: unmarshalDate(data.created_at),
53
50
  digest: data.digest,
@@ -62,7 +59,6 @@ const unmarshalListImagesResponse = data => {
62
59
  if (!isJSONObject(data)) {
63
60
  throw new TypeError(`Unmarshalling the type 'ListImagesResponse' failed as data isn't a dictionary.`);
64
61
  }
65
-
66
62
  return {
67
63
  images: unmarshalArrayOfObject(data.images, unmarshalImage),
68
64
  totalCount: data.total_count
@@ -72,7 +68,6 @@ const unmarshalListNamespacesResponse = data => {
72
68
  if (!isJSONObject(data)) {
73
69
  throw new TypeError(`Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`);
74
70
  }
75
-
76
71
  return {
77
72
  namespaces: unmarshalArrayOfObject(data.namespaces, unmarshalNamespace),
78
73
  totalCount: data.total_count
@@ -82,7 +77,6 @@ const unmarshalListTagsResponse = data => {
82
77
  if (!isJSONObject(data)) {
83
78
  throw new TypeError(`Unmarshalling the type 'ListTagsResponse' failed as data isn't a dictionary.`);
84
79
  }
85
-
86
80
  return {
87
81
  tags: unmarshalArrayOfObject(data.tags, unmarshalTag),
88
82
  totalCount: data.total_count
@@ -103,7 +97,7 @@ const marshalCreateNamespaceRequest = (request, defaults) => ({
103
97
  }])
104
98
  });
105
99
  const marshalUpdateImageRequest = (request, defaults) => ({
106
- visibility: request.visibility
100
+ visibility: request.visibility ?? 'visibility_unknown'
107
101
  });
108
102
  const marshalUpdateNamespaceRequest = (request, defaults) => ({
109
103
  description: request.description,
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };
@@ -0,0 +1,135 @@
1
+ import { API as API$1 } from '../../../scw/api.js';
2
+ import { validatePathParam, urlParams, resolveOneOf } from '../../../helpers/marshalling.js';
3
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
+ import { marshalCreateSecretRequest, unmarshalSecret, marshalUpdateSecretRequest, unmarshalListSecretsResponse, marshalCreateSecretVersionRequest, unmarshalSecretVersion, marshalUpdateSecretVersionRequest, unmarshalListSecretVersionsResponse, unmarshalAccessSecretVersionResponse } from './marshalling.gen.js';
5
+
6
+ // This file was automatically generated. DO NOT EDIT.
7
+ const jsonContentHeaders = {
8
+ 'Content-Type': 'application/json; charset=utf-8'
9
+ };
10
+
11
+ /**
12
+ * Secret API (beta).
13
+ *
14
+ * This API allows you to conveniently store, access and share sensitive data.
15
+ */
16
+ class API extends API$1 {
17
+ constructor() {
18
+ var _this;
19
+ super(...arguments);
20
+ _this = this;
21
+ this.createSecret = request => this.client.fetch({
22
+ body: JSON.stringify(marshalCreateSecretRequest(request, this.client.settings)),
23
+ headers: jsonContentHeaders,
24
+ method: 'POST',
25
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets`
26
+ }, unmarshalSecret);
27
+ this.getSecret = function (request) {
28
+ if (request === void 0) {
29
+ request = {};
30
+ }
31
+ return _this.client.fetch({
32
+ method: 'GET',
33
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}`,
34
+ urlParams: urlParams(...Object.entries(resolveOneOf([{
35
+ param: 'secret_name',
36
+ value: request.secretName
37
+ }])))
38
+ }, unmarshalSecret);
39
+ };
40
+ this.updateSecret = request => this.client.fetch({
41
+ body: JSON.stringify(marshalUpdateSecretRequest(request, this.client.settings)),
42
+ headers: jsonContentHeaders,
43
+ method: 'PATCH',
44
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}`
45
+ }, unmarshalSecret);
46
+ this.pageOfListSecrets = function (request) {
47
+ if (request === void 0) {
48
+ request = {};
49
+ }
50
+ return _this.client.fetch({
51
+ method: 'GET',
52
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/secrets`,
53
+ urlParams: urlParams(['name', request.name], ['order_by', request.orderBy ?? 'name_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], ['tags', request.tags])
54
+ }, unmarshalListSecretsResponse);
55
+ };
56
+ this.listSecrets = function (request) {
57
+ if (request === void 0) {
58
+ request = {};
59
+ }
60
+ return enrichForPagination('secrets', _this.pageOfListSecrets, request);
61
+ };
62
+ this.deleteSecret = request => this.client.fetch({
63
+ method: 'DELETE',
64
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}`
65
+ });
66
+ this.createSecretVersion = request => this.client.fetch({
67
+ body: JSON.stringify(marshalCreateSecretVersionRequest(request, this.client.settings)),
68
+ headers: jsonContentHeaders,
69
+ method: 'POST',
70
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions`
71
+ }, unmarshalSecretVersion);
72
+ this.getSecretVersion = request => this.client.fetch({
73
+ method: 'GET',
74
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}`,
75
+ urlParams: urlParams(...Object.entries(resolveOneOf([{
76
+ param: 'secret_name',
77
+ value: request.secretName
78
+ }])))
79
+ }, unmarshalSecretVersion);
80
+ this.updateSecretVersion = request => this.client.fetch({
81
+ body: JSON.stringify(marshalUpdateSecretVersionRequest(request, this.client.settings)),
82
+ headers: jsonContentHeaders,
83
+ method: 'PATCH',
84
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}`
85
+ }, unmarshalSecretVersion);
86
+ this.pageOfListSecretVersions = function (request) {
87
+ if (request === void 0) {
88
+ request = {};
89
+ }
90
+ return _this.client.fetch({
91
+ method: 'GET',
92
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions`,
93
+ urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['status', request.status], ...Object.entries(resolveOneOf([{
94
+ param: 'secret_name',
95
+ value: request.secretName
96
+ }])))
97
+ }, unmarshalListSecretVersionsResponse);
98
+ };
99
+ this.listSecretVersions = function (request) {
100
+ if (request === void 0) {
101
+ request = {};
102
+ }
103
+ return enrichForPagination('versions', _this.pageOfListSecretVersions, request);
104
+ };
105
+ this.destroySecretVersion = request => this.client.fetch({
106
+ body: '{}',
107
+ headers: jsonContentHeaders,
108
+ method: 'POST',
109
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/destroy`
110
+ }, unmarshalSecretVersion);
111
+ this.enableSecretVersion = request => this.client.fetch({
112
+ body: '{}',
113
+ headers: jsonContentHeaders,
114
+ method: 'POST',
115
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/enable`
116
+ }, unmarshalSecretVersion);
117
+ this.disableSecretVersion = request => this.client.fetch({
118
+ body: '{}',
119
+ headers: jsonContentHeaders,
120
+ method: 'POST',
121
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/disable`
122
+ }, unmarshalSecretVersion);
123
+ this.accessSecretVersion = request => this.client.fetch({
124
+ method: 'GET',
125
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/access`,
126
+ urlParams: urlParams(...Object.entries(resolveOneOf([{
127
+ param: 'secret_name',
128
+ value: request.secretName
129
+ }])))
130
+ }, unmarshalAccessSecretVersionResponse);
131
+ }
132
+ }
133
+ API.LOCALITIES = ['fr-par'];
134
+
135
+ 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,82 @@
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 unmarshalSecret = data => {
6
+ if (!isJSONObject(data)) {
7
+ throw new TypeError(`Unmarshalling the type 'Secret' failed as data isn't a dictionary.`);
8
+ }
9
+ return {
10
+ createdAt: unmarshalDate(data.created_at),
11
+ description: data.description,
12
+ id: data.id,
13
+ name: data.name,
14
+ projectId: data.project_id,
15
+ region: data.region,
16
+ status: data.status,
17
+ tags: data.tags,
18
+ updatedAt: unmarshalDate(data.updated_at),
19
+ versionCount: data.version_count
20
+ };
21
+ };
22
+ const unmarshalSecretVersion = data => {
23
+ if (!isJSONObject(data)) {
24
+ throw new TypeError(`Unmarshalling the type 'SecretVersion' failed as data isn't a dictionary.`);
25
+ }
26
+ return {
27
+ createdAt: unmarshalDate(data.created_at),
28
+ description: data.description,
29
+ revision: data.revision,
30
+ secretId: data.secret_id,
31
+ status: data.status,
32
+ updatedAt: unmarshalDate(data.updated_at)
33
+ };
34
+ };
35
+ const unmarshalAccessSecretVersionResponse = data => {
36
+ if (!isJSONObject(data)) {
37
+ throw new TypeError(`Unmarshalling the type 'AccessSecretVersionResponse' failed as data isn't a dictionary.`);
38
+ }
39
+ return {
40
+ data: data.data,
41
+ revision: data.revision,
42
+ secretId: data.secret_id
43
+ };
44
+ };
45
+ const unmarshalListSecretVersionsResponse = data => {
46
+ if (!isJSONObject(data)) {
47
+ throw new TypeError(`Unmarshalling the type 'ListSecretVersionsResponse' failed as data isn't a dictionary.`);
48
+ }
49
+ return {
50
+ totalCount: data.total_count,
51
+ versions: unmarshalArrayOfObject(data.versions, unmarshalSecretVersion)
52
+ };
53
+ };
54
+ const unmarshalListSecretsResponse = data => {
55
+ if (!isJSONObject(data)) {
56
+ throw new TypeError(`Unmarshalling the type 'ListSecretsResponse' failed as data isn't a dictionary.`);
57
+ }
58
+ return {
59
+ secrets: unmarshalArrayOfObject(data.secrets, unmarshalSecret),
60
+ totalCount: data.total_count
61
+ };
62
+ };
63
+ const marshalCreateSecretRequest = (request, defaults) => ({
64
+ description: request.description,
65
+ name: request.name,
66
+ project_id: request.projectId ?? defaults.defaultProjectId,
67
+ tags: request.tags
68
+ });
69
+ const marshalCreateSecretVersionRequest = (request, defaults) => ({
70
+ data: request.data,
71
+ description: request.description
72
+ });
73
+ const marshalUpdateSecretRequest = (request, defaults) => ({
74
+ description: request.description,
75
+ name: request.name,
76
+ tags: request.tags
77
+ });
78
+ const marshalUpdateSecretVersionRequest = (request, defaults) => ({
79
+ description: request.description
80
+ });
81
+
82
+ export { marshalCreateSecretRequest, marshalCreateSecretVersionRequest, marshalUpdateSecretRequest, marshalUpdateSecretVersionRequest, unmarshalAccessSecretVersionResponse, unmarshalListSecretVersionsResponse, unmarshalListSecretsResponse, unmarshalSecret, unmarshalSecretVersion };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };
@@ -0,0 +1,109 @@
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 { EMAIL_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES } from './content.gen.js';
6
+ import { marshalCreateEmailRequest, unmarshalCreateEmailResponse, unmarshalEmail, unmarshalListEmailsResponse, unmarshalStatistics, marshalCreateDomainRequest, unmarshalDomain, unmarshalListDomainsResponse } from './marshalling.gen.js';
7
+
8
+ // This file was automatically generated. DO NOT EDIT.
9
+ const jsonContentHeaders = {
10
+ 'Content-Type': 'application/json; charset=utf-8'
11
+ };
12
+
13
+ /**
14
+ * Transactional Email API.
15
+ *
16
+ * Tem.
17
+ */
18
+ class API extends API$1 {
19
+ constructor() {
20
+ var _this;
21
+ super(...arguments);
22
+ _this = this;
23
+ this.createEmail = request => this.client.fetch({
24
+ body: JSON.stringify(marshalCreateEmailRequest(request, this.client.settings)),
25
+ headers: jsonContentHeaders,
26
+ method: 'POST',
27
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/emails`
28
+ }, unmarshalCreateEmailResponse);
29
+ this.getEmail = request => this.client.fetch({
30
+ method: 'GET',
31
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/emails/${validatePathParam('emailId', request.emailId)}`
32
+ }, unmarshalEmail);
33
+ this.waitForEmail = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!EMAIL_TRANSIENT_STATUSES.includes(res.status))), this.getEmail, request, options);
34
+ this.pageOfListEmails = function (request) {
35
+ if (request === void 0) {
36
+ request = {};
37
+ }
38
+ return _this.client.fetch({
39
+ method: 'GET',
40
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/emails`,
41
+ urlParams: urlParams(['domain_id', request.domainId], ['mail_from', request.mailFrom], ['mail_to', request.mailTo], ['message_id', request.messageId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId], ['since', request.since], ['statuses', request.statuses], ['until', request.until])
42
+ }, unmarshalListEmailsResponse);
43
+ };
44
+ this.listEmails = function (request) {
45
+ if (request === void 0) {
46
+ request = {};
47
+ }
48
+ return enrichForPagination('emails', _this.pageOfListEmails, request);
49
+ };
50
+ this.getStatistics = function (request) {
51
+ if (request === void 0) {
52
+ request = {};
53
+ }
54
+ return _this.client.fetch({
55
+ method: 'GET',
56
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/statistics`,
57
+ urlParams: urlParams(['domain_id', request.domainId], ['mail_from', request.mailFrom], ['project_id', request.projectId ?? _this.client.settings.defaultProjectId], ['since', request.since], ['until', request.until])
58
+ }, unmarshalStatistics);
59
+ };
60
+ this.cancelEmail = request => this.client.fetch({
61
+ body: '{}',
62
+ headers: jsonContentHeaders,
63
+ method: 'POST',
64
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/emails/${validatePathParam('emailId', request.emailId)}/cancel`
65
+ }, unmarshalEmail);
66
+ this.createDomain = request => this.client.fetch({
67
+ body: JSON.stringify(marshalCreateDomainRequest(request, this.client.settings)),
68
+ headers: jsonContentHeaders,
69
+ method: 'POST',
70
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains`
71
+ }, unmarshalDomain);
72
+ this.getDomain = request => this.client.fetch({
73
+ method: 'GET',
74
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domainId', request.domainId)}`
75
+ }, unmarshalDomain);
76
+ this.waitForDomain = (request, options) => waitForResource((options == null ? void 0 : options.stop) ?? (res => Promise.resolve(!DOMAIN_TRANSIENT_STATUSES.includes(res.status))), this.getDomain, request, options);
77
+ this.pageOfListDomains = function (request) {
78
+ if (request === void 0) {
79
+ request = {};
80
+ }
81
+ return _this.client.fetch({
82
+ method: 'GET',
83
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/domains`,
84
+ urlParams: urlParams(['name', request.name], ['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], ['status', request.status])
85
+ }, unmarshalListDomainsResponse);
86
+ };
87
+ this.listDomains = function (request) {
88
+ if (request === void 0) {
89
+ request = {};
90
+ }
91
+ return enrichForPagination('domains', _this.pageOfListDomains, request);
92
+ };
93
+ this.revokeDomain = request => this.client.fetch({
94
+ body: '{}',
95
+ headers: jsonContentHeaders,
96
+ method: 'POST',
97
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domainId', request.domainId)}/revoke`
98
+ }, unmarshalDomain);
99
+ this.checkDomain = request => this.client.fetch({
100
+ body: '{}',
101
+ headers: jsonContentHeaders,
102
+ method: 'POST',
103
+ path: `/transactional-email/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/domains/${validatePathParam('domainId', request.domainId)}/check`
104
+ }, unmarshalDomain);
105
+ }
106
+ }
107
+ API.LOCALITIES = ['fr-par'];
108
+
109
+ export { API };
@@ -0,0 +1,10 @@
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 DomainStatus}. */
5
+ const DOMAIN_TRANSIENT_STATUSES = ['pending'];
6
+
7
+ /** Lists transient statutes of the enum {@link EmailStatus}. */
8
+ const EMAIL_TRANSIENT_STATUSES = ['new', 'sending'];
9
+
10
+ export { DOMAIN_TRANSIENT_STATUSES, EMAIL_TRANSIENT_STATUSES };
@@ -0,0 +1,4 @@
1
+ export { API } from './api.gen.js';
2
+ export { DOMAIN_TRANSIENT_STATUSES, EMAIL_TRANSIENT_STATUSES } from './content.gen.js';
3
+
4
+ // This file was automatically generated. DO NOT EDIT.