@scaleway/sdk-autoscaling 2.6.1 → 2.8.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/LICENSE +191 -0
  2. package/package.json +9 -8
  3. package/dist/.vite/license.md +0 -3
  4. package/dist/_virtual/_rolldown/runtime.js +0 -13
  5. package/dist/index.gen.d.ts +0 -6
  6. package/dist/index.gen.js +0 -3
  7. package/dist/metadata.gen.d.ts +0 -12
  8. package/dist/metadata.gen.js +0 -13
  9. package/dist/v1alpha1/api.gen.d.ts +0 -132
  10. package/dist/v1alpha1/api.gen.js +0 -98
  11. package/dist/v1alpha1/index.gen.d.ts +0 -4
  12. package/dist/v1alpha1/index.gen.js +0 -24
  13. package/dist/v1alpha1/marshalling.gen.d.ts +0 -15
  14. package/dist/v1alpha1/marshalling.gen.js +0 -282
  15. package/dist/v1alpha1/metadata.gen.d.ts +0 -81
  16. package/dist/v1alpha1/metadata.gen.js +0 -91
  17. package/dist/v1alpha1/types.gen.d.ts +0 -774
  18. package/dist/v1alpha1/types.gen.js +0 -0
  19. package/dist/v1alpha1/validation-rules.gen.d.ts +0 -119
  20. package/dist/v1alpha1/validation-rules.gen.js +0 -108
  21. package/dist/v1alpha2/api.gen.d.ts +0 -79
  22. package/dist/v1alpha2/api.gen.js +0 -68
  23. package/dist/v1alpha2/content.gen.d.ts +0 -3
  24. package/dist/v1alpha2/content.gen.js +0 -11
  25. package/dist/v1alpha2/index.gen.d.ts +0 -5
  26. package/dist/v1alpha2/index.gen.js +0 -20
  27. package/dist/v1alpha2/marshalling.gen.d.ts +0 -9
  28. package/dist/v1alpha2/marshalling.gen.js +0 -197
  29. package/dist/v1alpha2/metadata.gen.d.ts +0 -68
  30. package/dist/v1alpha2/metadata.gen.js +0 -76
  31. package/dist/v1alpha2/types.gen.d.ts +0 -488
  32. package/dist/v1alpha2/types.gen.js +0 -0
  33. package/dist/v1alpha2/validation-rules.gen.d.ts +0 -36
  34. package/dist/v1alpha2/validation-rules.gen.js +0 -36
