@scaleway/sdk-autoscaling 2.7.0 → 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.
Files changed (34) hide show
  1. package/dist/.vite/license.md +3 -0
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/index.gen.d.ts +6 -0
  4. package/dist/index.gen.js +3 -0
  5. package/dist/metadata.gen.d.ts +12 -0
  6. package/dist/metadata.gen.js +13 -0
  7. package/dist/v1alpha1/api.gen.d.ts +132 -0
  8. package/dist/v1alpha1/api.gen.js +98 -0
  9. package/dist/v1alpha1/index.gen.d.ts +4 -0
  10. package/dist/v1alpha1/index.gen.js +24 -0
  11. package/dist/v1alpha1/marshalling.gen.d.ts +15 -0
  12. package/dist/v1alpha1/marshalling.gen.js +282 -0
  13. package/dist/v1alpha1/metadata.gen.d.ts +81 -0
  14. package/dist/v1alpha1/metadata.gen.js +91 -0
  15. package/dist/v1alpha1/types.gen.d.ts +774 -0
  16. package/dist/v1alpha1/types.gen.js +0 -0
  17. package/dist/v1alpha1/validation-rules.gen.d.ts +119 -0
  18. package/dist/v1alpha1/validation-rules.gen.js +108 -0
  19. package/dist/v1alpha2/api.gen.d.ts +83 -0
  20. package/dist/v1alpha2/api.gen.js +70 -0
  21. package/dist/v1alpha2/content.gen.d.ts +3 -0
  22. package/dist/v1alpha2/content.gen.js +11 -0
  23. package/dist/v1alpha2/index.gen.d.ts +5 -0
  24. package/dist/v1alpha2/index.gen.js +20 -0
  25. package/dist/v1alpha2/marshalling.gen.d.ts +9 -0
  26. package/dist/v1alpha2/marshalling.gen.js +201 -0
  27. package/dist/v1alpha2/metadata.gen.d.ts +68 -0
  28. package/dist/v1alpha2/metadata.gen.js +76 -0
  29. package/dist/v1alpha2/types.gen.d.ts +505 -0
  30. package/dist/v1alpha2/types.gen.js +0 -0
  31. package/dist/v1alpha2/validation-rules.gen.d.ts +36 -0
  32. package/dist/v1alpha2/validation-rules.gen.js +36 -0
  33. package/package.json +5 -5
  34. package/LICENSE +0 -191
