@scaleway/sdk-autoscaling 1.2.0 → 2.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.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @scaleway/sdk-autoscaling
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-autoscaling.svg)](https://www.npmjs.com/package/@scaleway/sdk-autoscaling)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-autoscaling.svg)](https://www.npmjs.com/package/@scaleway/sdk-autoscaling)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-autoscaling.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Autoscaling API.
8
+
9
+ > **Note**
10
+ > This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @scaleway/sdk-autoscaling @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-autoscaling @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-autoscaling @scaleway/sdk-client
28
+ ```
29
+
30
+ ## Getting Started
31
+
32
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
33
+
34
+ ### Basic Usage
35
+
36
+ ```typescript
37
+ import { createClient } from '@scaleway/sdk-client'
38
+ import { Autoscaling } from '@scaleway/sdk-autoscaling'
39
+
40
+ const client = createClient({
41
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
42
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultRegion: 'fr-par',
45
+ defaultZone: 'fr-par-1',
46
+ })
47
+
48
+ const api = new Autoscaling.v1.API(client)
49
+
50
+ // Use the API
51
+ // Example: await api.listServers()
52
+ ```
53
+
54
+ ### Using Configuration Loader
55
+
56
+ For a simpler setup, you can load credentials from the configuration file or environment variables:
57
+
58
+ ```typescript
59
+ import { createClient } from '@scaleway/sdk-client'
60
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
61
+ import { Autoscaling } from '@scaleway/sdk-autoscaling'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Autoscaling.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Autoscaling API Documentation](https://www.scaleway.com/en/developers/api/autoscaling/)
72
+ - 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
73
+ - 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
74
+
75
+ ## Features
76
+
77
+ - ✅ Full TypeScript support with complete type definitions
78
+ - ✅ Promise-based API
79
+ - ✅ Automatic pagination helpers
80
+ - ✅ Built-in error handling
81
+ - ✅ Compatible with Node.js ≥ 20
82
+
83
+ ## Support
84
+
85
+ We love feedback! Feel free to reach us on:
86
+ - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
+ - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
+
89
+ ## Contributing
90
+
91
+ This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
92
+
93
+ ## License
94
+
95
+ This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
+
@@ -41,10 +41,7 @@ class API extends API$1 {
41
41
  urlParams: urlParams(
42
42
  ["order_by", request.orderBy],
43
43
  ["page", request.page],
44
- [
45
- "page_size",
46
- request.pageSize ?? this.client.settings.defaultPageSize
47
- ]
44
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
48
45
  )
49
46
  },
50
47
  unmarshalListInstanceGroupsResponse
@@ -55,11 +52,7 @@ class API extends API$1 {
55
52
  * @param request - The request {@link ListInstanceGroupsRequest}
56
53
  * @returns A Promise of ListInstanceGroupsResponse
57
54
  */
58
- listInstanceGroups = (request = {}) => enrichForPagination(
59
- "instanceGroups",
60
- this.pageOfListInstanceGroups,
61
- request
62
- );
55
+ listInstanceGroups = (request = {}) => enrichForPagination("instanceGroups", this.pageOfListInstanceGroups, request);
63
56
  /**
64
57
  * Update Instance group. Update the parameters of an existing Instance group, specified by its `instance_group_id`.
65
58
  *
@@ -82,10 +75,12 @@ class API extends API$1 {
82
75
  *
83
76
  * @param request - The request {@link DeleteInstanceGroupRequest}
84
77
  */
85
- deleteInstanceGroup = (request) => this.client.fetch({
86
- method: "DELETE",
87
- path: `/autoscaling/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-groups/${validatePathParam("instanceGroupId", request.instanceGroupId)}`
88
- });
78
+ deleteInstanceGroup = (request) => this.client.fetch(
79
+ {
80
+ method: "DELETE",
81
+ path: `/autoscaling/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-groups/${validatePathParam("instanceGroupId", request.instanceGroupId)}`
82
+ }
83
+ );
89
84
  /**
90
85
  * Create Instance template. Create a new Instance template. This specifies the details of the Instance (commercial type, zone, image, volumes etc.) that will be in the Instance group.
91
86
  *
@@ -138,10 +133,12 @@ class API extends API$1 {
138
133
  *
139
134
  * @param request - The request {@link DeleteInstanceTemplateRequest}
140
135
  */
141
- deleteInstanceTemplate = (request) => this.client.fetch({
142
- method: "DELETE",
143
- path: `/autoscaling/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-templates/${validatePathParam("templateId", request.templateId)}`
144
- });
136
+ deleteInstanceTemplate = (request) => this.client.fetch(
137
+ {
138
+ method: "DELETE",
139
+ path: `/autoscaling/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-templates/${validatePathParam("templateId", request.templateId)}`
140
+ }
141
+ );
145
142
  pageOfListInstanceTemplates = (request = {}) => this.client.fetch(
146
143
  {
147
144
  method: "GET",
@@ -149,10 +146,7 @@ class API extends API$1 {
149
146
  urlParams: urlParams(
150
147
  ["order_by", request.orderBy],
151
148
  ["page", request.page],
152
- [
153
- "page_size",
154
- request.pageSize ?? this.client.settings.defaultPageSize
155
- ]
149
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
156
150
  )
157
151
  },
158
152
  unmarshalListInstanceTemplatesResponse
@@ -163,11 +157,7 @@ class API extends API$1 {
163
157
  * @param request - The request {@link ListInstanceTemplatesRequest}
164
158
  * @returns A Promise of ListInstanceTemplatesResponse
165
159
  */
166
- listInstanceTemplates = (request = {}) => enrichForPagination(
167
- "instanceTemplates",
168
- this.pageOfListInstanceTemplates,
169
- request
170
- );
160
+ listInstanceTemplates = (request = {}) => enrichForPagination("instanceTemplates", this.pageOfListInstanceTemplates, request);
171
161
  /**
172
162
  * Create scaling policy. Create a new scaling policy. You must specify a `policy_id`, capacity and Load Balancer object.
173
163
  *
@@ -210,10 +200,7 @@ class API extends API$1 {
210
200
  ["instance_group_id", request.instanceGroupId],
211
201
  ["order_by", request.orderBy],
212
202
  ["page", request.page],
213
- [
214
- "page_size",
215
- request.pageSize ?? this.client.settings.defaultPageSize
216
- ]
203
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
217
204
  )
218
205
  },
219
206
  unmarshalListInstancePoliciesResponse
@@ -243,10 +230,12 @@ class API extends API$1 {
243
230
  *
244
231
  * @param request - The request {@link DeleteInstancePolicyRequest}
245
232
  */
246
- deleteInstancePolicy = (request) => this.client.fetch({
247
- method: "DELETE",
248
- path: `/autoscaling/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-policies/${validatePathParam("policyId", request.policyId)}`
249
- });
233
+ deleteInstancePolicy = (request) => this.client.fetch(
234
+ {
235
+ method: "DELETE",
236
+ path: `/autoscaling/v1alpha1/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-policies/${validatePathParam("policyId", request.policyId)}`
237
+ }
238
+ );
250
239
  pageOfListInstanceGroupEvents = (request) => this.client.fetch(
251
240
  {
252
241
  method: "GET",
@@ -254,10 +243,7 @@ class API extends API$1 {
254
243
  urlParams: urlParams(
255
244
  ["order_by", request.orderBy],
256
245
  ["page", request.page],
257
- [
258
- "page_size",
259
- request.pageSize ?? this.client.settings.defaultPageSize
260
- ]
246
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
261
247
  )
262
248
  },
263
249
  unmarshalListInstanceGroupEventsResponse
@@ -268,11 +254,7 @@ class API extends API$1 {
268
254
  * @param request - The request {@link ListInstanceGroupEventsRequest}
269
255
  * @returns A Promise of ListInstanceGroupEventsResponse
270
256
  */
271
- listInstanceGroupEvents = (request) => enrichForPagination(
272
- "instanceEvents",
273
- this.pageOfListInstanceGroupEvents,
274
- request
275
- );
257
+ listInstanceGroupEvents = (request) => enrichForPagination("instanceEvents", this.pageOfListInstanceGroupEvents, request);
276
258
  }
277
259
  export {
278
260
  API
@@ -1,4 +1,4 @@
1
- export { API } from './api.gen.js';
1
+ export { API, } from './api.gen.js';
2
2
  export * from './marshalling.gen.js';
3
3
  export type { Capacity, CreateInstanceGroupRequest, CreateInstancePolicyRequest, CreateInstanceTemplateRequest, DeleteInstanceGroupRequest, DeleteInstancePolicyRequest, DeleteInstanceTemplateRequest, GetInstanceGroupRequest, GetInstancePolicyRequest, GetInstanceTemplateRequest, InstanceGroup, InstanceGroupEvent, InstanceGroupEventLevel, InstanceGroupEventSource, InstancePolicy, InstancePolicyAction, InstancePolicyType, InstanceTemplate, InstanceTemplateStatus, ListInstanceGroupEventsRequest, ListInstanceGroupEventsRequestOrderBy, ListInstanceGroupEventsResponse, ListInstanceGroupsRequest, ListInstanceGroupsRequestOrderBy, ListInstanceGroupsResponse, ListInstancePoliciesRequest, ListInstancePoliciesRequestOrderBy, ListInstancePoliciesResponse, ListInstanceTemplatesRequest, ListInstanceTemplatesRequestOrderBy, ListInstanceTemplatesResponse, Loadbalancer, Metric, MetricAggregate, MetricManagedMetric, MetricOperator, UpdateInstanceGroupRequest, UpdateInstanceGroupRequestCapacity, UpdateInstanceGroupRequestLoadbalancer, UpdateInstancePolicyRequest, UpdateInstancePolicyRequestMetric, UpdateInstancePolicyRequestMetricAggregate, UpdateInstancePolicyRequestMetricManagedMetric, UpdateInstancePolicyRequestMetricOperator, UpdateInstanceTemplateRequest, VolumeInstanceTemplate, VolumeInstanceTemplateFromEmpty, VolumeInstanceTemplateFromSnapshot, VolumeInstanceTemplateVolumeType, } from './types.gen.js';
4
4
  export * as ValidationRules from './validation-rules.gen.js';
@@ -136,10 +136,7 @@ const unmarshalInstanceTemplate = (data) => {
136
136
  status: data.status,
137
137
  tags: data.tags,
138
138
  updatedAt: unmarshalDate(data.updated_at),
139
- volumes: unmarshalMapOfObject(
140
- data.volumes,
141
- unmarshalVolumeInstanceTemplate
142
- ),
139
+ volumes: unmarshalMapOfObject(data.volumes, unmarshalVolumeInstanceTemplate),
143
140
  zone: data.zone
144
141
  };
145
142
  };
@@ -165,10 +162,7 @@ const unmarshalListInstanceGroupEventsResponse = (data) => {
165
162
  );
166
163
  }
167
164
  return {
168
- instanceEvents: unmarshalArrayOfObject(
169
- data.instance_events,
170
- unmarshalInstanceGroupEvent
171
- ),
165
+ instanceEvents: unmarshalArrayOfObject(data.instance_events, unmarshalInstanceGroupEvent),
172
166
  totalCount: data.total_count
173
167
  };
174
168
  };
@@ -179,10 +173,7 @@ const unmarshalListInstanceGroupsResponse = (data) => {
179
173
  );
180
174
  }
181
175
  return {
182
- instanceGroups: unmarshalArrayOfObject(
183
- data.instance_groups,
184
- unmarshalInstanceGroup
185
- ),
176
+ instanceGroups: unmarshalArrayOfObject(data.instance_groups, unmarshalInstanceGroup),
186
177
  totalCount: data.total_count
187
178
  };
188
179
  };
@@ -204,10 +195,7 @@ const unmarshalListInstanceTemplatesResponse = (data) => {
204
195
  );
205
196
  }
206
197
  return {
207
- instanceTemplates: unmarshalArrayOfObject(
208
- data.instance_templates,
209
- unmarshalInstanceTemplate
210
- ),
198
+ instanceTemplates: unmarshalArrayOfObject(data.instance_templates, unmarshalInstanceTemplate),
211
199
  totalCount: data.total_count
212
200
  };
213
201
  };
@@ -236,8 +224,14 @@ const marshalMetric = (request, defaults) => ({
236
224
  sampling_range_min: request.samplingRangeMin,
237
225
  threshold: request.threshold,
238
226
  ...resolveOneOf([
239
- { param: "managed_metric", value: request.managedMetric },
240
- { param: "cockpit_metric_name", value: request.cockpitMetricName }
227
+ {
228
+ param: "managed_metric",
229
+ value: request.managedMetric
230
+ },
231
+ {
232
+ param: "cockpit_metric_name",
233
+ value: request.cockpitMetricName
234
+ }
241
235
  ])
242
236
  });
243
237
  const marshalCreateInstancePolicyRequest = (request, defaults) => ({
@@ -273,12 +267,15 @@ const marshalVolumeInstanceTemplate = (request, defaults) => ({
273
267
  },
274
268
  {
275
269
  param: "from_snapshot",
276
- value: request.fromSnapshot !== void 0 ? marshalVolumeInstanceTemplateFromSnapshot(
277
- request.fromSnapshot
278
- ) : void 0
270
+ value: request.fromSnapshot !== void 0 ? marshalVolumeInstanceTemplateFromSnapshot(request.fromSnapshot) : void 0
279
271
  }
280
272
  ]),
281
- ...resolveOneOf([{ param: "perf_iops", value: request.perfIops }])
273
+ ...resolveOneOf([
274
+ {
275
+ param: "perf_iops",
276
+ value: request.perfIops
277
+ }
278
+ ])
282
279
  });