File without changes
@@ -1,119 +0,0 @@
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
- };
@@ -1,108 +0,0 @@
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 };
@@ -1,79 +0,0 @@
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
- Instances Autoscaling Groups management API.
8
- */
9
- export declare class API extends ParentAPI {
10
- /**
11
- * Locality of this API.
12
- * type ∈ {'zone','region','global','unspecified'}
13
- */
14
- static readonly LOCALITY: ApiLocality;
15
- /**
16
- * List autoscaling groups. List all autoscaling groups in a project.
17
- *
18
- * @param request - The request {@link ListGroupsRequest}
19
- * @returns A Promise of ListGroupsResponse
20
- */
21
- listGroups: (request?: Readonly<ListGroupsRequest>) => Promise<ListGroupsResponse>;
22
- /**
23
- * Get an autoscaling group. Get details of a specified autoscaling group including its configuration, current size, and status.
24
- *
25
- * @param request - The request {@link GetGroupRequest}
26
- * @returns A Promise of Group
27
- */
28
- getGroup: (request: Readonly<GetGroupRequest>) => Promise<Group>;
29
- /**
30
- * Waits for {@link Group} to be in a final state.
31
- *
32
- * @param request - The request {@link GetGroupRequest}
33
- * @param options - The waiting options
34
- * @returns A Promise of Group
35
- */
36
- waitForGroup: (request: Readonly<GetGroupRequest>, options?: Readonly<WaitForOptions<Group>>) => Promise<Group>;
37
- /**
38
- * Create an autoscaling group. Create a new autoscaling group with the specified configuration including template, scaling policy, and optional load balancer settings.
39
- *
40
- * @param request - The request {@link CreateGroupRequest}
41
- * @returns A Promise of Group
42
- */
43
- createGroup: (request: Readonly<CreateGroupRequest>) => Promise<Group>;
44
- /**
45
- * Update an autoscaling group. Update the configuration of a specified autoscaling group including name, tags, template, scaling policy, and load balancer settings.
46
- *
47
- * @param request - The request {@link UpdateGroupRequest}
48
- * @returns A Promise of Group
49
- */
50
- updateGroup: (request: Readonly<UpdateGroupRequest>) => Promise<Group>;
51
- /**
52
- * Delete an autoscaling group. Delete a specified autoscaling group and all its associated resources.
53
- *
54
- * @param request - The request {@link DeleteGroupRequest}
55
- * @returns A Promise of Group
56
- */
57
- deleteGroup: (request: Readonly<DeleteGroupRequest>) => Promise<Group>;
58
- /**
59
- * List group logs. List logs for a specified autoscaling group to view scaling events and activities.
60
- *
61
- * @param request - The request {@link ListLogsRequest}
62
- * @returns A Promise of ListLogsResponse
63
- */
64
- listLogs: (request: Readonly<ListLogsRequest>) => Promise<ListLogsResponse>;
65
- /**
66
- * List group servers. List all Instances belonging to a specified autoscaling group.
67
- *
68
- * @param request - The request {@link ListServersRequest}
69
- * @returns A Promise of ListServersResponse
70
- */
71
- listServers: (request: Readonly<ListServersRequest>) => Promise<ListServersResponse>;
72
- /**
73
- * List group alerts. List active and historical alerts for a specified autoscaling group.
74
- *
75
- * @param request - The request {@link ListAlertsRequest}
76
- * @returns A Promise of ListAlertsResponse
77
- */
78
- listAlerts: (request?: Readonly<ListAlertsRequest>) => Promise<ListAlertsResponse>;
79
- }
@@ -1,68 +0,0 @@
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
- Instances Autoscaling Groups management API.
10
- */
11
- var API = class extends API$1 {
12
- constructor(..._args) {
13
- super(..._args);
14
- this.listGroups = (request = {}) => this.client.fetch({
15
- method: "GET",
16
- path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/groups`,
17
- 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])
18
- }, unmarshalListGroupsResponse);
19
- this.getGroup = (request) => this.client.fetch({
20
- method: "GET",
21
- path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/groups/${validatePathParam("groupId", request.groupId)}`
22
- }, unmarshalGroup);
23
- this.waitForGroup = (request, options) => waitForResource(options?.stop ?? ((res) => Promise.resolve(!GROUP_GROUP_TRANSIENT_STATUSES.includes(res.status))), this.getGroup, request, options);
24
- this.createGroup = (request) => this.client.fetch({
25
- body: JSON.stringify(marshalCreateGroupRequest(request, this.client.settings)),
26
- headers: jsonContentHeaders,
27
- method: "POST",
28
- path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/groups`
29
- }, unmarshalGroup);
30
- this.updateGroup = (request) => this.client.fetch({
31
- body: JSON.stringify(marshalUpdateGroupRequest(request, this.client.settings)),
32
- headers: jsonContentHeaders,
33
- method: "PATCH",
34
- path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/groups/${validatePathParam("groupId", request.groupId)}`
35
- }, unmarshalGroup);
36
- this.deleteGroup = (request) => this.client.fetch({
37
- method: "DELETE",
38
- path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/groups/${validatePathParam("groupId", request.groupId)}`
39
- }, unmarshalGroup);
40
- this.listLogs = (request) => this.client.fetch({
41
- method: "GET",
42
- path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/logs`,
43
- 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])
44
- }, unmarshalListLogsResponse);
45
- this.listServers = (request) => this.client.fetch({
46
- method: "GET",
47
- path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/servers`,
48
- urlParams: urlParams(["group_id", request.groupId], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["page_token", request.pageToken])
49
- }, unmarshalListServersResponse);
50
- this.listAlerts = (request = {}) => this.client.fetch({
51
- method: "GET",
52
- path: `/autoscaling/v1alpha2/zones/${validatePathParam("zone", request.zone ?? this.client.settings.defaultZone)}/alerts`,
53
- urlParams: urlParams(["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["page_token", request.pageToken], ...Object.entries(resolveOneOf([{
54
- param: "group_id",
55
- value: request.groupId
56
- }, {
57
- default: this.client.settings.defaultProjectId,
58
- param: "project_id",
59
- value: request.projectId
60
- }])))
61
- }, unmarshalListAlertsResponse);
62
- }
63
- static {
64
- this.LOCALITY = toApiLocality({ zones: ["fr-par-1"] });
65
- }
66
- };
67
- //#endregion
68
- export { API };
@@ -1,3 +0,0 @@
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[];
@@ -1,11 +0,0 @@
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 };
@@ -1,5 +0,0 @@
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, 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';
@@ -1,20 +0,0 @@
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 };
@@ -1,9 +0,0 @@
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>;
@@ -1,197 +0,0 @@
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
- name: data.name,
99
- projectId: data.project_id,
100
- status: data.status,
101
- tags: data.tags,
102
- templateId: data.template_id,
103
- updatedAt: unmarshalDate(data.updated_at)
104
- };
105
- };
106
- const unmarshalListGroupsResponse = (data) => {
107
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListGroupsResponse' failed as data isn't a dictionary.`);
108
- return {
109
- groupSummaries: unmarshalArrayOfObject(data.group_summaries, unmarshalGroupSummary),
110
- nextPageToken: data.next_page_token,
111
- totalCount: data.total_count
112
- };
113
- };
114
- const unmarshalLog = (data) => {
115
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Log' failed as data isn't a dictionary.`);
116
- return {
117
- level: data.level,
118
- message: data.message,
119
- timestamp: unmarshalDate(data.timestamp)
120
- };
121
- };
122
- const unmarshalListLogsResponse = (data) => {
123
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListLogsResponse' failed as data isn't a dictionary.`);
124
- return {
125
- logs: unmarshalArrayOfObject(data.logs, unmarshalLog),
126
- nextPageToken: data.next_page_token,
127
- totalCount: data.total_count
128
- };
129
- };
130
- const unmarshalServer = (data) => {
131
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Server' failed as data isn't a dictionary.`);
132
- return { serverId: data.server_id };
133
- };
134
- const unmarshalListServersResponse = (data) => {
135
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListServersResponse' failed as data isn't a dictionary.`);
136
- return {
137
- nextPageToken: data.next_page_token,
138
- servers: unmarshalArrayOfObject(data.servers, unmarshalServer),
139
- totalCount: data.total_count
140
- };
141
- };
142
- const marshalLoadBalancerConfigurationSpecAutoHealing = (request, defaults) => ({
143
- enabled: request.enabled,
144
- grace_period: request.gracePeriod
145
- });
146
- const marshalLoadBalancerConfigurationSpecBackend = (request, defaults) => ({
147
- address_family: request.addressFamily,
148
- backend_id: request.backendId,
149
- private_network_id: request.privateNetworkId
150
- });
151
- const marshalGroupScalingPolicyScalingPolicyCpuTarget = (request, defaults) => ({ target_avg_percent: request.targetAvgPercent });
152
- const marshalGroupScalingPolicyScalingPolicyFixedSize = (request, defaults) => ({ size: request.size });
153
- const marshalGroupScalingPolicyScalingPolicyMemoryTarget = (request, defaults) => ({ target_avg_percent: request.targetAvgPercent });
154
- const marshalLoadBalancerConfigurationSpec = (request, defaults) => ({
155
- auto_healing: request.autoHealing !== void 0 ? marshalLoadBalancerConfigurationSpecAutoHealing(request.autoHealing, defaults) : void 0,
156
- backends: request.backends.map((elt) => marshalLoadBalancerConfigurationSpecBackend(elt, defaults)),
157
- load_balancer_id: request.loadBalancerId
158
- });
159
- const marshalScalingPolicySpec = (request, defaults) => ({
160
- maximum_size: request.maximumSize,
161
- minimum_size: request.minimumSize,
162
- scale_in_cooldown: request.scaleInCooldown,
163
- scale_in_step: request.scaleInStep,
164
- scale_out_cooldown: request.scaleOutCooldown,
165
- scale_out_step: request.scaleOutStep,
166
- ...resolveOneOf([
167
- {
168
- param: "fixed_size",
169
- value: request.fixedSize !== void 0 ? marshalGroupScalingPolicyScalingPolicyFixedSize(request.fixedSize, defaults) : void 0
170
- },
171
- {
172
- param: "cpu_target",
173
- value: request.cpuTarget !== void 0 ? marshalGroupScalingPolicyScalingPolicyCpuTarget(request.cpuTarget, defaults) : void 0
174
- },
175
- {
176
- param: "memory_target",
177
- value: request.memoryTarget !== void 0 ? marshalGroupScalingPolicyScalingPolicyMemoryTarget(request.memoryTarget, defaults) : void 0
178
- }
179
- ])
180
- });
181
- const marshalCreateGroupRequest = (request, defaults) => ({
182
- load_balancer_configuration_spec: request.loadBalancerConfigurationSpec !== void 0 ? marshalLoadBalancerConfigurationSpec(request.loadBalancerConfigurationSpec, defaults) : void 0,
183
- name: request.name,
184
- project_id: request.projectId ?? defaults.defaultProjectId,
185
- scaling_policy_spec: request.scalingPolicySpec !== void 0 ? marshalScalingPolicySpec(request.scalingPolicySpec, defaults) : void 0,
186
- tags: request.tags,
187
- template_id: request.templateId
188
- });
189
- const marshalUpdateGroupRequest = (request, defaults) => ({
190
- load_balancer_configuration_spec: request.loadBalancerConfigurationSpec !== void 0 ? marshalLoadBalancerConfigurationSpec(request.loadBalancerConfigurationSpec, defaults) : void 0,
191
- name: request.name,
192
- scaling_policy_spec: request.scalingPolicySpec !== void 0 ? marshalScalingPolicySpec(request.scalingPolicySpec, defaults) : void 0,
193
- tags: request.tags,
194
- template_id: request.templateId
195
- });
196
- //#endregion
197
- export { marshalCreateGroupRequest, marshalUpdateGroupRequest, unmarshalGroup, unmarshalListAlertsResponse, unmarshalListGroupsResponse, unmarshalListLogsResponse, unmarshalListServersResponse };