Add method and subpath flags to timetrigger object for triggering a function (#3017)

* Update timetrigger crd and add method and subpath fields in spec.
Update fission-cli to accept user input for method and subpath fields.
Update publisher package to utilize these fields for triggering a function.
Update timer controller to use method and subpath fields for publishing a request.
Add a new test TestPublisherSubpath in pulisher package.

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

* Use kubebuilder default annotation.
Update test for fission-cli timetrigger create, update command to support method and subpath flags.

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>

---------

Signed-off-by: Md Soharab Ansari <soharab.ansari@infracloud.io>
This commit is contained in:
soharab-ic
2024-09-16 17:15:54 +05:30
committed by GitHub
parent 5d580e01aa
commit 93869d3bc8
16 changed files with 107 additions and 14 deletions
@@ -27,6 +27,8 @@ import (
type TimeTriggerSpecApplyConfiguration struct {
Cron *string `json:"cron,omitempty"`
*FunctionReferenceApplyConfiguration `json:"functionref,omitempty"`
Method *string `json:"method,omitempty"`
Subpath *string `json:"subpath,omitempty"`
}
// TimeTriggerSpecApplyConfiguration constructs an declarative configuration of the TimeTriggerSpec type for use with
@@ -81,3 +83,19 @@ func (b *TimeTriggerSpecApplyConfiguration) ensureFunctionReferenceApplyConfigur
b.FunctionReferenceApplyConfiguration = &FunctionReferenceApplyConfiguration{}
}
}
// WithMethod sets the Method field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Method field is set to the value of the last call.
func (b *TimeTriggerSpecApplyConfiguration) WithMethod(value string) *TimeTriggerSpecApplyConfiguration {
b.Method = &value
return b
}
// WithSubpath sets the Subpath field in the declarative configuration to the given value
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
// If called multiple times, the Subpath field is set to the value of the last call.
func (b *TimeTriggerSpecApplyConfiguration) WithSubpath(value string) *TimeTriggerSpecApplyConfiguration {
b.Subpath = &value
return b
}