283
280
  const marshalCreateInstanceTemplateRequest = (request, defaults) => ({
284
281
  cloud_init: request.cloudInit,
@@ -292,13 +289,7 @@ const marshalCreateInstanceTemplateRequest = (request, defaults) => ({
292
289
  public_ips_v6_count: request.publicIpsV6Count,
293
290
  security_group_id: request.securityGroupId,
294
291
  tags: request.tags,
295
- volumes: Object.entries(request.volumes).reduce(
296
- (acc, [key, value]) => ({
297
- ...acc,
298
- [key]: marshalVolumeInstanceTemplate(value)
299
- }),
300
- {}
301
- )
292
+ volumes: Object.entries(request.volumes).reduce((acc, [key, value]) => ({ ...acc, [key]: marshalVolumeInstanceTemplate(value) }), {})
302
293
  });
303
294
  const marshalUpdateInstanceGroupRequestCapacity = (request, defaults) => ({
304
295
  cooldown_delay: request.cooldownDelay,
@@ -310,9 +301,7 @@ const marshalUpdateInstanceGroupRequestLoadbalancer = (request, defaults) => ({
310
301
  });
311
302
  const marshalUpdateInstanceGroupRequest = (request, defaults) => ({
312
303
  capacity: request.capacity !== void 0 ? marshalUpdateInstanceGroupRequestCapacity(request.capacity) : void 0,
313
- loadbalancer: request.loadbalancer !== void 0 ? marshalUpdateInstanceGroupRequestLoadbalancer(
314
- request.loadbalancer
315
- ) : void 0,
304
+ loadbalancer: request.loadbalancer !== void 0 ? marshalUpdateInstanceGroupRequestLoadbalancer(request.loadbalancer) : void 0,
316
305
  name: request.name,
317
306
  tags: request.tags
318
307
  });
@@ -323,8 +312,14 @@ const marshalUpdateInstancePolicyRequestMetric = (request, defaults) => ({
323
312
  sampling_range_min: request.samplingRangeMin,
324
313
  threshold: request.threshold,
325
314
  ...resolveOneOf([
326
- { param: "managed_metric", value: request.managedMetric },
327
- { param: "cockpit_metric_name", value: request.cockpitMetricName }
315
+ {
316
+ param: "managed_metric",
317
+ value: request.managedMetric
318
+ },
319
+ {
320
+ param: "cockpit_metric_name",
321
+ value: request.cockpitMetricName
322
+ }
328
323
  ])
329
324
  });
330
325
  const marshalUpdateInstancePolicyRequest = (request, defaults) => ({
@@ -351,13 +346,7 @@ const marshalUpdateInstanceTemplateRequest = (request, defaults) => ({
351
346
  public_ips_v6_count: request.publicIpsV6Count,
352
347
  security_group_id: request.securityGroupId,
353
348
  tags: request.tags,
354
- volumes: request.volumes !== void 0 ? Object.entries(request.volumes).reduce(
355
- (acc, [key, value]) => ({
356
- ...acc,
357
- [key]: marshalVolumeInstanceTemplate(value)
358
- }),
359
- {}
360
- ) : void 0
349
+ volumes: request.volumes !== void 0 ? Object.entries(request.volumes).reduce((acc, [key, value]) => ({ ...acc, [key]: marshalVolumeInstanceTemplate(value) }), {}) : void 0
361
350
  });
362
351
  export {
363
352
  marshalCreateInstanceGroupRequest,
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-autoscaling",
3
- "version": "1.2.0",
3
+ "version": "2.1.1",
4
4
  "description": "Scaleway SDK autoscaling",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
+ "README.md",
7
8
  "dist"
8
9
  ],
9
10
  "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/index.gen.d.ts",
13
- "import": "./dist/index.gen.js",
14
- "require": "./dist/index.gen.cjs",
15
14
  "default": "./dist/index.gen.js"
16
15
  },
17
16
  "./*": {
18
17
  "types": "./dist/*/index.gen.d.ts",
19
- "import": "./dist/*/index.gen.js",
20
- "require": "./dist/*/index.gen.cjs",
21
18
  "default": "./dist/*/index.gen.js"
22
19
  }
23
20
  },
@@ -26,17 +23,17 @@
26
23
  "directory": "packages_generated/autoscaling"
27
24
  },
28
25
  "engines": {
29
- "node": ">=20.19.4"
26
+ "node": ">=20.19.6"
30
27
  },
31
28
  "dependencies": {
32
29
  "@scaleway/random-name": "5.1.2",
33
- "@scaleway/sdk-std": "1.1.0"
30
+ "@scaleway/sdk-std": "2.1.0"
34
31
  },
35
32
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.2"
33
+ "@scaleway/sdk-client": "^2.1.0"
37
34
  },
38
35
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.2"
36
+ "@scaleway/sdk-client": "^2.1.0"
40
37
  },
41
38
  "scripts": {
42
39
  "package:check": "pnpm publint",
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index_gen = require("./v1alpha1/index.gen.cjs");
4
- exports.Autoscalingv1alpha1 = index_gen;
@@ -1,279 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const marshalling_gen = require("./marshalling.gen.cjs");
5
- const jsonContentHeaders = {
6
- "Content-Type": "application/json; charset=utf-8"
7
- };
8
- class API extends sdkClient.API {
9
- /**
10
- * Get Instance group. Retrieve information about an existing Instance group, specified by its `instance_group_id`. Its full details, including errors, are returned in the response object.
11
- *
12
- * @param request - The request {@link GetInstanceGroupRequest}
13
- * @returns A Promise of InstanceGroup
14
- */
15
- getInstanceGroup = (request) => this.client.fetch(
16
- {
17
- method: "GET",
18
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-groups/${sdkClient.validatePathParam("instanceGroupId", request.instanceGroupId)}`
19
- },
20
- marshalling_gen.unmarshalInstanceGroup
21
- );
22
- /**
23
- * Create Instance group. Create a new Instance group. You must specify a `template_id`, capacity and Load Balancer object.
24
- *
25
- * @param request - The request {@link CreateInstanceGroupRequest}
26
- * @returns A Promise of InstanceGroup
27
- */
28
- createInstanceGroup = (request) => this.client.fetch(
29
- {
30
- body: JSON.stringify(
31
- marshalling_gen.marshalCreateInstanceGroupRequest(request, this.client.settings)
32
- ),
33
- headers: jsonContentHeaders,
34
- method: "POST",
35
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-groups`
36
- },
37
- marshalling_gen.unmarshalInstanceGroup
38
- );
39
- pageOfListInstanceGroups = (request = {}) => this.client.fetch(
40
- {
41
- method: "GET",
42
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-groups`,
43
- urlParams: sdkClient.urlParams(
44
- ["order_by", request.orderBy],
45
- ["page", request.page],
46
- [
47
- "page_size",
48
- request.pageSize ?? this.client.settings.defaultPageSize
49
- ]
50
- )
51
- },
52
- marshalling_gen.unmarshalListInstanceGroupsResponse
53
- );
54
- /**
55
- * List Instance groups. List all Instance groups, for a Scaleway Organization or Scaleway Project. By default, the Instance groups returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
56
- *
57
- * @param request - The request {@link ListInstanceGroupsRequest}
58
- * @returns A Promise of ListInstanceGroupsResponse
59
- */
60
- listInstanceGroups = (request = {}) => sdkClient.enrichForPagination(
61
- "instanceGroups",
62
- this.pageOfListInstanceGroups,
63
- request
64
- );
65
- /**
66
- * Update Instance group. Update the parameters of an existing Instance group, specified by its `instance_group_id`.
67
- *
68
- * @param request - The request {@link UpdateInstanceGroupRequest}
69
- * @returns A Promise of InstanceGroup
70
- */
71
- updateInstanceGroup = (request) => this.client.fetch(
72
- {
73
- body: JSON.stringify(
74
- marshalling_gen.marshalUpdateInstanceGroupRequest(request, this.client.settings)
75
- ),
76
- headers: jsonContentHeaders,
77
- method: "PATCH",
78
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-groups/${sdkClient.validatePathParam("instanceGroupId", request.instanceGroupId)}`
79
- },
80
- marshalling_gen.unmarshalInstanceGroup
81
- );
82
- /**
83
- * Delete Instance group. Delete an existing Instance group, specified by its `instance_group_id`. Deleting an Instance group is permanent, and cannot be undone.
84
- *
85
- * @param request - The request {@link DeleteInstanceGroupRequest}
86
- */
87
- deleteInstanceGroup = (request) => this.client.fetch({
88
- method: "DELETE",
89
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-groups/${sdkClient.validatePathParam("instanceGroupId", request.instanceGroupId)}`
90
- });
91
- /**
92
- * Create Instance template. Create a new Instance template. This specifies the details of the Instance (commercial type, zone, image, volumes etc.) that will be in the Instance group.
93
- *
94
- * @param request - The request {@link CreateInstanceTemplateRequest}
95
- * @returns A Promise of InstanceTemplate
96
- */
97
- createInstanceTemplate = (request) => this.client.fetch(
98
- {
99
- body: JSON.stringify(
100
- marshalling_gen.marshalCreateInstanceTemplateRequest(request, this.client.settings)
101
- ),
102
- headers: jsonContentHeaders,
103
- method: "POST",
104
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-templates`
105
- },
106
- marshalling_gen.unmarshalInstanceTemplate
107
- );
108
- /**
109
- * Update Instance template. Update an Instance template, such as its commercial offer type, image or volume template.
110
- *
111
- * @param request - The request {@link UpdateInstanceTemplateRequest}
112
- * @returns A Promise of InstanceTemplate
113
- */
114
- updateInstanceTemplate = (request) => this.client.fetch(
115
- {
116
- body: JSON.stringify(
117
- marshalling_gen.marshalUpdateInstanceTemplateRequest(request, this.client.settings)
118
- ),
119
- headers: jsonContentHeaders,
120
- method: "PATCH",
121
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-templates/${sdkClient.validatePathParam("templateId", request.templateId)}`
122
- },
123
- marshalling_gen.unmarshalInstanceTemplate
124
- );
125
- /**
126
- * Get Instance template. Get an existing Instance template from its `template_id`.
127
- *
128
- * @param request - The request {@link GetInstanceTemplateRequest}
129
- * @returns A Promise of InstanceTemplate
130
- */
131
- getInstanceTemplate = (request) => this.client.fetch(
132
- {
133
- method: "GET",
134
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-templates/${sdkClient.validatePathParam("templateId", request.templateId)}`
135
- },
136
- marshalling_gen.unmarshalInstanceTemplate
137
- );
138
- /**
139
- * Delete Instance template. Delete an existing Instance template. This action is permanent and cannot be undone.
140
- *
141
- * @param request - The request {@link DeleteInstanceTemplateRequest}
142
- */
143
- deleteInstanceTemplate = (request) => this.client.fetch({
144
- method: "DELETE",
145
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-templates/${sdkClient.validatePathParam("templateId", request.templateId)}`
146
- });
147
- pageOfListInstanceTemplates = (request = {}) => this.client.fetch(
148
- {
149
- method: "GET",
150
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-templates`,
151
- urlParams: sdkClient.urlParams(
152
- ["order_by", request.orderBy],
153
- ["page", request.page],
154
- [
155
- "page_size",
156
- request.pageSize ?? this.client.settings.defaultPageSize
157
- ]
158
- )
159
- },
160
- marshalling_gen.unmarshalListInstanceTemplatesResponse
161
- );
162
- /**
163
- * List Instance templates. List all Instance templates, for a Scaleway Organization or Scaleway Project. By default, the Instance templates returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
164
- *
165
- * @param request - The request {@link ListInstanceTemplatesRequest}
166
- * @returns A Promise of ListInstanceTemplatesResponse
167
- */
168
- listInstanceTemplates = (request = {}) => sdkClient.enrichForPagination(
169
- "instanceTemplates",
170
- this.pageOfListInstanceTemplates,
171
- request
172
- );
173
- /**
174
- * Create scaling policy. Create a new scaling policy. You must specify a `policy_id`, capacity and Load Balancer object.
175
- *
176
- * @param request - The request {@link CreateInstancePolicyRequest}
177
- * @returns A Promise of InstancePolicy
178
- */
179
- createInstancePolicy = (request) => this.client.fetch(
180
- {
181
- body: JSON.stringify(
182
- marshalling_gen.marshalCreateInstancePolicyRequest(request, this.client.settings)
183
- ),
184
- headers: jsonContentHeaders,
185
- method: "POST",
186
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-policies`
187
- },
188
- marshalling_gen.unmarshalInstancePolicy
189
- );
190
- /**
191
- * Update scaling policy. Update the parameters of an existing scaling policy, specified by its `policy_id`.
192
- *
193
- * @param request - The request {@link UpdateInstancePolicyRequest}
194
- * @returns A Promise of InstancePolicy
195
- */
196
- updateInstancePolicy = (request) => this.client.fetch(
197
- {
198
- body: JSON.stringify(
199
- marshalling_gen.marshalUpdateInstancePolicyRequest(request, this.client.settings)
200
- ),
201
- headers: jsonContentHeaders,
202
- method: "PATCH",
203
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-policies/${sdkClient.validatePathParam("policyId", request.policyId)}`
204
- },
205
- marshalling_gen.unmarshalInstancePolicy
206
- );
207
- pageOfListInstancePolicies = (request) => this.client.fetch(
208
- {
209
- method: "GET",
210
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-policies`,
211
- urlParams: sdkClient.urlParams(
212
- ["instance_group_id", request.instanceGroupId],
213
- ["order_by", request.orderBy],
214
- ["page", request.page],
215
- [
216
- "page_size",
217
- request.pageSize ?? this.client.settings.defaultPageSize
218
- ]
219
- )
220
- },
221
- marshalling_gen.unmarshalListInstancePoliciesResponse
222
- );
223
- /**
224
- * List scaling policies. List all scaling policies, for a Scaleway Organization or Scaleway Project. By default, the policies returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
225
- *
226
- * @param request - The request {@link ListInstancePoliciesRequest}
227
- * @returns A Promise of ListInstancePoliciesResponse
228
- */
229
- listInstancePolicies = (request) => sdkClient.enrichForPagination("policies", this.pageOfListInstancePolicies, request);
230
- /**
231
- * Get scaling policy. Retrieve information about an existing scaling policy, specified by its `policy_id`. Its full details are returned in the response object.
232
- *
233
- * @param request - The request {@link GetInstancePolicyRequest}
234
- * @returns A Promise of InstancePolicy
235
- */
236
- getInstancePolicy = (request) => this.client.fetch(
237
- {
238
- method: "GET",
239
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-policies/${sdkClient.validatePathParam("policyId", request.policyId)}`
240
- },
241
- marshalling_gen.unmarshalInstancePolicy
242
- );
243
- /**
244
- * Delete scaling policy. Delete an existing scaling policy, specified by its `policy_id`. Deleting a scaling policy is permanent, and cannot be undone.
245
- *
246
- * @param request - The request {@link DeleteInstancePolicyRequest}
247
- */
248
- deleteInstancePolicy = (request) => this.client.fetch({
249
- method: "DELETE",
250
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-policies/${sdkClient.validatePathParam("policyId", request.policyId)}`
251
- });
252
- pageOfListInstanceGroupEvents = (request) => this.client.fetch(
253
- {
254
- method: "GET",
255
- path: `/autoscaling/v1alpha1/zones/${sdkClient.validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/instance-groups/${sdkClient.validatePathParam("instanceGroupId", request.instanceGroupId)}/events`,
256
- urlParams: sdkClient.urlParams(
257
- ["order_by", request.orderBy],
258
- ["page", request.page],
259
- [
260
- "page_size",
261
- request.pageSize ?? this.client.settings.defaultPageSize
262
- ]
263
- )
264
- },
265
- marshalling_gen.unmarshalListInstanceGroupEventsResponse
266
- );
267
- /**
268
- * List events. List all events for a given Instance group. By default, the events are ordered by creation date in descending order, though this can be modified via the `order_by` field.
269
- *
270
- * @param request - The request {@link ListInstanceGroupEventsRequest}
271
- * @returns A Promise of ListInstanceGroupEventsResponse
272
- */
273
- listInstanceGroupEvents = (request) => sdkClient.enrichForPagination(
274
- "instanceEvents",
275
- this.pageOfListInstanceGroupEvents,
276
- request
277
- );
278
- }
279
- exports.API = API;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const api_gen = require("./api.gen.cjs");
4
- const marshalling_gen = require("./marshalling.gen.cjs");
5
- const validationRules_gen = require("./validation-rules.gen.cjs");
6
- exports.API = api_gen.API;
7
- exports.marshalCreateInstanceGroupRequest = marshalling_gen.marshalCreateInstanceGroupRequest;
8
- exports.marshalCreateInstancePolicyRequest = marshalling_gen.marshalCreateInstancePolicyRequest;
9
- exports.marshalCreateInstanceTemplateRequest = marshalling_gen.marshalCreateInstanceTemplateRequest;
10
- exports.marshalUpdateInstanceGroupRequest = marshalling_gen.marshalUpdateInstanceGroupRequest;
11
- exports.marshalUpdateInstancePolicyRequest = marshalling_gen.marshalUpdateInstancePolicyRequest;
12
- exports.marshalUpdateInstanceTemplateRequest = marshalling_gen.marshalUpdateInstanceTemplateRequest;
13
- exports.unmarshalInstanceGroup = marshalling_gen.unmarshalInstanceGroup;
14
- exports.unmarshalInstancePolicy = marshalling_gen.unmarshalInstancePolicy;
15
- exports.unmarshalInstanceTemplate = marshalling_gen.unmarshalInstanceTemplate;
16
- exports.unmarshalListInstanceGroupEventsResponse = marshalling_gen.unmarshalListInstanceGroupEventsResponse;
17
- exports.unmarshalListInstanceGroupsResponse = marshalling_gen.unmarshalListInstanceGroupsResponse;
18
- exports.unmarshalListInstancePoliciesResponse = marshalling_gen.unmarshalListInstancePoliciesResponse;
19
- exports.unmarshalListInstanceTemplatesResponse = marshalling_gen.unmarshalListInstanceTemplatesResponse;
20
- exports.ValidationRules = validationRules_gen;
@@ -1,376 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const unmarshalCapacity = (data) => {
5
- if (!sdkClient.isJSONObject(data)) {
6
- throw new TypeError(
7
- `Unmarshalling the type 'Capacity' failed as data isn't a dictionary.`
8
- );
9
- }
10
- return {
11
- cooldownDelay: data.cooldown_delay,
12
- maxReplicas: data.max_replicas,
13
- minReplicas: data.min_replicas
14
- };
15
- };
16
- const unmarshalLoadbalancer = (data) => {
17
- if (!sdkClient.isJSONObject(data)) {
18
- throw new TypeError(
19
- `Unmarshalling the type 'Loadbalancer' failed as data isn't a dictionary.`
20
- );
21
- }
22
- return {
23
- backendIds: data.backend_ids,
24
- id: data.id,
25
- privateNetworkId: data.private_network_id
26
- };
27
- };
28
- const unmarshalInstanceGroup = (data) => {
29
- if (!sdkClient.isJSONObject(data)) {
30
- throw new TypeError(
31
- `Unmarshalling the type 'InstanceGroup' failed as data isn't a dictionary.`
32
- );
33
- }
34
- return {
35
- capacity: unmarshalCapacity(data.capacity),
36
- createdAt: sdkClient.unmarshalDate(data.created_at),
37
- errorMessages: data.error_messages,
38
- id: data.id,
39
- instanceTemplateId: data.instance_template_id,
40
- loadbalancer: unmarshalLoadbalancer(data.loadbalancer),
41
- name: data.name,
42
- projectId: data.project_id,
43
- tags: data.tags,
44
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
45
- zone: data.zone
46
- };
47
- };
48
- const unmarshalMetric = (data) => {
49
- if (!sdkClient.isJSONObject(data)) {
50
- throw new TypeError(
51
- `Unmarshalling the type 'Metric' failed as data isn't a dictionary.`
52
- );
53
- }
54
- return {
55
- aggregate: data.aggregate,
56
- cockpitMetricName: data.cockpit_metric_name,
57
- managedMetric: data.managed_metric ? data.managed_metric : void 0,
58
- name: data.name,
59
- operator: data.operator,
60
- samplingRangeMin: data.sampling_range_min,
61
- threshold: data.threshold
62
- };
63
- };
64
- const unmarshalInstancePolicy = (data) => {
65
- if (!sdkClient.isJSONObject(data)) {
66
- throw new TypeError(
67
- `Unmarshalling the type 'InstancePolicy' failed as data isn't a dictionary.`
68
- );
69
- }
70
- return {
71
- action: data.action,
72
- id: data.id,
73
- instanceGroupId: data.instance_group_id,
74
- metric: data.metric ? unmarshalMetric(data.metric) : void 0,
75
- name: data.name,
76
- priority: data.priority,
77
- type: data.type,
78
- value: data.value,
79
- zone: data.zone
80
- };
81
- };
82
- const unmarshalVolumeInstanceTemplateFromEmpty = (data) => {
83
- if (!sdkClient.isJSONObject(data)) {
84
- throw new TypeError(
85
- `Unmarshalling the type 'VolumeInstanceTemplateFromEmpty' failed as data isn't a dictionary.`
86
- );
87
- }
88
- return {
89
- size: data.size
90
- };
91
- };
92
- const unmarshalVolumeInstanceTemplateFromSnapshot = (data) => {
93
- if (!sdkClient.isJSONObject(data)) {
94
- throw new TypeError(
95
- `Unmarshalling the type 'VolumeInstanceTemplateFromSnapshot' failed as data isn't a dictionary.`
96
- );
97
- }
98
- return {
99
- size: data.size,
100
- snapshotId: data.snapshot_id
101
- };
102
- };
103
- const unmarshalVolumeInstanceTemplate = (data) => {
104
- if (!sdkClient.isJSONObject(data)) {
105
- throw new TypeError(
106
- `Unmarshalling the type 'VolumeInstanceTemplate' failed as data isn't a dictionary.`
107
- );
108
- }
109
- return {
110
- boot: data.boot,
111
- fromEmpty: data.from_empty ? unmarshalVolumeInstanceTemplateFromEmpty(data.from_empty) : void 0,
112
- fromSnapshot: data.from_snapshot ? unmarshalVolumeInstanceTemplateFromSnapshot(data.from_snapshot) : void 0,
113
- name: data.name,
114
- perfIops: data.perf_iops,
115
- tags: data.tags,
116
- volumeType: data.volume_type
117
- };
118
- };
119
- const unmarshalInstanceTemplate = (data) => {
120
- if (!sdkClient.isJSONObject(data)) {
121
- throw new TypeError(
122
- `Unmarshalling the type 'InstanceTemplate' failed as data isn't a dictionary.`
123
- );
124
- }
125
- return {
126
- cloudInit: data.cloud_init,
127
- commercialType: data.commercial_type,
128
- createdAt: sdkClient.unmarshalDate(data.created_at),
129
- id: data.id,
130
- imageId: data.image_id,
131
- name: data.name,
132
- placementGroupId: data.placement_group_id,
133
- privateNetworkIds: data.private_network_ids,
134
- projectId: data.project_id,
135
- publicIpsV4Count: data.public_ips_v4_count,
136
- publicIpsV6Count: data.public_ips_v6_count,
137
- securityGroupId: data.security_group_id,
138
- status: data.status,
139
- tags: data.tags,
140
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
141
- volumes: sdkClient.unmarshalMapOfObject(
142
- data.volumes,
143
- unmarshalVolumeInstanceTemplate
144
- ),
145
- zone: data.zone
146
- };
147
- };
148
- const unmarshalInstanceGroupEvent = (data) => {
149
- if (!sdkClient.isJSONObject(data)) {
150
- throw new TypeError(
151
- `Unmarshalling the type 'InstanceGroupEvent' failed as data isn't a dictionary.`
152
- );
153
- }
154
- return {
155
- createdAt: sdkClient.unmarshalDate(data.created_at),
156
- details: data.details,
157
- id: data.id,
158
- level: data.level,
159
- name: data.name,
160
- source: data.source
161
- };
162
- };
163
- const unmarshalListInstanceGroupEventsResponse = (data) => {
164
- if (!sdkClient.isJSONObject(data)) {
165
- throw new TypeError(
166
- `Unmarshalling the type 'ListInstanceGroupEventsResponse' failed as data isn't a dictionary.`
167
- );
168
- }
169
- return {
170
- instanceEvents: sdkClient.unmarshalArrayOfObject(
171
- data.instance_events,
172
- unmarshalInstanceGroupEvent
173
- ),
174
- totalCount: data.total_count
175
- };
176
- };
177
- const unmarshalListInstanceGroupsResponse = (data) => {
178
- if (!sdkClient.isJSONObject(data)) {
179
- throw new TypeError(
180
- `Unmarshalling the type 'ListInstanceGroupsResponse' failed as data isn't a dictionary.`
181
- );
182
- }
183
- return {
184
- instanceGroups: sdkClient.unmarshalArrayOfObject(
185
- data.instance_groups,
186
- unmarshalInstanceGroup
187
- ),
188
- totalCount: data.total_count
189
- };
190
- };
191
- const unmarshalListInstancePoliciesResponse = (data) => {
192
- if (!sdkClient.isJSONObject(data)) {
193
- throw new TypeError(
194
- `Unmarshalling the type 'ListInstancePoliciesResponse' failed as data isn't a dictionary.`
195
- );
196
- }
197
- return {
198
- policies: sdkClient.unmarshalArrayOfObject(data.policies, unmarshalInstancePolicy),
199
- totalCount: data.total_count
200
- };
201
- };
202
- const unmarshalListInstanceTemplatesResponse = (data) => {
203
- if (!sdkClient.isJSONObject(data)) {
204
- throw new TypeError(
205
- `Unmarshalling the type 'ListInstanceTemplatesResponse' failed as data isn't a dictionary.`
206
- );
207
- }
208
- return {
209
- instanceTemplates: sdkClient.unmarshalArrayOfObject(
210
- data.instance_templates,
211
- unmarshalInstanceTemplate
212
- ),
213
- totalCount: data.total_count
214
- };
215
- };
216
- const marshalCapacity = (request, defaults) => ({
217
- cooldown_delay: request.cooldownDelay,
218
- max_replicas: request.maxReplicas,
219
- min_replicas: request.minReplicas
220
- });
221
- const marshalLoadbalancer = (request, defaults) => ({
222
- backend_ids: request.backendIds,
223
- id: request.id,
224
- private_network_id: request.privateNetworkId
225
- });
226
- const marshalCreateInstanceGroupRequest = (request, defaults) => ({
227
- capacity: marshalCapacity(request.capacity),
228
- loadbalancer: marshalLoadbalancer(request.loadbalancer),
229
- name: request.name,
230
- project_id: request.projectId ?? defaults.defaultProjectId,
231
- tags: request.tags,
232
- template_id: request.templateId
233
- });
234
- const marshalMetric = (request, defaults) => ({
235
- aggregate: request.aggregate,
236
- name: request.name,
237
- operator: request.operator,
238
- sampling_range_min: request.samplingRangeMin,
239
- threshold: request.threshold,
240
- ...sdkClient.resolveOneOf([
241
- { param: "managed_metric", value: request.managedMetric },
242
- { param: "cockpit_metric_name", value: request.cockpitMetricName }
243
- ])
244
- });
245
- const marshalCreateInstancePolicyRequest = (request, defaults) => ({
246
- action: request.action,
247
- instance_group_id: request.instanceGroupId,
248
- name: request.name,
249
- priority: request.priority,
250
- type: request.type,
251
- value: request.value,
252
- ...sdkClient.resolveOneOf([
253
- {
254
- param: "metric",
255
- value: request.metric !== void 0 ? marshalMetric(request.metric) : void 0
256
- }
257
- ])
258
- });
259
- const marshalVolumeInstanceTemplateFromEmpty = (request, defaults) => ({
260
- size: request.size
261
- });
262
- const marshalVolumeInstanceTemplateFromSnapshot = (request, defaults) => ({
263
- size: request.size,
264
- snapshot_id: request.snapshotId
265
- });
266
- const marshalVolumeInstanceTemplate = (request, defaults) => ({
267
- boot: request.boot,
268
- name: request.name,
269
- tags: request.tags,
270
- volume_type: request.volumeType,
271
- ...sdkClient.resolveOneOf([
272
- {
273
- param: "from_empty",
274
- value: request.fromEmpty !== void 0 ? marshalVolumeInstanceTemplateFromEmpty(request.fromEmpty) : void 0
275
- },
276
- {
277
- param: "from_snapshot",
278
- value: request.fromSnapshot !== void 0 ? marshalVolumeInstanceTemplateFromSnapshot(
279
- request.fromSnapshot
280
- ) : void 0
281
- }
282
- ]),
283
- ...sdkClient.resolveOneOf([{ param: "perf_iops", value: request.perfIops }])
284
- });
285
- const marshalCreateInstanceTemplateRequest = (request, defaults) => ({
286
- cloud_init: request.cloudInit,
287
- commercial_type: request.commercialType,
288
- image_id: request.imageId,
289
- name: request.name,
290
- placement_group_id: request.placementGroupId,
291
- private_network_ids: request.privateNetworkIds,
292
- project_id: request.projectId ?? defaults.defaultProjectId,
293
- public_ips_v4_count: request.publicIpsV4Count,
294
- public_ips_v6_count: request.publicIpsV6Count,
295
- security_group_id: request.securityGroupId,
296
- tags: request.tags,
297
- volumes: Object.entries(request.volumes).reduce(
298
- (acc, [key, value]) => ({
299
- ...acc,
300
- [key]: marshalVolumeInstanceTemplate(value)
301
- }),
302
- {}
303
- )
304
- });
305
- const marshalUpdateInstanceGroupRequestCapacity = (request, defaults) => ({
306
- cooldown_delay: request.cooldownDelay,
307
- max_replicas: request.maxReplicas,
308
- min_replicas: request.minReplicas
309
- });
310
- const marshalUpdateInstanceGroupRequestLoadbalancer = (request, defaults) => ({
311
- backend_ids: request.backendIds
312
- });
313
- const marshalUpdateInstanceGroupRequest = (request, defaults) => ({
314
- capacity: request.capacity !== void 0 ? marshalUpdateInstanceGroupRequestCapacity(request.capacity) : void 0,
315
- loadbalancer: request.loadbalancer !== void 0 ? marshalUpdateInstanceGroupRequestLoadbalancer(
316
- request.loadbalancer
317
- ) : void 0,
318
- name: request.name,
319
- tags: request.tags
320
- });
321
- const marshalUpdateInstancePolicyRequestMetric = (request, defaults) => ({
322
- aggregate: request.aggregate,
323
- name: request.name,
324
- operator: request.operator,
325
- sampling_range_min: request.samplingRangeMin,
326
- threshold: request.threshold,
327
- ...sdkClient.resolveOneOf([
328
- { param: "managed_metric", value: request.managedMetric },
329
- { param: "cockpit_metric_name", value: request.cockpitMetricName }
330
- ])
331
- });
332
- const marshalUpdateInstancePolicyRequest = (request, defaults) => ({
333
- action: request.action,
334
- name: request.name,
335
- priority: request.priority,
336
- type: request.type,
337
- value: request.value,
338
- ...sdkClient.resolveOneOf([
339
- {
340
- param: "metric",
341
- value: request.metric !== void 0 ? marshalUpdateInstancePolicyRequestMetric(request.metric) : void 0
342
- }
343
- ])
344
- });
345
- const marshalUpdateInstanceTemplateRequest = (request, defaults) => ({
346
- cloud_init: request.cloudInit,
347
- commercial_type: request.commercialType,
348
- image_id: request.imageId,
349
- name: request.name,
350
- placement_group_id: request.placementGroupId,
351
- private_network_ids: request.privateNetworkIds,
352
- public_ips_v4_count: request.publicIpsV4Count,
353
- public_ips_v6_count: request.publicIpsV6Count,
354
- security_group_id: request.securityGroupId,
355
- tags: request.tags,
356
- volumes: request.volumes !== void 0 ? Object.entries(request.volumes).reduce(
357
- (acc, [key, value]) => ({
358
- ...acc,
359
- [key]: marshalVolumeInstanceTemplate(value)
360
- }),
361
- {}
362
- ) : void 0
363
- });
364
- exports.marshalCreateInstanceGroupRequest = marshalCreateInstanceGroupRequest;
365
- exports.marshalCreateInstancePolicyRequest = marshalCreateInstancePolicyRequest;
366
- exports.marshalCreateInstanceTemplateRequest = marshalCreateInstanceTemplateRequest;
367
- exports.marshalUpdateInstanceGroupRequest = marshalUpdateInstanceGroupRequest;
368
- exports.marshalUpdateInstancePolicyRequest = marshalUpdateInstancePolicyRequest;
369
- exports.marshalUpdateInstanceTemplateRequest = marshalUpdateInstanceTemplateRequest;
370
- exports.unmarshalInstanceGroup = unmarshalInstanceGroup;
371
- exports.unmarshalInstancePolicy = unmarshalInstancePolicy;
372
- exports.unmarshalInstanceTemplate = unmarshalInstanceTemplate;
373
- exports.unmarshalListInstanceGroupEventsResponse = unmarshalListInstanceGroupEventsResponse;
374
- exports.unmarshalListInstanceGroupsResponse = unmarshalListInstanceGroupsResponse;
375
- exports.unmarshalListInstancePoliciesResponse = unmarshalListInstancePoliciesResponse;
376
- exports.unmarshalListInstanceTemplatesResponse = unmarshalListInstanceTemplatesResponse;
@@ -1,136 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Capacity = {
4
- maxReplicas: {
5
- greaterThanOrEqual: 2
6
- },
7
- minReplicas: {
8
- greaterThanOrEqual: 1
9
- }
10
- };
11
- const CreateInstanceGroupRequest = {
12
- name: {
13
- maxLength: 255,
14
- minLength: 1
15
- }
16
- };
17
- const CreateInstancePolicyRequest = {
18
- name: {
19
- maxLength: 255,
20
- minLength: 1
21
- },
22
- value: {
23
- greaterThanOrEqual: 1
24
- }
25
- };
26
- const CreateInstanceTemplateRequest = {
27
- name: {
28
- maxLength: 255,
29
- minLength: 1
30
- }
31
- };
32
- const ListInstanceGroupEventsRequest = {
33
- page: {
34
- greaterThanOrEqual: 1
35
- },
36
- pageSize: {
37
- greaterThanOrEqual: 1,
38
- lessThanOrEqual: 1e3
39
- }
40
- };
41
- const ListInstanceGroupsRequest = {
42
- page: {
43
- greaterThanOrEqual: 1
44
- },
45
- pageSize: {
46
- greaterThanOrEqual: 1,
47
- lessThanOrEqual: 1e3
48
- }
49
- };
50
- const ListInstancePoliciesRequest = {
51
- page: {
52
- greaterThanOrEqual: 1
53
- },
54
- pageSize: {
55
- greaterThanOrEqual: 1,
56
- lessThanOrEqual: 1e3
57
- }
58
- };
59
- const ListInstanceTemplatesRequest = {
60
- page: {
61
- greaterThanOrEqual: 1
62
- },
63
- pageSize: {
64
- greaterThanOrEqual: 1,
65
- lessThanOrEqual: 1e3
66
- }
67
- };
68
- const Metric = {
69
- name: {
70
- maxLength: 255,
71
- minLength: 1
72
- },
73
- samplingRangeMin: {
74
- greaterThanOrEqual: 1,
75
- lessThanOrEqual: 60
76
- }
77
- };
78
- const UpdateInstanceGroupRequest = {
79
- name: {
80
- maxLength: 255,
81
- minLength: 1
82
- }
83
- };
84
- const UpdateInstanceGroupRequestCapacity = {
85
- maxReplicas: {
86
- greaterThanOrEqual: 2
87
- },
88
- minReplicas: {
89
- greaterThanOrEqual: 1
90
- }
91
- };
92
- const UpdateInstancePolicyRequest = {
93
- name: {
94
- maxLength: 255,
95
- minLength: 1
96
- },
97
- value: {
98
- greaterThanOrEqual: 1
99
- }
100
- };
101
- const UpdateInstancePolicyRequestMetric = {
102
- name: {
103
- maxLength: 255,
104
- minLength: 1
105
- },
106
- samplingRangeMin: {
107
- greaterThanOrEqual: 1,
108
- lessThanOrEqual: 60
109
- }
110
- };
111
- const UpdateInstanceTemplateRequest = {
112
- name: {
113
- maxLength: 255,
114
- minLength: 1
115
- }
116
- };
117
- const VolumeInstanceTemplate = {
118
- name: {
119
- minLength: 1
120
- }
121
- };
122
- exports.Capacity = Capacity;
123
- exports.CreateInstanceGroupRequest = CreateInstanceGroupRequest;
124
- exports.CreateInstancePolicyRequest = CreateInstancePolicyRequest;
125
- exports.CreateInstanceTemplateRequest = CreateInstanceTemplateRequest;
126
- exports.ListInstanceGroupEventsRequest = ListInstanceGroupEventsRequest;
127
- exports.ListInstanceGroupsRequest = ListInstanceGroupsRequest;
128
- exports.ListInstancePoliciesRequest = ListInstancePoliciesRequest;
129
- exports.ListInstanceTemplatesRequest = ListInstanceTemplatesRequest;
130
- exports.Metric = Metric;
131
- exports.UpdateInstanceGroupRequest = UpdateInstanceGroupRequest;
132
- exports.UpdateInstanceGroupRequestCapacity = UpdateInstanceGroupRequestCapacity;
133
- exports.UpdateInstancePolicyRequest = UpdateInstancePolicyRequest;
134
- exports.UpdateInstancePolicyRequestMetric = UpdateInstancePolicyRequestMetric;
135
- exports.UpdateInstanceTemplateRequest = UpdateInstanceTemplateRequest;
136
- exports.VolumeInstanceTemplate = VolumeInstanceTemplate;