Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/app/piped/cloudprovider/lambda/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ type FunctionManifestSpec struct {
Name string `json:"name"`
ImageURI string `json:"image"`
Tags map[string]string `json:"tags,omitempty"`
Runtime string `json:"runtime"`
Handler string `json:"handler"`
}

func (fmp FunctionManifestSpec) validate() error {
Expand All @@ -60,6 +62,12 @@ func (fmp FunctionManifestSpec) validate() error {
if len(fmp.ImageURI) == 0 {
return fmt.Errorf("image uri is missing")
}
if len(fmp.Runtime) == 0 {
return fmt.Errorf("runtime is missing")
}
if len(fmp.Handler) == 0 {
return fmt.Errorf("handler is missing")
}
return nil
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/app/piped/cloudprovider/lambda/function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func TestparseFunctionManifest(t *testing.T) {
"kind": "LambdaFunction",
"spec": {
"name": "SimpleFunction",
"runtime": "nodejs12.x",
"handler": "SampleFunction",
"image": "ecr.region.amazonaws.com/lambda-simple-function:v0.0.1"
}
}`,
Expand All @@ -43,6 +45,8 @@ func TestparseFunctionManifest(t *testing.T) {
Spec: FunctionManifestSpec{
Name: "SimpleFunction",
ImageURI: "ecr.region.amazonaws.com/lambda-simple-function:v0.0.1",
Runtime: "nodejs12.x",
Handler: "SampleFunction",
},
},
wantErr: false,
Expand Down