@scaleway/sdk-autoscaling 2.15.1 → 2.17.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.
@@ -1,284 +0,0 @@
1
- import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMapOfObject } from "@scaleway/sdk-client";
2
-
3
- //#region src/v1alpha1/marshalling.gen.ts
4
- const unmarshalCapacity = (data) => {
5
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Capacity' failed as data isn't a dictionary.`);
6
- return {
7
- cooldownDelay: data.cooldown_delay,
8
- maxReplicas: data.max_replicas,
9
- minReplicas: data.min_replicas
10
- };
11
- };
12
- const unmarshalLoadbalancer = (data) => {
13
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Loadbalancer' failed as data isn't a dictionary.`);
14
- return {
15
- backendIds: data.backend_ids,
16
- id: data.id,
17
- privateNetworkId: data.private_network_id
18
- };
19
- };
20
- const unmarshalInstanceGroup = (data) => {
21
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InstanceGroup' failed as data isn't a dictionary.`);
22
- return {
23
- capacity: unmarshalCapacity(data.capacity),
24
- createdAt: unmarshalDate(data.created_at),
25
- errorMessages: data.error_messages,
26
- id: data.id,
27
- instanceTemplateId: data.instance_template_id,
28
- loadbalancer: unmarshalLoadbalancer(data.loadbalancer),
29
- name: data.name,
30
- projectId: data.project_id,
31
- tags: data.tags,
32
- updatedAt: unmarshalDate(data.updated_at),
33
- zone: data.zone
34
- };
35
- };
36
- const unmarshalMetric = (data) => {
37
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Metric' failed as data isn't a dictionary.`);
38
- return {
39
- aggregate: data.aggregate,
40
- cockpitMetricName: data.cockpit_metric_name,
41
- managedMetric: data.managed_metric ? data.managed_metric : void 0,
42
- name: data.name,
43
- operator: data.operator,
44
- samplingRangeMin: data.sampling_range_min,
45
- threshold: data.threshold
46
- };
47
- };
48
- const unmarshalInstancePolicy = (data) => {
49
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InstancePolicy' failed as data isn't a dictionary.`);
50
- return {
51
- action: data.action,
52
- id: data.id,
53
- instanceGroupId: data.instance_group_id,
54
- metric: data.metric ? unmarshalMetric(data.metric) : void 0,
55
- name: data.name,
56
- priority: data.priority,
57
- type: data.type,
58
- value: data.value,
59
- zone: data.zone
60
- };
61
- };
62
- const unmarshalVolumeInstanceTemplateFromEmpty = (data) => {
63
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeInstanceTemplateFromEmpty' failed as data isn't a dictionary.`);
64
- return { size: data.size };
65
- };
66
- const unmarshalVolumeInstanceTemplateFromSnapshot = (data) => {
67
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeInstanceTemplateFromSnapshot' failed as data isn't a dictionary.`);
68
- return {
69
- size: data.size,
70
- snapshotId: data.snapshot_id
71
- };
72
- };
73
- const unmarshalVolumeInstanceTemplate = (data) => {
74
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'VolumeInstanceTemplate' failed as data isn't a dictionary.`);
75
- return {
76
- boot: data.boot,
77
- fromEmpty: data.from_empty ? unmarshalVolumeInstanceTemplateFromEmpty(data.from_empty) : void 0,
78
- fromSnapshot: data.from_snapshot ? unmarshalVolumeInstanceTemplateFromSnapshot(data.from_snapshot) : void 0,
79
- name: data.name,
80
- perfIops: data.perf_iops,
81
- tags: data.tags,
82
- volumeType: data.volume_type
83
- };
84
- };
85
- const unmarshalInstanceTemplate = (data) => {
86
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InstanceTemplate' failed as data isn't a dictionary.`);
87
- return {
88
- cloudInit: data.cloud_init,
89
- commercialType: data.commercial_type,
90
- createdAt: unmarshalDate(data.created_at),
91
- id: data.id,
92
- imageId: data.image_id,
93
- name: data.name,
94
- placementGroupId: data.placement_group_id,
95
- privateNetworkIds: data.private_network_ids,
96
- projectId: data.project_id,
97
- publicIpsV4Count: data.public_ips_v4_count,
98
- publicIpsV6Count: data.public_ips_v6_count,
99
- securityGroupId: data.security_group_id,
100
- status: data.status,
101
- tags: data.tags,
102
- updatedAt: unmarshalDate(data.updated_at),
103
- volumes: unmarshalMapOfObject(data.volumes, unmarshalVolumeInstanceTemplate),
104
- zone: data.zone
105
- };
106
- };
107
- const unmarshalInstanceGroupEvent = (data) => {
108
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'InstanceGroupEvent' failed as data isn't a dictionary.`);
109
- return {
110
- createdAt: unmarshalDate(data.created_at),
111
- details: data.details,
112
- id: data.id,
113
- level: data.level,
114
- name: data.name,
115
- source: data.source
116
- };
117
- };
118
- const unmarshalListInstanceGroupEventsResponse = (data) => {
119
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceGroupEventsResponse' failed as data isn't a dictionary.`);
120
- return {
121
- instanceEvents: unmarshalArrayOfObject(data.instance_events, unmarshalInstanceGroupEvent),
122
- totalCount: data.total_count
123
- };
124
- };
125
- const unmarshalListInstanceGroupsResponse = (data) => {
126
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceGroupsResponse' failed as data isn't a dictionary.`);
127
- return {
128
- instanceGroups: unmarshalArrayOfObject(data.instance_groups, unmarshalInstanceGroup),
129
- totalCount: data.total_count
130
- };
131
- };
132
- const unmarshalListInstancePoliciesResponse = (data) => {
133
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstancePoliciesResponse' failed as data isn't a dictionary.`);
134
- return {
135
- policies: unmarshalArrayOfObject(data.policies, unmarshalInstancePolicy),
136
- totalCount: data.total_count
137
- };
138
- };
139
- const unmarshalListInstanceTemplatesResponse = (data) => {
140
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInstanceTemplatesResponse' failed as data isn't a dictionary.`);
141
- return {
142
- instanceTemplates: unmarshalArrayOfObject(data.instance_templates, unmarshalInstanceTemplate),
143
- totalCount: data.total_count
144
- };
145
- };
146
- const marshalCapacity = (request, defaults) => ({
147
- cooldown_delay: request.cooldownDelay,
148
- max_replicas: request.maxReplicas,
149
- min_replicas: request.minReplicas
150
- });
151
- const marshalLoadbalancer = (request, defaults) => ({
152
- backend_ids: request.backendIds,
153
- id: request.id,
154
- private_network_id: request.privateNetworkId
155
- });
156
- const marshalCreateInstanceGroupRequest = (request, defaults) => ({
157
- capacity: marshalCapacity(request.capacity, defaults),
158
- loadbalancer: marshalLoadbalancer(request.loadbalancer, defaults),
159
- name: request.name,
160
- project_id: request.projectId ?? defaults.defaultProjectId,
161
- tags: request.tags,
162
- template_id: request.templateId
163
- });
164
- const marshalMetric = (request, defaults) => ({
165
- aggregate: request.aggregate,
166
- name: request.name,
167
- operator: request.operator,
168
- sampling_range_min: request.samplingRangeMin,
169
- threshold: request.threshold,
170
- ...resolveOneOf([{
171
- param: "managed_metric",
172
- value: request.managedMetric
173
- }, {
174
- param: "cockpit_metric_name",
175
- value: request.cockpitMetricName
176
- }])
177
- });
178
- const marshalCreateInstancePolicyRequest = (request, defaults) => ({
179
- action: request.action,
180
- instance_group_id: request.instanceGroupId,
181
- name: request.name,
182
- priority: request.priority,
183
- type: request.type,
184
- value: request.value,
185
- ...resolveOneOf([{
186
- param: "metric",
187
- value: request.metric !== void 0 ? marshalMetric(request.metric, defaults) : void 0
188
- }])
189
- });
190
- const marshalVolumeInstanceTemplateFromEmpty = (request, defaults) => ({ size: request.size });
191
- const marshalVolumeInstanceTemplateFromSnapshot = (request, defaults) => ({
192
- size: request.size,
193
- snapshot_id: request.snapshotId
194
- });
195
- const marshalVolumeInstanceTemplate = (request, defaults) => ({
196
- boot: request.boot,
197
- name: request.name,
198
- tags: request.tags,
199
- volume_type: request.volumeType,
200
- ...resolveOneOf([{
201
- param: "from_empty",
202
- value: request.fromEmpty !== void 0 ? marshalVolumeInstanceTemplateFromEmpty(request.fromEmpty, defaults) : void 0
203
- }, {
204
- param: "from_snapshot",
205
- value: request.fromSnapshot !== void 0 ? marshalVolumeInstanceTemplateFromSnapshot(request.fromSnapshot, defaults) : void 0
206
- }]),
207
- ...resolveOneOf([{
208
- param: "perf_iops",
209
- value: request.perfIops
210
- }])
211
- });
212
- const marshalCreateInstanceTemplateRequest = (request, defaults) => ({
213
- cloud_init: request.cloudInit,
214
- commercial_type: request.commercialType,
215
- image_id: request.imageId,
216
- name: request.name,
217
- placement_group_id: request.placementGroupId,
218
- private_network_ids: request.privateNetworkIds,
219
- project_id: request.projectId ?? defaults.defaultProjectId,
220
- public_ips_v4_count: request.publicIpsV4Count,
221
- public_ips_v6_count: request.publicIpsV6Count,
222
- security_group_id: request.securityGroupId,
223
- tags: request.tags,
224
- volumes: Object.entries(request.volumes).reduce((acc, [key, value]) => ({
225
- ...acc,
226
- [key]: marshalVolumeInstanceTemplate(value, defaults)
227
- }), {})
228
- });
229
- const marshalUpdateInstanceGroupRequestCapacity = (request, defaults) => ({
230
- cooldown_delay: request.cooldownDelay,
231
- max_replicas: request.maxReplicas,
232
- min_replicas: request.minReplicas
233
- });
234
- const marshalUpdateInstanceGroupRequestLoadbalancer = (request, defaults) => ({ backend_ids: request.backendIds });
235
- const marshalUpdateInstanceGroupRequest = (request, defaults) => ({
236
- capacity: request.capacity !== void 0 ? marshalUpdateInstanceGroupRequestCapacity(request.capacity, defaults) : void 0,
237
- loadbalancer: request.loadbalancer !== void 0 ? marshalUpdateInstanceGroupRequestLoadbalancer(request.loadbalancer, defaults) : void 0,
238
- name: request.name,
239
- tags: request.tags
240
- });
241
- const marshalUpdateInstancePolicyRequestMetric = (request, defaults) => ({
242
- aggregate: request.aggregate,
243
- name: request.name,
244
- operator: request.operator,
245
- sampling_range_min: request.samplingRangeMin,
246
- threshold: request.threshold,
247
- ...resolveOneOf([{
248
- param: "managed_metric",
249
- value: request.managedMetric
250
- }, {
251
- param: "cockpit_metric_name",
252
- value: request.cockpitMetricName
253
- }])
254
- });
255
- const marshalUpdateInstancePolicyRequest = (request, defaults) => ({
256
- action: request.action,
257
- name: request.name,
258
- priority: request.priority,
259
- type: request.type,
260
- value: request.value,
261
- ...resolveOneOf([{
262
- param: "metric",
263
- value: request.metric !== void 0 ? marshalUpdateInstancePolicyRequestMetric(request.metric, defaults) : void 0
264
- }])
265
- });
266
- const marshalUpdateInstanceTemplateRequest = (request, defaults) => ({
267
- cloud_init: request.cloudInit,
268
- commercial_type: request.commercialType,
269
- image_id: request.imageId,
270
- name: request.name,
271
- placement_group_id: request.placementGroupId,
272
- private_network_ids: request.privateNetworkIds,
273
- public_ips_v4_count: request.publicIpsV4Count,
274
- public_ips_v6_count: request.publicIpsV6Count,
275
- security_group_id: request.securityGroupId,
276
- tags: request.tags,
277
- volumes: request.volumes !== void 0 ? Object.entries(request.volumes).reduce((acc, [key, value]) => ({
278
- ...acc,
279
- [key]: marshalVolumeInstanceTemplate(value, defaults)
280
- }), {}) : void 0
281
- });
282
-
283
- //#endregion
284
- export { marshalCreateInstanceGroupRequest, marshalCreateInstancePolicyRequest, marshalCreateInstanceTemplateRequest, marshalUpdateInstanceGroupRequest, marshalUpdateInstancePolicyRequest, marshalUpdateInstanceTemplateRequest, unmarshalInstanceGroup, unmarshalInstancePolicy, unmarshalInstanceTemplate, unmarshalListInstanceGroupEventsResponse, unmarshalListInstanceGroupsResponse, unmarshalListInstancePoliciesResponse, unmarshalListInstanceTemplatesResponse };
@@ -1,83 +0,0 @@
1
- //#region src/v1alpha1/metadata.gen.d.ts
2
- export declare const queriesMetadata: {
3
- readonly namespace: 'autoscaling';
4
- readonly version: 'v1alpha1';
5
- readonly folderName: 'autoscalingv1alpha1';
6
- readonly services: readonly [{
7
- readonly apiClass: 'API';
8
- readonly methods: readonly [{
9
- readonly methodName: 'getInstanceGroup';
10
- readonly protoName: 'GetInstanceGroup';
11
- readonly paramsType: 'GetInstanceGroupRequest';
12
- readonly returnType: 'InstanceGroup';
13
- readonly isList: false;
14
- readonly paginationType: 'none';
15
- readonly isPrivate: false;
16
- readonly description: '"';
17
- }, {
18
- readonly methodName: 'listInstanceGroups';
19
- readonly protoName: 'ListInstanceGroups';
20
- readonly paramsType: 'ListInstanceGroupsRequest';
21
- readonly returnType: 'ListInstanceGroupsResponse';
22
- readonly isList: true;
23
- readonly paginationType: 'offset';
24
- readonly pageParamKey: 'page';
25
- readonly listItemType: 'InstanceGroup';
26
- readonly isPrivate: false;
27
- readonly description: '"';
28
- }, {
29
- readonly methodName: 'getInstanceTemplate';
30
- readonly protoName: 'GetInstanceTemplate';
31
- readonly paramsType: 'GetInstanceTemplateRequest';
32
- readonly returnType: 'InstanceTemplate';
33
- readonly isList: false;
34
- readonly paginationType: 'none';
35
- readonly isPrivate: false;
36
- readonly description: '"';
37
- }, {
38
- readonly methodName: 'listInstanceTemplates';
39
- readonly protoName: 'ListInstanceTemplates';
40
- readonly paramsType: 'ListInstanceTemplatesRequest';
41
- readonly returnType: 'ListInstanceTemplatesResponse';
42
- readonly isList: true;
43
- readonly paginationType: 'offset';
44
- readonly pageParamKey: 'page';
45
- readonly listItemType: 'InstanceTemplate';
46
- readonly isPrivate: false;
47
- readonly description: '"';
48
- }, {
49
- readonly methodName: 'listInstancePolicies';
50
- readonly protoName: 'ListInstancePolicies';
51
- readonly paramsType: 'ListInstancePoliciesRequest';
52
- readonly returnType: 'ListInstancePoliciesResponse';
53
- readonly isList: true;
54
- readonly paginationType: 'offset';
55
- readonly pageParamKey: 'page';
56
- readonly listItemType: 'InstancePolicy';
57
- readonly isPrivate: false;
58
- readonly description: '"';
59
- }, {
60
- readonly methodName: 'getInstancePolicy';
61
- readonly protoName: 'GetInstancePolicy';
62
- readonly paramsType: 'GetInstancePolicyRequest';
63
- readonly returnType: 'InstancePolicy';
64
- readonly isList: false;
65
- readonly paginationType: 'none';
66
- readonly isPrivate: false;
67
- readonly description: '"';
68
- }, {
69
- readonly methodName: 'listInstanceGroupEvents';
70
- readonly protoName: 'ListInstanceGroupEvents';
71
- readonly paramsType: 'ListInstanceGroupEventsRequest';
72
- readonly returnType: 'ListInstanceGroupEventsResponse';
73
- readonly isList: true;
74
- readonly paginationType: 'offset';
75
- readonly pageParamKey: 'page';
76
- readonly listItemType: 'InstanceGroupEvent';
77
- readonly isPrivate: false;
78
- readonly description: '"';
79
- }];
80
- }];
81
- };
82
- export type QueriesMetadata = typeof queriesMetadata;
83
- //#endregion
@@ -1,92 +0,0 @@
1
- //#region src/v1alpha1/metadata.gen.ts
2
- const queriesMetadata = {
3
- namespace: "autoscaling",
4
- version: "v1alpha1",
5
- folderName: "autoscalingv1alpha1",
6
- services: [{
7
- apiClass: "API",
8
- methods: [
9
- {
10
- methodName: "getInstanceGroup",
11
- protoName: "GetInstanceGroup",
12
- paramsType: "GetInstanceGroupRequest",
13
- returnType: "InstanceGroup",
14
- isList: false,
15
- paginationType: "none",
16
- isPrivate: false,
17
- description: "\""
18
- },
19
- {
20
- methodName: "listInstanceGroups",
21
- protoName: "ListInstanceGroups",
22
- paramsType: "ListInstanceGroupsRequest",
23
- returnType: "ListInstanceGroupsResponse",
24
- isList: true,
25
- paginationType: "offset",
26
- pageParamKey: "page",
27
- listItemType: "InstanceGroup",
28
- isPrivate: false,
29
- description: "\""
30
- },
31
- {
32
- methodName: "getInstanceTemplate",
33
- protoName: "GetInstanceTemplate",
34
- paramsType: "GetInstanceTemplateRequest",
35
- returnType: "InstanceTemplate",
36
- isList: false,
37
- paginationType: "none",
38
- isPrivate: false,
39
- description: "\""
40
- },
41
- {
42
- methodName: "listInstanceTemplates",
43
- protoName: "ListInstanceTemplates",
44
- paramsType: "ListInstanceTemplatesRequest",
45
- returnType: "ListInstanceTemplatesResponse",
46
- isList: true,
47
- paginationType: "offset",
48
- pageParamKey: "page",
49
- listItemType: "InstanceTemplate",
50
- isPrivate: false,
51
- description: "\""
52
- },
53
- {
54
- methodName: "listInstancePolicies",
55
- protoName: "ListInstancePolicies",
56
- paramsType: "ListInstancePoliciesRequest",
57
- returnType: "ListInstancePoliciesResponse",
58
- isList: true,
59
- paginationType: "offset",
60
- pageParamKey: "page",
61
- listItemType: "InstancePolicy",
62
- isPrivate: false,
63
- description: "\""
64
- },
65
- {
66
- methodName: "getInstancePolicy",
67
- protoName: "GetInstancePolicy",
68
- paramsType: "GetInstancePolicyRequest",
69
- returnType: "InstancePolicy",
70
- isList: false,
71
- paginationType: "none",
72
- isPrivate: false,
73
- description: "\""
74
- },
75
- {
76
- methodName: "listInstanceGroupEvents",
77
- protoName: "ListInstanceGroupEvents",
78
- paramsType: "ListInstanceGroupEventsRequest",
79
- returnType: "ListInstanceGroupEventsResponse",
80
- isList: true,
81
- paginationType: "offset",
82
- pageParamKey: "page",
83
- listItemType: "InstanceGroupEvent",
84
- isPrivate: false,
85
- description: "\""
86
- }
87
- ]
88
- }]
89
- };
90
-
91
- //#endregion
92
- export { queriesMetadata };