File without changes
@@ -0,0 +1,119 @@
1
+ export declare const Capacity: {
2
+ maxReplicas: {
3
+ greaterThanOrEqual: number;
4
+ };
5
+ minReplicas: {
6
+ greaterThanOrEqual: number;
7
+ };
8
+ };
9
+ export declare const CreateInstanceGroupRequest: {
10
+ name: {
11
+ maxLength: number;
12
+ minLength: number;
13
+ };
14
+ };
15
+ export declare const CreateInstancePolicyRequest: {
16
+ name: {
17
+ maxLength: number;
18
+ minLength: number;
19
+ };
20
+ value: {
21
+ greaterThanOrEqual: number;
22
+ };
23
+ };
24
+ export declare const CreateInstanceTemplateRequest: {
25
+ name: {
26
+ maxLength: number;
27
+ minLength: number;
28
+ };
29
+ };
30
+ export declare const ListInstanceGroupEventsRequest: {
31
+ page: {
32
+ greaterThanOrEqual: number;
33
+ };
34
+ pageSize: {
35
+ greaterThanOrEqual: number;
36
+ lessThanOrEqual: number;
37
+ };
38
+ };
39
+ export declare const ListInstanceGroupsRequest: {
40
+ page: {
41
+ greaterThanOrEqual: number;
42
+ };
43
+ pageSize: {
44
+ greaterThanOrEqual: number;
45
+ lessThanOrEqual: number;
46
+ };
47
+ };
48
+ export declare const ListInstancePoliciesRequest: {
49
+ page: {
50
+ greaterThanOrEqual: number;
51
+ };
52
+ pageSize: {
53
+ greaterThanOrEqual: number;
54
+ lessThanOrEqual: number;
55
+ };
56
+ };
57
+ export declare const ListInstanceTemplatesRequest: {
58
+ page: {
59
+ greaterThanOrEqual: number;
60
+ };
61
+ pageSize: {
62
+ greaterThanOrEqual: number;
63
+ lessThanOrEqual: number;
64
+ };
65
+ };
66
+ export declare const Metric: {
67
+ name: {
68
+ maxLength: number;
69
+ minLength: number;
70
+ };
71
+ samplingRangeMin: {
72
+ greaterThanOrEqual: number;
73
+ lessThanOrEqual: number;
74
+ };
75
+ };
76
+ export declare const UpdateInstanceGroupRequest: {
77
+ name: {
78
+ maxLength: number;
79
+ minLength: number;
80
+ };
81
+ };
82
+ export declare const UpdateInstanceGroupRequestCapacity: {
83
+ maxReplicas: {
84
+ greaterThanOrEqual: number;
85
+ };
86
+ minReplicas: {
87
+ greaterThanOrEqual: number;
88
+ };
89
+ };
90
+ export declare const UpdateInstancePolicyRequest: {
91
+ name: {
92
+ maxLength: number;
93
+ minLength: number;
94
+ };
95
+ value: {
96
+ greaterThanOrEqual: number;
97
+ };
98
+ };
99
+ export declare const UpdateInstancePolicyRequestMetric: {
100
+ name: {
101
+ maxLength: number;
102
+ minLength: number;
103
+ };
104
+ samplingRangeMin: {
105
+ greaterThanOrEqual: number;
106
+ lessThanOrEqual: number;
107
+ };
108
+ };
109
+ export declare const UpdateInstanceTemplateRequest: {
110
+ name: {
111
+ maxLength: number;
112
+ minLength: number;
113
+ };
114
+ };
115
+ export declare const VolumeInstanceTemplate: {
116
+ name: {
117
+ minLength: number;
118
+ };
119
+ };
@@ -0,0 +1,108 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ //#region src/v1alpha1/validation-rules.gen.ts
3
+ var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({
4
+ Capacity: () => Capacity,
5
+ CreateInstanceGroupRequest: () => CreateInstanceGroupRequest,
6
+ CreateInstancePolicyRequest: () => CreateInstancePolicyRequest,
7
+ CreateInstanceTemplateRequest: () => CreateInstanceTemplateRequest,
8
+ ListInstanceGroupEventsRequest: () => ListInstanceGroupEventsRequest,
9
+ ListInstanceGroupsRequest: () => ListInstanceGroupsRequest,
10
+ ListInstancePoliciesRequest: () => ListInstancePoliciesRequest,
11
+ ListInstanceTemplatesRequest: () => ListInstanceTemplatesRequest,
12
+ Metric: () => Metric,
13
+ UpdateInstanceGroupRequest: () => UpdateInstanceGroupRequest,
14
+ UpdateInstanceGroupRequestCapacity: () => UpdateInstanceGroupRequestCapacity,
15
+ UpdateInstancePolicyRequest: () => UpdateInstancePolicyRequest,
16
+ UpdateInstancePolicyRequestMetric: () => UpdateInstancePolicyRequestMetric,
17
+ UpdateInstanceTemplateRequest: () => UpdateInstanceTemplateRequest,
18
+ VolumeInstanceTemplate: () => VolumeInstanceTemplate
19
+ });
20
+ const Capacity = {
21
+ maxReplicas: { greaterThanOrEqual: 2 },
22
+ minReplicas: { greaterThanOrEqual: 1 }
23
+ };
24
+ const CreateInstanceGroupRequest = { name: {
25
+ maxLength: 255,
26
+ minLength: 1
27
+ } };
28
+ const CreateInstancePolicyRequest = {
29
+ name: {
30
+ maxLength: 255,
31
+ minLength: 1
32
+ },
33
+ value: { greaterThanOrEqual: 1 }
34
+ };
35
+ const CreateInstanceTemplateRequest = { name: {
36
+ maxLength: 255,
37
+ minLength: 1
38
+ } };
39
+ const ListInstanceGroupEventsRequest = {
40
+ page: { greaterThanOrEqual: 1 },
41
+ pageSize: {
42
+ greaterThanOrEqual: 1,
43
+ lessThanOrEqual: 1e3
44
+ }
45
+ };
46
+ const ListInstanceGroupsRequest = {
47
+ page: { greaterThanOrEqual: 1 },
48
+ pageSize: {
49
+ greaterThanOrEqual: 1,
50
+ lessThanOrEqual: 1e3
51
+ }
52
+ };
53
+ const ListInstancePoliciesRequest = {
54
+ page: { greaterThanOrEqual: 1 },
55
+ pageSize: {
56
+ greaterThanOrEqual: 1,
57
+ lessThanOrEqual: 1e3
58
+ }
59
+ };
60
+ const ListInstanceTemplatesRequest = {
61
+ page: { greaterThanOrEqual: 1 },
62
+ pageSize: {
63
+ greaterThanOrEqual: 1,
64
+ lessThanOrEqual: 1e3
65
+ }
66
+ };
67
+ const Metric = {
68
+ name: {
69
+ maxLength: 255,
70
+ minLength: 1
71
+ },
72
+ samplingRangeMin: {
73
+ greaterThanOrEqual: 1,
74
+ lessThanOrEqual: 60
75
+ }
76
+ };
77
+ const UpdateInstanceGroupRequest = { name: {
78
+ maxLength: 255,
79
+ minLength: 1
80
+ } };
81
+ const UpdateInstanceGroupRequestCapacity = {
82
+ maxReplicas: { greaterThanOrEqual: 2 },
83
+ minReplicas: { greaterThanOrEqual: 1 }
84
+ };
85
+ const UpdateInstancePolicyRequest = {
86
+ name: {
87
+ maxLength: 255,
88
+ minLength: 1
89
+ },
90
+ value: { greaterThanOrEqual: 1 }
91
+ };
92
+ const UpdateInstancePolicyRequestMetric = {
93
+ name: {
94
+ maxLength: 255,
95
+ minLength: 1
96
+ },
97
+ samplingRangeMin: {
98
+ greaterThanOrEqual: 1,
99
+ lessThanOrEqual: 60
100
+ }
101
+ };
102
+ const UpdateInstanceTemplateRequest = { name: {
103
+ maxLength: 255,
104
+ minLength: 1
105
+ } };
106
+ const VolumeInstanceTemplate = { name: { minLength: 1 } };
107
+ //#endregion
108
+ export { Capacity, CreateInstanceGroupRequest, CreateInstancePolicyRequest, CreateInstanceTemplateRequest, ListInstanceGroupEventsRequest, ListInstanceGroupsRequest, ListInstancePoliciesRequest, ListInstanceTemplatesRequest, Metric, UpdateInstanceGroupRequest, UpdateInstanceGroupRequestCapacity, UpdateInstancePolicyRequest, UpdateInstancePolicyRequestMetric, UpdateInstanceTemplateRequest, VolumeInstanceTemplate, validation_rules_gen_exports };
@@ -0,0 +1,83 @@
1
+ import { API as ParentAPI } from '@scaleway/sdk-client';
2
+ import type { WaitForOptions, ApiLocality } from '@scaleway/sdk-client';
3
+ import type { CreateGroupRequest, DeleteGroupRequest, GetGroupRequest, Group, ListAlertsRequest, ListAlertsResponse, ListGroupsRequest, ListGroupsResponse, ListLogsRequest, ListLogsResponse, ListServersRequest, ListServersResponse, UpdateGroupRequest } from './types.gen.js';
4
+ /**
5
+ * Autoscaling Groups API.
6
+ */
7
+ export declare class API extends ParentAPI {
8
+ /**
9
+ * Locality of this API.
10
+ * type ∈ {'zone','region','global','unspecified'}
11
+ */
12
+ static readonly LOCALITY: ApiLocality;
13
+ /**
14
+ * List autoscaling groups. List all autoscaling groups in a project.
15
+ *
16
+ * @param request - The request {@link ListGroupsRequest}
17
+ * @returns A Promise of ListGroupsResponse
18
+ */
19
+ listGroups: (request?: Readonly<ListGroupsRequest>) => Promise<ListGroupsResponse>;
20
+ /**
21
+ * Get an autoscaling group. Get details of a specified autoscaling group including its
22
+ configuration, current size, and status.
23
+ *
24
+ * @param request - The request {@link GetGroupRequest}
25
+ * @returns A Promise of Group
26
+ */
27
+ getGroup: (request: Readonly<GetGroupRequest>) => Promise<Group>;
28
+ /**
29
+ * Waits for {@link Group} to be in a final state.
30
+ *
31
+ * @param request - The request {@link GetGroupRequest}
32
+ * @param options - The waiting options
33
+ * @returns A Promise of Group
34
+ */
35
+ waitForGroup: (request: Readonly<GetGroupRequest>, options?: Readonly<WaitForOptions<Group>>) => Promise<Group>;
36
+ /**
37
+ * Create an autoscaling group. Create a new autoscaling group with the specified configuration
38
+ including template, scaling policy, and optional load balancer
39
+ settings.
40
+ *
41
+ * @param request - The request {@link CreateGroupRequest}
42
+ * @returns A Promise of Group
43
+ */
44
+ createGroup: (request: Readonly<CreateGroupRequest>) => Promise<Group>;
45
+ /**
46
+ * Update an autoscaling group. Update the configuration of a specified autoscaling group including
47
+ name, tags, template, scaling policy, and load balancer settings.
48
+ *
49
+ * @param request - The request {@link UpdateGroupRequest}
50
+ * @returns A Promise of Group
51
+ */
52
+ updateGroup: (request: Readonly<UpdateGroupRequest>) => Promise<Group>;
53
+ /**
54
+ * Delete an autoscaling group. Delete a specified autoscaling group and all its associated
55
+ resources.
56
+ *
57
+ * @param request - The request {@link DeleteGroupRequest}
58
+ * @returns A Promise of Group
59
+ */
60
+ deleteGroup: (request: Readonly<DeleteGroupRequest>) => Promise<Group>;
61
+ /**
62
+ * List autoscaling group logs. List logs for a specified autoscaling group to view scaling events
63
+ and activities.
64
+ *
65
+ * @param request - The request {@link ListLogsRequest}
66
+ * @returns A Promise of ListLogsResponse
67
+ */
68
+ listLogs: (request: Readonly<ListLogsRequest>) => Promise<ListLogsResponse>;
69
+ /**
70
+ * List autoscaling group servers. List all Instances belonging to a specified autoscaling group.
71
+ *
72
+ * @param request - The request {@link ListServersRequest}
73
+ * @returns A Promise of ListServersResponse
74
+ */
75
+ listServers: (request: Readonly<ListServersRequest>) => Promise<ListServersResponse>;
76
+ /**
77
+ * List autoscaling group alerts. List active and historical alerts for a specified autoscaling group.
78
+ *
79
+ * @param request - The request {@link ListAlertsRequest}
80
+ * @returns A Promise of ListAlertsResponse
81
+ */
82
+ listAlerts: (request?: Readonly<ListAlertsRequest>) => Promise<ListAlertsResponse>;
83
+ }
@@ -0,0 +1,70 @@
1
+ import { GROUP_GROUP_TRANSIENT_STATUSES } from "./content.gen.js";
2
+ import { marshalCreateGroupRequest, marshalUpdateGroupRequest, unmarshalGroup, unmarshalListAlertsResponse, unmarshalListGroupsResponse, unmarshalListLogsResponse, unmarshalListServersResponse } from "./marshalling.gen.js";
3
+ import { API as API$1, resolveOneOf, toApiLocality, urlParams, validatePathParam, waitForResource } from "@scaleway/sdk-client";
4
+ //#region src/v1alpha2/api.gen.ts
5
+ const jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
6
+ /**
7
+ * Autoscaling Groups API.
8
+ */
9
+ var API = class extends API$1 {
10
+ constructor(..._args) {
11
+ super(..._args);
12
+ this.listGroups = (request = {}) => this.client.fetch({
13
+ method: "GET",
14
+ path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/groups`,
15
+ urlParams: urlParams(["load_balancer_id", request.loadBalancerId], ["order_by", request.orderBy], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["page_token", request.pageToken], ["project_id", request.projectId ?? this.client.settings.defaultProjectId], ["template_id", request.templateId])
16
+ }, unmarshalListGroupsResponse);
17
+ this.getGroup = (request) => this.client.fetch({
18
+ method: "GET",
19
+ path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/groups/${validatePathParam("groupId", request.groupId)}`
20
+ }, unmarshalGroup);
21
+ this.waitForGroup = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!GROUP_GROUP_TRANSIENT_STATUSES.includes(res.status))), this.getGroup, request, options);
22
+ this.createGroup = (request) => this.client.fetch({
23
+ body: JSON.stringify(marshalCreateGroupRequest(request, this.client.settings)),
24
+ headers: jsonContentHeaders,
25
+ method: "POST",
26
+ path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/groups`
27
+ }, unmarshalGroup);
28
+ this.updateGroup = (request) => this.client.fetch({
29
+ body: JSON.stringify(marshalUpdateGroupRequest(request, this.client.settings)),
30
+ headers: jsonContentHeaders,
31
+ method: "PATCH",
32
+ path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/groups/${validatePathParam("groupId", request.groupId)}`
33
+ }, unmarshalGroup);
34
+ this.deleteGroup = (request) => this.client.fetch({
35
+ method: "DELETE",
36
+ path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/groups/${validatePathParam("groupId", request.groupId)}`
37
+ }, unmarshalGroup);
38
+ this.listLogs = (request) => this.client.fetch({
39
+ method: "GET",
40
+ path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/logs`,
41
+ urlParams: urlParams(["end_time", request.endTime], ["group_id", request.groupId], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["page_token", request.pageToken], ["start_time", request.startTime])
42
+ }, unmarshalListLogsResponse);
43
+ this.listServers = (request) => this.client.fetch({
44
+ method: "GET",
45
+ path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers`,
46
+ urlParams: urlParams(["group_id", request.groupId], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["page_token", request.pageToken])
47
+ }, unmarshalListServersResponse);
48
+ this.listAlerts = (request = {}) => this.client.fetch({
49
+ method: "GET",
50
+ path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/alerts`,
51
+ urlParams: urlParams(["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["page_token", request.pageToken], ...Object.entries(resolveOneOf([{
52
+ param: "group_id",
53
+ value: request.groupId
54
+ }, {
55
+ default: this.client.settings.defaultProjectId,
56
+ param: "project_id",
57
+ value: request.projectId
58
+ }])))
59
+ }, unmarshalListAlertsResponse);
60
+ }
61
+ static {
62
+ this.LOCALITY = toApiLocality({ zones: [
63
+ "fr-par-1",
64
+ "fr-par-2",
65
+ "fr-par-3"
66
+ ] });
67
+ }
68
+ };
69
+ //#endregion
70
+ export { API };
@@ -0,0 +1,3 @@
1
+ import type { GroupGroupStatus } from './types.gen.js';
2
+ /** Lists transient statutes of the enum {@link GroupGroupStatus}. */
3
+ export declare const GROUP_GROUP_TRANSIENT_STATUSES: GroupGroupStatus[];
@@ -0,0 +1,11 @@
1
+ //#region src/v1alpha2/content.gen.ts
2
+ /** Lists transient statutes of the enum {@link GroupGroupStatus}. */
3
+ const GROUP_GROUP_TRANSIENT_STATUSES = [
4
+ "scaling_out",
5
+ "scaling_in",
6
+ "refreshing",
7
+ "healing",
8
+ "deleting"
9
+ ];
10
+ //#endregion
11
+ export { GROUP_GROUP_TRANSIENT_STATUSES };
@@ -0,0 +1,5 @@
1
+ export { API, } from './api.gen.js';
2
+ export * from './content.gen.js';
3
+ export * from './marshalling.gen.js';
4
+ export type { Alert, AlertAlertType, CreateGroupRequest, DeleteGroupRequest, GetGroupRequest, Group, GroupGroupStatus, GroupLoadBalancerConfiguration, GroupLoadBalancerConfigurationAutoHealing, GroupLoadBalancerConfigurationBackend, GroupLoadBalancerConfigurationBackendAddressFamily, GroupScalingPolicy, GroupScalingPolicyScalingPolicyCpuTarget, GroupScalingPolicyScalingPolicyFixedSize, GroupScalingPolicyScalingPolicyMemoryTarget, GroupSummary, GroupSummaryScalingPolicyTargetType, ListAlertsRequest, ListAlertsResponse, ListGroupsRequest, ListGroupsRequestOrderBy, ListGroupsResponse, ListLogsRequest, ListLogsResponse, ListServersRequest, ListServersResponse, LoadBalancerConfigurationSpec, LoadBalancerConfigurationSpecAutoHealing, LoadBalancerConfigurationSpecBackend, Log, LogLogLevel, ScalingPolicySpec, Server, UpdateGroupRequest, } from './types.gen.js';
5
+ export * as ValidationRules from './validation-rules.gen.js';
@@ -0,0 +1,20 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ import { GROUP_GROUP_TRANSIENT_STATUSES } from "./content.gen.js";
3
+ import { marshalCreateGroupRequest, marshalUpdateGroupRequest, unmarshalGroup, unmarshalListAlertsResponse, unmarshalListGroupsResponse, unmarshalListLogsResponse, unmarshalListServersResponse } from "./marshalling.gen.js";
4
+ import { API } from "./api.gen.js";
5
+ import { validation_rules_gen_exports } from "./validation-rules.gen.js";
6
+ //#region src/v1alpha2/index.gen.ts
7
+ var index_gen_exports = /* @__PURE__ */ __exportAll({
8
+ API: () => API,
9
+ GROUP_GROUP_TRANSIENT_STATUSES: () => GROUP_GROUP_TRANSIENT_STATUSES,
10
+ ValidationRules: () => validation_rules_gen_exports,
11
+ marshalCreateGroupRequest: () => marshalCreateGroupRequest,
12
+ marshalUpdateGroupRequest: () => marshalUpdateGroupRequest,
13
+ unmarshalGroup: () => unmarshalGroup,
14
+ unmarshalListAlertsResponse: () => unmarshalListAlertsResponse,
15
+ unmarshalListGroupsResponse: () => unmarshalListGroupsResponse,
16
+ unmarshalListLogsResponse: () => unmarshalListLogsResponse,
17
+ unmarshalListServersResponse: () => unmarshalListServersResponse
18
+ });
19
+ //#endregion
20
+ export { API, GROUP_GROUP_TRANSIENT_STATUSES, validation_rules_gen_exports as ValidationRules, index_gen_exports, marshalCreateGroupRequest, marshalUpdateGroupRequest, unmarshalGroup, unmarshalListAlertsResponse, unmarshalListGroupsResponse, unmarshalListLogsResponse, unmarshalListServersResponse };
@@ -0,0 +1,9 @@
1
+ import type { DefaultValues } from '@scaleway/sdk-client';
2
+ import type { Group, ListAlertsResponse, ListGroupsResponse, ListLogsResponse, ListServersResponse, CreateGroupRequest, UpdateGroupRequest } from './types.gen.js';
3
+ export declare const unmarshalGroup: (data: unknown) => Group;
4
+ export declare const unmarshalListAlertsResponse: (data: unknown) => ListAlertsResponse;
5
+ export declare const unmarshalListGroupsResponse: (data: unknown) => ListGroupsResponse;
6
+ export declare const unmarshalListLogsResponse: (data: unknown) => ListLogsResponse;
7
+ export declare const unmarshalListServersResponse: (data: unknown) => ListServersResponse;
8
+ export declare const marshalCreateGroupRequest: (request: CreateGroupRequest, defaults: DefaultValues) => Record<string, unknown>;
9
+ export declare const marshalUpdateGroupRequest: (request: UpdateGroupRequest, defaults: DefaultValues) => Record<string, unknown>;
@@ -0,0 +1,201 @@
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
2
+ //#region src/v1alpha2/marshalling.gen.ts
3
+ const unmarshalGroupLoadBalancerConfigurationAutoHealing = (data) => {
4
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GroupLoadBalancerConfigurationAutoHealing' failed as data isn't a dictionary.`);
5
+ return {
6
+ enabled: data.enabled,
7
+ gracePeriod: data.grace_period
8
+ };
9
+ };
10
+ const unmarshalGroupLoadBalancerConfigurationBackend = (data) => {
11
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GroupLoadBalancerConfigurationBackend' failed as data isn't a dictionary.`);
12
+ return {
13
+ addressFamily: data.address_family,
14
+ backendId: data.backend_id,
15
+ privateNetworkId: data.private_network_id
16
+ };
17
+ };
18
+ const unmarshalGroupScalingPolicyScalingPolicyCpuTarget = (data) => {
19
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GroupScalingPolicyScalingPolicyCpuTarget' failed as data isn't a dictionary.`);
20
+ return { targetAvgPercent: data.target_avg_percent };
21
+ };
22
+ const unmarshalGroupScalingPolicyScalingPolicyFixedSize = (data) => {
23
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GroupScalingPolicyScalingPolicyFixedSize' failed as data isn't a dictionary.`);
24
+ return { size: data.size };
25
+ };
26
+ const unmarshalGroupScalingPolicyScalingPolicyMemoryTarget = (data) => {
27
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GroupScalingPolicyScalingPolicyMemoryTarget' failed as data isn't a dictionary.`);
28
+ return { targetAvgPercent: data.target_avg_percent };
29
+ };
30
+ const unmarshalAlert = (data) => {
31
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Alert' failed as data isn't a dictionary.`);
32
+ return {
33
+ closedAt: unmarshalDate(data.closed_at),
34
+ failingQuotas: data.failing_quotas,
35
+ groupId: data.group_id,
36
+ openedAt: unmarshalDate(data.opened_at),
37
+ type: data.type
38
+ };
39
+ };
40
+ const unmarshalGroupLoadBalancerConfiguration = (data) => {
41
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GroupLoadBalancerConfiguration' failed as data isn't a dictionary.`);
42
+ return {
43
+ autoHealing: data.auto_healing ? unmarshalGroupLoadBalancerConfigurationAutoHealing(data.auto_healing) : void 0,
44
+ backends: unmarshalArrayOfObject(data.backends, unmarshalGroupLoadBalancerConfigurationBackend),
45
+ loadBalancerId: data.load_balancer_id
46
+ };
47
+ };
48
+ const unmarshalGroupScalingPolicy = (data) => {
49
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GroupScalingPolicy' failed as data isn't a dictionary.`);
50
+ return {
51
+ cpuTarget: data.cpu_target ? unmarshalGroupScalingPolicyScalingPolicyCpuTarget(data.cpu_target) : void 0,
52
+ fixedSize: data.fixed_size ? unmarshalGroupScalingPolicyScalingPolicyFixedSize(data.fixed_size) : void 0,
53
+ maximumSize: data.maximum_size,
54
+ memoryTarget: data.memory_target ? unmarshalGroupScalingPolicyScalingPolicyMemoryTarget(data.memory_target) : void 0,
55
+ minimumSize: data.minimum_size,
56
+ scaleInCooldown: data.scale_in_cooldown,
57
+ scaleInStep: data.scale_in_step,
58
+ scaleOutCooldown: data.scale_out_cooldown,
59
+ scaleOutStep: data.scale_out_step
60
+ };
61
+ };
62
+ const unmarshalGroup = (data) => {
63
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Group' failed as data isn't a dictionary.`);
64
+ return {
65
+ createdAt: unmarshalDate(data.created_at),
66
+ currentSize: data.current_size,
67
+ id: data.id,
68
+ lastScaleInAt: unmarshalDate(data.last_scale_in_at),
69
+ lastScaleOutAt: unmarshalDate(data.last_scale_out_at),
70
+ loadBalancerConfiguration: data.load_balancer_configuration ? unmarshalGroupLoadBalancerConfiguration(data.load_balancer_configuration) : void 0,
71
+ name: data.name,
72
+ openAlerts: unmarshalArrayOfObject(data.open_alerts, unmarshalAlert),
73
+ projectId: data.project_id,
74
+ scalingPolicy: data.scaling_policy ? unmarshalGroupScalingPolicy(data.scaling_policy) : void 0,
75
+ status: data.status,
76
+ tags: data.tags,
77
+ targetSize: data.target_size,
78
+ templateId: data.template_id,
79
+ updatedAt: unmarshalDate(data.updated_at)
80
+ };
81
+ };
82
+ const unmarshalListAlertsResponse = (data) => {
83
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListAlertsResponse' failed as data isn't a dictionary.`);
84
+ return {
85
+ alerts: unmarshalArrayOfObject(data.alerts, unmarshalAlert),
86
+ nextPageToken: data.next_page_token,
87
+ totalCount: data.total_count
88
+ };
89
+ };
90
+ const unmarshalGroupSummary = (data) => {
91
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'GroupSummary' failed as data isn't a dictionary.`);
92
+ return {
93
+ createdAt: unmarshalDate(data.created_at),
94
+ currentSize: data.current_size,
95
+ id: data.id,
96
+ latestOpenAlert: data.latest_open_alert ? unmarshalAlert(data.latest_open_alert) : void 0,
97
+ loadBalancerId: data.load_balancer_id,
98
+ maximumSize: data.maximum_size,
99
+ minimumSize: data.minimum_size,
100
+ name: data.name,
101
+ projectId: data.project_id,
102
+ scalingPolicyTargetType: data.scaling_policy_target_type,
103
+ status: data.status,
104
+ tags: data.tags,
105
+ templateId: data.template_id,
106
+ updatedAt: unmarshalDate(data.updated_at),
107
+ zone: data.zone
108
+ };
109
+ };
110
+ const unmarshalListGroupsResponse = (data) => {
111
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListGroupsResponse' failed as data isn't a dictionary.`);
112
+ return {
113
+ groupSummaries: unmarshalArrayOfObject(data.group_summaries, unmarshalGroupSummary),
114
+ nextPageToken: data.next_page_token,
115
+ totalCount: data.total_count
116
+ };
117
+ };
118
+ const unmarshalLog = (data) => {
119
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Log' failed as data isn't a dictionary.`);
120
+ return {
121
+ level: data.level,
122
+ message: data.message,
123
+ timestamp: unmarshalDate(data.timestamp)
124
+ };
125
+ };
126
+ const unmarshalListLogsResponse = (data) => {
127
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListLogsResponse' failed as data isn't a dictionary.`);
128
+ return {
129
+ logs: unmarshalArrayOfObject(data.logs, unmarshalLog),
130
+ nextPageToken: data.next_page_token,
131
+ totalCount: data.total_count
132
+ };
133
+ };
134
+ const unmarshalServer = (data) => {
135
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Server' failed as data isn't a dictionary.`);
136
+ return { serverId: data.server_id };
137
+ };
138
+ const unmarshalListServersResponse = (data) => {
139
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`);
140
+ return {
141
+ nextPageToken: data.next_page_token,
142
+ servers: unmarshalArrayOfObject(data.servers, unmarshalServer),
143
+ totalCount: data.total_count
144
+ };
145
+ };
146
+ const marshalLoadBalancerConfigurationSpecAutoHealing = (request, defaults) => ({
147
+ enabled: request.enabled,
148
+ grace_period: request.gracePeriod
149
+ });
150
+ const marshalLoadBalancerConfigurationSpecBackend = (request, defaults) => ({
151
+ address_family: request.addressFamily,
152
+ backend_id: request.backendId,
153
+ private_network_id: request.privateNetworkId
154
+ });
155
+ const marshalGroupScalingPolicyScalingPolicyCpuTarget = (request, defaults) => ({ target_avg_percent: request.targetAvgPercent });
156
+ const marshalGroupScalingPolicyScalingPolicyFixedSize = (request, defaults) => ({ size: request.size });
157
+ const marshalGroupScalingPolicyScalingPolicyMemoryTarget = (request, defaults) => ({ target_avg_percent: request.targetAvgPercent });
158
+ const marshalLoadBalancerConfigurationSpec = (request, defaults) => ({
159
+ auto_healing: request.autoHealing !== void 0 ? marshalLoadBalancerConfigurationSpecAutoHealing(request.autoHealing, defaults) : void 0,
160
+ backends: request.backends.map((elt) => marshalLoadBalancerConfigurationSpecBackend(elt, defaults)),
161
+ load_balancer_id: request.loadBalancerId
162
+ });
163
+ const marshalScalingPolicySpec = (request, defaults) => ({
164
+ maximum_size: request.maximumSize,
165
+ minimum_size: request.minimumSize,
166
+ scale_in_cooldown: request.scaleInCooldown,
167
+ scale_in_step: request.scaleInStep,
168
+ scale_out_cooldown: request.scaleOutCooldown,
169
+ scale_out_step: request.scaleOutStep,
170
+ ...resolveOneOf([
171
+ {
172
+ param: "fixed_size",
173
+ value: request.fixedSize !== void 0 ? marshalGroupScalingPolicyScalingPolicyFixedSize(request.fixedSize, defaults) : void 0
174
+ },
175
+ {
176
+ param: "cpu_target",
177
+ value: request.cpuTarget !== void 0 ? marshalGroupScalingPolicyScalingPolicyCpuTarget(request.cpuTarget, defaults) : void 0
178
+ },
179
+ {
180
+ param: "memory_target",
181
+ value: request.memoryTarget !== void 0 ? marshalGroupScalingPolicyScalingPolicyMemoryTarget(request.memoryTarget, defaults) : void 0
182
+ }
183
+ ])
184
+ });
185
+ const marshalCreateGroupRequest = (request, defaults) => ({
186
+ load_balancer_configuration_spec: request.loadBalancerConfigurationSpec !== void 0 ? marshalLoadBalancerConfigurationSpec(request.loadBalancerConfigurationSpec, defaults) : void 0,
187
+ name: request.name,
188
+ project_id: request.projectId ?? defaults.defaultProjectId,
189
+ scaling_policy_spec: request.scalingPolicySpec !== void 0 ? marshalScalingPolicySpec(request.scalingPolicySpec, defaults) : void 0,
190
+ tags: request.tags,
191
+ template_id: request.templateId
192
+ });
193
+ const marshalUpdateGroupRequest = (request, defaults) => ({
194
+ load_balancer_configuration_spec: request.loadBalancerConfigurationSpec !== void 0 ? marshalLoadBalancerConfigurationSpec(request.loadBalancerConfigurationSpec, defaults) : void 0,
195
+ name: request.name,
196
+ scaling_policy_spec: request.scalingPolicySpec !== void 0 ? marshalScalingPolicySpec(request.scalingPolicySpec, defaults) : void 0,
197
+ tags: request.tags,
198
+ template_id: request.templateId
199
+ });
200
+ //#endregion
201
+ export { marshalCreateGroupRequest, marshalUpdateGroupRequest, unmarshalGroup, unmarshalListAlertsResponse, unmarshalListGroupsResponse, unmarshalListLogsResponse, unmarshalListServersResponse };