@scaleway/sdk 2.49.0 → 2.50.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 (47) hide show
  1. package/dist/api/baremetal/index.gen.cjs +2 -0
  2. package/dist/api/baremetal/index.gen.d.ts +1 -0
  3. package/dist/api/baremetal/index.gen.js +3 -1
  4. package/dist/api/baremetal/v3/api.gen.cjs +109 -0
  5. package/dist/api/baremetal/v3/api.gen.d.ts +46 -0
  6. package/dist/api/baremetal/v3/api.gen.js +109 -0
  7. package/dist/api/baremetal/v3/content.gen.cjs +4 -0
  8. package/dist/api/baremetal/v3/content.gen.d.ts +3 -0
  9. package/dist/api/baremetal/v3/content.gen.js +4 -0
  10. package/dist/api/baremetal/v3/index.gen.cjs +6 -0
  11. package/dist/api/baremetal/v3/index.gen.d.ts +3 -0
  12. package/dist/api/baremetal/v3/index.gen.js +6 -0
  13. package/dist/api/baremetal/v3/marshalling.gen.cjs +62 -0
  14. package/dist/api/baremetal/v3/marshalling.gen.d.ts +7 -0
  15. package/dist/api/baremetal/v3/marshalling.gen.js +62 -0
  16. package/dist/api/baremetal/v3/types.gen.d.ts +82 -0
  17. package/dist/api/dedibox/v1/types.gen.d.ts +1 -1
  18. package/dist/api/edge_services/v1alpha1/api.gen.cjs +14 -0
  19. package/dist/api/edge_services/v1alpha1/api.gen.d.ts +9 -1
  20. package/dist/api/edge_services/v1alpha1/api.gen.js +15 -1
  21. package/dist/api/edge_services/v1alpha1/index.gen.d.ts +1 -1
  22. package/dist/api/edge_services/v1alpha1/marshalling.gen.cjs +31 -13
  23. package/dist/api/edge_services/v1alpha1/marshalling.gen.d.ts +2 -1
  24. package/dist/api/edge_services/v1alpha1/marshalling.gen.js +31 -13
  25. package/dist/api/edge_services/v1alpha1/types.gen.d.ts +28 -1
  26. package/dist/api/iam/v1alpha1/marshalling.gen.cjs +8 -0
  27. package/dist/api/iam/v1alpha1/marshalling.gen.js +8 -0
  28. package/dist/api/iam/v1alpha1/types.gen.d.ts +16 -0
  29. package/dist/api/jobs/v1alpha1/api.gen.cjs +46 -0
  30. package/dist/api/jobs/v1alpha1/api.gen.d.ts +6 -1
  31. package/dist/api/jobs/v1alpha1/api.gen.js +47 -1
  32. package/dist/api/jobs/v1alpha1/index.gen.d.ts +1 -1
  33. package/dist/api/jobs/v1alpha1/marshalling.gen.cjs +80 -0
  34. package/dist/api/jobs/v1alpha1/marshalling.gen.d.ts +6 -1
  35. package/dist/api/jobs/v1alpha1/marshalling.gen.js +81 -1
  36. package/dist/api/jobs/v1alpha1/types.gen.d.ts +81 -0
  37. package/dist/api/jobs/v1alpha1/validation-rules.gen.cjs +12 -0
  38. package/dist/api/jobs/v1alpha1/validation-rules.gen.d.ts +10 -0
  39. package/dist/api/jobs/v1alpha1/validation-rules.gen.js +13 -1
  40. package/dist/api/tem/v1alpha1/index.gen.d.ts +1 -1
  41. package/dist/api/tem/v1alpha1/marshalling.gen.cjs +13 -0
  42. package/dist/api/tem/v1alpha1/marshalling.gen.js +13 -0
  43. package/dist/api/tem/v1alpha1/types.gen.d.ts +13 -2
  44. package/dist/scw/constants.cjs +1 -1
  45. package/dist/scw/constants.d.ts +2 -2
  46. package/dist/scw/constants.js +1 -1
  47. package/package.json +2 -2
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const json = require("../../../helpers/json.cjs");
4
+ const customMarshalling = require("../../../scw/custom-marshalling.cjs");
4
5
  const marshalling = require("../../../helpers/marshalling.cjs");
