@scaleway/sdk 3.0.0-alpha.0 → 3.1.1

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 (214) hide show
  1. package/dist/index.gen.d.ts +362 -0
  2. package/dist/index.gen.js +323 -0
  3. package/package.json +71 -25
  4. package/README.md +0 -46
  5. package/dist/api/account/index.js +0 -4
  6. package/dist/api/account/v2/api.gen.js +0 -147
  7. package/dist/api/account/v2/index.gen.js +0 -4
  8. package/dist/api/account/v2/marshalling.gen.js +0 -39
  9. package/dist/api/account/v3/api.gen.js +0 -129
  10. package/dist/api/account/v3/index.gen.js +0 -6
  11. package/dist/api/account/v3/marshalling.gen.js +0 -39
  12. package/dist/api/account/v3/validation-rules.gen.js +0 -39
  13. package/dist/api/applesilicon/index.js +0 -2
  14. package/dist/api/applesilicon/v1alpha1/api.gen.js +0 -220
  15. package/dist/api/applesilicon/v1alpha1/content.gen.js +0 -7
  16. package/dist/api/applesilicon/v1alpha1/index.gen.js +0 -5
  17. package/dist/api/applesilicon/v1alpha1/marshalling.gen.js +0 -113
  18. package/dist/api/baremetal/index.js +0 -2
  19. package/dist/api/baremetal/v1/api.gen.js +0 -523
  20. package/dist/api/baremetal/v1/api.utils.js +0 -27
  21. package/dist/api/baremetal/v1/content.gen.js +0 -13
  22. package/dist/api/baremetal/v1/index.js +0 -5
  23. package/dist/api/baremetal/v1/marshalling.gen.js +0 -395
  24. package/dist/api/baremetal/v1/validation-rules.gen.js +0 -109
  25. package/dist/api/billing/index.js +0 -2
  26. package/dist/api/billing/v2alpha1/api.gen.js +0 -80
  27. package/dist/api/billing/v2alpha1/index.gen.js +0 -4
  28. package/dist/api/billing/v2alpha1/marshalling.gen.js +0 -53
  29. package/dist/api/block/index.js +0 -2
  30. package/dist/api/block/v1alpha1/api.gen.js +0 -245
  31. package/dist/api/block/v1alpha1/content.gen.js +0 -13
  32. package/dist/api/block/v1alpha1/index.gen.js +0 -7
  33. package/dist/api/block/v1alpha1/marshalling.gen.js +0 -175
  34. package/dist/api/block/v1alpha1/validation-rules.gen.js +0 -42
  35. package/dist/api/cockpit/index.js +0 -2
  36. package/dist/api/cockpit/v1beta1/api.gen.js +0 -448
  37. package/dist/api/cockpit/v1beta1/content.gen.js +0 -7
  38. package/dist/api/cockpit/v1beta1/index.gen.js +0 -5
  39. package/dist/api/cockpit/v1beta1/marshalling.gen.js +0 -220
  40. package/dist/api/container/index.js +0 -2
  41. package/dist/api/container/v1beta1/api.gen.js +0 -549
  42. package/dist/api/container/v1beta1/content.gen.js +0 -22
  43. package/dist/api/container/v1beta1/index.gen.js +0 -5
  44. package/dist/api/container/v1beta1/marshalling.gen.js +0 -330
  45. package/dist/api/document_db/index.js +0 -2
  46. package/dist/api/document_db/v1beta1/api.gen.js +0 -830
  47. package/dist/api/document_db/v1beta1/content.gen.js +0 -19
  48. package/dist/api/document_db/v1beta1/index.gen.js +0 -7
  49. package/dist/api/document_db/v1beta1/marshalling.gen.js +0 -580
  50. package/dist/api/document_db/v1beta1/validation-rules.gen.js +0 -10
  51. package/dist/api/domain/index.js +0 -2
  52. package/dist/api/domain/v2beta1/api.gen.js +0 -875
  53. package/dist/api/domain/v2beta1/content.gen.js +0 -28
  54. package/dist/api/domain/v2beta1/index.gen.js +0 -7
  55. package/dist/api/domain/v2beta1/marshalling.gen.js +0 -958
  56. package/dist/api/flexibleip/index.js +0 -2
  57. package/dist/api/flexibleip/v1alpha1/api.gen.js +0 -203
  58. package/dist/api/flexibleip/v1alpha1/content.gen.js +0 -10
  59. package/dist/api/flexibleip/v1alpha1/index.gen.js +0 -7
  60. package/dist/api/flexibleip/v1alpha1/marshalling.gen.js +0 -97
  61. package/dist/api/flexibleip/v1alpha1/validation-rules.gen.js +0 -14
  62. package/dist/api/function/index.js +0 -2
  63. package/dist/api/function/v1beta1/api.gen.js +0 -560
  64. package/dist/api/function/v1beta1/content.gen.js +0 -22
  65. package/dist/api/function/v1beta1/index.gen.js +0 -5
  66. package/dist/api/function/v1beta1/marshalling.gen.js +0 -368
  67. package/dist/api/iam/index.js +0 -2
  68. package/dist/api/iam/v1alpha1/api.gen.js +0 -799
  69. package/dist/api/iam/v1alpha1/index.gen.js +0 -6
  70. package/dist/api/iam/v1alpha1/marshalling.gen.js +0 -373
  71. package/dist/api/iam/v1alpha1/validation-rules.gen.js +0 -207
  72. package/dist/api/instance/index.js +0 -2
  73. package/dist/api/instance/v1/api.gen.js +0 -1003
  74. package/dist/api/instance/v1/api.utils.js +0 -369
  75. package/dist/api/instance/v1/content.gen.js +0 -31
  76. package/dist/api/instance/v1/index.js +0 -2
  77. package/dist/api/instance/v1/marshalling.gen.js +0 -1206
  78. package/dist/api/instance/v1/marshalling.utils.js +0 -63
  79. package/dist/api/iot/index.js +0 -2
  80. package/dist/api/iot/v1/api.gen.js +0 -581
  81. package/dist/api/iot/v1/content.gen.js +0 -7
  82. package/dist/api/iot/v1/index.gen.js +0 -5
  83. package/dist/api/iot/v1/marshalling.gen.js +0 -388
  84. package/dist/api/ipfs/index.js +0 -2
  85. package/dist/api/ipfs/v1alpha1/api.gen.js +0 -197
  86. package/dist/api/ipfs/v1alpha1/content.gen.js +0 -7
  87. package/dist/api/ipfs/v1alpha1/index.gen.js +0 -5
  88. package/dist/api/ipfs/v1alpha1/marshalling.gen.js +0 -121
  89. package/dist/api/k8s/index.js +0 -2
  90. package/dist/api/k8s/v1/api.gen.js +0 -454
  91. package/dist/api/k8s/v1/api.utils.js +0 -13
  92. package/dist/api/k8s/v1/content.gen.js +0 -13
  93. package/dist/api/k8s/v1/index.js +0 -4
  94. package/dist/api/k8s/v1/marshalling.gen.js +0 -333
  95. package/dist/api/k8s/v1/validation-rules.gen.js +0 -101
  96. package/dist/api/lb/index.js +0 -2
  97. package/dist/api/lb/v1/api.gen.js +0 -1669
  98. package/dist/api/lb/v1/api.utils.js +0 -81
  99. package/dist/api/lb/v1/content.gen.js +0 -16
  100. package/dist/api/lb/v1/index.js +0 -2
  101. package/dist/api/lb/v1/marshalling.gen.js +0 -923
  102. package/dist/api/marketplace/index.js +0 -4
  103. package/dist/api/marketplace/v1/api.gen.js +0 -60
  104. package/dist/api/marketplace/v1/index.gen.js +0 -4
  105. package/dist/api/marketplace/v1/marshalling.gen.js +0 -92
  106. package/dist/api/marketplace/v2/api.gen.js +0 -162
  107. package/dist/api/marketplace/v2/index.gen.js +0 -4
  108. package/dist/api/marketplace/v2/marshalling.gen.js +0 -94
  109. package/dist/api/mnq/index.js +0 -2
  110. package/dist/api/mnq/v1alpha1/api.gen.js +0 -205
  111. package/dist/api/mnq/v1alpha1/index.gen.js +0 -4
  112. package/dist/api/mnq/v1alpha1/marshalling.gen.js +0 -121
  113. package/dist/api/rdb/index.js +0 -2
  114. package/dist/api/rdb/v1/api.gen.js +0 -972
  115. package/dist/api/rdb/v1/content.gen.js +0 -22
  116. package/dist/api/rdb/v1/index.gen.js +0 -7
  117. package/dist/api/rdb/v1/marshalling.gen.js +0 -636
  118. package/dist/api/rdb/v1/validation-rules.gen.js +0 -10
  119. package/dist/api/redis/index.js +0 -2
  120. package/dist/api/redis/v1/api.gen.js +0 -389
  121. package/dist/api/redis/v1/content.gen.js +0 -7
  122. package/dist/api/redis/v1/index.gen.js +0 -5
  123. package/dist/api/redis/v1/marshalling.gen.js +0 -259
  124. package/dist/api/registry/index.js +0 -2
  125. package/dist/api/registry/v1/api.gen.js +0 -252
  126. package/dist/api/registry/v1/content.gen.js +0 -13
  127. package/dist/api/registry/v1/index.gen.js +0 -5
  128. package/dist/api/registry/v1/marshalling.gen.js +0 -106
  129. package/dist/api/secret/index.js +0 -2
  130. package/dist/api/secret/v1alpha1/api.gen.js +0 -415
  131. package/dist/api/secret/v1alpha1/index.gen.js +0 -4
  132. package/dist/api/secret/v1alpha1/marshalling.gen.js +0 -143
  133. package/dist/api/tem/index.js +0 -2
  134. package/dist/api/tem/v1alpha1/api.gen.js +0 -229
  135. package/dist/api/tem/v1alpha1/content.gen.js +0 -10
  136. package/dist/api/tem/v1alpha1/index.gen.js +0 -5
  137. package/dist/api/tem/v1alpha1/marshalling.gen.js +0 -159
  138. package/dist/api/test/index.js +0 -2
  139. package/dist/api/test/v1/api.gen.js +0 -152
  140. package/dist/api/test/v1/content.gen.js +0 -7
  141. package/dist/api/test/v1/index.gen.js +0 -5
  142. package/dist/api/test/v1/marshalling.gen.js +0 -79
  143. package/dist/api/vpc/index.js +0 -4
  144. package/dist/api/vpc/v1/api.gen.js +0 -110
  145. package/dist/api/vpc/v1/index.gen.js +0 -4
  146. package/dist/api/vpc/v1/marshalling.gen.js +0 -44
  147. package/dist/api/vpc/v2/api.gen.js +0 -276
  148. package/dist/api/vpc/v2/index.gen.js +0 -4
  149. package/dist/api/vpc/v2/marshalling.gen.js +0 -135
  150. package/dist/api/vpcgw/index.js +0 -2
  151. package/dist/api/vpcgw/v1/api.gen.js +0 -669
  152. package/dist/api/vpcgw/v1/content.gen.js +0 -10
  153. package/dist/api/vpcgw/v1/index.gen.js +0 -5
  154. package/dist/api/vpcgw/v1/marshalling.gen.js +0 -336
  155. package/dist/api/webhosting/index.js +0 -2
  156. package/dist/api/webhosting/v1alpha1/api.gen.js +0 -210
  157. package/dist/api/webhosting/v1alpha1/content.gen.js +0 -7
  158. package/dist/api/webhosting/v1alpha1/index.gen.js +0 -7
  159. package/dist/api/webhosting/v1alpha1/marshalling.gen.js +0 -173
  160. package/dist/api/webhosting/v1alpha1/validation-rules.gen.js +0 -23
  161. package/dist/helpers/is-browser.js +0 -5
  162. package/dist/helpers/is-response.js +0 -10
  163. package/dist/helpers/json.js +0 -11
  164. package/dist/helpers/marshalling.js +0 -130
  165. package/dist/index.cjs +0 -24364
  166. package/dist/index.d.ts +0 -27584
  167. package/dist/index.js +0 -69
  168. package/dist/internal/async/interval-retrier.js +0 -105
  169. package/dist/internal/async/sleep.js +0 -13
  170. package/dist/internal/interceptors/composer.js +0 -46
  171. package/dist/internal/interceptors/helpers.js +0 -32
  172. package/dist/internal/logger/console-logger.js +0 -38
  173. package/dist/internal/logger/index.js +0 -41
  174. package/dist/internal/logger/level-resolver.js +0 -13
  175. package/dist/internal/validations/string-validation.js +0 -38
  176. package/dist/node_modules/.pnpm/@scaleway_random-name@4.0.2/node_modules/@scaleway/random-name/dist/index.js +0 -13
  177. package/dist/scw/api.js +0 -12
  178. package/dist/scw/auth.js +0 -68
  179. package/dist/scw/client-ini-factory.js +0 -174
  180. package/dist/scw/client-ini-profile.js +0 -54
  181. package/dist/scw/client-settings.js +0 -78
  182. package/dist/scw/client.js +0 -98
  183. package/dist/scw/constants.js +0 -4
  184. package/dist/scw/custom-marshalling.js +0 -131
  185. package/dist/scw/errors/error-parser.js +0 -107
  186. package/dist/scw/errors/non-standard/invalid-request-mapper.js +0 -36
  187. package/dist/scw/errors/non-standard/unknown-resource-mapper.js +0 -27
  188. package/dist/scw/errors/scw-error.js +0 -66
  189. package/dist/scw/errors/standard/already-exists-error.js +0 -26
  190. package/dist/scw/errors/standard/denied-authentication-error.js +0 -52
  191. package/dist/scw/errors/standard/index.js +0 -13
  192. package/dist/scw/errors/standard/invalid-arguments-error.js +0 -67
  193. package/dist/scw/errors/standard/out-of-stock-error.js +0 -22
  194. package/dist/scw/errors/standard/permissions-denied-error.js +0 -48
  195. package/dist/scw/errors/standard/precondition-failed-error.js +0 -42
  196. package/dist/scw/errors/standard/quotas-exceeded-error.js +0 -68
  197. package/dist/scw/errors/standard/resource-expired-error.js +0 -26
  198. package/dist/scw/errors/standard/resource-locked-error.js +0 -25
  199. package/dist/scw/errors/standard/resource-not-found-error.js +0 -25
  200. package/dist/scw/errors/standard/too-many-requests-error.js +0 -70
  201. package/dist/scw/errors/standard/transient-state-error.js +0 -26
  202. package/dist/scw/errors/types.js +0 -23
  203. package/dist/scw/fetch/build-fetcher.js +0 -72
  204. package/dist/scw/fetch/http-dumper.js +0 -54
  205. package/dist/scw/fetch/http-interceptors.js +0 -99
  206. package/dist/scw/fetch/resource-paginator.js +0 -84
  207. package/dist/scw/fetch/response-parser.js +0 -72
  208. package/node_modules/@scaleway/random-name/.npmignore +0 -4
  209. package/node_modules/@scaleway/random-name/CHANGELOG.md +0 -129
  210. package/node_modules/@scaleway/random-name/LICENSE.md +0 -21
  211. package/node_modules/@scaleway/random-name/README.md +0 -26
  212. package/node_modules/@scaleway/random-name/dist/index.d.ts +0 -3
  213. package/node_modules/@scaleway/random-name/dist/index.js +0 -13
  214. package/node_modules/@scaleway/random-name/package.json +0 -23
