Skip to content
Open
Show file tree
Hide file tree
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
27 changes: 20 additions & 7 deletions internal/connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type connectorClient struct {
connectorV2.GrantManagerServiceClient
connectorV2.ResourceManagerServiceClient
connectorV2.AccountManagerServiceClient
connectorV2.AccountCreationStatusServiceClient
connectorV2.CredentialManagerServiceClient
connectorV2.EventServiceClient
connectorV2.TicketsServiceClient
Expand All @@ -53,13 +54,14 @@ var ErrConnectorNotImplemented = errors.New("client does not implement connector
type wrapper struct {
mtx sync.RWMutex

server types.ConnectorServer
client types.ConnectorClient
serverStdin io.WriteCloser
conn *grpc.ClientConn
provisioningEnabled bool
ticketingEnabled bool
fullSyncDisabled bool
server types.ConnectorServer
client types.ConnectorClient
serverStdin io.WriteCloser
conn *grpc.ClientConn
provisioningEnabled bool
ticketingEnabled bool
fullSyncDisabled bool
getAccountCreationStatusEnabled bool

rateLimiter ratelimitV1.RateLimiterServiceServer
rlCfg *ratelimitV1.RateLimiterConfig
Expand Down Expand Up @@ -98,6 +100,13 @@ func WithProvisioningEnabled() Option {
}
}

func WithAccountCreationStatusEnabled() Option {
return func(ctx context.Context, w *wrapper) error {
w.getAccountCreationStatusEnabled = true
return nil
}
}

func WithFullSyncDisabled() Option {
return func(ctx context.Context, w *wrapper) error {
w.fullSyncDisabled = true
Expand Down Expand Up @@ -178,6 +187,10 @@ func (cw *wrapper) Run(ctx context.Context, serverCfg *connectorwrapperV1.Server
connectorV2.RegisterTicketsServiceServer(server, noop)
}

if cw.getAccountCreationStatusEnabled {
connectorV2.RegisterResourceManagerServiceServer(server, cw.server)
}

if cw.provisioningEnabled {
connectorV2.RegisterGrantManagerServiceServer(server, cw.server)
connectorV2.RegisterResourceManagerServiceServer(server, cw.server)
Expand Down
3 changes: 2 additions & 1 deletion internal/connector/noop_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package connector
import (
"context"

v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2"
)

type noopProvisioner struct{}
Expand Down
Loading
Loading