@scaleway/sdk-redis 2.2.1 → 2.3.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.
@@ -1,413 +1,293 @@
1
- import { API as API$1, toApiLocality, validatePathParam, waitForResource, urlParams, enrichForPagination } from "@scaleway/sdk-client";
2
1
  import { CLUSTER_TRANSIENT_STATUSES } from "./content.gen.js";
3
- import { marshalCreateClusterRequest, unmarshalCluster, marshalUpdateClusterRequest, unmarshalListClustersResponse, marshalMigrateClusterRequest, unmarshalClusterMetricsResponse, unmarshalListNodeTypesResponse, unmarshalListClusterVersionsResponse, marshalAddClusterSettingsRequest, unmarshalClusterSettingsResponse, marshalSetClusterSettingsRequest, marshalSetAclRulesRequest, unmarshalSetAclRulesResponse, marshalAddAclRulesRequest, unmarshalAddAclRulesResponse, unmarshalACLRule, marshalSetEndpointsRequest, unmarshalSetEndpointsResponse, marshalAddEndpointsRequest, unmarshalAddEndpointsResponse, unmarshalEndpoint, marshalUpdateEndpointRequest } from "./marshalling.gen.js";
4
- const jsonContentHeaders = {
5
- "Content-Type": "application/json; charset=utf-8"
6
- };
7
- class API extends API$1 {
8
- /**
9
- * Locality of this API.
10
- * type ∈ {'zone','region','global','unspecified'}
11
- */
12
- static LOCALITY = toApiLocality({
13
- zones: [
14
- "fr-par-1",
15
- "fr-par-2",
16
- "nl-ams-1",
17
- "nl-ams-2",
18
- "pl-waw-1",
19
- "pl-waw-2"
20
- ]
21
- });
22
- /**
23
- * Create a Redis™ Database Instance. Create a new Redis™ Database Instance (Redis™ cluster). You must set the `zone`, `project_id`, `version`, `node_type`, `user_name` and `password` parameters. Optionally you can define `acl_rules`, `endpoints`, `tls_enabled` and `cluster_settings`.
24
- *
25
- * @param request - The request {@link CreateClusterRequest}
26
- * @returns A Promise of Cluster
27
- */
28
- createCluster = (request) => this.client.fetch(
29
- {
30
- body: JSON.stringify(
31
- marshalCreateClusterRequest(request, this.client.settings)
32
- ),
33
- headers: jsonContentHeaders,
34
- method: "POST",
35
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters`
36
- },
37
- unmarshalCluster
38
- );
39
- /**
40
- * Update a Redis™ Database Instance. Update the parameters of a Redis™ Database Instance (Redis™ cluster), including `name`, `tags`, `user_name` and `password`.
41
- *
42
- * @param request - The request {@link UpdateClusterRequest}
43
- * @returns A Promise of Cluster
44
- */
45
- updateCluster = (request) => this.client.fetch(
46
- {
47
- body: JSON.stringify(
48
- marshalUpdateClusterRequest(request, this.client.settings)
49
- ),
50
- headers: jsonContentHeaders,
51
- method: "PATCH",
52
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
53
- },
54
- unmarshalCluster
55
- );
56
- /**
57
- * Get a Redis™ Database Instance. Retrieve information about a Redis™ Database Instance (Redis™ cluster). Specify the `cluster_id` and `region` in your request to get information such as `id`, `status`, `version`, `tls_enabled`, `cluster_settings`, `upgradable_versions` and `endpoints` about your cluster in the response.
58
- *
59
- * @param request - The request {@link GetClusterRequest}
60
- * @returns A Promise of Cluster
61
- */
62
- getCluster = (request) => this.client.fetch(
63
- {
64
- method: "GET",
65
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
66
- },
67
- unmarshalCluster
68
- );
69
- /**
70
- * Waits for {@link Cluster} to be in a final state.
71
- *
72
- * @param request - The request {@link GetClusterRequest}
73
- * @param options - The waiting options
74
- * @returns A Promise of Cluster
75
- */
76
- waitForCluster = (request, options) => waitForResource(
77
- options?.stop ?? ((res) => Promise.resolve(!CLUSTER_TRANSIENT_STATUSES.includes(res.status))),
78
- this.getCluster,
79
- request,
80
- options
81
- );
82
- pageOfListClusters = (request = {}) => this.client.fetch(
83
- {
84
- method: "GET",
85
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters`,
86
- urlParams: urlParams(
87
- ["name", request.name],
88
- ["order_by", request.orderBy],
89
- ["organization_id", request.organizationId],
90
- ["page", request.page],
91
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
92
- ["project_id", request.projectId],
93
- ["tags", request.tags],
94
- ["version", request.version]
95
- )
96
- },
97
- unmarshalListClustersResponse
98
- );
99
- /**
100
- * List Redis™ Database Instances. List all Redis™ Database Instances (Redis™ cluster) in the specified zone. By default, the Database Instances returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `tags`, `name`, `organization_id` and `version`.
101
- *
102
- * @param request - The request {@link ListClustersRequest}
103
- * @returns A Promise of ListClustersResponse
104
- */
105
- listClusters = (request = {}) => enrichForPagination("clusters", this.pageOfListClusters, request);
106
- /**
107
- * Scale up a Redis™ Database Instance. Upgrade your Redis™ Database Instance, either by upgrading to a bigger node type (vertical scaling) or by adding more nodes to your Database Instance to increase your number of endpoints and distribute cache (horizontal scaling, available for clusters only). Note that scaling horizontally your Redis™ Database Instance will not renew its TLS certificate. In order to refresh the TLS certificate, you must use the Renew TLS certificate endpoint.
108
- *
109
- * @param request - The request {@link MigrateClusterRequest}
110
- * @returns A Promise of Cluster
111
- */
112
- migrateCluster = (request) => this.client.fetch(
113
- {
114
- body: JSON.stringify(
115
- marshalMigrateClusterRequest(request, this.client.settings)
116
- ),
117
- headers: jsonContentHeaders,
118
- method: "POST",
119
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/migrate`
120
- },
121
- unmarshalCluster
122
- );
123
- /**
124
- * Delete a Redis™ Database Instance. Delete a Redis™ Database Instance (Redis™ cluster), specified by the `region` and `cluster_id` parameters. Deleting a Database Instance is permanent, and cannot be undone. Note that upon deletion all your data will be lost.
125
- *
126
- * @param request - The request {@link DeleteClusterRequest}
127
- * @returns A Promise of Cluster
128
- */
129
- deleteCluster = (request) => this.client.fetch(
130
- {
131
- method: "DELETE",
132
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
133
- },
134
- unmarshalCluster
135
- );
136
- /**
137
- * Get metrics of a Redis™ Database Instance. Retrieve the metrics of a Redis™ Database Instance (Redis™ cluster). You can define the period from which to retrieve metrics by specifying the `start_date` and `end_date`.
138
- *
139
- * @param request - The request {@link GetClusterMetricsRequest}
140
- * @returns A Promise of ClusterMetricsResponse
141
- */
142
- getClusterMetrics = (request) => this.client.fetch(
143
- {
144
- method: "GET",
145
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/metrics`,
146
- urlParams: urlParams(
147
- ["end_at", request.endAt],
148
- ["metric_name", request.metricName],
149
- ["start_at", request.startAt]
150
- )
151
- },
152
- unmarshalClusterMetricsResponse
153
- );
154
- pageOfListNodeTypes = (request) => this.client.fetch(
155
- {
156
- method: "GET",
157
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/node-types`,
158
- urlParams: urlParams(
159
- ["include_disabled_types", request.includeDisabledTypes],
160
- ["page", request.page],
161
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
162
- )
163
- },
164
- unmarshalListNodeTypesResponse
165
- );
166
- /**
167
- * List available node types. List all available node types. By default, the node types returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
168
- *
169
- * @param request - The request {@link ListNodeTypesRequest}
170
- * @returns A Promise of ListNodeTypesResponse
171
- */
172
- listNodeTypes = (request) => enrichForPagination("nodeTypes", this.pageOfListNodeTypes, request);
173
- pageOfListClusterVersions = (request) => this.client.fetch(
174
- {
175
- method: "GET",
176
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/cluster-versions`,
177
- urlParams: urlParams(
178
- ["include_beta", request.includeBeta],
179
- ["include_deprecated", request.includeDeprecated],
180
- ["include_disabled", request.includeDisabled],
181
- ["page", request.page],
182
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
183
- ["version", request.version]
184
- )
185
- },
186
- unmarshalListClusterVersionsResponse
187
- );
188
- /**
189
- * List available Redis™ versions. List the Redis™ database engine versions available. You can define additional parameters for your query, such as `include_disabled`, `include_beta`, `include_deprecated` and `version`.
190
- *
191
- * @param request - The request {@link ListClusterVersionsRequest}
192
- * @returns A Promise of ListClusterVersionsResponse
193
- */
194
- listClusterVersions = (request) => enrichForPagination("versions", this.pageOfListClusterVersions, request);
195
- /**
196
- * Get the TLS certificate of a cluster. Retrieve information about the TLS certificate of a Redis™ Database Instance (Redis™ cluster). Details like name and content are returned in the response.
197
- *
198
- * @param request - The request {@link GetClusterCertificateRequest}
199
- * @returns A Promise of Blob
200
- */
201
- getClusterCertificate = (request) => this.client.fetch(
202
- {
203
- method: "GET",
204
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/certificate`,
205
- urlParams: urlParams(
206
- ["dl", 1]
207
- ),
208
- responseType: "blob"
209
- }
210
- );
211
- /**
212
- * Renew the TLS certificate of a cluster. Renew a TLS certificate for a Redis™ Database Instance (Redis™ cluster). Renewing a certificate means that you will not be able to connect to your Database Instance using the previous certificate. You will also need to download and update the new certificate for all database clients.
213
- *
214
- * @param request - The request {@link RenewClusterCertificateRequest}
215
- * @returns A Promise of Cluster
216
- */
217
- renewClusterCertificate = (request) => this.client.fetch(
218
- {
219
- body: "{}",
220
- headers: jsonContentHeaders,
221
- method: "POST",
222
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/renew-certificate`
223
- },
224
- unmarshalCluster
225
- );
226
- /**
227
- * Add advanced settings. Add an advanced setting to a Redis™ Database Instance (Redis™ cluster). You must set the `name` and the `value` of each setting.
228
- *
229
- * @param request - The request {@link AddClusterSettingsRequest}
230
- * @returns A Promise of ClusterSettingsResponse
231
- */
232
- addClusterSettings = (request) => this.client.fetch(
233
- {
234
- body: JSON.stringify(
235
- marshalAddClusterSettingsRequest(request, this.client.settings)
236
- ),
237
- headers: jsonContentHeaders,
238
- method: "POST",
239
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/settings`
240
- },
241
- unmarshalClusterSettingsResponse
242
- );
243
- /**
244
- * Delete advanced setting. Delete an advanced setting in a Redis™ Database Instance (Redis™ cluster). You must specify the names of the settings you want to delete in the request body.
245
- *
246
- * @param request - The request {@link DeleteClusterSettingRequest}
247
- * @returns A Promise of Cluster
248
- */
249
- deleteClusterSetting = (request) => this.client.fetch(
250
- {
251
- method: "DELETE",
252
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/settings/${validatePathParam("settingName", request.settingName)}`
253
- },
254
- unmarshalCluster
255
- );
256
- /**
257
- * Set advanced settings. Update an advanced setting for a Redis™ Database Instance (Redis™ cluster). Settings added upon database engine initialization can only be defined once, and cannot, therefore, be updated.
258
- *
259
- * @param request - The request {@link SetClusterSettingsRequest}
260
- * @returns A Promise of ClusterSettingsResponse
261
- */
262
- setClusterSettings = (request) => this.client.fetch(
263
- {
264
- body: JSON.stringify(
265
- marshalSetClusterSettingsRequest(request, this.client.settings)
266
- ),
267
- headers: jsonContentHeaders,
268
- method: "PUT",
269
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/settings`
270
- },
271
- unmarshalClusterSettingsResponse
272
- );
273
- /**
274
- * Set ACL rules for a cluster. Replace all the ACL rules of a Redis™ Database Instance (Redis™ cluster).
275
- *
276
- * @param request - The request {@link SetAclRulesRequest}
277
- * @returns A Promise of SetAclRulesResponse
278
- */
279
- setAclRules = (request) => this.client.fetch(
280
- {
281
- body: JSON.stringify(
282
- marshalSetAclRulesRequest(request, this.client.settings)
283
- ),
284
- headers: jsonContentHeaders,
285
- method: "PUT",
286
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
287
- },
288
- unmarshalSetAclRulesResponse
289
- );
290
- /**
291
- * Add ACL rules for a cluster. Add an additional ACL rule to a Redis™ Database Instance (Redis™ cluster).
292
- *
293
- * @param request - The request {@link AddAclRulesRequest}
294
- * @returns A Promise of AddAclRulesResponse
295
- */
296
- addAclRules = (request) => this.client.fetch(
297
- {
298
- body: JSON.stringify(
299
- marshalAddAclRulesRequest(request, this.client.settings)
300
- ),
301
- headers: jsonContentHeaders,
302
- method: "POST",
303
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
304
- },
305
- unmarshalAddAclRulesResponse
306
- );
307
- /**
308
- * Delete an ACL rule for a cluster. Delete an ACL rule of a Redis™ Database Instance (Redis™ cluster). You must specify the `acl_id` of the rule you want to delete in your request.
309
- *
310
- * @param request - The request {@link DeleteAclRuleRequest}
311
- * @returns A Promise of Cluster
312
- */
313
- deleteAclRule = (request) => this.client.fetch(
314
- {
315
- method: "DELETE",
316
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/acls/${validatePathParam("aclId", request.aclId)}`
317
- },
318
- unmarshalCluster
319
- );
320
- /**
321
- * Get an ACL rule. Retrieve information about an ACL rule of a Redis™ Database Instance (Redis™ cluster). You must specify the `acl_id` of the rule in your request.
322
- *
323
- * @param request - The request {@link GetAclRuleRequest}
324
- * @returns A Promise of ACLRule
325
- */
326
- getAclRule = (request) => this.client.fetch(
327
- {
328
- method: "GET",
329
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/acls/${validatePathParam("aclId", request.aclId)}`
330
- },
331
- unmarshalACLRule
332
- );
333
- /**
334
- * Set endpoints for a cluster. Update an endpoint for a Redis™ Database Instance (Redis™ cluster). You must specify the `cluster_id` and the `endpoints` parameters in your request.
335
- *
336
- * @param request - The request {@link SetEndpointsRequest}
337
- * @returns A Promise of SetEndpointsResponse
338
- */
339
- setEndpoints = (request) => this.client.fetch(
340
- {
341
- body: JSON.stringify(
342
- marshalSetEndpointsRequest(request, this.client.settings)
343
- ),
344
- headers: jsonContentHeaders,
345
- method: "PUT",
346
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/endpoints`
347
- },
348
- unmarshalSetEndpointsResponse
349
- );
350
- /**
351
- * Add endpoints for a cluster. Add a new endpoint for a Redis™ Database Instance (Redis™ cluster). You can add `private_network` or `public_network` specifications to the body of the request.
352
- *
353
- * @param request - The request {@link AddEndpointsRequest}
354
- * @returns A Promise of AddEndpointsResponse
355
- */
356
- addEndpoints = (request) => this.client.fetch(
357
- {
358
- body: JSON.stringify(
359
- marshalAddEndpointsRequest(request, this.client.settings)
360
- ),
361
- headers: jsonContentHeaders,
362
- method: "POST",
363
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/endpoints`
364
- },
365
- unmarshalAddEndpointsResponse
366
- );
367
- /**
368
- * Delete an endpoint for a cluster. Delete the endpoint of a Redis™ Database Instance (Redis™ cluster). You must specify the `region` and `endpoint_id` parameters of the endpoint you want to delete. Note that might need to update any environment configurations that point to the deleted endpoint.
369
- *
370
- * @param request - The request {@link DeleteEndpointRequest}
371
- * @returns A Promise of Cluster
372
- */
373
- deleteEndpoint = (request) => this.client.fetch(
374
- {
375
- method: "DELETE",
376
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
377
- },
378
- unmarshalCluster
379
- );
380
- /**
381
- * Get an endpoint. Retrieve information about a Redis™ Database Instance (Redis™ cluster) endpoint. Full details about the endpoint, like `ips`, `port`, `private_network` and `public_network` specifications are returned in the response.
382
- *
383
- * @param request - The request {@link GetEndpointRequest}
384
- * @returns A Promise of Endpoint
385
- */
386
- getEndpoint = (request) => this.client.fetch(
387
- {
388
- method: "GET",
389
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
390
- },
391
- unmarshalEndpoint
392
- );
393
- /**
394
- * Update an endpoint. Update information about a Redis™ Database Instance (Redis™ cluster) endpoint. Full details about the endpoint, like `ips`, `port`, `private_network` and `public_network` specifications are returned in the response.
395
- *
396
- * @param request - The request {@link UpdateEndpointRequest}
397
- * @returns A Promise of Endpoint
398
- */
399
- updateEndpoint = (request) => this.client.fetch(
400
- {
401
- body: JSON.stringify(
402
- marshalUpdateEndpointRequest(request, this.client.settings)
403
- ),
404
- headers: jsonContentHeaders,
405
- method: "PATCH",
406
- path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
407
- },
408
- unmarshalEndpoint
409
- );
410
- }
411
- export {
412
- API
2
+ import { marshalAddAclRulesRequest, marshalAddClusterSettingsRequest, marshalAddEndpointsRequest, marshalCreateClusterRequest, marshalMigrateClusterRequest, marshalSetAclRulesRequest, marshalSetClusterSettingsRequest, marshalSetEndpointsRequest, marshalUpdateClusterRequest, marshalUpdateEndpointRequest, unmarshalACLRule, unmarshalAddAclRulesResponse, unmarshalAddEndpointsResponse, unmarshalCluster, unmarshalClusterMetricsResponse, unmarshalClusterSettingsResponse, unmarshalEndpoint, unmarshalListClusterVersionsResponse, unmarshalListClustersResponse, unmarshalListNodeTypesResponse, unmarshalSetAclRulesResponse, unmarshalSetEndpointsResponse } from "./marshalling.gen.js";
3
+ import { API, enrichForPagination, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
5
+ /**
6
+ * Managed Database for Redis™ API.
7
+
8
+ This API allows you to manage your Managed Databases for Redis™.
9
+ */
10
+ var API$1 = class extends API {
11
+ /**
12
+ * Locality of this API.
13
+ * type ∈ {'zone','region','global','unspecified'}
14
+ */
15
+ static LOCALITY = toApiLocality({ zones: [
16
+ "fr-par-1",
17
+ "fr-par-2",
18
+ "nl-ams-1",
19
+ "nl-ams-2",
20
+ "pl-waw-1",
21
+ "pl-waw-2"
22
+ ] });
23
+ /**
24
+ * Create a Redis™ Database Instance. Create a new Redis™ Database Instance (Redis™ cluster). You must set the `zone`, `project_id`, `version`, `node_type`, `user_name` and `password` parameters. Optionally you can define `acl_rules`, `endpoints`, `tls_enabled` and `cluster_settings`.
25
+ *
26
+ * @param request - The request {@link CreateClusterRequest}
27
+ * @returns A Promise of Cluster
28
+ */
29
+ createCluster = (request) => this.client.fetch({
30
+ body: JSON.stringify(marshalCreateClusterRequest(request, this.client.settings)),
31
+ headers: jsonContentHeaders,
32
+ method: "POST",
33
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters`
34
+ }, unmarshalCluster);
35
+ /**
36
+ * Update a Redis™ Database Instance. Update the parameters of a Redis™ Database Instance (Redis™ cluster), including `name`, `tags`, `user_name` and `password`.
37
+ *
38
+ * @param request - The request {@link UpdateClusterRequest}
39
+ * @returns A Promise of Cluster
40
+ */
41
+ updateCluster = (request) => this.client.fetch({
42
+ body: JSON.stringify(marshalUpdateClusterRequest(request, this.client.settings)),
43
+ headers: jsonContentHeaders,
44
+ method: "PATCH",
45
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
46
+ }, unmarshalCluster);
47
+ /**
48
+ * Get a Redis™ Database Instance. Retrieve information about a Redis™ Database Instance (Redis™ cluster). Specify the `cluster_id` and `region` in your request to get information such as `id`, `status`, `version`, `tls_enabled`, `cluster_settings`, `upgradable_versions` and `endpoints` about your cluster in the response.
49
+ *
50
+ * @param request - The request {@link GetClusterRequest}
51
+ * @returns A Promise of Cluster
52
+ */
53
+ getCluster = (request) => this.client.fetch({
54
+ method: "GET",
55
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
56
+ }, unmarshalCluster);
57
+ /**
58
+ * Waits for {@link Cluster} to be in a final state.
59
+ *
60
+ * @param request - The request {@link GetClusterRequest}
61
+ * @param options - The waiting options
62
+ * @returns A Promise of Cluster
63
+ */
64
+ waitForCluster = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!CLUSTER_TRANSIENT_STATUSES.includes(res.status))), this.getCluster, request, options);
65
+ pageOfListClusters = (request = {}) => this.client.fetch({
66
+ method: "GET",
67
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters`,
68
+ urlParams: urlParams(["name", request.name], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["project_id", request.projectId], ["tags", request.tags], ["version", request.version])
69
+ }, unmarshalListClustersResponse);
70
+ /**
71
+ * List Redis™ Database Instances. List all Redis™ Database Instances (Redis™ cluster) in the specified zone. By default, the Database Instances returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `tags`, `name`, `organization_id` and `version`.
72
+ *
73
+ * @param request - The request {@link ListClustersRequest}
74
+ * @returns A Promise of ListClustersResponse
75
+ */
76
+ listClusters = (request = {}) => enrichForPagination("clusters", this.pageOfListClusters, request);
77
+ /**
78
+ * Scale up a Redis™ Database Instance. Upgrade your Redis™ Database Instance, either by upgrading to a bigger node type (vertical scaling) or by adding more nodes to your Database Instance to increase your number of endpoints and distribute cache (horizontal scaling, available for clusters only). Note that scaling horizontally your Redis™ Database Instance will not renew its TLS certificate. In order to refresh the TLS certificate, you must use the Renew TLS certificate endpoint.
79
+ *
80
+ * @param request - The request {@link MigrateClusterRequest}
81
+ * @returns A Promise of Cluster
82
+ */
83
+ migrateCluster = (request) => this.client.fetch({
84
+ body: JSON.stringify(marshalMigrateClusterRequest(request, this.client.settings)),
85
+ headers: jsonContentHeaders,
86
+ method: "POST",
87
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/migrate`
88
+ }, unmarshalCluster);
89
+ /**
90
+ * Delete a Redis™ Database Instance. Delete a Redis™ Database Instance (Redis™ cluster), specified by the `region` and `cluster_id` parameters. Deleting a Database Instance is permanent, and cannot be undone. Note that upon deletion all your data will be lost.
91
+ *
92
+ * @param request - The request {@link DeleteClusterRequest}
93
+ * @returns A Promise of Cluster
94
+ */
95
+ deleteCluster = (request) => this.client.fetch({
96
+ method: "DELETE",
97
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}`
98
+ }, unmarshalCluster);
99
+ /**
100
+ * Get metrics of a Redis™ Database Instance. Retrieve the metrics of a Redis™ Database Instance (Redis™ cluster). You can define the period from which to retrieve metrics by specifying the `start_date` and `end_date`.
101
+ *
102
+ * @param request - The request {@link GetClusterMetricsRequest}
103
+ * @returns A Promise of ClusterMetricsResponse
104
+ */
105
+ getClusterMetrics = (request) => this.client.fetch({
106
+ method: "GET",
107
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/metrics`,
108
+ urlParams: urlParams(["end_at", request.endAt], ["metric_name", request.metricName], ["start_at", request.startAt])
109
+ }, unmarshalClusterMetricsResponse);
110
+ pageOfListNodeTypes = (request) => this.client.fetch({
111
+ method: "GET",
112
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/node-types`,
113
+ urlParams: urlParams(["include_disabled_types", request.includeDisabledTypes], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
114
+ }, unmarshalListNodeTypesResponse);
115
+ /**
116
+ * List available node types. List all available node types. By default, the node types returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
117
+ *
118
+ * @param request - The request {@link ListNodeTypesRequest}
119
+ * @returns A Promise of ListNodeTypesResponse
120
+ */
121
+ listNodeTypes = (request) => enrichForPagination("nodeTypes", this.pageOfListNodeTypes, request);
122
+ pageOfListClusterVersions = (request) => this.client.fetch({
123
+ method: "GET",
124
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/cluster-versions`,
125
+ urlParams: urlParams(["include_beta", request.includeBeta], ["include_deprecated", request.includeDeprecated], ["include_disabled", request.includeDisabled], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["version", request.version])
126
+ }, unmarshalListClusterVersionsResponse);
127
+ /**
128
+ * List available Redis™ versions. List the Redis™ database engine versions available. You can define additional parameters for your query, such as `include_disabled`, `include_beta`, `include_deprecated` and `version`.
129
+ *
130
+ * @param request - The request {@link ListClusterVersionsRequest}
131
+ * @returns A Promise of ListClusterVersionsResponse
132
+ */
133
+ listClusterVersions = (request) => enrichForPagination("versions", this.pageOfListClusterVersions, request);
134
+ /**
135
+ * Get the TLS certificate of a cluster. Retrieve information about the TLS certificate of a Redis™ Database Instance (Redis™ cluster). Details like name and content are returned in the response.
136
+ *
137
+ * @param request - The request {@link GetClusterCertificateRequest}
138
+ * @returns A Promise of Blob
139
+ */
140
+ getClusterCertificate = (request) => this.client.fetch({
141
+ method: "GET",
142
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/certificate`,
143
+ urlParams: urlParams(["dl", 1]),
144
+ responseType: "blob"
145
+ });
146
+ /**
147
+ * Renew the TLS certificate of a cluster. Renew a TLS certificate for a Redis™ Database Instance (Redis™ cluster). Renewing a certificate means that you will not be able to connect to your Database Instance using the previous certificate. You will also need to download and update the new certificate for all database clients.
148
+ *
149
+ * @param request - The request {@link RenewClusterCertificateRequest}
150
+ * @returns A Promise of Cluster
151
+ */
152
+ renewClusterCertificate = (request) => this.client.fetch({
153
+ body: "{}",
154
+ headers: jsonContentHeaders,
155
+ method: "POST",
156
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/renew-certificate`
157
+ }, unmarshalCluster);
158
+ /**
159
+ * Add advanced settings. Add an advanced setting to a Redis™ Database Instance (Redis™ cluster). You must set the `name` and the `value` of each setting.
160
+ *
161
+ * @param request - The request {@link AddClusterSettingsRequest}
162
+ * @returns A Promise of ClusterSettingsResponse
163
+ */
164
+ addClusterSettings = (request) => this.client.fetch({
165
+ body: JSON.stringify(marshalAddClusterSettingsRequest(request, this.client.settings)),
166
+ headers: jsonContentHeaders,
167
+ method: "POST",
168
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/settings`
169
+ }, unmarshalClusterSettingsResponse);
170
+ /**
171
+ * Delete advanced setting. Delete an advanced setting in a Redis™ Database Instance (Redis™ cluster). You must specify the names of the settings you want to delete in the request body.
172
+ *
173
+ * @param request - The request {@link DeleteClusterSettingRequest}
174
+ * @returns A Promise of Cluster
175
+ */
176
+ deleteClusterSetting = (request) => this.client.fetch({
177
+ method: "DELETE",
178
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/settings/${validatePathParam("settingName", request.settingName)}`
179
+ }, unmarshalCluster);
180
+ /**
181
+ * Set advanced settings. Update an advanced setting for a Redis™ Database Instance (Redis™ cluster). Settings added upon database engine initialization can only be defined once, and cannot, therefore, be updated.
182
+ *
183
+ * @param request - The request {@link SetClusterSettingsRequest}
184
+ * @returns A Promise of ClusterSettingsResponse
185
+ */
186
+ setClusterSettings = (request) => this.client.fetch({
187
+ body: JSON.stringify(marshalSetClusterSettingsRequest(request, this.client.settings)),
188
+ headers: jsonContentHeaders,
189
+ method: "PUT",
190
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/settings`
191
+ }, unmarshalClusterSettingsResponse);
192
+ /**
193
+ * Set ACL rules for a cluster. Replace all the ACL rules of a Redis™ Database Instance (Redis™ cluster).
194
+ *
195
+ * @param request - The request {@link SetAclRulesRequest}
196
+ * @returns A Promise of SetAclRulesResponse
197
+ */
198
+ setAclRules = (request) => this.client.fetch({
199
+ body: JSON.stringify(marshalSetAclRulesRequest(request, this.client.settings)),
200
+ headers: jsonContentHeaders,
201
+ method: "PUT",
202
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
203
+ }, unmarshalSetAclRulesResponse);
204
+ /**
205
+ * Add ACL rules for a cluster. Add an additional ACL rule to a Redis™ Database Instance (Redis™ cluster).
206
+ *
207
+ * @param request - The request {@link AddAclRulesRequest}
208
+ * @returns A Promise of AddAclRulesResponse
209
+ */
210
+ addAclRules = (request) => this.client.fetch({
211
+ body: JSON.stringify(marshalAddAclRulesRequest(request, this.client.settings)),
212
+ headers: jsonContentHeaders,
213
+ method: "POST",
214
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/acls`
215
+ }, unmarshalAddAclRulesResponse);
216
+ /**
217
+ * Delete an ACL rule for a cluster. Delete an ACL rule of a Redis™ Database Instance (Redis™ cluster). You must specify the `acl_id` of the rule you want to delete in your request.
218
+ *
219
+ * @param request - The request {@link DeleteAclRuleRequest}
220
+ * @returns A Promise of Cluster
221
+ */
222
+ deleteAclRule = (request) => this.client.fetch({
223
+ method: "DELETE",
224
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/acls/${validatePathParam("aclId", request.aclId)}`
225
+ }, unmarshalCluster);
226
+ /**
227
+ * Get an ACL rule. Retrieve information about an ACL rule of a Redis™ Database Instance (Redis™ cluster). You must specify the `acl_id` of the rule in your request.
228
+ *
229
+ * @param request - The request {@link GetAclRuleRequest}
230
+ * @returns A Promise of ACLRule
231
+ */
232
+ getAclRule = (request) => this.client.fetch({
233
+ method: "GET",
234
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/acls/${validatePathParam("aclId", request.aclId)}`
235
+ }, unmarshalACLRule);
236
+ /**
237
+ * Set endpoints for a cluster. Update an endpoint for a Redis™ Database Instance (Redis™ cluster). You must specify the `cluster_id` and the `endpoints` parameters in your request.
238
+ *
239
+ * @param request - The request {@link SetEndpointsRequest}
240
+ * @returns A Promise of SetEndpointsResponse
241
+ */
242
+ setEndpoints = (request) => this.client.fetch({
243
+ body: JSON.stringify(marshalSetEndpointsRequest(request, this.client.settings)),
244
+ headers: jsonContentHeaders,
245
+ method: "PUT",
246
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/endpoints`
247
+ }, unmarshalSetEndpointsResponse);
248
+ /**
249
+ * Add endpoints for a cluster. Add a new endpoint for a Redis™ Database Instance (Redis™ cluster). You can add `private_network` or `public_network` specifications to the body of the request.
250
+ *
251
+ * @param request - The request {@link AddEndpointsRequest}
252
+ * @returns A Promise of AddEndpointsResponse
253
+ */
254
+ addEndpoints = (request) => this.client.fetch({
255
+ body: JSON.stringify(marshalAddEndpointsRequest(request, this.client.settings)),
256
+ headers: jsonContentHeaders,
257
+ method: "POST",
258
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/clusters/${validatePathParam("clusterId", request.clusterId)}/endpoints`
259
+ }, unmarshalAddEndpointsResponse);
260
+ /**
261
+ * Delete an endpoint for a cluster. Delete the endpoint of a Redis™ Database Instance (Redis™ cluster). You must specify the `region` and `endpoint_id` parameters of the endpoint you want to delete. Note that might need to update any environment configurations that point to the deleted endpoint.
262
+ *
263
+ * @param request - The request {@link DeleteEndpointRequest}
264
+ * @returns A Promise of Cluster
265
+ */
266
+ deleteEndpoint = (request) => this.client.fetch({
267
+ method: "DELETE",
268
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
269
+ }, unmarshalCluster);
270
+ /**
271
+ * Get an endpoint. Retrieve information about a Redis™ Database Instance (Redis™ cluster) endpoint. Full details about the endpoint, like `ips`, `port`, `private_network` and `public_network` specifications are returned in the response.
272
+ *
273
+ * @param request - The request {@link GetEndpointRequest}
274
+ * @returns A Promise of Endpoint
275
+ */
276
+ getEndpoint = (request) => this.client.fetch({
277
+ method: "GET",
278
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
279
+ }, unmarshalEndpoint);
280
+ /**
281
+ * Update an endpoint. Update information about a Redis™ Database Instance (Redis™ cluster) endpoint. Full details about the endpoint, like `ips`, `port`, `private_network` and `public_network` specifications are returned in the response.
282
+ *
283
+ * @param request - The request {@link UpdateEndpointRequest}
284
+ * @returns A Promise of Endpoint
285
+ */
286
+ updateEndpoint = (request) => this.client.fetch({
287
+ body: JSON.stringify(marshalUpdateEndpointRequest(request, this.client.settings)),
288
+ headers: jsonContentHeaders,
289
+ method: "PATCH",
290
+ path: `/redis/v1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
291
+ }, unmarshalEndpoint);
413
292
  };
293
+ export { API$1 as API };