Skip to content

Commit a4b203e

Browse files
authored
docs(serverless): document trigger API (#945)
1 parent 1823af4 commit a4b203e

File tree

4 files changed

+189
-61
lines changed

4 files changed

+189
-61
lines changed

packages/clients/src/api/container/v1beta1/marshalling.gen.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -493,19 +493,19 @@ export const marshalCreateTriggerRequest = (
493493
: undefined,
494494
},
495495
{
496-
param: 'sqs_config',
497-
value: request.sqsConfig
498-
? marshalCreateTriggerRequestSqsClientConfig(
499-
request.sqsConfig,
496+
param: 'scw_nats_config',
497+
value: request.scwNatsConfig
498+
? marshalCreateTriggerRequestMnqNatsClientConfig(
499+
request.scwNatsConfig,
500500
defaults,
501501
)
502502
: undefined,
503503
},
504504
{
505-
param: 'scw_nats_config',
506-
value: request.scwNatsConfig
507-
? marshalCreateTriggerRequestMnqNatsClientConfig(
508-
request.scwNatsConfig,
505+
param: 'sqs_config',
506+
value: request.sqsConfig
507+
? marshalCreateTriggerRequestSqsClientConfig(
508+
request.sqsConfig,
509509
defaults,
510510
)
511511
: undefined,

packages/clients/src/api/container/v1beta1/types.gen.ts

Lines changed: 87 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -154,20 +154,29 @@ export interface Container {
154154
region: Region
155155
}
156156

157+
/** Create trigger request. mnq nats client config. */
157158
export interface CreateTriggerRequestMnqNatsClientConfig {
158159
/** @deprecated */
159160
mnqNamespaceId?: string
161+
/** Name of the NATS subject the trigger should listen to. */
160162
subject: string
163+
/** ID of the M&Q NATS account. */
164+
mnqNatsAccountId: string
165+
/** ID of the M&Q project. */
161166
mnqProjectId: string
167+
/** Region of the M&Q project. */
162168
mnqRegion: string
163-
mnqNatsAccountId: string
164169
}
165170

171+
/** Create trigger request. mnq sqs client config. */
166172
export interface CreateTriggerRequestMnqSqsClientConfig {
173+
/** Name of the SQS queue the trigger should listen to. */
174+
queue: string
167175
/** @deprecated */
168176
mnqNamespaceId?: string
169-
queue: string
177+
/** ID of the M&Q project. You must have activated SQS on this project. */
170178
mnqProjectId: string
179+
/** Region in which the M&Q project is activated. */
171180
mnqRegion: string
172181
}
173182

@@ -253,9 +262,12 @@ export interface ListTokensResponse {
253262
totalCount: number
254263
}
255264

265+
/** List triggers response. */
256266
export interface ListTriggersResponse {
257-
triggers: Trigger[]
267+
/** Total count of existing triggers (matching any filters specified). */
258268
totalCount: number
269+
/** Triggers on this page. */
270+
triggers: Trigger[]
259271
}
260272

261273
/** Log. */
@@ -337,47 +349,72 @@ export interface Token {
337349
expiresAt?: Date
338350
}
339351

352+
/** Trigger. */
340353
export interface Trigger {
354+
/** ID of the trigger. */
341355
id: string
356+
/** Name of the trigger. */
342357
name: string
358+
/** Description of the trigger. */
343359
description: string
360+
/** ID of the container to trigger. */
361+
containerId: string
362+
/** Type of the input. */
344363
inputType: TriggerInputType
364+
/** Status of the trigger. */
345365
status: TriggerStatus
366+
/** Error message of the trigger. */
346367
errorMessage?: string
347-
containerId: string
348368
/**
349-
* One-of ('config'): at most one of 'scwSqsConfig', 'sqsConfig',
350-
* 'scwNatsConfig' could be set.
369+
* Configuration for a Scaleway M&Q SQS queue.
370+
*
371+
* One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig',
372+
* 'sqsConfig' could be set.
351373
*/
352374
scwSqsConfig?: TriggerMnqSqsClientConfig
353375
/**
354-
* One-of ('config'): at most one of 'scwSqsConfig', 'sqsConfig',
355-
* 'scwNatsConfig' could be set.
376+
* Configuration for a Scaleway M&Q NATS subject.
377+
*
378+
* One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig',
379+
* 'sqsConfig' could be set.
356380
*/
357-
sqsConfig?: TriggerSqsClientConfig
381+
scwNatsConfig?: TriggerMnqNatsClientConfig
358382
/**
359-
* One-of ('config'): at most one of 'scwSqsConfig', 'sqsConfig',
360-
* 'scwNatsConfig' could be set.
383+
* Configuration for an AWS SQS queue.
384+
*
385+
* One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig',
386+
* 'sqsConfig' could be set.
361387
*/
362-
scwNatsConfig?: TriggerMnqNatsClientConfig
388+
sqsConfig?: TriggerSqsClientConfig
363389
}
364390

391+
/** Trigger. mnq nats client config. */
365392
export interface TriggerMnqNatsClientConfig {
366393
/** @deprecated */
367394
mnqNamespaceId?: string
395+
/** Name of the NATS subject the trigger listens to. */
368396
subject: string
397+
/** ID of the M&Q NATS account. */
398+
mnqNatsAccountId: string
399+
/** ID of the M&Q project. */
369400
mnqProjectId: string
401+
/** Region of the M&Q project. */
370402
mnqRegion: string
403+
/** ID of the M&Q credentials used to subscribe to the NATS subject. */
371404
mnqCredentialId?: string
372-
mnqNatsAccountId: string
373405
}
374406

407+
/** Trigger. mnq sqs client config. */
375408
export interface TriggerMnqSqsClientConfig {
376409
/** @deprecated */
377410
mnqNamespaceId?: string
411+
/** Name of the SQS queue the trigger listens to. */
378412
queue: string
413+
/** ID of the M&Q project. */
379414
mnqProjectId: string
415+
/** Region in which the M&Q project is activated. */
380416
mnqRegion: string
417+
/** ID of the M&Q credentials used to read from the SQS queue. */
381418
mnqCredentialId?: string
382419
}
383420

@@ -829,24 +866,33 @@ export type CreateTriggerRequest = {
829866
* config.
830867
*/
831868
region?: Region
869+
/** Name of the trigger. */
832870
name: string
833-
description?: string
871+
/** ID of the container to trigger. */
834872
containerId: string
873+
/** Description of the trigger. */
874+
description?: string
835875
/**
836-
* One-of ('config'): at most one of 'scwSqsConfig', 'sqsConfig',
837-
* 'scwNatsConfig' could be set.
876+
* Configuration for a Scaleway M&Q SQS queue.
877+
*
878+
* One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig',
879+
* 'sqsConfig' could be set.
838880
*/
839881
scwSqsConfig?: CreateTriggerRequestMnqSqsClientConfig
840882
/**
841-
* One-of ('config'): at most one of 'scwSqsConfig', 'sqsConfig',
842-
* 'scwNatsConfig' could be set.
883+
* Configuration for a Scaleway M&Q NATS subject.
884+
*
885+
* One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig',
886+
* 'sqsConfig' could be set.
843887
*/
844-
sqsConfig?: CreateTriggerRequestSqsClientConfig
888+
scwNatsConfig?: CreateTriggerRequestMnqNatsClientConfig
845889
/**
846-
* One-of ('config'): at most one of 'scwSqsConfig', 'sqsConfig',
847-
* 'scwNatsConfig' could be set.
890+
* Configuration for an AWS SQS queue.
891+
*
892+
* One-of ('config'): at most one of 'scwSqsConfig', 'scwNatsConfig',
893+
* 'sqsConfig' could be set.
848894
*/
849-
scwNatsConfig?: CreateTriggerRequestMnqNatsClientConfig
895+
sqsConfig?: CreateTriggerRequestSqsClientConfig
850896
}
851897

852898
export type GetTriggerRequest = {
@@ -855,6 +901,7 @@ export type GetTriggerRequest = {
855901
* config.
856902
*/
857903
region?: Region
904+
/** ID of the trigger to get. */
858905
triggerId: string
859906
}
860907

@@ -864,20 +911,29 @@ export type ListTriggersRequest = {
864911
* config.
865912
*/
866913
region?: Region
914+
/** Page number to return. */
867915
page?: number
916+
/** Maximum number of triggers to return per page. */
868917
pageSize?: number
918+
/** Order in which to return results. */
869919
orderBy?: ListTriggersRequestOrderBy
870920
/**
921+
* ID of the container the triggers belongs to.
922+
*
871923
* One-of ('scope'): at most one of 'containerId', 'namespaceId', 'projectId'
872924
* could be set.
873925
*/
874926
containerId?: string
875927
/**
928+
* ID of the namespace the triggers belongs to.
929+
*
876930
* One-of ('scope'): at most one of 'containerId', 'namespaceId', 'projectId'
877931
* could be set.
878932
*/
879933
namespaceId?: string
880934
/**
935+
* ID of the project the triggers belongs to.
936+
*
881937
* One-of ('scope'): at most one of 'containerId', 'namespaceId', 'projectId'
882938
* could be set.
883939
*/
@@ -890,10 +946,17 @@ export type UpdateTriggerRequest = {
890946
* config.
891947
*/
892948
region?: Region
949+
/** ID of the trigger to update. */
893950
triggerId: string
951+
/** Name of the trigger. */
894952
name?: string
953+
/** Description of the trigger. */
895954
description?: string
896-
/** One-of ('config'): at most one of 'sqsConfig' could be set. */
955+
/**
956+
* Configuration for an AWS SQS queue.
957+
*
958+
* One-of ('config'): at most one of 'sqsConfig' could be set.
959+
*/
897960
sqsConfig?: UpdateTriggerRequestSqsClientConfig
898961
}
899962

@@ -903,5 +966,6 @@ export type DeleteTriggerRequest = {
903966
* config.
904967
*/
905968
region?: Region
969+
/** ID of the trigger to delete. */
906970
triggerId: string
907971
}

packages/clients/src/api/function/v1beta1/marshalling.gen.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -548,19 +548,19 @@ export const marshalCreateTriggerRequest = (
548548
: undefined,
549549
},
550550
{
551-
param: 'sqs_config',
552-
value: request.sqsConfig
553-
? marshalCreateTriggerRequestSqsClientConfig(
554-
request.sqsConfig,
551+
param: 'scw_nats_config',
552+
value: request.scwNatsConfig
553+
? marshalCreateTriggerRequestMnqNatsClientConfig(
554+
request.scwNatsConfig,
555555
defaults,
556556
)
557557
: undefined,
558558
},
559559
{
560-
param: 'scw_nats_config',
561-
value: request.scwNatsConfig
562-
? marshalCreateTriggerRequestMnqNatsClientConfig(
563-
request.scwNatsConfig,
560+
param: 'sqs_config',
561+
value: request.sqsConfig
562+
? marshalCreateTriggerRequestSqsClientConfig(
563+
request.sqsConfig,
564564
defaults,
565565
)
566566
: undefined,

0 commit comments

Comments
 (0)