@@ -1,830 +0,0 @@
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 { INSTANCE_TRANSIENT_STATUSES, READ_REPLICA_TRANSIENT_STATUSES, INSTANCE_LOG_TRANSIENT_STATUSES, SNAPSHOT_TRANSIENT_STATUSES } from './content.gen.js';
6
- import { unmarshalListDatabaseEnginesResponse, unmarshalListNodeTypesResponse, marshalUpgradeInstanceRequest, unmarshalInstance, unmarshalListInstancesResponse, marshalCreateInstanceRequest, marshalUpdateInstanceRequest, marshalCloneInstanceRequest, unmarshalInstanceMetrics, marshalCreateReadReplicaRequest, unmarshalReadReplica, marshalCreateReadReplicaEndpointRequest, unmarshalListInstanceLogsResponse, unmarshalInstanceLog, marshalPurgeInstanceLogsRequest, unmarshalListInstanceLogsDetailsResponse, marshalAddInstanceSettingsRequest, unmarshalAddInstanceSettingsResponse, marshalDeleteInstanceSettingsRequest, unmarshalDeleteInstanceSettingsResponse, marshalSetInstanceSettingsRequest, unmarshalSetInstanceSettingsResponse, unmarshalListInstanceACLRulesResponse, marshalAddInstanceACLRulesRequest, unmarshalAddInstanceACLRulesResponse, marshalSetInstanceACLRulesRequest, unmarshalSetInstanceACLRulesResponse, marshalDeleteInstanceACLRulesRequest, unmarshalDeleteInstanceACLRulesResponse, unmarshalListUsersResponse, marshalCreateUserRequest, unmarshalUser, marshalUpdateUserRequest, unmarshalListDatabasesResponse, marshalCreateDatabaseRequest, unmarshalDatabase, unmarshalListPrivilegesResponse, marshalSetPrivilegeRequest, unmarshalPrivilege, unmarshalListSnapshotsResponse, unmarshalSnapshot, marshalCreateSnapshotRequest, marshalUpdateSnapshotRequest, marshalCreateInstanceFromSnapshotRequest, marshalCreateEndpointRequest, unmarshalEndpoint, marshalMigrateEndpointRequest } from './marshalling.gen.js';
7
-
8
- // This file was automatically generated. DO NOT EDIT.
9
- // If you have any remark or suggestion do not hesitate to open an issue.
10
- const jsonContentHeaders = {
11
- 'Content-Type': 'application/json; charset=utf-8'
12
- };
13
-
14
- /** Managed Document Databases API. */
15
- class API extends API$1 {
16
- /** Lists the available regions of the API. */
17
- static LOCALITIES = ['fr-par', 'nl-ams', 'pl-waw'];
18
- pageOfListDatabaseEngines = (() => {
19
- var _this = this;
20
- return function (request) {
21
- if (request === void 0) {
22
- request = {};
23
- }
24
- return _this.client.fetch({
25
- method: 'GET',
26
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? _this.client.settings.defaultRegion)}/database-engines`,
27
- urlParams: urlParams(['name', request.name], ['page', request.page], ['page_size', request.pageSize ?? _this.client.settings.defaultPageSize], ['version', request.version])
28
- }, unmarshalListDatabaseEnginesResponse);
29
- };
30
- })();
31
-
32
- /**
33
- * List available database engines. List the FerretDB database engines
34
- * available at Scaleway.
35
- *
36
- * @param request - The request {@link ListDatabaseEnginesRequest}
37
- * @returns A Promise of ListDatabaseEnginesResponse
38
- */
39
- listDatabaseEngines = (() => {
40
- var _this2 = this;
41
- return function (request) {
42
- if (request === void 0) {
43
- request = {};
44
- }
45
- return enrichForPagination('engines', _this2.pageOfListDatabaseEngines, request);
46
- };
47
- })();
48
- pageOfListNodeTypes = request => this.client.fetch({
49
- method: 'GET',
50
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/node-types`,
51
- urlParams: urlParams(['include_disabled_types', request.includeDisabledTypes], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
52
- }, unmarshalListNodeTypesResponse);
53
-
54
- /**
55
- * List available node types. List all available node types. By default, the
56
- * node types returned in the list are ordered by creation date in ascending
57
- * order, though this can be modified via the `order_by` field.
58
- *
59
- * @param request - The request {@link ListNodeTypesRequest}
60
- * @returns A Promise of ListNodeTypesResponse
61
- */
62
- listNodeTypes = request => enrichForPagination('nodeTypes', this.pageOfListNodeTypes, request);
63
-
64
- /**
65
- * Upgrade a Database Instance. Upgrade your current Database Instance
66
- * specifications like node type, high availability, volume, or the database
67
- * engine version. Note that upon upgrade the `enable_ha` parameter can only
68
- * be set to `true`.
69
- *
70
- * @param request - The request {@link UpgradeInstanceRequest}
71
- * @returns A Promise of Instance
72
- */
73
- upgradeInstance = request => this.client.fetch({
74
- body: JSON.stringify(marshalUpgradeInstanceRequest(request, this.client.settings)),
75
- headers: jsonContentHeaders,
76
- method: 'POST',
77
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/upgrade`
78
- }, unmarshalInstance);
79
- pageOfListInstances = (() => {
80
- var _this3 = this;
81
- return function (request) {
82
- if (request === void 0) {
83
- request = {};
84
- }
85
- return _this3.client.fetch({
86
- method: 'GET',
87
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? _this3.client.settings.defaultRegion)}/instances`,
88
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this3.client.settings.defaultPageSize], ['project_id', request.projectId], ['tags', request.tags])
89
- }, unmarshalListInstancesResponse);
90
- };
91
- })();
92
-
93
- /**
94
- * List Database Instances. List all Database Instances in the specified
95
- * region, for a given Scaleway Organization or Scaleway Project. By default,
96
- * the Database Instances returned in the list are ordered by creation date in
97
- * ascending order, though this can be modified via the order_by field. You
98
- * can define additional parameters for your query, such as `tags` and `name`.
99
- * For the `name` parameter, the value you include will be checked against the
100
- * whole name string to see if it includes the string you put in the
101
- * parameter.
102
- *
103
- * @param request - The request {@link ListInstancesRequest}
104
- * @returns A Promise of ListInstancesResponse
105
- */
106
- listInstances = (() => {
107
- var _this4 = this;
108
- return function (request) {
109
- if (request === void 0) {
110
- request = {};
111
- }
112
- return enrichForPagination('instances', _this4.pageOfListInstances, request);
113
- };
114
- })();
115
-
116
- /**
117
- * Get a Database Instance. Retrieve information about a given Database
118
- * Instance, specified by the `region` and `instance_id` parameters. Its full
119
- * details, including name, status, IP address and port, are returned in the
120
- * response object.
121
- *
122
- * @param request - The request {@link GetInstanceRequest}
123
- * @returns A Promise of Instance
124
- */
125
- getInstance = request => this.client.fetch({
126
- method: 'GET',
127
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}`
128
- }, unmarshalInstance);
129
-
130
- /**
131
- * Waits for {@link Instance} to be in a final state.
132
- *
133
- * @param request - The request {@link GetInstanceRequest}
134
- * @param options - The waiting options
135
- * @returns A Promise of Instance
136
- */
137
- waitForInstance = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!INSTANCE_TRANSIENT_STATUSES.includes(res.status))), this.getInstance, request, options);
138
-
139
- /**
140
- * Create a Database Instance. Create a new Database Instance. You must set
141
- * the `engine`, `user_name`, `password` and `node_type` parameters.
142
- * Optionally, you can specify the volume type and size.
143
- *
144
- * @param request - The request {@link CreateInstanceRequest}
145
- * @returns A Promise of Instance
146
- */
147
- createInstance = request => this.client.fetch({
148
- body: JSON.stringify(marshalCreateInstanceRequest(request, this.client.settings)),
149
- headers: jsonContentHeaders,
150
- method: 'POST',
151
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances`
152
- }, unmarshalInstance);
153
-
154
- /**
155
- * Update a Database Instance. Update the parameters of a Database Instance,
156
- * including name, tags and backup schedule details.
157
- *
158
- * @param request - The request {@link UpdateInstanceRequest}
159
- * @returns A Promise of Instance
160
- */
161
- updateInstance = request => this.client.fetch({
162
- body: JSON.stringify(marshalUpdateInstanceRequest(request, this.client.settings)),
163
- headers: jsonContentHeaders,
164
- method: 'PATCH',
165
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}`
166
- }, unmarshalInstance);
167
-
168
- /**
169
- * Delete a Database Instance. Delete a given Database Instance, specified by
170
- * the `region` and `instance_id` parameters. Deleting a Database Instance is
171
- * permanent, and cannot be undone. Note that upon deletion all your data will
172
- * be lost.
173
- *
174
- * @param request - The request {@link DeleteInstanceRequest}
175
- * @returns A Promise of Instance
176
- */
177
- deleteInstance = request => this.client.fetch({
178
- method: 'DELETE',
179
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}`
180
- }, unmarshalInstance);
181
-
182
- /**
183
- * Clone a Database Instance. Clone a given Database Instance, specified by
184
- * the `region` and `instance_id` parameters. The clone feature allows you to
185
- * create a new Database Instance from an existing one. The clone includes all
186
- * existing databases, users and permissions. You can create a clone on a
187
- * Database Instance bigger than your current one.
188
- *
189
- * @param request - The request {@link CloneInstanceRequest}
190
- * @returns A Promise of Instance
191
- */
192
- cloneInstance = request => this.client.fetch({
193
- body: JSON.stringify(marshalCloneInstanceRequest(request, this.client.settings)),
194
- headers: jsonContentHeaders,
195
- method: 'POST',
196
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/clone`
197
- }, unmarshalInstance);
198
-
199
- /**
200
- * Restart Database Instance. Restart a given Database Instance, specified by
201
- * the `region` and `instance_id` parameters. The status of the Database
202
- * Instance returned in the response.
203
- *
204
- * @param request - The request {@link RestartInstanceRequest}
205
- * @returns A Promise of Instance
206
- */
207
- restartInstance = request => this.client.fetch({
208
- body: '{}',
209
- headers: jsonContentHeaders,
210
- method: 'POST',
211
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/restart`
212
- }, unmarshalInstance);
213
-
214
- /**
215
- * Get the TLS certificate of a Database Instance. Retrieve information about
216
- * the TLS certificate of a given Database Instance. Details like name and
217
- * content are returned in the response.
218
- *
219
- * @param request - The request {@link GetInstanceCertificateRequest}
220
- * @returns A Promise of Blob
221
- */
222
- getInstanceCertificate = request => this.client.fetch({
223
- method: 'GET',
224
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/certificate`,
225
- urlParams: urlParams(['dl', 1]),
226
- responseType: 'blob'
227
- });
228
-
229
- /**
230
- * Renew the TLS certificate of a Database Instance. Renew a TLS for a
231
- * Database Instance. Renewing a certificate means that you will not be able
232
- * to connect to your Database Instance using the previous certificate. You
233
- * will also need to download and update the new certificate for all database
234
- * clients.
235
- *
236
- * @param request - The request {@link RenewInstanceCertificateRequest}
237
- */
238
- renewInstanceCertificate = request => this.client.fetch({
239
- body: '{}',
240
- headers: jsonContentHeaders,
241
- method: 'POST',
242
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/renew-certificate`
243
- });
244
-
245
- /**
246
- * Get Database Instance metrics. Retrieve the time series metrics of a given
247
- * Database Instance. You can define the period from which to retrieve metrics
248
- * by specifying the `start_date` and `end_date`.
249
- *
250
- * @param request - The request {@link GetInstanceMetricsRequest}
251
- * @returns A Promise of InstanceMetrics
252
- */
253
- getInstanceMetrics = request => this.client.fetch({
254
- method: 'GET',
255
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/metrics`,
256
- urlParams: urlParams(['end_date', request.endDate], ['metric_name', request.metricName], ['start_date', request.startDate])
257
- }, unmarshalInstanceMetrics);
258
-
259
- /**
260
- * Create a Read Replica. Create a new Read Replica of a Database Instance.
261
- * You must specify the `region` and the `instance_id`. You can only create a
262
- * maximum of 3 Read Replicas per Database Instance.
263
- *
264
- * @param request - The request {@link CreateReadReplicaRequest}
265
- * @returns A Promise of ReadReplica
266
- */
267
- createReadReplica = request => this.client.fetch({
268
- body: JSON.stringify(marshalCreateReadReplicaRequest(request, this.client.settings)),
269
- headers: jsonContentHeaders,
270
- method: 'POST',
271
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/read-replicas`
272
- }, unmarshalReadReplica);
273
-
274
- /**
275
- * Get a Read Replica. Retrieve information about a Database Instance Read
276
- * Replica. Full details about the Read Replica, like `endpoints`, `status`
277
- * and `region` are returned in the response.
278
- *
279
- * @param request - The request {@link GetReadReplicaRequest}
280
- * @returns A Promise of ReadReplica
281
- */
282
- getReadReplica = request => this.client.fetch({
283
- method: 'GET',
284
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam('readReplicaId', request.readReplicaId)}`
285
- }, unmarshalReadReplica);
286
-
287
- /**
288
- * Waits for {@link ReadReplica} to be in a final state.
289
- *
290
- * @param request - The request {@link GetReadReplicaRequest}
291
- * @param options - The waiting options
292
- * @returns A Promise of ReadReplica
293
- */
294
- waitForReadReplica = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!READ_REPLICA_TRANSIENT_STATUSES.includes(res.status))), this.getReadReplica, request, options);
295
-
296
- /**
297
- * Delete a Read Replica. Delete a Read Replica of a Database Instance. You
298
- * must specify the `region` and `read_replica_id` parameters of the Read
299
- * Replica you want to delete.
300
- *
301
- * @param request - The request {@link DeleteReadReplicaRequest}
302
- * @returns A Promise of ReadReplica
303
- */
304
- deleteReadReplica = request => this.client.fetch({
305
- method: 'DELETE',
306
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam('readReplicaId', request.readReplicaId)}`
307
- }, unmarshalReadReplica);
308
-
309
- /**
310
- * Resync a Read Replica. When you resync a Read Replica, first it is reset,
311
- * then its data is resynchronized from the primary node. Your Read Replica
312
- * remains unavailable during the resync process. The duration of this process
313
- * is proportional to the size of your Database Instance. The configured
314
- * endpoints do not change.
315
- *
316
- * @param request - The request {@link ResetReadReplicaRequest}
317
- * @returns A Promise of ReadReplica
318
- */
319
- resetReadReplica = request => this.client.fetch({
320
- body: '{}',
321
- headers: jsonContentHeaders,
322
- method: 'POST',
323
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam('readReplicaId', request.readReplicaId)}/reset`
324
- }, unmarshalReadReplica);
325
-
326
- /**
327
- * Promote a Read Replica. Promote a Read Replica to Database Instance
328
- * automatically.
329
- *
330
- * @param request - The request {@link PromoteReadReplicaRequest}
331
- * @returns A Promise of Instance
332
- */
333
- promoteReadReplica = request => this.client.fetch({
334
- body: '{}',
335
- headers: jsonContentHeaders,
336
- method: 'POST',
337
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam('readReplicaId', request.readReplicaId)}/promote`
338
- }, unmarshalInstance);
339
-
340
- /**
341
- * Create an endpoint for a Read Replica. Create a new endpoint for a Read
342
- * Replica. Read Replicas can have at most one direct access and one Private
343
- * Network endpoint.
344
- *
345
- * @param request - The request {@link CreateReadReplicaEndpointRequest}
346
- * @returns A Promise of ReadReplica
347
- */
348
- createReadReplicaEndpoint = request => this.client.fetch({
349
- body: JSON.stringify(marshalCreateReadReplicaEndpointRequest(request, this.client.settings)),
350
- headers: jsonContentHeaders,
351
- method: 'POST',
352
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/read-replicas/${validatePathParam('readReplicaId', request.readReplicaId)}/endpoints`
353
- }, unmarshalReadReplica);
354
-
355
- /**
356
- * List available logs of a Database Instance. List the available logs of a
357
- * Database Instance. By default, the logs returned in the list are ordered by
358
- * creation date in ascending order, though this can be modified via the
359
- * order_by field.
360
- *
361
- * @param request - The request {@link ListInstanceLogsRequest}
362
- * @returns A Promise of ListInstanceLogsResponse
363
- */
364
- listInstanceLogs = request => this.client.fetch({
365
- method: 'GET',
366
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/logs`,
367
- urlParams: urlParams(['order_by', request.orderBy])
368
- }, unmarshalListInstanceLogsResponse);
369
-
370
- /**
371
- * Get given logs of a Database Instance. Retrieve information about the logs
372
- * of a Database Instance. Specify the `instance_log_id` and `region` in your
373
- * request to get information such as `download_url`, `status`, `expires_at`
374
- * and `created_at` about your logs in the response.
375
- *
376
- * @param request - The request {@link GetInstanceLogRequest}
377
- * @returns A Promise of InstanceLog
378
- */
379
- getInstanceLog = request => this.client.fetch({
380
- method: 'GET',
381
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/logs/${validatePathParam('instanceLogId', request.instanceLogId)}`
382
- }, unmarshalInstanceLog);
383
-
384
- /**
385
- * Waits for {@link InstanceLog} to be in a final state.
386
- *
387
- * @param request - The request {@link GetInstanceLogRequest}
388
- * @param options - The waiting options
389
- * @returns A Promise of InstanceLog
390
- */
391
- waitForInstanceLog = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!INSTANCE_LOG_TRANSIENT_STATUSES.includes(res.status))), this.getInstanceLog, request, options);
392
-
393
- /**
394
- * Purge remote Database Instance logs. Purge a given remote log from a
395
- * Database Instance. You can specify the `log_name` of the log you wish to
396
- * clean from your Database Instance.
397
- *
398
- * @param request - The request {@link PurgeInstanceLogsRequest}
399
- */
400
- purgeInstanceLogs = request => this.client.fetch({
401
- body: JSON.stringify(marshalPurgeInstanceLogsRequest(request, this.client.settings)),
402
- headers: jsonContentHeaders,
403
- method: 'POST',
404
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/purge-logs`
405
- });
406
-
407
- /**
408
- * List remote Database Instance logs details. List remote log details. By
409
- * default, the details returned in the list are ordered by creation date in
410
- * ascending order, though this can be modified via the order_by field.
411
- *
412
- * @param request - The request {@link ListInstanceLogsDetailsRequest}
413
- * @returns A Promise of ListInstanceLogsDetailsResponse
414
- */
415
- listInstanceLogsDetails = request => this.client.fetch({
416
- method: 'GET',
417
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/logs-details`
418
- }, unmarshalListInstanceLogsDetailsResponse);
419
-
420
- /**
421
- * Add Database Instance advanced settings. Add an advanced setting to a
422
- * Database Instance. You must set the `name` and the `value` of each
423
- * setting.
424
- *
425
- * @param request - The request {@link AddInstanceSettingsRequest}
426
- * @returns A Promise of AddInstanceSettingsResponse
427
- */
428
- addInstanceSettings = request => this.client.fetch({
429
- body: JSON.stringify(marshalAddInstanceSettingsRequest(request, this.client.settings)),
430
- headers: jsonContentHeaders,
431
- method: 'POST',
432
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/settings`
433
- }, unmarshalAddInstanceSettingsResponse);
434
-
435
- /**
436
- * Delete Database Instance advanced settings. Delete an advanced setting in a
437
- * Database Instance. You must specify the names of the settings you want to
438
- * delete in the request.
439
- *
440
- * @param request - The request {@link DeleteInstanceSettingsRequest}
441
- * @returns A Promise of DeleteInstanceSettingsResponse
442
- */
443
- deleteInstanceSettings = request => this.client.fetch({
444
- body: JSON.stringify(marshalDeleteInstanceSettingsRequest(request, this.client.settings)),
445
- headers: jsonContentHeaders,
446
- method: 'DELETE',
447
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/settings`
448
- }, unmarshalDeleteInstanceSettingsResponse);
449
-
450
- /**
451
- * Set Database Instance advanced settings. Update an advanced setting for a
452
- * Database Instance. Settings added upon database engine initalization can
453
- * only be defined once, and cannot, therefore, be updated.
454
- *
455
- * @param request - The request {@link SetInstanceSettingsRequest}
456
- * @returns A Promise of SetInstanceSettingsResponse
457
- */
458
- setInstanceSettings = request => this.client.fetch({
459
- body: JSON.stringify(marshalSetInstanceSettingsRequest(request, this.client.settings)),
460
- headers: jsonContentHeaders,
461
- method: 'PUT',
462
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/settings`
463
- }, unmarshalSetInstanceSettingsResponse);
464
- pageOfListInstanceACLRules = request => this.client.fetch({
465
- method: 'GET',
466
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/acls`,
467
- urlParams: urlParams(['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
468
- }, unmarshalListInstanceACLRulesResponse);
469
-
470
- /**
471
- * List ACL rules of a Database Instance. List the ACL rules for a given
472
- * Database Instance. The response is an array of ACL objects, each one
473
- * representing an ACL that denies, allows or redirects traffic based on
474
- * certain conditions.
475
- *
476
- * @param request - The request {@link ListInstanceACLRulesRequest}
477
- * @returns A Promise of ListInstanceACLRulesResponse
478
- */
479
- listInstanceACLRules = request => enrichForPagination('rules', this.pageOfListInstanceACLRules, request);
480
-
481
- /**
482
- * Add an ACL rule to a Database Instance. Add an additional ACL rule to a
483
- * Database Instance.
484
- *
485
- * @param request - The request {@link AddInstanceACLRulesRequest}
486
- * @returns A Promise of AddInstanceACLRulesResponse
487
- */
488
- addInstanceACLRules = request => this.client.fetch({
489
- body: JSON.stringify(marshalAddInstanceACLRulesRequest(request, this.client.settings)),
490
- headers: jsonContentHeaders,
491
- method: 'POST',
492
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/acls`
493
- }, unmarshalAddInstanceACLRulesResponse);
494
-
495
- /**
496
- * Set ACL rules for a Database Instance. Replace all the ACL rules of a
497
- * Database Instance.
498
- *
499
- * @param request - The request {@link SetInstanceACLRulesRequest}
500
- * @returns A Promise of SetInstanceACLRulesResponse
501
- */
502
- setInstanceACLRules = request => this.client.fetch({
503
- body: JSON.stringify(marshalSetInstanceACLRulesRequest(request, this.client.settings)),
504
- headers: jsonContentHeaders,
505
- method: 'PUT',
506
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/acls`
507
- }, unmarshalSetInstanceACLRulesResponse);
508
-
509
- /**
510
- * Delete ACL rules of a Database Instance. Delete one or more ACL rules of a
511
- * Database Instance.
512
- *
513
- * @param request - The request {@link DeleteInstanceACLRulesRequest}
514
- * @returns A Promise of DeleteInstanceACLRulesResponse
515
- */
516
- deleteInstanceACLRules = request => this.client.fetch({
517
- body: JSON.stringify(marshalDeleteInstanceACLRulesRequest(request, this.client.settings)),
518
- headers: jsonContentHeaders,
519
- method: 'DELETE',
520
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/acls`
521
- }, unmarshalDeleteInstanceACLRulesResponse);
522
- pageOfListUsers = request => this.client.fetch({
523
- method: 'GET',
524
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/users`,
525
- urlParams: urlParams(['name', request.name], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
526
- }, unmarshalListUsersResponse);
527
-
528
- /**
529
- * List users of a Database Instance. List all users of a given Database
530
- * Instance. By default, the users returned in the list are ordered by
531
- * creation date in ascending order, though this can be modified via the
532
- * order_by field.
533
- *
534
- * @param request - The request {@link ListUsersRequest}
535
- * @returns A Promise of ListUsersResponse
536
- */
537
- listUsers = request => enrichForPagination('users', this.pageOfListUsers, request);
538
-
539
- /**
540
- * Create a user for a Database Instance. Create a new user for a Database
541
- * Instance. You must define the `name`, `password` and `is_admin`
542
- * parameters.
543
- *
544
- * @param request - The request {@link CreateUserRequest}
545
- * @returns A Promise of User
546
- */
547
- createUser = request => this.client.fetch({
548
- body: JSON.stringify(marshalCreateUserRequest(request, this.client.settings)),
549
- headers: jsonContentHeaders,
550
- method: 'POST',
551
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/users`
552
- }, unmarshalUser);
553
-
554
- /**
555
- * Update a user on a Database Instance. Update the parameters of a user on a
556
- * Database Instance. You can update the `password` and `is_admin` parameters,
557
- * but you cannot change the name of the user.
558
- *
559
- * @param request - The request {@link UpdateUserRequest}
560
- * @returns A Promise of User
561
- */
562
- updateUser = request => this.client.fetch({
563
- body: JSON.stringify(marshalUpdateUserRequest(request, this.client.settings)),
564
- headers: jsonContentHeaders,
565
- method: 'PATCH',
566
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/users/${validatePathParam('name', request.name)}`
567
- }, unmarshalUser);
568
-
569
- /**
570
- * Delete a user on a Database Instance. Delete a given user on a Database
571
- * Instance. You must specify, in the endpoint, the `region`, `instance_id`
572
- * and `name` parameters of the user you want to delete.
573
- *
574
- * @param request - The request {@link DeleteUserRequest}
575
- */
576
- deleteUser = request => this.client.fetch({
577
- method: 'DELETE',
578
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/users/${validatePathParam('name', request.name)}`
579
- });
580
- pageOfListDatabases = request => this.client.fetch({
581
- method: 'GET',
582
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/databases`,
583
- urlParams: urlParams(['managed', request.managed], ['name', request.name], ['order_by', request.orderBy], ['owner', request.owner], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize])
584
- }, unmarshalListDatabasesResponse);
585
-
586
- /**
587
- * List databases in a Database Instance. List all databases of a given
588
- * Database Instance. By default, the databases returned in the list are
589
- * ordered by creation date in ascending order, though this can be modified
590
- * via the order_by field. You can define additional parameters for your
591
- * query, such as `name`, `managed` and `owner`.
592
- *
593
- * @param request - The request {@link ListDatabasesRequest}
594
- * @returns A Promise of ListDatabasesResponse
595
- */
596
- listDatabases = request => enrichForPagination('databases', this.pageOfListDatabases, request);
597
-
598
- /**
599
- * Create a database in a Database Instance. Create a new database. You must
600
- * define the `name` parameter in the request.
601
- *
602
- * @param request - The request {@link CreateDatabaseRequest}
603
- * @returns A Promise of Database
604
- */
605
- createDatabase = request => this.client.fetch({
606
- body: JSON.stringify(marshalCreateDatabaseRequest(request, this.client.settings)),
607
- headers: jsonContentHeaders,
608
- method: 'POST',
609
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/databases`
610
- }, unmarshalDatabase);
611
-
612
- /**
613
- * Delete a database in a Database Instance. Delete a given database on a
614
- * Database Instance. You must specify, in the endpoint, the `region`,
615
- * `instance_id` and `name` parameters of the database you want to delete.
616
- *
617
- * @param request - The request {@link DeleteDatabaseRequest}
618
- */
619
- deleteDatabase = request => this.client.fetch({
620
- method: 'DELETE',
621
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/databases/${validatePathParam('name', request.name)}`
622
- });
623
- pageOfListPrivileges = request => this.client.fetch({
624
- method: 'GET',
625
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/privileges`,
626
- urlParams: urlParams(['database_name', request.databaseName], ['order_by', request.orderBy], ['page', request.page], ['page_size', request.pageSize ?? this.client.settings.defaultPageSize], ['user_name', request.userName])
627
- }, unmarshalListPrivilegesResponse);
628
-
629
- /**
630
- * List user privileges for a database. List privileges of a user on a
631
- * database. By default, the details returned in the list are ordered by
632
- * creation date in ascending order, though this can be modified via the
633
- * order_by field. You can define additional parameters for your query, such
634
- * as `database_name` and `user_name`.
635
- *
636
- * @param request - The request {@link ListPrivilegesRequest}
637
- * @returns A Promise of ListPrivilegesResponse
638
- */
639
- listPrivileges = request => enrichForPagination('privileges', this.pageOfListPrivileges, request);
640
-
641
- /**
642
- * Set user privileges for a database. Set the privileges of a user on a
643
- * database. You must define `database_name`, `user_name` and `permission` in
644
- * the request body.
645
- *
646
- * @param request - The request {@link SetPrivilegeRequest}
647
- * @returns A Promise of Privilege
648
- */
649
- setPrivilege = request => this.client.fetch({
650
- body: JSON.stringify(marshalSetPrivilegeRequest(request, this.client.settings)),
651
- headers: jsonContentHeaders,
652
- method: 'PUT',
653
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/privileges`
654
- }, unmarshalPrivilege);
655
- pageOfListSnapshots = (() => {
656
- var _this5 = this;
657
- return function (request) {
658
- if (request === void 0) {
659
- request = {};
660
- }
661
- return _this5.client.fetch({
662
- method: 'GET',
663
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? _this5.client.settings.defaultRegion)}/snapshots`,
664
- urlParams: urlParams(['instance_id', request.instanceId], ['name', request.name], ['order_by', request.orderBy], ['organization_id', request.organizationId], ['page', request.page], ['page_size', request.pageSize ?? _this5.client.settings.defaultPageSize], ['project_id', request.projectId])
665
- }, unmarshalListSnapshotsResponse);
666
- };
667
- })();
668
-
669
- /**
670
- * List snapshots. List snapshots. You can include the `instance_id` or
671
- * `project_id` in your query to get the list of snapshots for specific
672
- * Database Instances and/or Projects. By default, the details returned in the
673
- * list are ordered by creation date in ascending order, though this can be
674
- * modified via the `order_by` field.
675
- *
676
- * @param request - The request {@link ListSnapshotsRequest}
677
- * @returns A Promise of ListSnapshotsResponse
678
- */
679
- listSnapshots = (() => {
680
- var _this6 = this;
681
- return function (request) {
682
- if (request === void 0) {
683
- request = {};
684
- }
685
- return enrichForPagination('snapshots', _this6.pageOfListSnapshots, request);
686
- };
687
- })();
688
-
689
- /**
690
- * Get a Database Instance snapshot. Retrieve information about a given
691
- * snapshot, specified by its `snapshot_id` and `region`. Full details about
692
- * the snapshot, like size and expiration date, are returned in the response.
693
- *
694
- * @param request - The request {@link GetSnapshotRequest}
695
- * @returns A Promise of Snapshot
696
- */
697
- getSnapshot = request => this.client.fetch({
698
- method: 'GET',
699
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`
700
- }, unmarshalSnapshot);
701
-
702
- /**
703
- * Waits for {@link Snapshot} to be in a final state.
704
- *
705
- * @param request - The request {@link GetSnapshotRequest}
706
- * @param options - The waiting options
707
- * @returns A Promise of Snapshot
708
- */
709
- waitForSnapshot = (request, options) => waitForResource(options?.stop ?? (res => Promise.resolve(!SNAPSHOT_TRANSIENT_STATUSES.includes(res.status))), this.getSnapshot, request, options);
710
-
711
- /**
712
- * Create a Database Instance snapshot. Create a new snapshot of a Database
713
- * Instance. You must define the `name` parameter in the request.
714
- *
715
- * @param request - The request {@link CreateSnapshotRequest}
716
- * @returns A Promise of Snapshot
717
- */
718
- createSnapshot = request => this.client.fetch({
719
- body: JSON.stringify(marshalCreateSnapshotRequest(request, this.client.settings)),
720
- headers: jsonContentHeaders,
721
- method: 'POST',
722
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/snapshots`
723
- }, unmarshalSnapshot);
724
-
725
- /**
726
- * Update a Database Instance snapshot. Update the parameters of a snapshot of
727
- * a Database Instance. You can update the `name` and `expires_at`
728
- * parameters.
729
- *
730
- * @param request - The request {@link UpdateSnapshotRequest}
731
- * @returns A Promise of Snapshot
732
- */
733
- updateSnapshot = request => this.client.fetch({
734
- body: JSON.stringify(marshalUpdateSnapshotRequest(request, this.client.settings)),
735
- headers: jsonContentHeaders,
736
- method: 'PATCH',
737
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`
738
- }, unmarshalSnapshot);
739
-
740
- /**
741
- * Delete a Database Instance snapshot. Delete a given snapshot of a Database
742
- * Instance. You must specify, in the endpoint, the `region` and `snapshot_id`
743
- * parameters of the snapshot you want to delete.
744
- *
745
- * @param request - The request {@link DeleteSnapshotRequest}
746
- * @returns A Promise of Snapshot
747
- */
748
- deleteSnapshot = request => this.client.fetch({
749
- method: 'DELETE',
750
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}`
751
- }, unmarshalSnapshot);
752
-
753
- /**
754
- * Create a new Database Instance from a snapshot. Restore a snapshot. When
755
- * you restore a snapshot, a new Instance is created and billed to your
756
- * account. Note that is possible to select a larger node type for your new
757
- * Database Instance. However, the Block volume size will be the same as the
758
- * size of the restored snapshot. All Instance settings will be restored if
759
- * you chose a node type with the same or more memory size than the initial
760
- * Instance. Settings will be reset to the default if your node type has less
761
- * memory.
762
- *
763
- * @param request - The request {@link CreateInstanceFromSnapshotRequest}
764
- * @returns A Promise of Instance
765
- */
766
- createInstanceFromSnapshot = request => this.client.fetch({
767
- body: JSON.stringify(marshalCreateInstanceFromSnapshotRequest(request, this.client.settings)),
768
- headers: jsonContentHeaders,
769
- method: 'POST',
770
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/snapshots/${validatePathParam('snapshotId', request.snapshotId)}/create-instance`
771
- }, unmarshalInstance);
772
-
773
- /**
774
- * Create a new Database Instance endpoint. Create a new endpoint for a
775
- * Database Instance. You can add `load_balancer` and `private_network`
776
- * specifications to the body of the request.
777
- *
778
- * @param request - The request {@link CreateEndpointRequest}
779
- * @returns A Promise of Endpoint
780
- */
781
- createEndpoint = request => this.client.fetch({
782
- body: JSON.stringify(marshalCreateEndpointRequest(request, this.client.settings)),
783
- headers: jsonContentHeaders,
784
- method: 'POST',
785
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/instances/${validatePathParam('instanceId', request.instanceId)}/endpoints`
786
- }, unmarshalEndpoint);
787
-
788
- /**
789
- * Delete a Database Instance endpoint. Delete the endpoint of a Database
790
- * Instance. You must specify the `region` and `endpoint_id` parameters of the
791
- * endpoint you want to delete. Note that might need to update any environment
792
- * configurations that point to the deleted endpoint.
793
- *
794
- * @param request - The request {@link DeleteEndpointRequest}
795
- */
796
- deleteEndpoint = request => this.client.fetch({
797
- method: 'DELETE',
798
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam('endpointId', request.endpointId)}`
799
- });
800
-
801
- /**
802
- * Get a Database Instance endpoint. Retrieve information about a Database
803
- * Instance endpoint. Full details about the endpoint, like `ip`, `port`,
804
- * `private_network` and `load_balancer` specifications are returned in the
805
- * response.
806
- *
807
- * @param request - The request {@link GetEndpointRequest}
808
- * @returns A Promise of Endpoint
809
- */
810
- getEndpoint = request => this.client.fetch({
811
- method: 'GET',
812
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam('endpointId', request.endpointId)}`
813
- }, unmarshalEndpoint);
814
-
815
- /**
816
- * Migrate Database Instance endpoint. Migrate an existing Database Instance
817
- * endpoint to another Database Instance.
818
- *
819
- * @param request - The request {@link MigrateEndpointRequest}
820
- * @returns A Promise of Endpoint
821
- */
822
- migrateEndpoint = request => this.client.fetch({
823
- body: JSON.stringify(marshalMigrateEndpointRequest(request, this.client.settings)),
824
- headers: jsonContentHeaders,
825
- method: 'POST',
826
- path: `/document-db/v1beta1/regions/${validatePathParam('region', request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam('endpointId', request.endpointId)}/migrate`
827
- }, unmarshalEndpoint);
828
- }
829
-
830
- export { API };