Skip to content

Commit

Permalink
code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lynnemorrison committed Oct 23, 2024
1 parent 780e06a commit c0d88c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions internal/nonkube/client/fs/connector_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (s *ConnectorHandler) Get(name string) (*v1alpha1.Connector, error) {
return nil, err
}

if err = s.EncodeYaml(file, &context); err != nil {
if err = s.DecodeYaml(file, &context); err != nil {
return nil, err
}

Expand All @@ -67,7 +67,7 @@ func (s *ConnectorHandler) GetRuntime(fileName string) (*v1alpha1.Connector, []f
return nil, nil, err
}

if err = s.EncodeYaml(file, &context); err != nil {
if err = s.DecodeYaml(file, &context); err != nil {
return nil, nil, err
}

Expand Down
5 changes: 2 additions & 3 deletions internal/nonkube/client/fs/custom_resource_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type CustomResourceHandler[T any] interface {
//Common methods
EncodeToYaml(resource interface{}) (string, error)
WriteFile(path string, name string, content string, kind string) error
EncodeYaml(content []byte, resource interface{}) (interface{}, error)
DecodeYaml(content []byte, resource interface{}) (interface{}, error)
ReadFile(path string, name string, kind string) (error, []byte)
DeleteFile(path string, name string, kind string) error
ReadDir(path string, kind string) (error, []fs.DirEntry)
Expand All @@ -34,8 +34,7 @@ func (b *BaseCustomResourceHandler) EncodeToYaml(resource interface{}) (string,
return string(result), err
}

// TBD better name
func (b *BaseCustomResourceHandler) EncodeYaml(content []byte, resource interface{}) error {
func (b *BaseCustomResourceHandler) DecodeYaml(content []byte, resource interface{}) error {

if err := yaml.Unmarshal(content, &resource); err != nil {
return err
Expand Down

0 comments on commit c0d88c1

Please sign in to comment.