Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⭐️ support recording for gcp #2315

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
28 changes: 27 additions & 1 deletion providers/gcp/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,33 @@ func (s *Service) Shutdown(req *plugin.ShutdownReq) (*plugin.ShutdownRes, error)
}

func (s *Service) MockConnect(req *plugin.ConnectReq, callback plugin.ProviderCallback) (*plugin.ConnectRes, error) {
return nil, errors.New("mock connect not yet implemented")
if req == nil || req.Asset == nil {
return nil, errors.New("no connection data provided")
}

asset := &inventory.Asset{
PlatformIds: req.Asset.PlatformIds,
Platform: req.Asset.Platform,
Connections: []*inventory.Config{{
Type: "mock",
}},
}

conn, err := s.connect(&plugin.ConnectReq{
Features: req.Features,
Upstream: req.Upstream,
Asset: asset,
}, callback)
if err != nil {
return nil, err
}

return &plugin.ConnectRes{
Id: uint32(conn.(shared.GcpConnection).ID()),
Name: conn.(shared.GcpConnection).Name(),
Asset: asset,
Inventory: nil,
}, nil
}

func (s *Service) Connect(req *plugin.ConnectReq, callback plugin.ProviderCallback) (*plugin.ConnectRes, error) {
Expand Down