Skip to content

Commit

Permalink
Allow empty version to be the same as v1 in providers (#5172)
Browse files Browse the repository at this point in the history
  • Loading branch information
evankanderson authored Dec 11, 2024
1 parent 7d818e9 commit 9336b1b
Show file tree
Hide file tree
Showing 5 changed files with 1,081 additions and 1,070 deletions.
2 changes: 1 addition & 1 deletion docs/docs/ref/proto.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions internal/controlplane/handlers_providers.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func (s *Server) CreateProvider(
return nil, status.Errorf(codes.InvalidArgument, "provider is required")
}

if provider.GetVersion() == "" {
provider.Version = "v1"
}

var provConfig json.RawMessage
if provider.Config != nil {
var marshallErr error
Expand Down Expand Up @@ -237,6 +241,10 @@ func (s *Server) PatchProvider(
return nil, status.Errorf(codes.InvalidArgument, "provider name is required")
}

if req.GetPatch() != nil && req.GetPatch().GetVersion() == "" {
req.Patch.Version = "v1"
}

err := s.providerManager.PatchProviderConfig(ctx, providerName, projectID, req.GetPatch().GetConfig().AsMap())
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/openapi/minder/v1/minder.swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9336b1b

Please sign in to comment.