Skip to content

Commit

Permalink
Add ocm package
Browse files Browse the repository at this point in the history
  • Loading branch information
nesmabadr committed Sep 10, 2024
1 parent facfcb3 commit 434354f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions internal/service/ocm/ocm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package ocm

import (
"fmt"

commonerrors "github.com/kyma-project/modulectl/internal/common/errors"
)

type ModuleDefinition struct {
Name string
Version string
SchemaVersion string

// TODO: Define Layer struct based on the new ocm and remember to add the raw-manifest layer
// Layers []Layer

}

func (d *ModuleDefinition) ValidateModuleDefinition() error {
if d.Name == "" {
return fmt.Errorf("%w: module name must not be empty", commonerrors.ErrInvalidArg)
}

if d.Version == "" {
return fmt.Errorf("%w: module version must not be empty", commonerrors.ErrInvalidArg)
}

if d.SchemaVersion == "" {
return fmt.Errorf("%w: module schema version must not be empty", commonerrors.ErrInvalidArg)
}

return nil
}

0 comments on commit 434354f

Please sign in to comment.