Documentation ¶
Index ¶
- Constants
- Variables
- type Agent
- type AgentClient
- func (s *AgentClient) ExportDone(sessionID string, lastProcessed interface{})
- func (s *AgentClient) ExportGitRepo(fetch GitRepoFetch) error
- func (s *AgentClient) ExportStarted(modelType string) (sessionID string, lastProcessed interface{})
- func (s *AgentClient) OAuthNewAccessToken() (token string, _ error)
- func (s *AgentClient) SendExported(sessionID string, objs []ExportObj)
- func (s *AgentClient) SendPauseEvent(msg string, resumeDate time.Time) error
- func (s *AgentClient) SendResumeEvent(msg string) error
- func (s *AgentClient) SessionProgress(id int, current, total int) error
- func (s *AgentClient) SessionRollback(id int) error
- func (s *AgentClient) SessionStart(isTracking bool, name string, parentSessionID int, ...) (sessionID int, lastProcessed interface{}, _ error)
- type AgentServer
- func (s *AgentServer) ExportDone(ctx context.Context, req *proto.ExportDoneReq) (*proto.Empty, error)
- func (s *AgentServer) ExportGitRepo(ctx context.Context, req *proto.ExportGitRepoReq) (resp *proto.Empty, _ error)
- func (s *AgentServer) ExportStarted(ctx context.Context, req *proto.ExportStartedReq) (*proto.ExportStartedResp, error)
- func (s *AgentServer) OAuthNewAccessToken(ctx context.Context, req *proto.Empty) (*proto.OAuthNewAccessTokenResp, error)
- func (s *AgentServer) SendExported(ctx context.Context, req *proto.SendExportedReq) (*proto.Empty, error)
- func (s *AgentServer) SendPauseEvent(ctx context.Context, req *proto.SendPauseEventReq) (resp *proto.Empty, rerr error)
- func (s *AgentServer) SendResumeEvent(ctx context.Context, req *proto.SendResumeEventReq) (resp *proto.Empty, err error)
- func (s *AgentServer) SessionProgress(ctx context.Context, req *proto.SessionProgressReq) (resp *proto.Empty, _ error)
- func (s *AgentServer) SessionRollback(ctx context.Context, req *proto.SessionRollbackReq) (resp *proto.Empty, _ error)
- func (s *AgentServer) SessionStart(ctx context.Context, req *proto.SessionStartReq) (resp *proto.SessionStartResp, _ error)
- type ExportConfig
- type ExportConfigPinpoint
- type ExportObj
- type ExportProject
- type ExportResult
- type GitRepoFetch
- type GitRepoFetchPR
- type Integration
- type IntegrationClient
- func (s *IntegrationClient) Destroy()
- func (s *IntegrationClient) Export(ctx context.Context, exportConfig ExportConfig) (res ExportResult, _ error)
- func (s *IntegrationClient) Init(agent Agent) error
- func (s *IntegrationClient) Mutate(ctx context.Context, mutateFn string, mutateData string, ...) (res MutateResult, rerr error)
- func (s *IntegrationClient) OnboardExport(ctx context.Context, objectType OnboardExportType, exportConfig ExportConfig) (res OnboardExportResult, _ error)
- func (s *IntegrationClient) ValidateConfig(ctx context.Context, exportConfig ExportConfig) (res ValidationResult, _ error)
- func (s *IntegrationClient) Webhook(ctx context.Context, headers map[string]string, body string, ...) (res WebhookResult, rerr error)
- type IntegrationConfig
- type IntegrationPlugin
- type IntegrationServer
- func (s *IntegrationServer) Destroy() error
- func (s *IntegrationServer) Export(ctx context.Context, req *proto.IntegrationExportReq) (res *proto.IntegrationExportResp, _ error)
- func (s *IntegrationServer) Init(ctx context.Context, req *proto.IntegrationInitReq) (*proto.Empty, error)
- func (s *IntegrationServer) Mutate(ctx context.Context, req *proto.IntegrationMutateReq) (res *proto.IntegrationMutateResp, _ error)
- func (s *IntegrationServer) OnboardExport(ctx context.Context, req *proto.IntegrationOnboardExportReq) (res *proto.IntegrationOnboardExportResp, _ error)
- func (s *IntegrationServer) ValidateConfig(ctx context.Context, req *proto.IntegrationValidateConfigReq) (res *proto.IntegrationValidateConfigResp, _ error)
- func (s *IntegrationServer) Webhook(ctx context.Context, req *proto.IntegrationWebhookReq) (res *proto.IntegrationWebhookResp, _ error)
- type MutateResult
- type MutatedObjects
- type OnboardExportResult
- type OnboardExportType
- type ValidationResult
- type WebhookResult
Constants ¶
View Source
const ( OnboardExportTypeUsers OnboardExportType = "users" OnboardExportTypeRepos = "repos" OnboardExportTypeProjects = "projects" OnboardExportTypeWorkConfig = "workconfig" OnboardExportTypeCalendar = "calendars" )
Variables ¶
View Source
var ErrOnboardExportNotSupported = errors.New("onboard for integration does not support requested object type")
View Source
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "PLUGIN",
MagicCookieValue: "pinpoint-agent-plugin",
}
handshakeConfigs are used to just do a basic handshake between a plugin and host. If the handshake fails, a user friendly error is shown. This prevents users from executing bad plugins or executing a plugin directory. It is a UX feature, not a security feature.
View Source
var PluginMap = map[string]plugin.Plugin{ "integration": &IntegrationPlugin{}, }
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent interface { // ExportStarted should be called when starting export for each modelType. // It returns session id to be used later when sending objects. ExportStarted(modelType string) (sessionID string, lastProcessed interface{}) // ExportDone should be called when export of a certain modelType is complete. // TODO: rename to SessionDone ExportDone(sessionID string, lastProcessed interface{}) // SendExported forwards the exported objects from intergration to agent, // which then uploads the data (or queues for uploading). // TODO: rename to SessionSend SendExported( sessionID string, objs []ExportObj) // SessionStart creates a new export session with optional parent. // isTracking is a bool to create a tracking session instead of normal session. Tracking sessions do not allow sending data, they are only used for organizing progress events. // name - For normal sessions use model name. For tracking sessions any string is allows, it will be shown in the progress log. // parentSessionID - parent session. Can be 0 for root sessions. // parentObjectID - id of the parent object. To show in progress logs. // parentObjectName - name of the parent object SessionStart(isTracking bool, name string, parentSessionID int, parentObjectID, parentObjectName string) (sessionID int, lastProcessed interface{}, _ error) // SessionProgress updates progress for a session SessionProgress(id int, current, total int) error // SessionRollback does not update lastProcessed, and deletes temp session file SessionRollback(id int) error // Integration can ask agent to download and process git repo using ripsrc. ExportGitRepo(fetch GitRepoFetch) error // OAuthNewAccessToken returns a new access token for integrations with UseOAuth: true. It askes agent to retrieve a new token from backend based on refresh token agent has. OAuthNewAccessToken() (token string, _ error) SendPauseEvent(msg string, resumeDate time.Time) error SendResumeEvent(msg string) error }
keep in sync with readme.md
type AgentClient ¶
type AgentClient struct {
// contains filtered or unexported fields
}
func (*AgentClient) ExportDone ¶
func (s *AgentClient) ExportDone(sessionID string, lastProcessed interface{})
func (*AgentClient) ExportGitRepo ¶
func (s *AgentClient) ExportGitRepo(fetch GitRepoFetch) error
func (*AgentClient) ExportStarted ¶
func (s *AgentClient) ExportStarted(modelType string) (sessionID string, lastProcessed interface{})
func (*AgentClient) OAuthNewAccessToken ¶
func (s *AgentClient) OAuthNewAccessToken() (token string, _ error)
func (*AgentClient) SendExported ¶
func (s *AgentClient) SendExported(sessionID string, objs []ExportObj)
func (*AgentClient) SendPauseEvent ¶
func (s *AgentClient) SendPauseEvent(msg string, resumeDate time.Time) error
func (*AgentClient) SendResumeEvent ¶
func (s *AgentClient) SendResumeEvent(msg string) error
func (*AgentClient) SessionProgress ¶
func (s *AgentClient) SessionProgress(id int, current, total int) error
func (*AgentClient) SessionRollback ¶
func (s *AgentClient) SessionRollback(id int) error
func (*AgentClient) SessionStart ¶
type AgentServer ¶
type AgentServer struct {
Impl Agent
}
func (*AgentServer) ExportDone ¶
func (s *AgentServer) ExportDone(ctx context.Context, req *proto.ExportDoneReq) (*proto.Empty, error)
func (*AgentServer) ExportGitRepo ¶
func (s *AgentServer) ExportGitRepo(ctx context.Context, req *proto.ExportGitRepoReq) (resp *proto.Empty, _ error)
func (*AgentServer) ExportStarted ¶
func (s *AgentServer) ExportStarted(ctx context.Context, req *proto.ExportStartedReq) (*proto.ExportStartedResp, error)
func (*AgentServer) OAuthNewAccessToken ¶
func (s *AgentServer) OAuthNewAccessToken(ctx context.Context, req *proto.Empty) (*proto.OAuthNewAccessTokenResp, error)
func (*AgentServer) SendExported ¶
func (s *AgentServer) SendExported(ctx context.Context, req *proto.SendExportedReq) (*proto.Empty, error)
func (*AgentServer) SendPauseEvent ¶
func (s *AgentServer) SendPauseEvent(ctx context.Context, req *proto.SendPauseEventReq) (resp *proto.Empty, rerr error)
func (*AgentServer) SendResumeEvent ¶
func (s *AgentServer) SendResumeEvent(ctx context.Context, req *proto.SendResumeEventReq) (resp *proto.Empty, err error)
func (*AgentServer) SessionProgress ¶
func (s *AgentServer) SessionProgress(ctx context.Context, req *proto.SessionProgressReq) (resp *proto.Empty, _ error)
func (*AgentServer) SessionRollback ¶
func (s *AgentServer) SessionRollback(ctx context.Context, req *proto.SessionRollbackReq) (resp *proto.Empty, _ error)
func (*AgentServer) SessionStart ¶
func (s *AgentServer) SessionStart(ctx context.Context, req *proto.SessionStartReq) (resp *proto.SessionStartResp, _ error)
type ExportConfig ¶
type ExportConfig struct { Pinpoint ExportConfigPinpoint Integration IntegrationConfig UseOAuth bool }
type ExportConfigPinpoint ¶
type ExportConfigPinpoint struct {
CustomerID string
}
type ExportProject ¶
type ExportResult ¶
type ExportResult struct {
Projects []ExportProject
}
type GitRepoFetch ¶
type GitRepoFetch struct { RepoID string UniqueName string RefType string URL string CommitURLTemplate string BranchURLTemplate string PRs []GitRepoFetchPR }
func (GitRepoFetch) Validate ¶
func (s GitRepoFetch) Validate() error
type GitRepoFetchPR ¶
type GitRepoFetchPR struct { ID string RefID string URL string BranchName string LastCommitSHA string }
func (GitRepoFetchPR) Validate ¶
func (s GitRepoFetchPR) Validate() error
type Integration ¶
type Integration interface { // Init provides the connection details for connecting back to agent. Init(agent Agent) error // Export starts export of all data types for this integration. // Config contains typed config common for all integrations and map[string]interface{} for custom fields. Export(context.Context, ExportConfig) (ExportResult, error) ValidateConfig(context.Context, ExportConfig) (ValidationResult, error) // OnboardExport returns the data used in onboard. Kind is one of users, repos, projects. OnboardExport(ctx context.Context, objectType OnboardExportType, config ExportConfig) (OnboardExportResult, error) // Mutate changes integration data Mutate(ctx context.Context, fn string, data string, config ExportConfig) (MutateResult, error) // Webhook takes the objects provided by integration webhooks and queries for additional fields if needed Webhook(ctx context.Context, headers map[string]string, body string, config ExportConfig) (WebhookResult, error) }
type IntegrationClient ¶
type IntegrationClient struct {
// contains filtered or unexported fields
}
func NewIntegrationClient ¶
func NewIntegrationClient(protoClient proto.IntegrationClient, broker *plugin.GRPCBroker) *IntegrationClient
func (*IntegrationClient) Destroy ¶
func (s *IntegrationClient) Destroy()
func (*IntegrationClient) Export ¶
func (s *IntegrationClient) Export(ctx context.Context, exportConfig ExportConfig) (res ExportResult, _ error)
func (*IntegrationClient) Init ¶
func (s *IntegrationClient) Init(agent Agent) error
func (*IntegrationClient) Mutate ¶
func (s *IntegrationClient) Mutate(ctx context.Context, mutateFn string, mutateData string, exportConfig ExportConfig) (res MutateResult, rerr error)
func (*IntegrationClient) OnboardExport ¶
func (s *IntegrationClient) OnboardExport(ctx context.Context, objectType OnboardExportType, exportConfig ExportConfig) (res OnboardExportResult, _ error)
func (*IntegrationClient) ValidateConfig ¶
func (s *IntegrationClient) ValidateConfig(ctx context.Context, exportConfig ExportConfig) (res ValidationResult, _ error)
func (*IntegrationClient) Webhook ¶
func (s *IntegrationClient) Webhook(ctx context.Context, headers map[string]string, body string, exportConfig ExportConfig) (res WebhookResult, rerr error)
type IntegrationConfig ¶
type IntegrationConfig inconfig.Integration
type IntegrationPlugin ¶
type IntegrationPlugin struct { plugin.Plugin Impl Integration }
func (*IntegrationPlugin) GRPCClient ¶
func (s *IntegrationPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*IntegrationPlugin) GRPCServer ¶
func (s *IntegrationPlugin) GRPCServer(broker *plugin.GRPCBroker, server *grpc.Server) error
type IntegrationServer ¶
type IntegrationServer struct { Impl Integration // contains filtered or unexported fields }
func NewIntegrationServer ¶
func NewIntegrationServer(impl Integration, broker *plugin.GRPCBroker) *IntegrationServer
func (*IntegrationServer) Destroy ¶
func (s *IntegrationServer) Destroy() error
func (*IntegrationServer) Export ¶
func (s *IntegrationServer) Export(ctx context.Context, req *proto.IntegrationExportReq) (res *proto.IntegrationExportResp, _ error)
func (*IntegrationServer) Init ¶
func (s *IntegrationServer) Init(ctx context.Context, req *proto.IntegrationInitReq) (*proto.Empty, error)
func (*IntegrationServer) Mutate ¶
func (s *IntegrationServer) Mutate(ctx context.Context, req *proto.IntegrationMutateReq) (res *proto.IntegrationMutateResp, _ error)
func (*IntegrationServer) OnboardExport ¶
func (s *IntegrationServer) OnboardExport(ctx context.Context, req *proto.IntegrationOnboardExportReq) (res *proto.IntegrationOnboardExportResp, _ error)
func (*IntegrationServer) ValidateConfig ¶
func (s *IntegrationServer) ValidateConfig(ctx context.Context, req *proto.IntegrationValidateConfigReq) (res *proto.IntegrationValidateConfigResp, _ error)
func (*IntegrationServer) Webhook ¶
func (s *IntegrationServer) Webhook(ctx context.Context, req *proto.IntegrationWebhookReq) (res *proto.IntegrationWebhookResp, _ error)
type MutateResult ¶
type MutateResult struct { MutatedObjects MutatedObjects WebappResponse interface{} Error string ErrorCode string }
type MutatedObjects ¶
type MutatedObjects map[string][]interface{}
type OnboardExportResult ¶
type OnboardExportResult struct { Error error Data interface{} }
OnboardExportResult is the result of the onboard call. If the particular data type is not supported by integration, return Error will be equal to OnboardExportErrNotSupported.
type OnboardExportType ¶
type OnboardExportType string
type ValidationResult ¶
type WebhookResult ¶
type WebhookResult struct { MutatedObjects MutatedObjects Error string }
Click to show internal directories.
Click to hide internal directories.