@scaleway/sdk-function 1.2.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.
- package/LICENSE +191 -0
- package/dist/index.gen.cjs +4 -0
- package/dist/index.gen.d.ts +5 -0
- package/dist/index.gen.js +4 -0
- package/dist/v1beta1/api.gen.cjs +642 -0
- package/dist/v1beta1/api.gen.d.ts +308 -0
- package/dist/v1beta1/api.gen.js +642 -0
- package/dist/v1beta1/content.gen.cjs +34 -0
- package/dist/v1beta1/content.gen.d.ts +13 -0
- package/dist/v1beta1/content.gen.js +34 -0
- package/dist/v1beta1/index.gen.cjs +39 -0
- package/dist/v1beta1/index.gen.d.ts +5 -0
- package/dist/v1beta1/index.gen.js +39 -0
- package/dist/v1beta1/marshalling.gen.cjs +470 -0
- package/dist/v1beta1/marshalling.gen.d.ts +27 -0
- package/dist/v1beta1/marshalling.gen.js +470 -0
- package/dist/v1beta1/types.gen.d.ts +1171 -0
- package/dist/v1beta1/validation-rules.gen.cjs +45 -0
- package/dist/v1beta1/validation-rules.gen.d.ts +39 -0
- package/dist/v1beta1/validation-rules.gen.js +45 -0
- package/package.json +51 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const CRON_TRANSIENT_STATUSES = [
|
|
2
|
+
"deleting",
|
|
3
|
+
"creating",
|
|
4
|
+
"pending"
|
|
5
|
+
];
|
|
6
|
+
const DOMAIN_TRANSIENT_STATUSES = [
|
|
7
|
+
"deleting",
|
|
8
|
+
"creating",
|
|
9
|
+
"pending"
|
|
10
|
+
];
|
|
11
|
+
const FUNCTION_TRANSIENT_STATUSES = [
|
|
12
|
+
"deleting",
|
|
13
|
+
"creating",
|
|
14
|
+
"pending"
|
|
15
|
+
];
|
|
16
|
+
const NAMESPACE_TRANSIENT_STATUSES = [
|
|
17
|
+
"deleting",
|
|
18
|
+
"creating",
|
|
19
|
+
"pending"
|
|
20
|
+
];
|
|
21
|
+
const TOKEN_TRANSIENT_STATUSES = ["deleting", "creating"];
|
|
22
|
+
const TRIGGER_TRANSIENT_STATUSES = [
|
|
23
|
+
"deleting",
|
|
24
|
+
"creating",
|
|
25
|
+
"pending"
|
|
26
|
+
];
|
|
27
|
+
export {
|
|
28
|
+
CRON_TRANSIENT_STATUSES,
|
|
29
|
+
DOMAIN_TRANSIENT_STATUSES,
|
|
30
|
+
FUNCTION_TRANSIENT_STATUSES,
|
|
31
|
+
NAMESPACE_TRANSIENT_STATUSES,
|
|
32
|
+
TOKEN_TRANSIENT_STATUSES,
|
|
33
|
+
TRIGGER_TRANSIENT_STATUSES
|
|
34
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const api_gen = require("./api.gen.cjs");
|
|
4
|
+
const content_gen = require("./content.gen.cjs");
|
|
5
|
+
const marshalling_gen = require("./marshalling.gen.cjs");
|
|
6
|
+
const validationRules_gen = require("./validation-rules.gen.cjs");
|
|
7
|
+
exports.API = api_gen.API;
|
|
8
|
+
exports.CRON_TRANSIENT_STATUSES = content_gen.CRON_TRANSIENT_STATUSES;
|
|
9
|
+
exports.DOMAIN_TRANSIENT_STATUSES = content_gen.DOMAIN_TRANSIENT_STATUSES;
|
|
10
|
+
exports.FUNCTION_TRANSIENT_STATUSES = content_gen.FUNCTION_TRANSIENT_STATUSES;
|
|
11
|
+
exports.NAMESPACE_TRANSIENT_STATUSES = content_gen.NAMESPACE_TRANSIENT_STATUSES;
|
|
12
|
+
exports.TOKEN_TRANSIENT_STATUSES = content_gen.TOKEN_TRANSIENT_STATUSES;
|
|
13
|
+
exports.TRIGGER_TRANSIENT_STATUSES = content_gen.TRIGGER_TRANSIENT_STATUSES;
|
|
14
|
+
exports.marshalCreateCronRequest = marshalling_gen.marshalCreateCronRequest;
|
|
15
|
+
exports.marshalCreateDomainRequest = marshalling_gen.marshalCreateDomainRequest;
|
|
16
|
+
exports.marshalCreateFunctionRequest = marshalling_gen.marshalCreateFunctionRequest;
|
|
17
|
+
exports.marshalCreateNamespaceRequest = marshalling_gen.marshalCreateNamespaceRequest;
|
|
18
|
+
exports.marshalCreateTokenRequest = marshalling_gen.marshalCreateTokenRequest;
|
|
19
|
+
exports.marshalCreateTriggerRequest = marshalling_gen.marshalCreateTriggerRequest;
|
|
20
|
+
exports.marshalUpdateCronRequest = marshalling_gen.marshalUpdateCronRequest;
|
|
21
|
+
exports.marshalUpdateFunctionRequest = marshalling_gen.marshalUpdateFunctionRequest;
|
|
22
|
+
exports.marshalUpdateNamespaceRequest = marshalling_gen.marshalUpdateNamespaceRequest;
|
|
23
|
+
exports.marshalUpdateTriggerRequest = marshalling_gen.marshalUpdateTriggerRequest;
|
|
24
|
+
exports.unmarshalCron = marshalling_gen.unmarshalCron;
|
|
25
|
+
exports.unmarshalDomain = marshalling_gen.unmarshalDomain;
|
|
26
|
+
exports.unmarshalDownloadURL = marshalling_gen.unmarshalDownloadURL;
|
|
27
|
+
exports.unmarshalFunction = marshalling_gen.unmarshalFunction;
|
|
28
|
+
exports.unmarshalListCronsResponse = marshalling_gen.unmarshalListCronsResponse;
|
|
29
|
+
exports.unmarshalListDomainsResponse = marshalling_gen.unmarshalListDomainsResponse;
|
|
30
|
+
exports.unmarshalListFunctionRuntimesResponse = marshalling_gen.unmarshalListFunctionRuntimesResponse;
|
|
31
|
+
exports.unmarshalListFunctionsResponse = marshalling_gen.unmarshalListFunctionsResponse;
|
|
32
|
+
exports.unmarshalListNamespacesResponse = marshalling_gen.unmarshalListNamespacesResponse;
|
|
33
|
+
exports.unmarshalListTokensResponse = marshalling_gen.unmarshalListTokensResponse;
|
|
34
|
+
exports.unmarshalListTriggersResponse = marshalling_gen.unmarshalListTriggersResponse;
|
|
35
|
+
exports.unmarshalNamespace = marshalling_gen.unmarshalNamespace;
|
|
36
|
+
exports.unmarshalToken = marshalling_gen.unmarshalToken;
|
|
37
|
+
exports.unmarshalTrigger = marshalling_gen.unmarshalTrigger;
|
|
38
|
+
exports.unmarshalUploadURL = marshalling_gen.unmarshalUploadURL;
|
|
39
|
+
exports.ValidationRules = validationRules_gen;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { API } from './api.gen';
|
|
2
|
+
export * from './content.gen';
|
|
3
|
+
export * from './marshalling.gen';
|
|
4
|
+
export type { CreateCronRequest, CreateDomainRequest, CreateFunctionRequest, CreateNamespaceRequest, CreateTokenRequest, CreateTriggerRequest, CreateTriggerRequestMnqNatsClientConfig, CreateTriggerRequestMnqSqsClientConfig, CreateTriggerRequestSqsClientConfig, Cron, CronStatus, DeleteCronRequest, DeleteDomainRequest, DeleteFunctionRequest, DeleteNamespaceRequest, DeleteTokenRequest, DeleteTriggerRequest, DeployFunctionRequest, Domain, DomainStatus, DownloadURL, Function, FunctionHttpOption, FunctionPrivacy, FunctionRuntime, FunctionSandbox, FunctionStatus, GetCronRequest, GetDomainRequest, GetFunctionDownloadURLRequest, GetFunctionRequest, GetFunctionUploadURLRequest, GetNamespaceRequest, GetTokenRequest, GetTriggerRequest, ListCronsRequest, ListCronsRequestOrderBy, ListCronsResponse, ListDomainsRequest, ListDomainsRequestOrderBy, ListDomainsResponse, ListFunctionRuntimesRequest, ListFunctionRuntimesResponse, ListFunctionsRequest, ListFunctionsRequestOrderBy, ListFunctionsResponse, ListNamespacesRequest, ListNamespacesRequestOrderBy, ListNamespacesResponse, ListTokensRequest, ListTokensRequestOrderBy, ListTokensResponse, ListTriggersRequest, ListTriggersRequestOrderBy, ListTriggersResponse, Namespace, NamespaceStatus, Runtime, RuntimeStatus, Secret, SecretHashedValue, Token, TokenStatus, Trigger, TriggerInputType, TriggerMnqNatsClientConfig, TriggerMnqSqsClientConfig, TriggerSqsClientConfig, TriggerStatus, UpdateCronRequest, UpdateFunctionRequest, UpdateNamespaceRequest, UpdateTriggerRequest, UpdateTriggerRequestSqsClientConfig, UploadURL, } from './types.gen';
|
|
5
|
+
export * as ValidationRules from './validation-rules.gen';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { API } from "./api.gen.js";
|
|
2
|
+
import { CRON_TRANSIENT_STATUSES, DOMAIN_TRANSIENT_STATUSES, FUNCTION_TRANSIENT_STATUSES, NAMESPACE_TRANSIENT_STATUSES, TOKEN_TRANSIENT_STATUSES, TRIGGER_TRANSIENT_STATUSES } from "./content.gen.js";
|
|
3
|
+
import { marshalCreateCronRequest, marshalCreateDomainRequest, marshalCreateFunctionRequest, marshalCreateNamespaceRequest, marshalCreateTokenRequest, marshalCreateTriggerRequest, marshalUpdateCronRequest, marshalUpdateFunctionRequest, marshalUpdateNamespaceRequest, marshalUpdateTriggerRequest, unmarshalCron, unmarshalDomain, unmarshalDownloadURL, unmarshalFunction, unmarshalListCronsResponse, unmarshalListDomainsResponse, unmarshalListFunctionRuntimesResponse, unmarshalListFunctionsResponse, unmarshalListNamespacesResponse, unmarshalListTokensResponse, unmarshalListTriggersResponse, unmarshalNamespace, unmarshalToken, unmarshalTrigger, unmarshalUploadURL } from "./marshalling.gen.js";
|
|
4
|
+
import * as validationRules_gen from "./validation-rules.gen.js";
|
|
5
|
+
export {
|
|
6
|
+
API,
|
|
7
|
+
CRON_TRANSIENT_STATUSES,
|
|
8
|
+
DOMAIN_TRANSIENT_STATUSES,
|
|
9
|
+
FUNCTION_TRANSIENT_STATUSES,
|
|
10
|
+
NAMESPACE_TRANSIENT_STATUSES,
|
|
11
|
+
TOKEN_TRANSIENT_STATUSES,
|
|
12
|
+
TRIGGER_TRANSIENT_STATUSES,
|
|
13
|
+
validationRules_gen as ValidationRules,
|
|
14
|
+
marshalCreateCronRequest,
|
|
15
|
+
marshalCreateDomainRequest,
|
|
16
|
+
marshalCreateFunctionRequest,
|
|
17
|
+
marshalCreateNamespaceRequest,
|
|
18
|
+
marshalCreateTokenRequest,
|
|
19
|
+
marshalCreateTriggerRequest,
|
|
20
|
+
marshalUpdateCronRequest,
|
|
21
|
+
marshalUpdateFunctionRequest,
|
|
22
|
+
marshalUpdateNamespaceRequest,
|
|
23
|
+
marshalUpdateTriggerRequest,
|
|
24
|
+
unmarshalCron,
|
|
25
|
+
unmarshalDomain,
|
|
26
|
+
unmarshalDownloadURL,
|
|
27
|
+
unmarshalFunction,
|
|
28
|
+
unmarshalListCronsResponse,
|
|
29
|
+
unmarshalListDomainsResponse,
|
|
30
|
+
unmarshalListFunctionRuntimesResponse,
|
|
31
|
+
unmarshalListFunctionsResponse,
|
|
32
|
+
unmarshalListNamespacesResponse,
|
|
33
|
+
unmarshalListTokensResponse,
|
|
34
|
+
unmarshalListTriggersResponse,
|
|
35
|
+
unmarshalNamespace,
|
|
36
|
+
unmarshalToken,
|
|
37
|
+
unmarshalTrigger,
|
|
38
|
+
unmarshalUploadURL
|
|
39
|
+
};
|
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const randomName = require("@scaleway/random-name");
|
|
4
|
+
const sdkClient = require("@scaleway/sdk-client");
|
|
5
|
+
const unmarshalCron = (data) => {
|
|
6
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
7
|
+
throw new TypeError(
|
|
8
|
+
`Unmarshalling the type 'Cron' failed as data isn't a dictionary.`
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
args: data.args,
|
|
13
|
+
functionId: data.function_id,
|
|
14
|
+
id: data.id,
|
|
15
|
+
name: data.name,
|
|
16
|
+
schedule: data.schedule,
|
|
17
|
+
status: data.status
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
const unmarshalDomain = (data) => {
|
|
21
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
22
|
+
throw new TypeError(
|
|
23
|
+
`Unmarshalling the type 'Domain' failed as data isn't a dictionary.`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
errorMessage: data.error_message,
|
|
28
|
+
functionId: data.function_id,
|
|
29
|
+
hostname: data.hostname,
|
|
30
|
+
id: data.id,
|
|
31
|
+
status: data.status,
|
|
32
|
+
url: data.url
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const unmarshalSecretHashedValue = (data) => {
|
|
36
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
37
|
+
throw new TypeError(
|
|
38
|
+
`Unmarshalling the type 'SecretHashedValue' failed as data isn't a dictionary.`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
hashedValue: data.hashed_value,
|
|
43
|
+
key: data.key
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
const unmarshalFunction = (data) => {
|
|
47
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
48
|
+
throw new TypeError(
|
|
49
|
+
`Unmarshalling the type 'Function' failed as data isn't a dictionary.`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
buildMessage: data.build_message,
|
|
54
|
+
cpuLimit: data.cpu_limit,
|
|
55
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
56
|
+
description: data.description,
|
|
57
|
+
domainName: data.domain_name,
|
|
58
|
+
environmentVariables: data.environment_variables,
|
|
59
|
+
errorMessage: data.error_message,
|
|
60
|
+
handler: data.handler,
|
|
61
|
+
httpOption: data.http_option,
|
|
62
|
+
id: data.id,
|
|
63
|
+
maxScale: data.max_scale,
|
|
64
|
+
memoryLimit: data.memory_limit,
|
|
65
|
+
minScale: data.min_scale,
|
|
66
|
+
name: data.name,
|
|
67
|
+
namespaceId: data.namespace_id,
|
|
68
|
+
privacy: data.privacy,
|
|
69
|
+
readyAt: sdkClient.unmarshalDate(data.ready_at),
|
|
70
|
+
region: data.region,
|
|
71
|
+
runtime: data.runtime,
|
|
72
|
+
runtimeMessage: data.runtime_message,
|
|
73
|
+
sandbox: data.sandbox,
|
|
74
|
+
secretEnvironmentVariables: sdkClient.unmarshalArrayOfObject(
|
|
75
|
+
data.secret_environment_variables,
|
|
76
|
+
unmarshalSecretHashedValue
|
|
77
|
+
),
|
|
78
|
+
status: data.status,
|
|
79
|
+
tags: data.tags,
|
|
80
|
+
timeout: data.timeout,
|
|
81
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at)
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const unmarshalNamespace = (data) => {
|
|
85
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
86
|
+
throw new TypeError(
|
|
87
|
+
`Unmarshalling the type 'Namespace' failed as data isn't a dictionary.`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
createdAt: sdkClient.unmarshalDate(data.created_at),
|
|
92
|
+
description: data.description,
|
|
93
|
+
environmentVariables: data.environment_variables,
|
|
94
|
+
errorMessage: data.error_message,
|
|
95
|
+
id: data.id,
|
|
96
|
+
name: data.name,
|
|
97
|
+
organizationId: data.organization_id,
|
|
98
|
+
projectId: data.project_id,
|
|
99
|
+
region: data.region,
|
|
100
|
+
registryEndpoint: data.registry_endpoint,
|
|
101
|
+
registryNamespaceId: data.registry_namespace_id,
|
|
102
|
+
secretEnvironmentVariables: sdkClient.unmarshalArrayOfObject(
|
|
103
|
+
data.secret_environment_variables,
|
|
104
|
+
unmarshalSecretHashedValue
|
|
105
|
+
),
|
|
106
|
+
status: data.status,
|
|
107
|
+
tags: data.tags,
|
|
108
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at)
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const unmarshalToken = (data) => {
|
|
112
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
113
|
+
throw new TypeError(
|
|
114
|
+
`Unmarshalling the type 'Token' failed as data isn't a dictionary.`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
description: data.description,
|
|
119
|
+
expiresAt: sdkClient.unmarshalDate(data.expires_at),
|
|
120
|
+
functionId: data.function_id,
|
|
121
|
+
id: data.id,
|
|
122
|
+
namespaceId: data.namespace_id,
|
|
123
|
+
publicKey: data.public_key,
|
|
124
|
+
status: data.status,
|
|
125
|
+
token: data.token
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const unmarshalTriggerMnqNatsClientConfig = (data) => {
|
|
129
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
130
|
+
throw new TypeError(
|
|
131
|
+
`Unmarshalling the type 'TriggerMnqNatsClientConfig' failed as data isn't a dictionary.`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
mnqCredentialId: data.mnq_credential_id,
|
|
136
|
+
mnqNatsAccountId: data.mnq_nats_account_id,
|
|
137
|
+
mnqProjectId: data.mnq_project_id,
|
|
138
|
+
mnqRegion: data.mnq_region,
|
|
139
|
+
subject: data.subject
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
const unmarshalTriggerMnqSqsClientConfig = (data) => {
|
|
143
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
144
|
+
throw new TypeError(
|
|
145
|
+
`Unmarshalling the type 'TriggerMnqSqsClientConfig' failed as data isn't a dictionary.`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
mnqCredentialId: data.mnq_credential_id,
|
|
150
|
+
mnqProjectId: data.mnq_project_id,
|
|
151
|
+
mnqRegion: data.mnq_region,
|
|
152
|
+
queue: data.queue
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
const unmarshalTriggerSqsClientConfig = (data) => {
|
|
156
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
157
|
+
throw new TypeError(
|
|
158
|
+
`Unmarshalling the type 'TriggerSqsClientConfig' failed as data isn't a dictionary.`
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
accessKey: data.access_key,
|
|
163
|
+
endpoint: data.endpoint,
|
|
164
|
+
queueUrl: data.queue_url,
|
|
165
|
+
secretKey: data.secret_key
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
const unmarshalTrigger = (data) => {
|
|
169
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
170
|
+
throw new TypeError(
|
|
171
|
+
`Unmarshalling the type 'Trigger' failed as data isn't a dictionary.`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
description: data.description,
|
|
176
|
+
errorMessage: data.error_message,
|
|
177
|
+
functionId: data.function_id,
|
|
178
|
+
id: data.id,
|
|
179
|
+
inputType: data.input_type,
|
|
180
|
+
name: data.name,
|
|
181
|
+
scwNatsConfig: data.scw_nats_config ? unmarshalTriggerMnqNatsClientConfig(data.scw_nats_config) : void 0,
|
|
182
|
+
scwSqsConfig: data.scw_sqs_config ? unmarshalTriggerMnqSqsClientConfig(data.scw_sqs_config) : void 0,
|
|
183
|
+
sqsConfig: data.sqs_config ? unmarshalTriggerSqsClientConfig(data.sqs_config) : void 0,
|
|
184
|
+
status: data.status
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
const unmarshalDownloadURL = (data) => {
|
|
188
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
189
|
+
throw new TypeError(
|
|
190
|
+
`Unmarshalling the type 'DownloadURL' failed as data isn't a dictionary.`
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
headers: data.headers,
|
|
195
|
+
url: data.url
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
const unmarshalListCronsResponse = (data) => {
|
|
199
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
200
|
+
throw new TypeError(
|
|
201
|
+
`Unmarshalling the type 'ListCronsResponse' failed as data isn't a dictionary.`
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
crons: sdkClient.unmarshalArrayOfObject(data.crons, unmarshalCron),
|
|
206
|
+
totalCount: data.total_count
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
const unmarshalListDomainsResponse = (data) => {
|
|
210
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
211
|
+
throw new TypeError(
|
|
212
|
+
`Unmarshalling the type 'ListDomainsResponse' failed as data isn't a dictionary.`
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
domains: sdkClient.unmarshalArrayOfObject(data.domains, unmarshalDomain),
|
|
217
|
+
totalCount: data.total_count
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
const unmarshalRuntime = (data) => {
|
|
221
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
222
|
+
throw new TypeError(
|
|
223
|
+
`Unmarshalling the type 'Runtime' failed as data isn't a dictionary.`
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
codeSample: data.code_sample,
|
|
228
|
+
defaultHandler: data.default_handler,
|
|
229
|
+
extension: data.extension,
|
|
230
|
+
implementation: data.implementation,
|
|
231
|
+
language: data.language,
|
|
232
|
+
logoUrl: data.logo_url,
|
|
233
|
+
name: data.name,
|
|
234
|
+
status: data.status,
|
|
235
|
+
statusMessage: data.status_message,
|
|
236
|
+
version: data.version
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
const unmarshalListFunctionRuntimesResponse = (data) => {
|
|
240
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
241
|
+
throw new TypeError(
|
|
242
|
+
`Unmarshalling the type 'ListFunctionRuntimesResponse' failed as data isn't a dictionary.`
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
runtimes: sdkClient.unmarshalArrayOfObject(data.runtimes, unmarshalRuntime),
|
|
247
|
+
totalCount: data.total_count
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
const unmarshalListFunctionsResponse = (data) => {
|
|
251
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
252
|
+
throw new TypeError(
|
|
253
|
+
`Unmarshalling the type 'ListFunctionsResponse' failed as data isn't a dictionary.`
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
return {
|
|
257
|
+
functions: sdkClient.unmarshalArrayOfObject(data.functions, unmarshalFunction),
|
|
258
|
+
totalCount: data.total_count
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
const unmarshalListNamespacesResponse = (data) => {
|
|
262
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
263
|
+
throw new TypeError(
|
|
264
|
+
`Unmarshalling the type 'ListNamespacesResponse' failed as data isn't a dictionary.`
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
return {
|
|
268
|
+
namespaces: sdkClient.unmarshalArrayOfObject(data.namespaces, unmarshalNamespace),
|
|
269
|
+
totalCount: data.total_count
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
const unmarshalListTokensResponse = (data) => {
|
|
273
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
274
|
+
throw new TypeError(
|
|
275
|
+
`Unmarshalling the type 'ListTokensResponse' failed as data isn't a dictionary.`
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
tokens: sdkClient.unmarshalArrayOfObject(data.tokens, unmarshalToken),
|
|
280
|
+
totalCount: data.total_count
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
const unmarshalListTriggersResponse = (data) => {
|
|
284
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
285
|
+
throw new TypeError(
|
|
286
|
+
`Unmarshalling the type 'ListTriggersResponse' failed as data isn't a dictionary.`
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
return {
|
|
290
|
+
totalCount: data.total_count,
|
|
291
|
+
triggers: sdkClient.unmarshalArrayOfObject(data.triggers, unmarshalTrigger)
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
const unmarshalUploadURL = (data) => {
|
|
295
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
296
|
+
throw new TypeError(
|
|
297
|
+
`Unmarshalling the type 'UploadURL' failed as data isn't a dictionary.`
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
return {
|
|
301
|
+
headers: data.headers,
|
|
302
|
+
url: data.url
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
const marshalCreateCronRequest = (request, defaults) => ({
|
|
306
|
+
args: request.args,
|
|
307
|
+
function_id: request.functionId,
|
|
308
|
+
name: request.name,
|
|
309
|
+
schedule: request.schedule
|
|
310
|
+
});
|
|
311
|
+
const marshalCreateDomainRequest = (request, defaults) => ({
|
|
312
|
+
function_id: request.functionId,
|
|
313
|
+
hostname: request.hostname
|
|
314
|
+
});
|
|
315
|
+
const marshalSecret = (request, defaults) => ({
|
|
316
|
+
key: request.key,
|
|
317
|
+
value: request.value
|
|
318
|
+
});
|
|
319
|
+
const marshalCreateFunctionRequest = (request, defaults) => ({
|
|
320
|
+
description: request.description,
|
|
321
|
+
environment_variables: request.environmentVariables,
|
|
322
|
+
handler: request.handler,
|
|
323
|
+
http_option: request.httpOption,
|
|
324
|
+
max_scale: request.maxScale,
|
|
325
|
+
memory_limit: request.memoryLimit,
|
|
326
|
+
min_scale: request.minScale,
|
|
327
|
+
name: request.name || randomName("fn"),
|
|
328
|
+
namespace_id: request.namespaceId,
|
|
329
|
+
privacy: request.privacy,
|
|
330
|
+
runtime: request.runtime,
|
|
331
|
+
sandbox: request.sandbox,
|
|
332
|
+
secret_environment_variables: request.secretEnvironmentVariables !== void 0 ? request.secretEnvironmentVariables.map(
|
|
333
|
+
(elt) => marshalSecret(elt)
|
|
334
|
+
) : void 0,
|
|
335
|
+
tags: request.tags,
|
|
336
|
+
timeout: request.timeout
|
|
337
|
+
});
|
|
338
|
+
const marshalCreateNamespaceRequest = (request, defaults) => ({
|
|
339
|
+
description: request.description,
|
|
340
|
+
environment_variables: request.environmentVariables,
|
|
341
|
+
name: request.name || randomName("ns"),
|
|
342
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
343
|
+
secret_environment_variables: request.secretEnvironmentVariables !== void 0 ? request.secretEnvironmentVariables.map(
|
|
344
|
+
(elt) => marshalSecret(elt)
|
|
345
|
+
) : void 0,
|
|
346
|
+
tags: request.tags
|
|
347
|
+
});
|
|
348
|
+
const marshalCreateTokenRequest = (request, defaults) => ({
|
|
349
|
+
description: request.description,
|
|
350
|
+
expires_at: request.expiresAt,
|
|
351
|
+
...sdkClient.resolveOneOf([
|
|
352
|
+
{ param: "function_id", value: request.functionId },
|
|
353
|
+
{ param: "namespace_id", value: request.namespaceId }
|
|
354
|
+
])
|
|
355
|
+
});
|
|
356
|
+
const marshalCreateTriggerRequestMnqNatsClientConfig = (request, defaults) => ({
|
|
357
|
+
mnq_nats_account_id: request.mnqNatsAccountId,
|
|
358
|
+
mnq_project_id: request.mnqProjectId,
|
|
359
|
+
mnq_region: request.mnqRegion,
|
|
360
|
+
subject: request.subject
|
|
361
|
+
});
|
|
362
|
+
const marshalCreateTriggerRequestMnqSqsClientConfig = (request, defaults) => ({
|
|
363
|
+
mnq_project_id: request.mnqProjectId,
|
|
364
|
+
mnq_region: request.mnqRegion,
|
|
365
|
+
queue: request.queue
|
|
366
|
+
});
|
|
367
|
+
const marshalCreateTriggerRequestSqsClientConfig = (request, defaults) => ({
|
|
368
|
+
access_key: request.accessKey,
|
|
369
|
+
endpoint: request.endpoint,
|
|
370
|
+
queue_url: request.queueUrl,
|
|
371
|
+
secret_key: request.secretKey
|
|
372
|
+
});
|
|
373
|
+
const marshalCreateTriggerRequest = (request, defaults) => ({
|
|
374
|
+
description: request.description,
|
|
375
|
+
function_id: request.functionId,
|
|
376
|
+
name: request.name,
|
|
377
|
+
...sdkClient.resolveOneOf([
|
|
378
|
+
{
|
|
379
|
+
param: "scw_sqs_config",
|
|
380
|
+
value: request.scwSqsConfig !== void 0 ? marshalCreateTriggerRequestMnqSqsClientConfig(
|
|
381
|
+
request.scwSqsConfig
|
|
382
|
+
) : void 0
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
param: "scw_nats_config",
|
|
386
|
+
value: request.scwNatsConfig !== void 0 ? marshalCreateTriggerRequestMnqNatsClientConfig(
|
|
387
|
+
request.scwNatsConfig
|
|
388
|
+
) : void 0
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
param: "sqs_config",
|
|
392
|
+
value: request.sqsConfig !== void 0 ? marshalCreateTriggerRequestSqsClientConfig(
|
|
393
|
+
request.sqsConfig
|
|
394
|
+
) : void 0
|
|
395
|
+
}
|
|
396
|
+
])
|
|
397
|
+
});
|
|
398
|
+
const marshalUpdateCronRequest = (request, defaults) => ({
|
|
399
|
+
args: request.args,
|
|
400
|
+
function_id: request.functionId,
|
|
401
|
+
name: request.name,
|
|
402
|
+
schedule: request.schedule
|
|
403
|
+
});
|
|
404
|
+
const marshalUpdateFunctionRequest = (request, defaults) => ({
|
|
405
|
+
description: request.description,
|
|
406
|
+
environment_variables: request.environmentVariables,
|
|
407
|
+
handler: request.handler,
|
|
408
|
+
http_option: request.httpOption,
|
|
409
|
+
max_scale: request.maxScale,
|
|
410
|
+
memory_limit: request.memoryLimit,
|
|
411
|
+
min_scale: request.minScale,
|
|
412
|
+
privacy: request.privacy,
|
|
413
|
+
redeploy: request.redeploy,
|
|
414
|
+
runtime: request.runtime,
|
|
415
|
+
sandbox: request.sandbox,
|
|
416
|
+
secret_environment_variables: request.secretEnvironmentVariables !== void 0 ? request.secretEnvironmentVariables.map(
|
|
417
|
+
(elt) => marshalSecret(elt)
|
|
418
|
+
) : void 0,
|
|
419
|
+
tags: request.tags,
|
|
420
|
+
timeout: request.timeout
|
|
421
|
+
});
|
|
422
|
+
const marshalUpdateNamespaceRequest = (request, defaults) => ({
|
|
423
|
+
description: request.description,
|
|
424
|
+
environment_variables: request.environmentVariables,
|
|
425
|
+
secret_environment_variables: request.secretEnvironmentVariables !== void 0 ? request.secretEnvironmentVariables.map(
|
|
426
|
+
(elt) => marshalSecret(elt)
|
|
427
|
+
) : void 0,
|
|
428
|
+
tags: request.tags
|
|
429
|
+
});
|
|
430
|
+
const marshalUpdateTriggerRequestSqsClientConfig = (request, defaults) => ({
|
|
431
|
+
access_key: request.accessKey,
|
|
432
|
+
secret_key: request.secretKey
|
|
433
|
+
});
|
|
434
|
+
const marshalUpdateTriggerRequest = (request, defaults) => ({
|
|
435
|
+
description: request.description,
|
|
436
|
+
name: request.name,
|
|
437
|
+
...sdkClient.resolveOneOf([
|
|
438
|
+
{
|
|
439
|
+
param: "sqs_config",
|
|
440
|
+
value: request.sqsConfig !== void 0 ? marshalUpdateTriggerRequestSqsClientConfig(
|
|
441
|
+
request.sqsConfig
|
|
442
|
+
) : void 0
|
|
443
|
+
}
|
|
444
|
+
])
|
|
445
|
+
});
|
|
446
|
+
exports.marshalCreateCronRequest = marshalCreateCronRequest;
|
|
447
|
+
exports.marshalCreateDomainRequest = marshalCreateDomainRequest;
|
|
448
|
+
exports.marshalCreateFunctionRequest = marshalCreateFunctionRequest;
|
|
449
|
+
exports.marshalCreateNamespaceRequest = marshalCreateNamespaceRequest;
|
|
450
|
+
exports.marshalCreateTokenRequest = marshalCreateTokenRequest;
|
|
451
|
+
exports.marshalCreateTriggerRequest = marshalCreateTriggerRequest;
|
|
452
|
+
exports.marshalUpdateCronRequest = marshalUpdateCronRequest;
|
|
453
|
+
exports.marshalUpdateFunctionRequest = marshalUpdateFunctionRequest;
|
|
454
|
+
exports.marshalUpdateNamespaceRequest = marshalUpdateNamespaceRequest;
|
|
455
|
+
exports.marshalUpdateTriggerRequest = marshalUpdateTriggerRequest;
|
|
456
|
+
exports.unmarshalCron = unmarshalCron;
|
|
457
|
+
exports.unmarshalDomain = unmarshalDomain;
|
|
458
|
+
exports.unmarshalDownloadURL = unmarshalDownloadURL;
|
|
459
|
+
exports.unmarshalFunction = unmarshalFunction;
|
|
460
|
+
exports.unmarshalListCronsResponse = unmarshalListCronsResponse;
|
|
461
|
+
exports.unmarshalListDomainsResponse = unmarshalListDomainsResponse;
|
|
462
|
+
exports.unmarshalListFunctionRuntimesResponse = unmarshalListFunctionRuntimesResponse;
|
|
463
|
+
exports.unmarshalListFunctionsResponse = unmarshalListFunctionsResponse;
|
|
464
|
+
exports.unmarshalListNamespacesResponse = unmarshalListNamespacesResponse;
|
|
465
|
+
exports.unmarshalListTokensResponse = unmarshalListTokensResponse;
|
|
466
|
+
exports.unmarshalListTriggersResponse = unmarshalListTriggersResponse;
|
|
467
|
+
exports.unmarshalNamespace = unmarshalNamespace;
|
|
468
|
+
exports.unmarshalToken = unmarshalToken;
|
|
469
|
+
exports.unmarshalTrigger = unmarshalTrigger;
|
|
470
|
+
exports.unmarshalUploadURL = unmarshalUploadURL;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DefaultValues } from '@scaleway/sdk-client';
|
|
2
|
+
import type { CreateCronRequest, CreateDomainRequest, CreateFunctionRequest, CreateNamespaceRequest, CreateTokenRequest, CreateTriggerRequest, Cron, Domain, DownloadURL, Function, ListCronsResponse, ListDomainsResponse, ListFunctionRuntimesResponse, ListFunctionsResponse, ListNamespacesResponse, ListTokensResponse, ListTriggersResponse, Namespace, Token, Trigger, UpdateCronRequest, UpdateFunctionRequest, UpdateNamespaceRequest, UpdateTriggerRequest, UploadURL } from './types.gen';
|
|
3
|
+
export declare const unmarshalCron: (data: unknown) => Cron;
|
|
4
|
+
export declare const unmarshalDomain: (data: unknown) => Domain;
|
|
5
|
+
export declare const unmarshalFunction: (data: unknown) => Function;
|
|
6
|
+
export declare const unmarshalNamespace: (data: unknown) => Namespace;
|
|
7
|
+
export declare const unmarshalToken: (data: unknown) => Token;
|
|
8
|
+
export declare const unmarshalTrigger: (data: unknown) => Trigger;
|
|
9
|
+
export declare const unmarshalDownloadURL: (data: unknown) => DownloadURL;
|
|
10
|
+
export declare const unmarshalListCronsResponse: (data: unknown) => ListCronsResponse;
|
|
11
|
+
export declare const unmarshalListDomainsResponse: (data: unknown) => ListDomainsResponse;
|
|
12
|
+
export declare const unmarshalListFunctionRuntimesResponse: (data: unknown) => ListFunctionRuntimesResponse;
|
|
13
|
+
export declare const unmarshalListFunctionsResponse: (data: unknown) => ListFunctionsResponse;
|
|
14
|
+
export declare const unmarshalListNamespacesResponse: (data: unknown) => ListNamespacesResponse;
|
|
15
|
+
export declare const unmarshalListTokensResponse: (data: unknown) => ListTokensResponse;
|
|
16
|
+
export declare const unmarshalListTriggersResponse: (data: unknown) => ListTriggersResponse;
|
|
17
|
+
export declare const unmarshalUploadURL: (data: unknown) => UploadURL;
|
|
18
|
+
export declare const marshalCreateCronRequest: (request: CreateCronRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
19
|
+
export declare const marshalCreateDomainRequest: (request: CreateDomainRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
20
|
+
export declare const marshalCreateFunctionRequest: (request: CreateFunctionRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
21
|
+
export declare const marshalCreateNamespaceRequest: (request: CreateNamespaceRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
22
|
+
export declare const marshalCreateTokenRequest: (request: CreateTokenRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
23
|
+
export declare const marshalCreateTriggerRequest: (request: CreateTriggerRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
24
|
+
export declare const marshalUpdateCronRequest: (request: UpdateCronRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
25
|
+
export declare const marshalUpdateFunctionRequest: (request: UpdateFunctionRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
26
|
+
export declare const marshalUpdateNamespaceRequest: (request: UpdateNamespaceRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
27
|
+
export declare const marshalUpdateTriggerRequest: (request: UpdateTriggerRequest, defaults: DefaultValues) => Record<string, unknown>;
|