Skip to content

Commit

Permalink
migrate okta provider
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Milchev <[email protected]>
  • Loading branch information
imilchev committed Feb 12, 2024
1 parent f3d80b2 commit aa0094f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
13 changes: 5 additions & 8 deletions providers/okta/connection/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"github.com/okta/okta-sdk-golang/v2/okta"
"github.com/rs/zerolog/log"
"go.mondoo.com/cnquery/v10/providers-sdk/v1/inventory"
"go.mondoo.com/cnquery/v10/providers-sdk/v1/plugin"
"go.mondoo.com/cnquery/v10/providers-sdk/v1/vault"
)

type OktaConnection struct {
id uint32
plugin.Connection
Conf *inventory.Config
asset *inventory.Asset
// custom connection fields
Expand All @@ -25,9 +26,9 @@ type OktaConnection struct {

func NewOktaConnection(id uint32, asset *inventory.Asset, conf *inventory.Config) (*OktaConnection, error) {
conn := &OktaConnection{
Conf: conf,
id: id,
asset: asset,
Connection: plugin.NewConnection(id, asset),
Conf: conf,
asset: asset,
}

// initialize connection
Expand Down Expand Up @@ -77,10 +78,6 @@ func (c *OktaConnection) Name() string {
return "okta"
}

func (c *OktaConnection) ID() uint32 {
return c.id
}

func (c *OktaConnection) Asset() *inventory.Asset {
return c.asset
}
Expand Down
19 changes: 9 additions & 10 deletions providers/okta/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,15 @@ func (s *Service) connect(req *plugin.ConnectReq, callback plugin.ProviderCallba
}

asset.Connections[0].Id = connId
return &plugin.Runtime{
Connection: conn,
Callback: callback,
HasRecording: req.HasRecording,
CreateResource: resources.CreateResource,
NewResource: resources.NewResource,
GetData: resources.GetData,
SetData: resources.SetData,
Upstream: upstream,
}, nil
return plugin.NewRuntime(
conn,
callback,
req.HasRecording,
resources.CreateResource,
resources.NewResource,
resources.GetData,
resources.SetData,
upstream), nil
})
if err != nil {
return nil, err
Expand Down

0 comments on commit aa0094f

Please sign in to comment.