@@ -43,6 +43,24 @@ const (
4343 CapabilityTypeCombined CapabilityType = "combined"
4444)
4545
46+ // MethodType is an enum for the type of method
47+ type MethodType string
48+
49+ // MethodType enum values.
50+ const (
51+ MethodAction MethodType = "unknown"
52+ MethodTrigger MethodType = "trigger"
53+ )
54+
55+ // ActionSchedule is an enum for the type of method
56+ type ActionSchedule string
57+
58+ // ActionSchedule enum values.
59+ const (
60+ ActionScheduleOneAtATime ActionSchedule = "one_at_a_time"
61+ ActionScheduleAllAtOnce ActionSchedule = "all_at_once"
62+ )
63+
4664// IsValid checks if the capability type is valid.
4765func (c CapabilityType ) IsValid () error {
4866 switch c {
@@ -488,35 +506,10 @@ type RemoteTriggerConfig struct {
488506type RemoteTargetConfig struct {
489507 RequestHashExcludedAttributes []string
490508}
491-
492- // CapabilityMethodConfig holds configuration for a capability method (action or trigger).
493- type CapabilityMethodConfig struct {
494- Type CapabilityType
495- Schedule string
496- DeltaStage int
497- }
498-
499- //example from Bolek
500- //var CapabilityMethodConfigs = map[string]CapabilityMethodConfig{
501- // "CallContract": {
502- // Type: CapabilityTypeAction, // or CapabilityTypeExecutable if defined
503- // Schedule: "all_at_once",
504- // },
505- // "LogTrigger": {
506- // Type: CapabilityTypeTrigger,
507- // },
508- // "WriteReport": {
509- // Type: CapabilityTypeAction, // or CapabilityTypeExecutable if defined
510- // Schedule: "one_at_a_time",
511- // DeltaStage: 10,
512- // },
513- //}
514-
515509type RemoteExecutableConfig struct {
516510 RequestHashExcludedAttributes []string
517511 RegistrationRefresh time.Duration
518512 RegistrationExpiry time.Duration
519- CapabilityMethodConfigs map [string ]CapabilityMethodConfig
520513}
521514
522515// NOTE: consider splitting this config into values stored in Registry (KS-118)
@@ -554,6 +547,29 @@ func (c *RemoteExecutableConfig) ApplyDefaults() {
554547 }
555548}
556549
550+ // CapabilityMethodConfig holds configuration for a capability method (action or trigger).
551+ type CapabilityMethodConfig struct {
552+ Type MethodType
553+ ActionSchedule * ActionSchedule
554+ DeltaStage * time.Duration
555+ }
556+
557+ //example from Bolek
558+ //var CapabilityMethodConfigs = map[string]CapabilityMethodConfig{
559+ // "CallContract": {
560+ // Type: CapabilityTypeAction, // or CapabilityTypeExecutable if defined
561+ // Schedule: "all_at_once",
562+ // },
563+ // "LogTrigger": {
564+ // Type: CapabilityTypeTrigger,
565+ // },
566+ // "WriteReport": {
567+ // Type: CapabilityTypeAction, // or CapabilityTypeExecutable if defined
568+ // Schedule: "one_at_a_time",
569+ // DeltaStage: 10,
570+ // },
571+ //}
572+
557573type CapabilityConfiguration struct {
558574 DefaultConfig * values.Map
559575 // RestrictedKeys is a list of keys that can't be provided by users in their
@@ -565,4 +581,7 @@ type CapabilityConfiguration struct {
565581 RemoteTriggerConfig * RemoteTriggerConfig
566582 RemoteTargetConfig * RemoteTargetConfig
567583 RemoteExecutableConfig * RemoteExecutableConfig
584+ // CapabilityMethodConfig contains all the methods supported by this capability declaring the type of method
585+ //(trigger or action), and for all the actions it will have different scheduling configurations.
586+ CapabilityMethodConfig map [string ]CapabilityMethodConfig
568587}
0 commit comments