5
- require("../../../vendor/base64/index.cjs");
6
6
  const unmarshalScalewayLb = (data) => {
7
7
  if (!json.isJSONObject(data)) {
8
8
  throw new TypeError(
@@ -199,6 +199,35 @@ const unmarshalCheckPEMChainResponse = (data) => {
199
199
  isValid: data.is_valid
200
200
  };
201
201
  };
202
+ const unmarshalPlanDetails = (data) => {
203
+ if (!json.isJSONObject(data)) {
204
+ throw new TypeError(
205
+ `Unmarshalling the type 'PlanDetails' failed as data isn't a dictionary.`
206
+ );
207
+ }
208
+ return {
209
+ packageGb: data.package_gb,
210
+ pipelineLimit: data.pipeline_limit,
211
+ planName: data.plan_name
212
+ };
213
+ };
214
+ const unmarshalGetBillingResponse = (data) => {
215
+ if (!json.isJSONObject(data)) {
216
+ throw new TypeError(
217
+ `Unmarshalling the type 'GetBillingResponse' failed as data isn't a dictionary.`
218
+ );
219
+ }
220
+ return {
221
+ currentPlan: data.current_plan ? unmarshalPlanDetails(data.current_plan) : void 0,
222
+ currentPlanCacheUsage: data.current_plan_cache_usage,
223
+ extraCacheCost: data.extra_cache_cost ? customMarshalling.unmarshalMoney(data.extra_cache_cost) : void 0,
224
+ extraCacheUsage: data.extra_cache_usage,
225
+ extraPipelinesCost: data.extra_pipelines_cost ? customMarshalling.unmarshalMoney(data.extra_pipelines_cost) : void 0,
226
+ pipelineNumber: data.pipeline_number,
227
+ planCost: data.plan_cost ? customMarshalling.unmarshalMoney(data.plan_cost) : void 0,
228
+ totalCost: data.total_cost ? customMarshalling.unmarshalMoney(data.total_cost) : void 0
229
+ };
230
+ };
202
231
  const unmarshalListBackendStagesResponse = (data) => {
203
232
  if (!json.isJSONObject(data)) {
204
233
  throw new TypeError(
@@ -243,18 +272,6 @@ const unmarshalListPipelinesResponse = (data) => {
243
272
  totalCount: data.total_count
244
273
  };
245
274
  };
246
- const unmarshalPlanDetails = (data) => {
247
- if (!json.isJSONObject(data)) {
248
- throw new TypeError(
249
- `Unmarshalling the type 'PlanDetails' failed as data isn't a dictionary.`
250
- );
251
- }
252
- return {
253
- packageGb: data.package_gb,
254
- pipelineLimit: data.pipeline_limit,
255
- planName: data.plan_name
256
- };
257
- };
258
275
  const unmarshalListPlansResponse = (data) => {
259
276
  if (!json.isJSONObject(data)) {
260
277
  throw new TypeError(
@@ -461,6 +478,7 @@ exports.unmarshalCheckDomainResponse = unmarshalCheckDomainResponse;
461
478
  exports.unmarshalCheckLbOriginResponse = unmarshalCheckLbOriginResponse;
462
479
  exports.unmarshalCheckPEMChainResponse = unmarshalCheckPEMChainResponse;
463
480
  exports.unmarshalDNSStage = unmarshalDNSStage;
481
+ exports.unmarshalGetBillingResponse = unmarshalGetBillingResponse;
464
482
  exports.unmarshalListBackendStagesResponse = unmarshalListBackendStagesResponse;
465
483
  exports.unmarshalListCacheStagesResponse = unmarshalListCacheStagesResponse;
466
484
  exports.unmarshalListDNSStagesResponse = unmarshalListDNSStagesResponse;
@@ -1,5 +1,5 @@
1
1
  import type { DefaultValues } from '../../../bridge';
2
- import type { BackendStage, CacheStage, CheckDomainRequest, CheckDomainResponse, CheckLbOriginRequest, CheckLbOriginResponse, CheckPEMChainRequest, CheckPEMChainResponse, CreateBackendStageRequest, CreateCacheStageRequest, CreateDNSStageRequest, CreatePipelineRequest, CreatePurgeRequestRequest, CreateTLSStageRequest, DNSStage, ListBackendStagesResponse, ListCacheStagesResponse, ListDNSStagesResponse, ListPipelinesResponse, ListPlansResponse, ListPurgeRequestsResponse, ListTLSStagesResponse, Pipeline, Plan, PurgeRequest, SelectPlanRequest, TLSStage, UpdateBackendStageRequest, UpdateCacheStageRequest, UpdateDNSStageRequest, UpdatePipelineRequest, UpdateTLSStageRequest } from './types.gen';
2
+ import type { BackendStage, CacheStage, CheckDomainRequest, CheckDomainResponse, CheckLbOriginRequest, CheckLbOriginResponse, CheckPEMChainRequest, CheckPEMChainResponse, CreateBackendStageRequest, CreateCacheStageRequest, CreateDNSStageRequest, CreatePipelineRequest, CreatePurgeRequestRequest, CreateTLSStageRequest, DNSStage, GetBillingResponse, ListBackendStagesResponse, ListCacheStagesResponse, ListDNSStagesResponse, ListPipelinesResponse, ListPlansResponse, ListPurgeRequestsResponse, ListTLSStagesResponse, Pipeline, Plan, PurgeRequest, SelectPlanRequest, TLSStage, UpdateBackendStageRequest, UpdateCacheStageRequest, UpdateDNSStageRequest, UpdatePipelineRequest, UpdateTLSStageRequest } from './types.gen';
3
3
  export declare const unmarshalBackendStage: (data: unknown) => BackendStage;
4
4
  export declare const unmarshalCacheStage: (data: unknown) => CacheStage;
5
5
  export declare const unmarshalDNSStage: (data: unknown) => DNSStage;
@@ -9,6 +9,7 @@ export declare const unmarshalPurgeRequest: (data: unknown) => PurgeRequest;
9
9
  export declare const unmarshalCheckDomainResponse: (data: unknown) => CheckDomainResponse;
10
10
  export declare const unmarshalCheckLbOriginResponse: (data: unknown) => CheckLbOriginResponse;
11
11
  export declare const unmarshalCheckPEMChainResponse: (data: unknown) => CheckPEMChainResponse;
12
+ export declare const unmarshalGetBillingResponse: (data: unknown) => GetBillingResponse;
12
13
  export declare const unmarshalListBackendStagesResponse: (data: unknown) => ListBackendStagesResponse;
13
14
  export declare const unmarshalListCacheStagesResponse: (data: unknown) => ListCacheStagesResponse;
14
15
  export declare const unmarshalListDNSStagesResponse: (data: unknown) => ListDNSStagesResponse;
@@ -1,6 +1,6 @@
1
1
  import { isJSONObject } from "../../../helpers/json.js";
2
+ import { unmarshalMoney } from "../../../scw/custom-marshalling.js";
2
3
  import { unmarshalDate, unmarshalArrayOfObject, resolveOneOf } from "../../../helpers/marshalling.js";
3
- import "../../../vendor/base64/index.js";
4
4
  const unmarshalScalewayLb = (data) => {
5
5
  if (!isJSONObject(data)) {
6
6
  throw new TypeError(
@@ -197,6 +197,35 @@ const unmarshalCheckPEMChainResponse = (data) => {
197
197
  isValid: data.is_valid
198
198
  };
199
199
  };
200
+ const unmarshalPlanDetails = (data) => {
201
+ if (!isJSONObject(data)) {
202
+ throw new TypeError(
203
+ `Unmarshalling the type 'PlanDetails' failed as data isn't a dictionary.`
204
+ );
205
+ }
206
+ return {
207
+ packageGb: data.package_gb,
208
+ pipelineLimit: data.pipeline_limit,
209
+ planName: data.plan_name
210
+ };
211
+ };
212
+ const unmarshalGetBillingResponse = (data) => {
213
+ if (!isJSONObject(data)) {
214
+ throw new TypeError(
215
+ `Unmarshalling the type 'GetBillingResponse' failed as data isn't a dictionary.`
216
+ );
217
+ }
218
+ return {
219
+ currentPlan: data.current_plan ? unmarshalPlanDetails(data.current_plan) : void 0,
220
+ currentPlanCacheUsage: data.current_plan_cache_usage,
221
+ extraCacheCost: data.extra_cache_cost ? unmarshalMoney(data.extra_cache_cost) : void 0,
222
+ extraCacheUsage: data.extra_cache_usage,
223
+ extraPipelinesCost: data.extra_pipelines_cost ? unmarshalMoney(data.extra_pipelines_cost) : void 0,
224
+ pipelineNumber: data.pipeline_number,
225
+ planCost: data.plan_cost ? unmarshalMoney(data.plan_cost) : void 0,
226
+ totalCost: data.total_cost ? unmarshalMoney(data.total_cost) : void 0
227
+ };
228
+ };
200
229
  const unmarshalListBackendStagesResponse = (data) => {
201
230
  if (!isJSONObject(data)) {
202
231
  throw new TypeError(
@@ -241,18 +270,6 @@ const unmarshalListPipelinesResponse = (data) => {
241
270
  totalCount: data.total_count
242
271
  };
243
272
  };
244
- const unmarshalPlanDetails = (data) => {
245
- if (!isJSONObject(data)) {
246
- throw new TypeError(
247
- `Unmarshalling the type 'PlanDetails' failed as data isn't a dictionary.`
248
- );
249
- }
250
- return {
251
- packageGb: data.package_gb,
252
- pipelineLimit: data.pipeline_limit,
253
- planName: data.plan_name
254
- };
255
- };
256
273
  const unmarshalListPlansResponse = (data) => {
257
274
  if (!isJSONObject(data)) {
258
275
  throw new TypeError(
@@ -460,6 +477,7 @@ export {
460
477
  unmarshalCheckLbOriginResponse,
461
478
  unmarshalCheckPEMChainResponse,
462
479
  unmarshalDNSStage,
480
+ unmarshalGetBillingResponse,
463
481
  unmarshalListBackendStagesResponse,
464
482
  unmarshalListCacheStagesResponse,
465
483
  unmarshalListDNSStagesResponse,
@@ -1,4 +1,4 @@
1
- import type { Region, Zone } from '../../../bridge';
1
+ import type { Money, Region, Zone } from '../../../bridge';
2
2
  export type DNSStageType = 'unknown_type' | 'auto' | 'managed' | 'custom';
3
3
  export type LbOriginError = 'unknown' | 'timeout' | 'connection_refused' | 'tls_error';
4
4
  export type ListBackendStagesRequestOrderBy = 'created_at_asc' | 'created_at_desc';
@@ -201,8 +201,11 @@ export interface CheckPEMChainRequestSecretChain {
201
201
  secretRegion: string;
202
202
  }
203
203
  export interface PlanDetails {
204
+ /** Subscription plan name. */
204
205
  planName: PlanName;
206
+ /** Amount of egress data from cache included in subscription plan. */
205
207
  packageGb: number;
208
+ /** Number of pipeline included in subscription plan. */
206
209
  pipelineLimit: number;
207
210
  }
208
211
  export interface PurgeRequest {
@@ -401,6 +404,30 @@ export type GetBackendStageRequest = {
401
404
  /** ID of the requested backend stage. */
402
405
  backendStageId: string;
403
406
  };
407
+ export type GetBillingRequest = {
408
+ projectId?: string;
409
+ };
410
+ export interface GetBillingResponse {
411
+ /** Information on the current edge-service subscription plan. */
412
+ currentPlan?: PlanDetails;
413
+ /** Price of the current subscription plan. */
414
+ planCost?: Money;
415
+ /** Total number of pipeline currently configured. */
416
+ pipelineNumber: number;
417
+ /** Cost to date of the pipelines not included in the plans. */
418
+ extraPipelinesCost?: Money;
419
+ /** Total amount of data egressed from cache in current subscription plan. */
420
+ currentPlanCacheUsage: number;
421
+ /** Total amount of data egressed from cache not included in the plans. */
422
+ extraCacheUsage: number;
423
+ /** Cost to date of the data egressed from cache not included in the plans. */
424
+ extraCacheCost?: Money;
425
+ /**
426
+ * Total cost to date of edge-service product for the month including current
427
+ * plan, previous plans, extra pipelines and extra egress cache data.
428
+ */
429
+ totalCost?: Money;
430
+ }
404
431
  export type GetCacheStageRequest = {
405
432
  /** ID of the requested cache stage. */
406
433
  cacheStageId: string;
@@ -36,6 +36,7 @@ const unmarshalAPIKey = (data) => {
36
36
  description: data.description,
37
37
  editable: data.editable,
38
38
  expiresAt: marshalling.unmarshalDate(data.expires_at),
39
+ managed: data.managed,
39
40
  secretKey: data.secret_key,
40
41
  updatedAt: marshalling.unmarshalDate(data.updated_at),
41
42
  userId: data.user_id
@@ -49,9 +50,11 @@ const unmarshalApplication = (data) => {
49
50
  }
50
51
  return {
51
52
  createdAt: marshalling.unmarshalDate(data.created_at),
53
+ deletable: data.deletable,
52
54
  description: data.description,
53
55
  editable: data.editable,
54
56
  id: data.id,
57
+ managed: data.managed,
55
58
  name: data.name,
56
59
  nbApiKeys: data.nb_api_keys,
57
60
  organizationId: data.organization_id,
@@ -68,8 +71,11 @@ const unmarshalGroup = (data) => {
68
71
  return {
69
72
  applicationIds: data.application_ids,
70
73
  createdAt: marshalling.unmarshalDate(data.created_at),
74
+ deletable: data.deletable,
71
75
  description: data.description,
76
+ editable: data.editable,
72
77
  id: data.id,
78
+ managed: data.managed,
73
79
  name: data.name,
74
80
  organizationId: data.organization_id,
75
81
  tags: data.tags,
@@ -104,10 +110,12 @@ const unmarshalPolicy = (data) => {
104
110
  return {
105
111
  applicationId: data.application_id,
106
112
  createdAt: marshalling.unmarshalDate(data.created_at),
113
+ deletable: data.deletable,
107
114
  description: data.description,
108
115
  editable: data.editable,
109
116
  groupId: data.group_id,
110
117
  id: data.id,
118
+ managed: data.managed,
111
119
  name: data.name,
112
120
  nbPermissionSets: data.nb_permission_sets,
113
121
  nbRules: data.nb_rules,
@@ -34,6 +34,7 @@ const unmarshalAPIKey = (data) => {
34
34
  description: data.description,
35
35
  editable: data.editable,
36
36
  expiresAt: unmarshalDate(data.expires_at),
37
+ managed: data.managed,
37
38
  secretKey: data.secret_key,
38
39
  updatedAt: unmarshalDate(data.updated_at),
39
40
  userId: data.user_id
@@ -47,9 +48,11 @@ const unmarshalApplication = (data) => {
47
48
  }
48
49
  return {
49
50
  createdAt: unmarshalDate(data.created_at),
51
+ deletable: data.deletable,
50
52
  description: data.description,
51
53
  editable: data.editable,
52
54
  id: data.id,
55
+ managed: data.managed,
53
56
  name: data.name,
54
57
  nbApiKeys: data.nb_api_keys,
55
58
  organizationId: data.organization_id,
@@ -66,8 +69,11 @@ const unmarshalGroup = (data) => {
66
69
  return {
67
70
  applicationIds: data.application_ids,
68
71
  createdAt: unmarshalDate(data.created_at),
72
+ deletable: data.deletable,
69
73
  description: data.description,
74
+ editable: data.editable,
70
75
  id: data.id,
76
+ managed: data.managed,
71
77
  name: data.name,
72
78
  organizationId: data.organization_id,
73
79
  tags: data.tags,
@@ -102,10 +108,12 @@ const unmarshalPolicy = (data) => {
102
108
  return {
103
109
  applicationId: data.application_id,
104
110
  createdAt: unmarshalDate(data.created_at),
111
+ deletable: data.deletable,
105
112
  description: data.description,
106
113
  editable: data.editable,
107
114
  groupId: data.group_id,
108
115
  id: data.id,
116
+ managed: data.managed,
109
117
  name: data.name,
110
118
  nbPermissionSets: data.nb_permission_sets,
111
119
  nbRules: data.nb_rules,
@@ -91,6 +91,8 @@ export interface APIKey {
91
91
  defaultProjectId: string;
92
92
  /** Defines whether or not the API key is editable. */
93
93
  editable: boolean;
94
+ /** Defines whether or not the API key is managed. */
95
+ managed: boolean;
94
96
  /** IP address of the device that created the API key. */
95
97
  creationIp: string;
96
98
  }
@@ -109,6 +111,10 @@ export interface Application {
109
111
  organizationId: string;
110
112
  /** Defines whether or not the application is editable. */
111
113
  editable: boolean;
114
+ /** Defines whether or not the application is deletable. */
115
+ deletable: boolean;
116
+ /** Defines whether or not the application is managed. */
117
+ managed: boolean;
112
118
  /** Number of API keys attributed to the application. */
113
119
  nbApiKeys: number;
114
120
  /** Tags associated with the user. */
@@ -133,6 +139,12 @@ export interface Group {
133
139
  applicationIds: string[];
134
140
  /** Tags associated to the group. */
135
141
  tags: string[];
142
+ /** Defines whether or not the group is editable. */
143
+ editable: boolean;
144
+ /** Defines whether or not the group is deletable. */
145
+ deletable: boolean;
146
+ /** Defines whether or not the group is managed. */
147
+ managed: boolean;
136
148
  }
137
149
  export interface Log {
138
150
  /** Log ID. */
@@ -181,6 +193,10 @@ export interface Policy {
181
193
  updatedAt?: Date;
182
194
  /** Defines whether or not a policy is editable. */
183
195
  editable: boolean;
196
+ /** Defines whether or not a policy is deletable. */
197
+ deletable: boolean;
198
+ /** Defines whether or not a policy is managed. */
199
+ managed: boolean;
184
200
  /** Number of rules of the policy. */
185
201
  nbRules: number;
186
202
  /** Number of policy scopes. */
@@ -114,6 +114,52 @@ class API extends api.API {
114
114
  },
115
115
  marshalling_gen.unmarshalStartJobDefinitionResponse
116
116
  );
117
+ createJobDefinitionSecrets = (request) => this.client.fetch(
118
+ {
119
+ body: JSON.stringify(
120
+ marshalling_gen.marshalCreateJobDefinitionSecretsRequest(
121
+ request,
122
+ this.client.settings
123
+ )
124
+ ),
125
+ headers: jsonContentHeaders,
126
+ method: "POST",
127
+ path: `/serverless-jobs/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/job-definitions/${marshalling.validatePathParam("jobDefinitionId", request.jobDefinitionId)}/secrets`
128
+ },
129
+ marshalling_gen.unmarshalCreateJobDefinitionSecretsResponse
130
+ );
131
+ getJobDefinitionSecret = (request) => this.client.fetch(
132
+ {
133
+ method: "GET",
134
+ path: `/serverless-jobs/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/job-definitions/${marshalling.validatePathParam("jobDefinitionId", request.jobDefinitionId)}/secrets/${marshalling.validatePathParam("secretId", request.secretId)}`
135
+ },
136
+ marshalling_gen.unmarshalSecret
137
+ );
138
+ listJobDefinitionSecrets = (request) => this.client.fetch(
139
+ {
140
+ method: "GET",
141
+ path: `/serverless-jobs/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/job-definitions/${marshalling.validatePathParam("jobDefinitionId", request.jobDefinitionId)}/secrets`
142
+ },
143
+ marshalling_gen.unmarshalListJobDefinitionSecretsResponse
144
+ );
145
+ updateJobDefinitionSecret = (request) => this.client.fetch(
146
+ {
147
+ body: JSON.stringify(
148
+ marshalling_gen.marshalUpdateJobDefinitionSecretRequest(
149
+ request,
150
+ this.client.settings
151
+ )
152
+ ),
153
+ headers: jsonContentHeaders,
154
+ method: "PATCH",
155
+ path: `/serverless-jobs/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/job-definitions/${marshalling.validatePathParam("jobDefinitionId", request.jobDefinitionId)}/secrets/${marshalling.validatePathParam("secretId", request.secretId)}`
156
+ },
157
+ marshalling_gen.unmarshalSecret
158
+ );
159
+ deleteJobDefinitionSecret = (request) => this.client.fetch({
160
+ method: "DELETE",
161
+ path: `/serverless-jobs/v1alpha1/regions/${marshalling.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/job-definitions/${marshalling.validatePathParam("jobDefinitionId", request.jobDefinitionId)}/secrets/${marshalling.validatePathParam("secretId", request.secretId)}`
162
+ });
117
163
  /**
118
164
  * Get a job run by its unique identifier.
119
165
  *
@@ -1,6 +1,6 @@
1
1
  import { API as ParentAPI } from '../../../bridge';
2
2
  import type { Region } from '../../../bridge';
3
- import type { CreateJobDefinitionRequest, DeleteJobDefinitionRequest, GetJobDefinitionRequest, GetJobRunRequest, JobDefinition, JobRun, ListJobDefinitionsRequest, ListJobDefinitionsResponse, ListJobRunsRequest, ListJobRunsResponse, ListJobsResourcesRequest, ListJobsResourcesResponse, StartJobDefinitionRequest, StartJobDefinitionResponse, StopJobRunRequest, UpdateJobDefinitionRequest } from './types.gen';
3
+ import type { CreateJobDefinitionRequest, CreateJobDefinitionSecretsRequest, CreateJobDefinitionSecretsResponse, DeleteJobDefinitionRequest, DeleteJobDefinitionSecretRequest, GetJobDefinitionRequest, GetJobDefinitionSecretRequest, GetJobRunRequest, JobDefinition, JobRun, ListJobDefinitionSecretsRequest, ListJobDefinitionSecretsResponse, ListJobDefinitionsRequest, ListJobDefinitionsResponse, ListJobRunsRequest, ListJobRunsResponse, ListJobsResourcesRequest, ListJobsResourcesResponse, Secret, StartJobDefinitionRequest, StartJobDefinitionResponse, StopJobRunRequest, UpdateJobDefinitionRequest, UpdateJobDefinitionSecretRequest } from './types.gen';
4
4
  /**
5
5
  * Serverless Jobs API.
6
6
  *
@@ -56,6 +56,11 @@ export declare class API extends ParentAPI {
56
56
  * @returns A Promise of StartJobDefinitionResponse
57
57
  */
58
58
  startJobDefinition: (request: Readonly<StartJobDefinitionRequest>) => Promise<StartJobDefinitionResponse>;
59
+ createJobDefinitionSecrets: (request: Readonly<CreateJobDefinitionSecretsRequest>) => Promise<CreateJobDefinitionSecretsResponse>;
60
+ getJobDefinitionSecret: (request: Readonly<GetJobDefinitionSecretRequest>) => Promise<Secret>;
61
+ listJobDefinitionSecrets: (request: Readonly<ListJobDefinitionSecretsRequest>) => Promise<ListJobDefinitionSecretsResponse>;
62
+ updateJobDefinitionSecret: (request: Readonly<UpdateJobDefinitionSecretRequest>) => Promise<Secret>;
63
+ deleteJobDefinitionSecret: (request: Readonly<DeleteJobDefinitionSecretRequest>) => Promise<void>;
59
64
  /**
60
65
  * Get a job run by its unique identifier.
61
66
  *
@@ -2,7 +2,7 @@ import { API as API$1 } from "../../../scw/api.js";
2
2
  import { validatePathParam, urlParams } from "../../../helpers/marshalling.js";
3
3
  import "../../../vendor/base64/index.js";
4
4
  import { enrichForPagination } from "../../../scw/fetch/resource-paginator.js";
5
- import { marshalCreateJobDefinitionRequest, unmarshalJobDefinition, unmarshalListJobDefinitionsResponse, marshalUpdateJobDefinitionRequest, marshalStartJobDefinitionRequest, unmarshalStartJobDefinitionResponse, unmarshalJobRun, unmarshalListJobRunsResponse, unmarshalListJobsResourcesResponse } from "./marshalling.gen.js";
5
+ import { marshalCreateJobDefinitionRequest, unmarshalJobDefinition, unmarshalListJobDefinitionsResponse, marshalUpdateJobDefinitionRequest, marshalStartJobDefinitionRequest, unmarshalStartJobDefinitionResponse, marshalCreateJobDefinitionSecretsRequest, unmarshalCreateJobDefinitionSecretsResponse, unmarshalSecret, unmarshalListJobDefinitionSecretsResponse, marshalUpdateJobDefinitionSecretRequest, unmarshalJobRun, unmarshalListJobRunsResponse, unmarshalListJobsResourcesResponse } from "./marshalling.gen.js";
6
6
  const jsonContentHeaders = {
7
7
  "Content-Type": "application/json; charset=utf-8"
8
8
  };
@@ -112,6 +112,52 @@ class API extends API$1 {
112
112
  },
113
113
  unmarshalStartJobDefinitionResponse
114
114
  );
115
+ createJobDefinitionSecrets = (request) => this.client.fetch(
116
+ {
117
+ body: JSON.stringify(
118
+ marshalCreateJobDefinitionSecretsRequest(
119
+ request,
120
+ this.client.settings
121
+ )
122
+ ),
123
+ headers: jsonContentHeaders,
124
+ method: "POST",
125
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam("jobDefinitionId", request.jobDefinitionId)}/secrets`
126
+ },
127
+ unmarshalCreateJobDefinitionSecretsResponse
128
+ );
129
+ getJobDefinitionSecret = (request) => this.client.fetch(
130
+ {
131
+ method: "GET",
132
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam("jobDefinitionId", request.jobDefinitionId)}/secrets/${validatePathParam("secretId", request.secretId)}`
133
+ },
134
+ unmarshalSecret
135
+ );
136
+ listJobDefinitionSecrets = (request) => this.client.fetch(
137
+ {
138
+ method: "GET",
139
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam("jobDefinitionId", request.jobDefinitionId)}/secrets`
140
+ },
141
+ unmarshalListJobDefinitionSecretsResponse
142
+ );
143
+ updateJobDefinitionSecret = (request) => this.client.fetch(
144
+ {
145
+ body: JSON.stringify(
146
+ marshalUpdateJobDefinitionSecretRequest(
147
+ request,
148
+ this.client.settings
149
+ )
150
+ ),
151
+ headers: jsonContentHeaders,
152
+ method: "PATCH",
153
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam("jobDefinitionId", request.jobDefinitionId)}/secrets/${validatePathParam("secretId", request.secretId)}`
154
+ },
155
+ unmarshalSecret
156
+ );
157
+ deleteJobDefinitionSecret = (request) => this.client.fetch({
158
+ method: "DELETE",
159
+ path: `/serverless-jobs/v1alpha1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/job-definitions/${validatePathParam("jobDefinitionId", request.jobDefinitionId)}/secrets/${validatePathParam("secretId", request.secretId)}`
160
+ });
115
161
  /**
116
162
  * Get a job run by its unique identifier.
117
163
  *
@@ -1,4 +1,4 @@
1
1
  export { API } from './api.gen';
2
2
  export * from './content.gen';
3
- export type { CreateJobDefinitionRequest, CreateJobDefinitionRequestCronScheduleConfig, CronSchedule, DeleteJobDefinitionRequest, GetJobDefinitionRequest, GetJobRunRequest, JobDefinition, JobRun, JobRunState, ListJobDefinitionsRequest, ListJobDefinitionsRequestOrderBy, ListJobDefinitionsResponse, ListJobRunsRequest, ListJobRunsRequestOrderBy, ListJobRunsResponse, ListJobsResourcesRequest, ListJobsResourcesResponse, Resource, StartJobDefinitionRequest, StartJobDefinitionResponse, StopJobRunRequest, UpdateJobDefinitionRequest, UpdateJobDefinitionRequestCronScheduleConfig, } from './types.gen';
3
+ export type { CreateJobDefinitionRequest, CreateJobDefinitionRequestCronScheduleConfig, CreateJobDefinitionSecretsRequest, CreateJobDefinitionSecretsRequestSecretConfig, CreateJobDefinitionSecretsResponse, CronSchedule, DeleteJobDefinitionRequest, DeleteJobDefinitionSecretRequest, GetJobDefinitionRequest, GetJobDefinitionSecretRequest, GetJobRunRequest, JobDefinition, JobRun, JobRunState, ListJobDefinitionSecretsRequest, ListJobDefinitionSecretsResponse, ListJobDefinitionsRequest, ListJobDefinitionsRequestOrderBy, ListJobDefinitionsResponse, ListJobRunsRequest, ListJobRunsRequestOrderBy, ListJobRunsResponse, ListJobsResourcesRequest, ListJobsResourcesResponse, Resource, Secret, SecretEnvVar, SecretFile, StartJobDefinitionRequest, StartJobDefinitionResponse, StopJobRunRequest, UpdateJobDefinitionRequest, UpdateJobDefinitionRequestCronScheduleConfig, UpdateJobDefinitionSecretRequest, } from './types.gen';
4
4
  export * as ValidationRules from './validation-rules.gen';
@@ -4,6 +4,40 @@ const randomName = require("@scaleway/random-name");
4
4
  const json = require("../../../helpers/json.cjs");
5
5
  const marshalling = require("../../../helpers/marshalling.cjs");
6
6
  require("../../../vendor/base64/index.cjs");
7
+ const unmarshalSecretEnvVar = (data) => {
8
+ if (!json.isJSONObject(data)) {
9
+ throw new TypeError(
10
+ `Unmarshalling the type 'SecretEnvVar' failed as data isn't a dictionary.`
11
+ );
12
+ }
13
+ return {
14
+ name: data.name
15
+ };
16
+ };
17
+ const unmarshalSecretFile = (data) => {
18
+ if (!json.isJSONObject(data)) {
19
+ throw new TypeError(
20
+ `Unmarshalling the type 'SecretFile' failed as data isn't a dictionary.`
21
+ );
22
+ }
23
+ return {
24
+ path: data.path
25
+ };
26
+ };
27
+ const unmarshalSecret = (data) => {
28
+ if (!json.isJSONObject(data)) {
29
+ throw new TypeError(
30
+ `Unmarshalling the type 'Secret' failed as data isn't a dictionary.`
31
+ );
32
+ }
33
+ return {
34
+ envVar: data.env_var ? unmarshalSecretEnvVar(data.env_var) : void 0,
35
+ file: data.file ? unmarshalSecretFile(data.file) : void 0,
36
+ secretId: data.secret_id,
37
+ secretManagerId: data.secret_manager_id,
38
+ secretManagerVersion: data.secret_manager_version
39
+ };
40
+ };
7
41
  const unmarshalCronSchedule = (data) => {
8
42
  if (!json.isJSONObject(data)) {
9
43
  throw new TypeError(
@@ -64,6 +98,27 @@ const unmarshalJobRun = (data) => {
64
98
  updatedAt: marshalling.unmarshalDate(data.updated_at)
65
99
  };
66
100
  };
101
+ const unmarshalCreateJobDefinitionSecretsResponse = (data) => {
102
+ if (!json.isJSONObject(data)) {
103
+ throw new TypeError(
104
+ `Unmarshalling the type 'CreateJobDefinitionSecretsResponse' failed as data isn't a dictionary.`
105
+ );
106
+ }
107
+ return {
108
+ secrets: marshalling.unmarshalArrayOfObject(data.secrets, unmarshalSecret)
109
+ };
110
+ };
111
+ const unmarshalListJobDefinitionSecretsResponse = (data) => {
112
+ if (!json.isJSONObject(data)) {
113
+ throw new TypeError(
114
+ `Unmarshalling the type 'ListJobDefinitionSecretsResponse' failed as data isn't a dictionary.`
115
+ );
116
+ }
117
+ return {
118
+ secrets: marshalling.unmarshalArrayOfObject(data.secrets, unmarshalSecret),
119
+ totalCount: data.total_count
120
+ };
121
+ };
67
122
  const unmarshalListJobDefinitionsResponse = (data) => {
68
123
  if (!json.isJSONObject(data)) {
69
124
  throw new TypeError(
@@ -139,6 +194,19 @@ const marshalCreateJobDefinitionRequest = (request, defaults) => ({
139
194
  name: request.name || randomName("job"),
140
195
  project_id: request.projectId ?? defaults.defaultProjectId
141
196
  });
197
+ const marshalCreateJobDefinitionSecretsRequestSecretConfig = (request, defaults) => ({
198
+ secret_manager_id: request.secretManagerId,
199
+ secret_manager_version: request.secretManagerVersion,
200
+ ...marshalling.resolveOneOf([
201
+ { param: "path", value: request.path },
202
+ { param: "env_var_name", value: request.envVarName }
203
+ ])
204
+ });
205
+ const marshalCreateJobDefinitionSecretsRequest = (request, defaults) => ({
206
+ secrets: request.secrets.map(
207
+ (elt) => marshalCreateJobDefinitionSecretsRequestSecretConfig(elt)
208
+ )
209
+ });
142
210
  const marshalStartJobDefinitionRequest = (request, defaults) => ({
143
211
  command: request.command,
144
212
  environment_variables: request.environmentVariables,
@@ -162,12 +230,24 @@ const marshalUpdateJobDefinitionRequest = (request, defaults) => ({
162
230
  memory_limit: request.memoryLimit,
163
231
  name: request.name
164
232
  });
233
+ const marshalUpdateJobDefinitionSecretRequest = (request, defaults) => ({
234
+ secret_manager_version: request.secretManagerVersion,
235
+ ...marshalling.resolveOneOf([
236
+ { param: "path", value: request.path },
237
+ { param: "env_var_name", value: request.envVarName }
238
+ ])
239
+ });
165
240
  exports.marshalCreateJobDefinitionRequest = marshalCreateJobDefinitionRequest;
241
+ exports.marshalCreateJobDefinitionSecretsRequest = marshalCreateJobDefinitionSecretsRequest;
166
242
  exports.marshalStartJobDefinitionRequest = marshalStartJobDefinitionRequest;
167
243
  exports.marshalUpdateJobDefinitionRequest = marshalUpdateJobDefinitionRequest;
244
+ exports.marshalUpdateJobDefinitionSecretRequest = marshalUpdateJobDefinitionSecretRequest;
245
+ exports.unmarshalCreateJobDefinitionSecretsResponse = unmarshalCreateJobDefinitionSecretsResponse;
168
246
  exports.unmarshalJobDefinition = unmarshalJobDefinition;
169
247
  exports.unmarshalJobRun = unmarshalJobRun;
248
+ exports.unmarshalListJobDefinitionSecretsResponse = unmarshalListJobDefinitionSecretsResponse;
170
249
  exports.unmarshalListJobDefinitionsResponse = unmarshalListJobDefinitionsResponse;
171
250
  exports.unmarshalListJobRunsResponse = unmarshalListJobRunsResponse;
172
251
  exports.unmarshalListJobsResourcesResponse = unmarshalListJobsResourcesResponse;
252
+ exports.unmarshalSecret = unmarshalSecret;
173
253
  exports.unmarshalStartJobDefinitionResponse = unmarshalStartJobDefinitionResponse;
@@ -1,11 +1,16 @@
1
1
  import type { DefaultValues } from '../../../bridge';
2
- import type { CreateJobDefinitionRequest, JobDefinition, JobRun, ListJobDefinitionsResponse, ListJobRunsResponse, ListJobsResourcesResponse, StartJobDefinitionRequest, StartJobDefinitionResponse, UpdateJobDefinitionRequest } from './types.gen';
2
+ import type { CreateJobDefinitionRequest, CreateJobDefinitionSecretsRequest, CreateJobDefinitionSecretsResponse, JobDefinition, JobRun, ListJobDefinitionSecretsResponse, ListJobDefinitionsResponse, ListJobRunsResponse, ListJobsResourcesResponse, Secret, StartJobDefinitionRequest, StartJobDefinitionResponse, UpdateJobDefinitionRequest, UpdateJobDefinitionSecretRequest } from './types.gen';
3
+ export declare const unmarshalSecret: (data: unknown) => Secret;
3
4
  export declare const unmarshalJobDefinition: (data: unknown) => JobDefinition;
4
5
  export declare const unmarshalJobRun: (data: unknown) => JobRun;
6
+ export declare const unmarshalCreateJobDefinitionSecretsResponse: (data: unknown) => CreateJobDefinitionSecretsResponse;
7
+ export declare const unmarshalListJobDefinitionSecretsResponse: (data: unknown) => ListJobDefinitionSecretsResponse;
5
8
  export declare const unmarshalListJobDefinitionsResponse: (data: unknown) => ListJobDefinitionsResponse;
6
9
  export declare const unmarshalListJobRunsResponse: (data: unknown) => ListJobRunsResponse;
7
10
  export declare const unmarshalListJobsResourcesResponse: (data: unknown) => ListJobsResourcesResponse;
8
11
  export declare const unmarshalStartJobDefinitionResponse: (data: unknown) => StartJobDefinitionResponse;
9
12
  export declare const marshalCreateJobDefinitionRequest: (request: CreateJobDefinitionRequest, defaults: DefaultValues) => Record<string, unknown>;
13
+ export declare const marshalCreateJobDefinitionSecretsRequest: (request: CreateJobDefinitionSecretsRequest, defaults: DefaultValues) => Record<string, unknown>;
10
14
  export declare const marshalStartJobDefinitionRequest: (request: StartJobDefinitionRequest, defaults: DefaultValues) => Record<string, unknown>;
11
15
  export declare const marshalUpdateJobDefinitionRequest: (request: UpdateJobDefinitionRequest, defaults: DefaultValues) => Record<string, unknown>;
16
+ export declare const marshalUpdateJobDefinitionSecretRequest: (request: UpdateJobDefinitionSecretRequest, defaults: DefaultValues) => Record<string, unknown>;