Add Better Stack access review connector
Better Stack exposes team members and pending invitations through its Uptime API. Wire it as an access-review connector so a Better Stack team can be reviewed in access-review campaigns. Better Stack has no third-party OAuth app for listing members (its OAuth is an end-user MCP sign-in), so the connector authenticates with a Bearer API token plus the team name that scopes the team-members listing. The driver paginates /api/v2/team-members, maps roles and invitation records into account records, and the source name is resolved from the configured team. This wires the full surface: the provider enum and migration, the connector settings, the registry registration with the team-name extra setting, the GraphQL input and resolver marshaling, the frontend field mapping and connector logo, and cassette-backed driver tests. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
65
pkg/connector/provider/better_stack.go
Normal file
65
pkg/connector/provider/better_stack.go
Normal file
@@ -0,0 +1,65 @@
|
||||
// Copyright (c) 2026 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice appear in all copies.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
package provider
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"go.gearno.de/kit/log"
|
||||
"go.probo.inc/probo/pkg/accessreview/drivers"
|
||||
"go.probo.inc/probo/pkg/coredata"
|
||||
)
|
||||
|
||||
// betterStackRegistration wires the Better Stack Uptime access-review
|
||||
// connector. Better Stack has no third-party OAuth app for listing team
|
||||
// members (its OAuth is an end-user MCP sign-in), so the connector is
|
||||
// API-key only: the operator supplies a Bearer API token plus the team
|
||||
// name that scopes the team-members listing.
|
||||
func betterStackRegistration() *Registration {
|
||||
return &Registration{
|
||||
Provider: coredata.ConnectorProviderBetterStack,
|
||||
DisplayName: "Better Stack",
|
||||
SupportsAPIKey: true,
|
||||
ProbeURL: "https://betterstack.com/api/v2/team-members",
|
||||
ExtraSettings: []ExtraSetting{
|
||||
{Key: "teamName", Label: "Team Name", Required: true},
|
||||
},
|
||||
NewDriver: func(_ context.Context, c *http.Client, conn *coredata.Connector, _ *log.Logger) (drivers.Driver, error) {
|
||||
s, err := coredata.ConnectorSettings[coredata.BetterStackConnectorSettings](conn)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot read better stack connector settings: %w", err)
|
||||
}
|
||||
|
||||
teamName := strings.TrimSpace(s.TeamName)
|
||||
if teamName == "" {
|
||||
return nil, fmt.Errorf("cannot create better stack driver: team_name is required")
|
||||
}
|
||||
|
||||
return drivers.NewBetterStackDriver(c, teamName), nil
|
||||
},
|
||||
NewNameResolver: func(ctx context.Context, _ *http.Client, conn *coredata.Connector, logger *log.Logger) drivers.NameResolver {
|
||||
s, err := coredata.ConnectorSettings[coredata.BetterStackConnectorSettings](conn)
|
||||
if err != nil {
|
||||
logger.ErrorCtx(ctx, "cannot read better stack connector settings", log.Error(err))
|
||||
return nil
|
||||
}
|
||||
|
||||
return drivers.NewBetterStackNameResolver(strings.TrimSpace(s.TeamName))
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user