@scaleway/sdk-redis 2.7.2 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,222 @@
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalTimeSeries } from "@scaleway/sdk-client";
2
+ import randomName from "@scaleway/random-name";
3
+ //#region src/v1/marshalling.gen.ts
4
+ const unmarshalACLRule = (data) => {
5
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`);
6
+ return {
7
+ description: data.description,
8
+ id: data.id,
9
+ ipCidr: data.ip_cidr
10
+ };
11
+ };
12
+ const unmarshalPrivateNetwork = (data) => {
13
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PrivateNetwork' failed as data isn't a dictionary.`);
14
+ return {
15
+ id: data.id,
16
+ provisioningMode: data.provisioning_mode,
17
+ serviceIps: data.service_ips,
18
+ zone: data.zone
19
+ };
20
+ };
21
+ const unmarshalPublicNetwork = (data) => {
22
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'PublicNetwork' failed as data isn't a dictionary.`);
23
+ return {};
24
+ };
25
+ const unmarshalEndpoint = (data) => {
26
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`);
27
+ return {
28
+ id: data.id,
29
+ ips: data.ips,
30
+ port: data.port,
31
+ privateNetwork: data.private_network ? unmarshalPrivateNetwork(data.private_network) : void 0,
32
+ publicNetwork: data.public_network ? unmarshalPublicNetwork(data.public_network) : void 0
33
+ };
34
+ };
35
+ const unmarshalClusterSetting = (data) => {
36
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ClusterSetting' failed as data isn't a dictionary.`);
37
+ return {
38
+ name: data.name,
39
+ value: data.value
40
+ };
41
+ };
42
+ const unmarshalCluster = (data) => {
43
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Cluster' failed as data isn't a dictionary.`);
44
+ return {
45
+ aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule),
46
+ clusterSettings: unmarshalArrayOfObject(data.cluster_settings, unmarshalClusterSetting),
47
+ clusterSize: data.cluster_size,
48
+ createdAt: unmarshalDate(data.created_at),
49
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
50
+ id: data.id,
51
+ name: data.name,
52
+ nodeType: data.node_type,
53
+ projectId: data.project_id,
54
+ status: data.status,
55
+ tags: data.tags,
56
+ tlsEnabled: data.tls_enabled,
57
+ updatedAt: unmarshalDate(data.updated_at),
58
+ upgradableVersions: data.upgradable_versions,
59
+ userName: data.user_name,
60
+ version: data.version,
61
+ zone: data.zone
62
+ };
63
+ };
64
+ const unmarshalAddAclRulesResponse = (data) => {
65
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'AddAclRulesResponse' failed as data isn't a dictionary.`);
66
+ return {
67
+ aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule),
68
+ totalCount: data.total_count
69
+ };
70
+ };
71
+ const unmarshalAddEndpointsResponse = (data) => {
72
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'AddEndpointsResponse' failed as data isn't a dictionary.`);
73
+ return {
74
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
75
+ totalCount: data.total_count
76
+ };
77
+ };
78
+ const unmarshalClusterMetricsResponse = (data) => {
79
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ClusterMetricsResponse' failed as data isn't a dictionary.`);
80
+ return { timeseries: unmarshalArrayOfObject(data.timeseries, unmarshalTimeSeries) };
81
+ };
82
+ const unmarshalClusterSettingsResponse = (data) => {
83
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ClusterSettingsResponse' failed as data isn't a dictionary.`);
84
+ return { settings: unmarshalArrayOfObject(data.settings, unmarshalClusterSetting) };
85
+ };
86
+ const unmarshalAvailableClusterSetting = (data) => {
87
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'AvailableClusterSetting' failed as data isn't a dictionary.`);
88
+ return {
89
+ defaultValue: data.default_value,
90
+ deprecated: data.deprecated,
91
+ description: data.description,
92
+ maxValue: data.max_value,
93
+ minValue: data.min_value,
94
+ name: data.name,
95
+ regex: data.regex,
96
+ type: data.type
97
+ };
98
+ };
99
+ const unmarshalClusterVersion = (data) => {
100
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ClusterVersion' failed as data isn't a dictionary.`);
101
+ return {
102
+ availableSettings: unmarshalArrayOfObject(data.available_settings, unmarshalAvailableClusterSetting),
103
+ endOfLifeAt: unmarshalDate(data.end_of_life_at),
104
+ logoUrl: data.logo_url,
105
+ releasedAt: unmarshalDate(data.released_at),
106
+ version: data.version,
107
+ zone: data.zone
108
+ };
109
+ };
110
+ const unmarshalListClusterVersionsResponse = (data) => {
111
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListClusterVersionsResponse' failed as data isn't a dictionary.`);
112
+ return {
113
+ totalCount: data.total_count,
114
+ versions: unmarshalArrayOfObject(data.versions, unmarshalClusterVersion)
115
+ };
116
+ };
117
+ const unmarshalListClustersResponse = (data) => {
118
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListClustersResponse' failed as data isn't a dictionary.`);
119
+ return {
120
+ clusters: unmarshalArrayOfObject(data.clusters, unmarshalCluster),
121
+ totalCount: data.total_count
122
+ };
123
+ };
124
+ const unmarshalNodeType = (data) => {
125
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`);
126
+ return {
127
+ beta: data.beta,
128
+ description: data.description,
129
+ disabled: data.disabled,
130
+ memory: data.memory,
131
+ name: data.name,
132
+ stockStatus: data.stock_status,
133
+ vcpus: data.vcpus,
134
+ zone: data.zone
135
+ };
136
+ };
137
+ const unmarshalListNodeTypesResponse = (data) => {
138
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`);
139
+ return {
140
+ nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
141
+ totalCount: data.total_count
142
+ };
143
+ };
144
+ const unmarshalSetAclRulesResponse = (data) => {
145
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetAclRulesResponse' failed as data isn't a dictionary.`);
146
+ return { aclRules: unmarshalArrayOfObject(data.acl_rules, unmarshalACLRule) };
147
+ };
148
+ const unmarshalSetEndpointsResponse = (data) => {
149
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SetEndpointsResponse' failed as data isn't a dictionary.`);
150
+ return { endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint) };
151
+ };
152
+ const marshalACLRuleSpec = (request, defaults) => ({
153
+ description: request.description,
154
+ ip_cidr: request.ipCidr
155
+ });
156
+ const marshalAddAclRulesRequest = (request, defaults) => ({ acl_rules: request.aclRules.map((elt) => marshalACLRuleSpec(elt, defaults)) });
157
+ const marshalClusterSetting = (request, defaults) => ({
158
+ name: request.name,
159
+ value: request.value
160
+ });
161
+ const marshalAddClusterSettingsRequest = (request, defaults) => ({ settings: request.settings.map((elt) => marshalClusterSetting(elt, defaults)) });
162
+ const marshalEndpointSpecPrivateNetworkSpecIpamConfig = (request, defaults) => ({});
163
+ const marshalEndpointSpecPrivateNetworkSpec = (request, defaults) => ({
164
+ id: request.id,
165
+ ipam_config: request.ipamConfig !== void 0 ? marshalEndpointSpecPrivateNetworkSpecIpamConfig(request.ipamConfig, defaults) : void 0,
166
+ service_ips: request.serviceIps
167
+ });
168
+ const marshalEndpointSpecPublicNetworkSpec = (request, defaults) => ({});
169
+ const marshalEndpointSpec = (request, defaults) => ({ ...resolveOneOf([{
170
+ param: "private_network",
171
+ value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetworkSpec(request.privateNetwork, defaults) : void 0
172
+ }, {
173
+ param: "public_network",
174
+ value: request.publicNetwork !== void 0 ? marshalEndpointSpecPublicNetworkSpec(request.publicNetwork, defaults) : void 0
175
+ }]) });
176
+ const marshalAddEndpointsRequest = (request, defaults) => ({ endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt, defaults)) });
177
+ const marshalCreateClusterRequest = (request, defaults) => ({
178
+ acl_rules: request.aclRules !== void 0 ? request.aclRules.map((elt) => marshalACLRuleSpec(elt, defaults)) : void 0,
179
+ cluster_settings: request.clusterSettings !== void 0 ? request.clusterSettings.map((elt) => marshalClusterSetting(elt, defaults)) : void 0,
180
+ cluster_size: request.clusterSize,
181
+ endpoints: request.endpoints !== void 0 ? request.endpoints.map((elt) => marshalEndpointSpec(elt, defaults)) : void 0,
182
+ name: request.name || randomName("ins"),
183
+ node_type: request.nodeType,
184
+ password: request.password,
185
+ project_id: request.projectId ?? defaults.defaultProjectId,
186
+ tags: request.tags,
187
+ tls_enabled: request.tlsEnabled,
188
+ user_name: request.userName,
189
+ version: request.version
190
+ });
191
+ const marshalMigrateClusterRequest = (request, defaults) => ({ ...resolveOneOf([
192
+ {
193
+ param: "version",
194
+ value: request.version
195
+ },
196
+ {
197
+ param: "node_type",
198
+ value: request.nodeType
199
+ },
200
+ {
201
+ param: "cluster_size",
202
+ value: request.clusterSize
203
+ }
204
+ ]) });
205
+ const marshalSetAclRulesRequest = (request, defaults) => ({ acl_rules: request.aclRules.map((elt) => marshalACLRuleSpec(elt, defaults)) });
206
+ const marshalSetClusterSettingsRequest = (request, defaults) => ({ settings: request.settings.map((elt) => marshalClusterSetting(elt, defaults)) });
207
+ const marshalSetEndpointsRequest = (request, defaults) => ({ endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt, defaults)) });
208
+ const marshalUpdateClusterRequest = (request, defaults) => ({
209
+ name: request.name,
210
+ password: request.password,
211
+ tags: request.tags,
212
+ user_name: request.userName
213
+ });
214
+ const marshalUpdateEndpointRequest = (request, defaults) => ({ ...resolveOneOf([{
215
+ param: "private_network",
216
+ value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetworkSpec(request.privateNetwork, defaults) : void 0
217
+ }, {
218
+ param: "public_network",
219
+ value: request.publicNetwork !== void 0 ? marshalEndpointSpecPublicNetworkSpec(request.publicNetwork, defaults) : void 0
220
+ }]) });
221
+ //#endregion
222
+ export { marshalAddAclRulesRequest, marshalAddClusterSettingsRequest, marshalAddEndpointsRequest, marshalCreateClusterRequest, marshalMigrateClusterRequest, marshalSetAclRulesRequest, marshalSetClusterSettingsRequest, marshalSetEndpointsRequest, marshalUpdateClusterRequest, marshalUpdateEndpointRequest, unmarshalACLRule, unmarshalAddAclRulesResponse, unmarshalAddEndpointsResponse, unmarshalCluster, unmarshalClusterMetricsResponse, unmarshalClusterSettingsResponse, unmarshalEndpoint, unmarshalListClusterVersionsResponse, unmarshalListClustersResponse, unmarshalListNodeTypesResponse, unmarshalSetAclRulesResponse, unmarshalSetEndpointsResponse };
@@ -0,0 +1,89 @@
1
+ export declare const queriesMetadata: {
2
+ readonly namespace: 'redis';
3
+ readonly version: 'v1';
4
+ readonly folderName: 'redisv1';
5
+ readonly services: readonly [{
6
+ readonly apiClass: 'API';
7
+ readonly methods: readonly [{
8
+ readonly methodName: 'getCluster';
9
+ readonly protoName: 'GetCluster';
10
+ readonly paramsType: 'GetClusterRequest';
11
+ readonly returnType: 'Cluster';
12
+ readonly isList: false;
13
+ readonly paginationType: 'none';
14
+ readonly isPrivate: false;
15
+ readonly description: '"';
16
+ readonly hasWaiter: true;
17
+ }, {
18
+ readonly methodName: 'listClusters';
19
+ readonly protoName: 'ListClusters';
20
+ readonly paramsType: 'ListClustersRequest';
21
+ readonly returnType: 'ListClustersResponse';
22
+ readonly isList: true;
23
+ readonly paginationType: 'offset';
24
+ readonly pageParamKey: 'page';
25
+ readonly listItemType: 'Cluster';
26
+ readonly isPrivate: false;
27
+ readonly description: '"';
28
+ }, {
29
+ readonly methodName: 'getClusterMetrics';
30
+ readonly protoName: 'GetClusterMetrics';
31
+ readonly paramsType: 'GetClusterMetricsRequest';
32
+ readonly returnType: 'ClusterMetricsResponse';
33
+ readonly isList: false;
34
+ readonly paginationType: 'none';
35
+ readonly isPrivate: false;
36
+ readonly description: '"';
37
+ }, {
38
+ readonly methodName: 'listNodeTypes';
39
+ readonly protoName: 'ListNodeTypes';
40
+ readonly paramsType: 'ListNodeTypesRequest';
41
+ readonly returnType: 'ListNodeTypesResponse';
42
+ readonly isList: true;
43
+ readonly paginationType: 'offset';
44
+ readonly pageParamKey: 'page';
45
+ readonly listItemType: 'NodeType';
46
+ readonly isPrivate: false;
47
+ readonly description: '"';
48
+ }, {
49
+ readonly methodName: 'listClusterVersions';
50
+ readonly protoName: 'ListClusterVersions';
51
+ readonly paramsType: 'ListClusterVersionsRequest';
52
+ readonly returnType: 'ListClusterVersionsResponse';
53
+ readonly isList: true;
54
+ readonly paginationType: 'offset';
55
+ readonly pageParamKey: 'page';
56
+ readonly listItemType: 'ClusterVersion';
57
+ readonly isPrivate: false;
58
+ readonly description: '"';
59
+ }, {
60
+ readonly methodName: 'getClusterCertificate';
61
+ readonly protoName: 'GetClusterCertificate';
62
+ readonly paramsType: 'GetClusterCertificateRequest';
63
+ readonly returnType: 'Blob';
64
+ readonly isList: false;
65
+ readonly paginationType: 'none';
66
+ readonly isPrivate: false;
67
+ readonly description: '"';
68
+ }, {
69
+ readonly methodName: 'getAclRule';
70
+ readonly protoName: 'GetAclRule';
71
+ readonly paramsType: 'GetAclRuleRequest';
72
+ readonly returnType: 'ACLRule';
73
+ readonly isList: false;
74
+ readonly paginationType: 'none';
75
+ readonly isPrivate: false;
76
+ readonly description: '"';
77
+ }, {
78
+ readonly methodName: 'getEndpoint';
79
+ readonly protoName: 'GetEndpoint';
80
+ readonly paramsType: 'GetEndpointRequest';
81
+ readonly returnType: 'Endpoint';
82
+ readonly isList: false;
83
+ readonly paginationType: 'none';
84
+ readonly isPrivate: false;
85
+ readonly description: '"';
86
+ }];
87
+ }];
88
+ };
89
+ export type QueriesMetadata = typeof queriesMetadata;
@@ -0,0 +1,100 @@
1
+ //#region src/v1/metadata.gen.ts
2
+ const queriesMetadata = {
3
+ namespace: "redis",
4
+ version: "v1",
5
+ folderName: "redisv1",
6
+ services: [{
7
+ apiClass: "API",
8
+ methods: [
9
+ {
10
+ methodName: "getCluster",
11
+ protoName: "GetCluster",
12
+ paramsType: "GetClusterRequest",
13
+ returnType: "Cluster",
14
+ isList: false,
15
+ paginationType: "none",
16
+ isPrivate: false,
17
+ description: "\"",
18
+ hasWaiter: true
19
+ },
20
+ {
21
+ methodName: "listClusters",
22
+ protoName: "ListClusters",
23
+ paramsType: "ListClustersRequest",
24
+ returnType: "ListClustersResponse",
25
+ isList: true,
26
+ paginationType: "offset",
27
+ pageParamKey: "page",
28
+ listItemType: "Cluster",
29
+ isPrivate: false,
30
+ description: "\""
31
+ },
32
+ {
33
+ methodName: "getClusterMetrics",
34
+ protoName: "GetClusterMetrics",
35
+ paramsType: "GetClusterMetricsRequest",
36
+ returnType: "ClusterMetricsResponse",
37
+ isList: false,
38
+ paginationType: "none",
39
+ isPrivate: false,
40
+ description: "\""
41
+ },
42
+ {
43
+ methodName: "listNodeTypes",
44
+ protoName: "ListNodeTypes",
45
+ paramsType: "ListNodeTypesRequest",
46
+ returnType: "ListNodeTypesResponse",
47
+ isList: true,
48
+ paginationType: "offset",
49
+ pageParamKey: "page",
50
+ listItemType: "NodeType",
51
+ isPrivate: false,
52
+ description: "\""
53
+ },
54
+ {
55
+ methodName: "listClusterVersions",
56
+ protoName: "ListClusterVersions",
57
+ paramsType: "ListClusterVersionsRequest",
58
+ returnType: "ListClusterVersionsResponse",
59
+ isList: true,
60
+ paginationType: "offset",
61
+ pageParamKey: "page",
62
+ listItemType: "ClusterVersion",
63
+ isPrivate: false,
64
+ description: "\""
65
+ },
66
+ {
67
+ methodName: "getClusterCertificate",
68
+ protoName: "GetClusterCertificate",
69
+ paramsType: "GetClusterCertificateRequest",
70
+ returnType: "Blob",
71
+ isList: false,
72
+ paginationType: "none",
73
+ isPrivate: false,
74
+ description: "\""
75
+ },
76
+ {
77
+ methodName: "getAclRule",
78
+ protoName: "GetAclRule",
79
+ paramsType: "GetAclRuleRequest",
80
+ returnType: "ACLRule",
81
+ isList: false,
82
+ paginationType: "none",
83
+ isPrivate: false,
84
+ description: "\""
85
+ },
86
+ {
87
+ methodName: "getEndpoint",
88
+ protoName: "GetEndpoint",
89
+ paramsType: "GetEndpointRequest",
90
+ returnType: "Endpoint",
91
+ isList: false,
92
+ paginationType: "none",
93
+ isPrivate: false,
94
+ description: "\""
95
+ }
96
+ ]
97
+ }]
98
+ };
99
+ //#endregion
100
+ export { queriesMetadata };