@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,415 @@
1
+ import { API as API$1 } from '../../../scw/api.js';
2
+ import { validatePathParam, urlParams } from '../../../helpers/marshalling.js';
3
+ import { enrichForPagination } from '../../../scw/fetch/resource-paginator.js';
4
+ import { marshalCreateSecretRequest, unmarshalSecret, marshalCreateFolderRequest, unmarshalFolder, marshalUpdateSecretRequest, unmarshalListSecretsResponse, unmarshalListFoldersResponse, marshalAddSecretOwnerRequest, marshalCreateSecretVersionRequest, unmarshalSecretVersion, marshalGeneratePasswordRequest, marshalUpdateSecretVersionRequest, unmarshalListSecretVersionsResponse, unmarshalAccessSecretVersionResponse, unmarshalListTagsResponse } from './marshalling.gen.js';
5
+
6
+ // This file was automatically generated. DO NOT EDIT.
7
+ // If you have any remark or suggestion do not hesitate to open an issue.
8
+ const jsonContentHeaders = {
9
+ 'Content-Type': 'application/json; charset=utf-8'
10
+ };
11
+
12
+ /**
13
+ * Secret Manager API.
14
+ *
15
+ * Secret Manager API. This API allows you to conveniently store, access and
16
+ * share sensitive data.
17
+ */
18
+ class API extends API$1 {
19
+ /** Lists the available regions of the API. */
20
+ static LOCALITIES = ['fr-par'];
21
+
22
+ /**
23
+ * Create a secret. You must specify the `region` to create a secret.
24
+ *
25
+ * @param request - The request {@link CreateSecretRequest}
26
+ * @returns A Promise of Secret
27
+ */
28
+ createSecret = request => this.client.fetch({
29
+ body: JSON.stringify(marshalCreateSecretRequest(request, this.client.settings)),
30
+ headers: jsonContentHeaders,
31
+ method: 'POST',
32
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets`
33
+ }, unmarshalSecret);
34
+
35
+ /**
36
+ * Create folder.
37
+ *
38
+ * @param request - The request {@link CreateFolderRequest}
39
+ * @returns A Promise of Folder
40
+ */
41
+ createFolder = request => this.client.fetch({
42
+ body: JSON.stringify(marshalCreateFolderRequest(request, this.client.settings)),
43
+ headers: jsonContentHeaders,
44
+ method: 'POST',
45
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/folders`
46
+ }, unmarshalFolder);
47
+
48
+ /**
49
+ * Get metadata using the secret's ID. Retrieve the metadata of a secret
50
+ * specified by the `region` and `secret_id` parameters.
51
+ *
52
+ * @param request - The request {@link GetSecretRequest}
53
+ * @returns A Promise of Secret
54
+ */
55
+ getSecret = request => this.client.fetch({
56
+ method: 'GET',
57
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}`
58
+ }, unmarshalSecret);
59
+
60
+ /**
61
+ * Get metadata using the secret's name. Retrieve the metadata of a secret
62
+ * specified by the `region` and `secret_name` parameters.
63
+ *
64
+ * GetSecretByName usage is now deprecated.
65
+ *
66
+ * Scaleway recommends that you use the `ListSecrets` request with the `name`
67
+ * filter.
68
+ *
69
+ * @deprecated
70
+ * @param request - The request {@link GetSecretByNameRequest}
71
+ * @returns A Promise of Secret
72
+ */
73
+ getSecretByName = request => this.client.fetch({
74
+ method: 'GET',
75
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets-by-name/${validatePathParam('secretName', request.secretName)}`,
76
+ urlParams: urlParams(['project_id', request.projectId])
77
+ }, unmarshalSecret);
78
+
79
+ /**
80
+ * Update metadata of a secret. Edit a secret's metadata such as name, tag(s)
81
+ * and description. The secret to update is specified by the `secret_id` and
82
+ * `region` parameters.
83
+ *
84
+ * @param request - The request {@link UpdateSecretRequest}
85
+ * @returns A Promise of Secret
86
+ */
87
+ updateSecret = request => this.client.fetch({
88
+ body: JSON.stringify(marshalUpdateSecretRequest(request, this.client.settings)),
89
+ headers: jsonContentHeaders,
90
+ method: 'PATCH',
91
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}`
92
+ }, unmarshalSecret);
93
+ pageOfListSecrets = (() => {
94
+ var _this = this;
95
+ return function (request) {
96
+ if (request === void 0) {
97
+ request = {};
98
+ }
99
+ return _this.client.fetch({
100
+ method: 'GET',
101
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/secrets`,
102
+ urlParams: urlParams(['is_managed', request.isManaged], ['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['path', request.path], ['project_id', request.projectId], ['tags', request.tags])
103
+ }, unmarshalListSecretsResponse);
104
+ };
105
+ })();
106
+
107
+ /**
108
+ * List secrets. Retrieve the list of secrets created within an Organization
109
+ * and/or Project. You must specify either the `organization_id` or the
110
+ * `project_id` and the `region`.
111
+ *
112
+ * @param request - The request {@link ListSecretsRequest}
113
+ * @returns A Promise of ListSecretsResponse
114
+ */
115
+ listSecrets = (() => {
116
+ var _this2 = this;
117
+ return function (request) {
118
+ if (request === void 0) {
119
+ request = {};
120
+ }
121
+ return enrichForPagination('secrets', _this2.pageOfListSecrets, request);
122
+ };
123
+ })();
124
+ pageOfListFolders = (() => {
125
+ var _this3 = this;
126
+ return function (request) {
127
+ if (request === void 0) {
128
+ request = {};
129
+ }
130
+ return _this3.client.fetch({
131
+ method: 'GET',
132
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/folders`,
133
+ urlParams: urlParams(['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['path', request.path], ['project_id', request.projectId])
134
+ }, unmarshalListFoldersResponse);
135
+ };
136
+ })();
137
+
138
+ /**
139
+ * List folders. Retrieve the list of folders created within a Project.
140
+ *
141
+ * @param request - The request {@link ListFoldersRequest}
142
+ * @returns A Promise of ListFoldersResponse
143
+ */
144
+ listFolders = (() => {
145
+ var _this4 = this;
146
+ return function (request) {
147
+ if (request === void 0) {
148
+ request = {};
149
+ }
150
+ return enrichForPagination('folders', _this4.pageOfListFolders, request);
151
+ };
152
+ })();
153
+
154
+ /**
155
+ * Delete a secret. Delete a given secret specified by the `region` and
156
+ * `secret_id` parameters.
157
+ *
158
+ * @param request - The request {@link DeleteSecretRequest}
159
+ */
160
+ deleteSecret = request => this.client.fetch({
161
+ method: 'DELETE',
162
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}`
163
+ });
164
+
165
+ /**
166
+ * Delete a given folder specified by the `region` and `folder_id` parameters.
167
+ *
168
+ * @param request - The request {@link DeleteFolderRequest}
169
+ */
170
+ deleteFolder = request => this.client.fetch({
171
+ method: 'DELETE',
172
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/folders/${validatePathParam('folderId', request.folderId)}`
173
+ });
174
+
175
+ /**
176
+ * Protect a secret. Protect a given secret specified by the `secret_id`
177
+ * parameter. A protected secret can be read and modified but cannot be
178
+ * deleted.
179
+ *
180
+ * @param request - The request {@link ProtectSecretRequest}
181
+ * @returns A Promise of Secret
182
+ */
183
+ protectSecret = request => this.client.fetch({
184
+ body: '{}',
185
+ headers: jsonContentHeaders,
186
+ method: 'POST',
187
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/protect`
188
+ }, unmarshalSecret);
189
+
190
+ /**
191
+ * Unprotect a secret. Unprotect a given secret specified by the `secret_id`
192
+ * parameter. An unprotected secret can be read, modified and deleted.
193
+ *
194
+ * @param request - The request {@link UnprotectSecretRequest}
195
+ * @returns A Promise of Secret
196
+ */
197
+ unprotectSecret = request => this.client.fetch({
198
+ body: '{}',
199
+ headers: jsonContentHeaders,
200
+ method: 'POST',
201
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/unprotect`
202
+ }, unmarshalSecret);
203
+
204
+ /**
205
+ * Allow a product to use the secret.
206
+ *
207
+ * @param request - The request {@link AddSecretOwnerRequest}
208
+ */
209
+ addSecretOwner = request => this.client.fetch({
210
+ body: JSON.stringify(marshalAddSecretOwnerRequest(request, this.client.settings)),
211
+ headers: jsonContentHeaders,
212
+ method: 'POST',
213
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/add-owner`
214
+ });
215
+
216
+ /**
217
+ * Create a version. Create a version of a given secret specified by the
218
+ * `region` and `secret_id` parameters.
219
+ *
220
+ * @param request - The request {@link CreateSecretVersionRequest}
221
+ * @returns A Promise of SecretVersion
222
+ */
223
+ createSecretVersion = request => this.client.fetch({
224
+ body: JSON.stringify(marshalCreateSecretVersionRequest(request, this.client.settings)),
225
+ headers: jsonContentHeaders,
226
+ method: 'POST',
227
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions`
228
+ }, unmarshalSecretVersion);
229
+
230
+ /**
231
+ * Generate a password in a new version. Generate a password for the given
232
+ * secret specified by the `region` and `secret_id` parameters. This will also
233
+ * create a new version of the secret that will store the password.
234
+ *
235
+ * @param request - The request {@link GeneratePasswordRequest}
236
+ * @returns A Promise of SecretVersion
237
+ */
238
+ generatePassword = request => this.client.fetch({
239
+ body: JSON.stringify(marshalGeneratePasswordRequest(request, this.client.settings)),
240
+ headers: jsonContentHeaders,
241
+ method: 'POST',
242
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/generate-password`
243
+ }, unmarshalSecretVersion);
244
+
245
+ /**
246
+ * Get metadata of a secret's version using the secret's ID. Retrieve the
247
+ * metadata of a secret's given version specified by the `region`, `secret_id`
248
+ * and `revision` parameters.
249
+ *
250
+ * @param request - The request {@link GetSecretVersionRequest}
251
+ * @returns A Promise of SecretVersion
252
+ */
253
+ getSecretVersion = request => this.client.fetch({
254
+ method: 'GET',
255
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}`
256
+ }, unmarshalSecretVersion);
257
+
258
+ /**
259
+ * Get metadata of a secret's version using the secret's name. Retrieve the
260
+ * metadata of a secret's given version specified by the `region`,
261
+ * `secret_name`, `revision` and `project_id` parameters.
262
+ *
263
+ * @param request - The request {@link GetSecretVersionByNameRequest}
264
+ * @returns A Promise of SecretVersion
265
+ */
266
+ getSecretVersionByName = request => this.client.fetch({
267
+ method: 'GET',
268
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets-by-name/${validatePathParam('secretName', request.secretName)}/versions/${validatePathParam('revision', request.revision)}`,
269
+ urlParams: urlParams(['project_id', request.projectId])
270
+ }, unmarshalSecretVersion);
271
+
272
+ /**
273
+ * Update metadata of a version. Edit the metadata of a secret's given
274
+ * version, specified by the `region`, `secret_id` and `revision` parameters.
275
+ *
276
+ * @param request - The request {@link UpdateSecretVersionRequest}
277
+ * @returns A Promise of SecretVersion
278
+ */
279
+ updateSecretVersion = request => this.client.fetch({
280
+ body: JSON.stringify(marshalUpdateSecretVersionRequest(request, this.client.settings)),
281
+ headers: jsonContentHeaders,
282
+ method: 'PATCH',
283
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}`
284
+ }, unmarshalSecretVersion);
285
+ pageOfListSecretVersions = request => this.client.fetch({
286
+ method: 'GET',
287
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions`,
288
+ urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['status', request.status])
289
+ }, unmarshalListSecretVersionsResponse);
290
+
291
+ /**
292
+ * List versions of a secret using the secret's ID. Retrieve the list of a
293
+ * given secret's versions specified by the `secret_id` and `region`
294
+ * parameters.
295
+ *
296
+ * @param request - The request {@link ListSecretVersionsRequest}
297
+ * @returns A Promise of ListSecretVersionsResponse
298
+ */
299
+ listSecretVersions = request => enrichForPagination('versions', this.pageOfListSecretVersions, request);
300
+ pageOfListSecretVersionsByName = request => this.client.fetch({
301
+ method: 'GET',
302
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets-by-name/${validatePathParam('secretName', request.secretName)}/versions`,
303
+ urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['project_id', request.projectId], ['status', request.status])
304
+ }, unmarshalListSecretVersionsResponse);
305
+
306
+ /**
307
+ * List versions of a secret using the secret's name. Retrieve the list of a
308
+ * given secret's versions specified by the `secret_name`,`region` and
309
+ * `project_id` parameters.
310
+ *
311
+ * @param request - The request {@link ListSecretVersionsByNameRequest}
312
+ * @returns A Promise of ListSecretVersionsResponse
313
+ */
314
+ listSecretVersionsByName = request => enrichForPagination('versions', this.pageOfListSecretVersionsByName, request);
315
+
316
+ /**
317
+ * Enable a version. Make a specific version accessible. You must specify the
318
+ * `region`, `secret_id` and `revision` parameters.
319
+ *
320
+ * @param request - The request {@link EnableSecretVersionRequest}
321
+ * @returns A Promise of SecretVersion
322
+ */
323
+ enableSecretVersion = request => this.client.fetch({
324
+ body: '{}',
325
+ headers: jsonContentHeaders,
326
+ method: 'POST',
327
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/enable`
328
+ }, unmarshalSecretVersion);
329
+
330
+ /**
331
+ * Disable a version. Make a specific version inaccessible. You must specify
332
+ * the `region`, `secret_id` and `revision` parameters.
333
+ *
334
+ * @param request - The request {@link DisableSecretVersionRequest}
335
+ * @returns A Promise of SecretVersion
336
+ */
337
+ disableSecretVersion = request => this.client.fetch({
338
+ body: '{}',
339
+ headers: jsonContentHeaders,
340
+ method: 'POST',
341
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/disable`
342
+ }, unmarshalSecretVersion);
343
+
344
+ /**
345
+ * Access a secret's version using the secret's ID. Access sensitive data in a
346
+ * secret's version specified by the `region`, `secret_id` and `revision`
347
+ * parameters.
348
+ *
349
+ * @param request - The request {@link AccessSecretVersionRequest}
350
+ * @returns A Promise of AccessSecretVersionResponse
351
+ */
352
+ accessSecretVersion = request => this.client.fetch({
353
+ method: 'GET',
354
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/access`
355
+ }, unmarshalAccessSecretVersionResponse);
356
+
357
+ /**
358
+ * Access a secret's version using the secret's name. Access sensitive data in
359
+ * a secret's version specified by the `region`, `secret_name`, `revision` and
360
+ * `project_id` parameters.
361
+ *
362
+ * @param request - The request {@link AccessSecretVersionByNameRequest}
363
+ * @returns A Promise of AccessSecretVersionResponse
364
+ */
365
+ accessSecretVersionByName = request => this.client.fetch({
366
+ method: 'GET',
367
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets-by-name/${validatePathParam('secretName', request.secretName)}/versions/${validatePathParam('revision', request.revision)}/access`,
368
+ urlParams: urlParams(['project_id', request.projectId])
369
+ }, unmarshalAccessSecretVersionResponse);
370
+
371
+ /**
372
+ * Delete a version. Delete a secret's version and the sensitive data
373
+ * contained in it. Deleting a version is permanent and cannot be undone.
374
+ *
375
+ * @param request - The request {@link DestroySecretVersionRequest}
376
+ * @returns A Promise of SecretVersion
377
+ */
378
+ destroySecretVersion = request => this.client.fetch({
379
+ body: '{}',
380
+ headers: jsonContentHeaders,
381
+ method: 'POST',
382
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/secrets/${validatePathParam('secretId', request.secretId)}/versions/${validatePathParam('revision', request.revision)}/destroy`
383
+ }, unmarshalSecretVersion);
384
+ pageOfListTags = (() => {
385
+ var _this5 = this;
386
+ return function (request) {
387
+ if (request === void 0) {
388
+ request = {};
389
+ }
390
+ return _this5.client.fetch({
391
+ method: 'GET',
392
+ path: `/secret-manager/v1alpha1/regions/${validatePathParam('region', request.region ?? _this5.client.settings.defaultRegion)}/tags`,
393
+ urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? _this5.client.settings.defaultPageSize], ['project_id', request.projectId])
394
+ }, unmarshalListTagsResponse);
395
+ };
396
+ })();
397
+
398
+ /**
399
+ * List tags. List all tags associated with secrets within a given Project.
400
+ *
401
+ * @param request - The request {@link ListTagsRequest}
402
+ * @returns A Promise of ListTagsResponse
403
+ */
404
+ listTags = (() => {
405
+ var _this6 = this;
406
+ return function (request) {
407
+ if (request === void 0) {
408
+ request = {};
409
+ }
410
+ return enrichForPagination('tags', _this6.pageOfListTags, request);
411
+ };
412
+ })();
413
+ }
414
+
415
+ export { API };
@@ -0,0 +1,4 @@
1
+ export { API } from './api.gen.js';
2
+
3
+ // This file was automatically generated. DO NOT EDIT.
4
+ // If you have any remark or suggestion do not hesitate to open an issue.
@@ -0,0 +1,150 @@
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
+ // If you have any remark or suggestion do not hesitate to open an issue.
6
+ const unmarshalFolder = data => {
7
+ if (!isJSONObject(data)) {
8
+ throw new TypeError(`Unmarshalling the type 'Folder' failed as data isn't a dictionary.`);
9
+ }
10
+ return {
11
+ createdAt: unmarshalDate(data.created_at),
12
+ id: data.id,
13
+ name: data.name,
14
+ path: data.path,
15
+ projectId: data.project_id
16
+ };
17
+ };
18
+ const unmarshalSecretVersion = data => {
19
+ if (!isJSONObject(data)) {
20
+ throw new TypeError(`Unmarshalling the type 'SecretVersion' failed as data isn't a dictionary.`);
21
+ }
22
+ return {
23
+ createdAt: unmarshalDate(data.created_at),
24
+ description: data.description,
25
+ isLatest: data.is_latest,
26
+ revision: data.revision,
27
+ secretId: data.secret_id,
28
+ status: data.status,
29
+ updatedAt: unmarshalDate(data.updated_at)
30
+ };
31
+ };
32
+ const unmarshalSecret = data => {
33
+ if (!isJSONObject(data)) {
34
+ throw new TypeError(`Unmarshalling the type 'Secret' failed as data isn't a dictionary.`);
35
+ }
36
+ return {
37
+ createdAt: unmarshalDate(data.created_at),
38
+ description: data.description,
39
+ id: data.id,
40
+ isManaged: data.is_managed,
41
+ isProtected: data.is_protected,
42
+ name: data.name,
43
+ path: data.path,
44
+ projectId: data.project_id,
45
+ region: data.region,
46
+ status: data.status,
47
+ tags: data.tags,
48
+ type: data.type,
49
+ updatedAt: unmarshalDate(data.updated_at),
50
+ versionCount: data.version_count
51
+ };
52
+ };
53
+ const unmarshalAccessSecretVersionResponse = data => {
54
+ if (!isJSONObject(data)) {
55
+ throw new TypeError(`Unmarshalling the type 'AccessSecretVersionResponse' failed as data isn't a dictionary.`);
56
+ }
57
+ return {
58
+ data: data.data,
59
+ dataCrc32: data.data_crc32,
60
+ revision: data.revision,
61
+ secretId: data.secret_id
62
+ };
63
+ };
64
+ const unmarshalListFoldersResponse = data => {
65
+ if (!isJSONObject(data)) {
66
+ throw new TypeError(`Unmarshalling the type 'ListFoldersResponse' failed as data isn't a dictionary.`);
67
+ }
68
+ return {
69
+ folders: unmarshalArrayOfObject(data.folders, unmarshalFolder),
70
+ totalCount: data.total_count
71
+ };
72
+ };
73
+ const unmarshalListSecretVersionsResponse = data => {
74
+ if (!isJSONObject(data)) {
75
+ throw new TypeError(`Unmarshalling the type 'ListSecretVersionsResponse' failed as data isn't a dictionary.`);
76
+ }
77
+ return {
78
+ totalCount: data.total_count,
79
+ versions: unmarshalArrayOfObject(data.versions, unmarshalSecretVersion)
80
+ };
81
+ };
82
+ const unmarshalListSecretsResponse = data => {
83
+ if (!isJSONObject(data)) {
84
+ throw new TypeError(`Unmarshalling the type 'ListSecretsResponse' failed as data isn't a dictionary.`);
85
+ }
86
+ return {
87
+ secrets: unmarshalArrayOfObject(data.secrets, unmarshalSecret),
88
+ totalCount: data.total_count
89
+ };
90
+ };
91
+ const unmarshalListTagsResponse = data => {
92
+ if (!isJSONObject(data)) {
93
+ throw new TypeError(`Unmarshalling the type 'ListTagsResponse' failed as data isn't a dictionary.`);
94
+ }
95
+ return {
96
+ tags: data.tags,
97
+ totalCount: data.total_count
98
+ };
99
+ };
100
+ const marshalAddSecretOwnerRequest = (request, defaults) => ({
101
+ product: request.product,
102
+ product_name: request.productName
103
+ });
104
+ const marshalCreateFolderRequest = (request, defaults) => ({
105
+ name: request.name,
106
+ path: request.path,
107
+ project_id: request.projectId ?? defaults.defaultProjectId
108
+ });
109
+ const marshalCreateSecretRequest = (request, defaults) => ({
110
+ description: request.description,
111
+ name: request.name,
112
+ path: request.path,
113
+ project_id: request.projectId ?? defaults.defaultProjectId,
114
+ tags: request.tags,
115
+ type: request.type
116
+ });
117
+ const marshalPasswordGenerationParams = (request, defaults) => ({
118
+ additional_chars: request.additionalChars,
119
+ length: request.length,
120
+ no_digits: request.noDigits,
121
+ no_lowercase_letters: request.noLowercaseLetters,
122
+ no_uppercase_letters: request.noUppercaseLetters
123
+ });
124
+ const marshalCreateSecretVersionRequest = (request, defaults) => ({
125
+ data: request.data,
126
+ data_crc32: request.dataCrc32,
127
+ description: request.description,
128
+ disable_previous: request.disablePrevious,
129
+ password_generation: request.passwordGeneration !== undefined ? marshalPasswordGenerationParams(request.passwordGeneration) : undefined
130
+ });
131
+ const marshalGeneratePasswordRequest = (request, defaults) => ({
132
+ additional_chars: request.additionalChars,
133
+ description: request.description,
134
+ disable_previous: request.disablePrevious,
135
+ length: request.length,
136
+ no_digits: request.noDigits,
137
+ no_lowercase_letters: request.noLowercaseLetters,
138
+ no_uppercase_letters: request.noUppercaseLetters
139
+ });
140
+ const marshalUpdateSecretRequest = (request, defaults) => ({
141
+ description: request.description,
142
+ name: request.name,
143
+ path: request.path,
144
+ tags: request.tags
145
+ });
146
+ const marshalUpdateSecretVersionRequest = (request, defaults) => ({
147
+ description: request.description
148
+ });
149
+
150
+ export { marshalAddSecretOwnerRequest, marshalCreateFolderRequest, marshalCreateSecretRequest, marshalCreateSecretVersionRequest, marshalGeneratePasswordRequest, marshalUpdateSecretRequest, marshalUpdateSecretVersionRequest, unmarshalAccessSecretVersionResponse, unmarshalFolder, unmarshalListFoldersResponse, unmarshalListSecretVersionsResponse, unmarshalListSecretsResponse, unmarshalListTagsResponse, unmarshalSecret, unmarshalSecretVersion };
@@ -0,0 +1,2 @@
1
+ import * as index_gen from './v1alpha1/index.gen.js';
2
+ export { index_gen as v1alpha1 };