Documentation
¶
Index ¶
- Constants
- func NewConnector(ctx context.Context, in interface{}, opts ...Opt) (types.ConnectorServer, error)
- type AccountManager
- type ConnectorBuilder
- type CreateAccountResponse
- type CredentialManager
- type CustomActionManager
- type EventFeed
- type EventLister
- type EventProviderdeprecated
- type EventProviderV2
- type Opt
- type RegisterActionManager
- type ResourceDeleter
- type ResourceManager
- type ResourceProvisioner
- type ResourceProvisionerV2
- type ResourceSyncer
- type ResourceTargetedSyncer
- type TicketManager
Constants ¶
const (
LegacyBatonFeedId = "baton_feed_event"
)
Variables ¶
This section is empty.
Functions ¶
func NewConnector ¶
NewConnector creates a new ConnectorServer for a new resource.
Types ¶
type AccountManager ¶ added in v0.1.15
type AccountManager interface {
ResourceSyncer
CreateAccount(ctx context.Context, accountInfo *v2.AccountInfo, credentialOptions *v2.CredentialOptions) (CreateAccountResponse, []*v2.PlaintextData, annotations.Annotations, error)
CreateAccountCapabilityDetails(ctx context.Context) (*v2.CredentialDetailsAccountProvisioning, annotations.Annotations, error)
}
AccountManager extends ResourceSyncer to add capabilities for managing user accounts.
Implementing this interface indicates the connector supports creating accounts in the external system. A resource type should implement this interface if it represents users or accounts that can be provisioned.
type ConnectorBuilder ¶
type ConnectorBuilder interface {
Metadata(ctx context.Context) (*v2.ConnectorMetadata, error)
Validate(ctx context.Context) (annotations.Annotations, error)
ResourceSyncers(ctx context.Context) []ResourceSyncer
}
ConnectorBuilder is the foundational interface for creating Baton connectors.
This interface defines the core capabilities required by all connectors, including metadata, validation, and registering resource syncers. Additional functionality can be added by implementing extension interfaces such as: - RegisterActionManager: For custom action support - EventProvider: For event stream support - TicketManager: For ticket management integration.
type CreateAccountResponse ¶ added in v0.1.15
CreateAccountResponse is a semi-opaque type returned from CreateAccount operations.
This is used to communicate the result of account creation back to Baton.
type CredentialManager ¶ added in v0.1.15
type CredentialManager interface {
ResourceSyncer
Rotate(ctx context.Context, resourceId *v2.ResourceId, credentialOptions *v2.CredentialOptions) ([]*v2.PlaintextData, annotations.Annotations, error)
RotateCapabilityDetails(ctx context.Context) (*v2.CredentialDetailsCredentialRotation, annotations.Annotations, error)
}
CredentialManager extends ResourceSyncer to add capabilities for managing credentials.
Implementing this interface indicates the connector supports rotating credentials for resources of the associated type. This is commonly used for user accounts or service accounts that have rotatable credentials.
type CustomActionManager ¶ added in v0.2.71
type CustomActionManager interface {
ListActionSchemas(ctx context.Context) ([]*v2.BatonActionSchema, annotations.Annotations, error)
GetActionSchema(ctx context.Context, name string) (*v2.BatonActionSchema, annotations.Annotations, error)
InvokeAction(ctx context.Context, name string, args *structpb.Struct) (string, v2.BatonActionStatus, *structpb.Struct, annotations.Annotations, error)
GetActionStatus(ctx context.Context, id string) (v2.BatonActionStatus, string, *structpb.Struct, annotations.Annotations, error)
}
CustomActionManager defines capabilities for handling custom actions.
Note: RegisterActionManager is preferred for new connectors.
This interface allows connectors to define and execute custom actions that can be triggered from Baton.
type EventFeed ¶ added in v0.3.9
type EventFeed interface {
EventLister
EventFeedMetadata(ctx context.Context) *v2.EventFeedMetadata
}
EventFeed is a single stream of events from the external system.
EventFeedMetadata describes this feed, and a connector can have multiple feeds.
type EventLister ¶ added in v0.3.9
type EventLister interface {
ListEvents(ctx context.Context, earliestEvent *timestamppb.Timestamp, pToken *pagination.StreamToken) ([]*v2.Event, *pagination.StreamState, annotations.Annotations, error)
}
Compatibility interface lets us handle both EventFeed and EventProvider the same.
type EventProvider
deprecated
added in
v0.1.16
type EventProvider interface {
ConnectorBuilder
EventLister
}
Deprecated: This interface is deprecated in favor of EventProviderV2 which supports multiple event feeds. Implementing this interface indicates the connector can provide a single stream of events from the external system, enabling near real-time updates in Baton. New connectors should implement EventProviderV2 instead.
type EventProviderV2 ¶ added in v0.3.9
type EventProviderV2 interface {
ConnectorBuilder
EventFeeds(ctx context.Context) []EventFeed
}
NewEventProviderV2 is a new interface that allows connectors to provide multiple event feeds.
This is the recommended interface for implementing event feed support in new connectors.
type Opt ¶ added in v0.1.39
type Opt func(b *builderImpl) error
func WithMetricsHandler ¶ added in v0.1.39
func WithTicketingEnabled ¶ added in v0.2.7
func WithTicketingEnabled() Opt
type RegisterActionManager ¶ added in v0.2.71
type RegisterActionManager interface {
ConnectorBuilder
RegisterActionManager(ctx context.Context) (CustomActionManager, error)
}
RegisterActionManager extends ConnectorBuilder to add capabilities for registering custom actions.
This is the recommended interface for implementing custom action support in new connectors. It provides a mechanism to register a CustomActionManager with the connector.
type ResourceDeleter ¶ added in v0.2.84
type ResourceDeleter interface {
ResourceSyncer
Delete(ctx context.Context, resourceId *v2.ResourceId) (annotations.Annotations, error)
}
ResourceDeleter extends ResourceSyncer to add capabilities for deleting resources.
Implementing this interface indicates the connector supports deleting resources of the associated resource type.
type ResourceManager ¶ added in v0.1.15
type ResourceManager interface {
ResourceSyncer
Create(ctx context.Context, resource *v2.Resource) (*v2.Resource, annotations.Annotations, error)
ResourceDeleter
}
ResourceManager extends ResourceSyncer to add capabilities for creating resources.
Implementing this interface indicates the connector supports creating and deleting resources of the associated resource type. A ResourceManager automatically provides ResourceDeleter functionality.
type ResourceProvisioner ¶ added in v0.0.30
type ResourceProvisioner interface {
ResourceSyncer
ResourceType(ctx context.Context) *v2.ResourceType
Grant(ctx context.Context, resource *v2.Resource, entitlement *v2.Entitlement) (annotations.Annotations, error)
Revoke(ctx context.Context, grant *v2.Grant) (annotations.Annotations, error)
}
ResourceProvisioner extends ResourceSyncer to add capabilities for granting and revoking access.
Note: ResourceProvisionerV2 is preferred for new connectors as it provides enhanced grant capabilities.
Implementing this interface indicates the connector supports provisioning operations for the associated resource type.
type ResourceProvisionerV2 ¶ added in v0.1.13
type ResourceProvisionerV2 interface {
ResourceSyncer
ResourceType(ctx context.Context) *v2.ResourceType
Grant(ctx context.Context, resource *v2.Resource, entitlement *v2.Entitlement) ([]*v2.Grant, annotations.Annotations, error)
Revoke(ctx context.Context, grant *v2.Grant) (annotations.Annotations, error)
}
ResourceProvisionerV2 extends ResourceSyncer to add capabilities for granting and revoking access with enhanced functionality compared to ResourceProvisioner.
This is the recommended interface for implementing provisioning operations in new connectors. It differs from ResourceProvisioner by returning a list of grants from the Grant method.
type ResourceSyncer ¶
type ResourceSyncer interface {
ResourceType(ctx context.Context) *v2.ResourceType
List(ctx context.Context, parentResourceID *v2.ResourceId, pToken *pagination.Token) ([]*v2.Resource, string, annotations.Annotations, error)
Entitlements(ctx context.Context, resource *v2.Resource, pToken *pagination.Token) ([]*v2.Entitlement, string, annotations.Annotations, error)
Grants(ctx context.Context, resource *v2.Resource, pToken *pagination.Token) ([]*v2.Grant, string, annotations.Annotations, error)
}
ResourceSyncer is the primary interface for connector developers to implement.
It defines the core functionality for synchronizing resources, entitlements, and grants from external systems into Baton. Every connector must implement at least this interface for each resource type it supports.
Extensions to this interface include: - ResourceProvisioner/ResourceProvisionerV2: For adding/removing access - ResourceManager: For creating and managing resources - ResourceDeleter: For deleting resources - AccountManager: For account provisioning operations - CredentialManager: For credential rotation operations. - ResourceTargetedSyncer: For directly getting a resource supporting targeted sync.
type ResourceTargetedSyncer ¶ added in v0.2.99
type ResourceTargetedSyncer interface {
ResourceSyncer
Get(ctx context.Context, resourceId *v2.ResourceId, parentResourceId *v2.ResourceId) (*v2.Resource, annotations.Annotations, error)
}
ResourceTargetedSyncer extends ResourceSyncer to add capabilities for directly syncing an individual resource
Implementing this interface indicates the connector supports calling "get" on a resource of the associated resource type.
type TicketManager ¶ added in v0.1.36
type TicketManager interface {
ConnectorBuilder
GetTicket(ctx context.Context, ticketId string) (*v2.Ticket, annotations.Annotations, error)
CreateTicket(ctx context.Context, ticket *v2.Ticket, schema *v2.TicketSchema) (*v2.Ticket, annotations.Annotations, error)
GetTicketSchema(ctx context.Context, schemaID string) (*v2.TicketSchema, annotations.Annotations, error)
ListTicketSchemas(ctx context.Context, pToken *pagination.Token) ([]*v2.TicketSchema, string, annotations.Annotations, error)
BulkCreateTickets(context.Context, *v2.TicketsServiceBulkCreateTicketsRequest) (*v2.TicketsServiceBulkCreateTicketsResponse, error)
BulkGetTickets(context.Context, *v2.TicketsServiceBulkGetTicketsRequest) (*v2.TicketsServiceBulkGetTicketsResponse, error)
}
TicketManager extends ConnectorBuilder to add capabilities for ticket management.
Implementing this interface indicates the connector can integrate with an external ticketing system, allowing Baton to create and track tickets in that system.