Documentation ¶
Index ¶
- Constants
- Variables
- func ContainsSubstring(target string, substrings []string) bool
- func ForEveryStringWithBoundedGoroutines(limit int, values []interface{}, f func(i int, value interface{}))
- func GetPluginVersions(pluginsDir, pluginType string) map[string]PluginMeta
- func HasFlags(flags *pflag.FlagSet) bool
- func IsInList(target string, list []string) bool
- func StructToMap(data interface{}) (map[string]string, error)
- func WithPlugin(cfg *config.Config, loggerName, pluginType, pluginName string, ...) error
- func WriteGenericResult(cfg *config.Config, logger hclog.Logger, result GenericLaunchesResult, ...) error
- type Args
- type GenericLaunchesResult
- type GenericResult
- type ListFuncResult
- type PRParams
- type PluginMeta
- type ProjectParams
- type Reference
- type RepositoryParams
- type Result
- type Scanner
- type ScannerPlugin
- type ScannerRPCClient
- type ScannerRPCServer
- type ScannerScanRequest
- type ScannerScanResponse
- type User
- type VCS
- type VCSAddCommentToPRRequest
- type VCSAddRoleToPRRequest
- type VCSFetchRequest
- type VCSFetchResponse
- type VCSListRepositoriesRequest
- type VCSListRepositoriesResponse
- type VCSPlugin
- type VCSRPCClient
- func (g *VCSRPCClient) AddCommentToPR(req VCSAddCommentToPRRequest) (bool, error)
- func (g *VCSRPCClient) AddRoleToPR(req VCSAddRoleToPRRequest) (bool, error)
- func (g *VCSRPCClient) Fetch(req VCSFetchRequest) (VCSFetchResponse, error)
- func (g *VCSRPCClient) ListRepositories(req VCSListRepositoriesRequest) ([]RepositoryParams, error)
- func (g *VCSRPCClient) RetrievePRInformation(req VCSRetrievePRInformationRequest) (PRParams, error)
- func (g *VCSRPCClient) SetStatusOfPR(req VCSSetStatusOfPRRequest) (bool, error)
- func (g *VCSRPCClient) Setup(configData config.Config) (bool, error)
- type VCSRPCServer
- func (s *VCSRPCServer) AddCommentToPR(args VCSAddCommentToPRRequest, resp *VCSRetrievePRInformationResponse) error
- func (s *VCSRPCServer) AddRoleToPR(args VCSAddRoleToPRRequest, resp *VCSRetrievePRInformationResponse) error
- func (s *VCSRPCServer) Fetch(args VCSFetchRequest, resp *VCSFetchResponse) error
- func (s *VCSRPCServer) ListRepositories(args VCSListRepositoriesRequest, resp *VCSListRepositoriesResponse) error
- func (s *VCSRPCServer) RetrievePRInformation(args VCSRetrievePRInformationRequest, resp *VCSRetrievePRInformationResponse) error
- func (s *VCSRPCServer) SetStatusOfPR(args VCSSetStatusOfPRRequest, resp *VCSRetrievePRInformationResponse) error
- func (s *VCSRPCServer) Setup(configData config.Config, resp *bool) error
- type VCSRequestBase
- type VCSRetrievePRInformationRequest
- type VCSRetrievePRInformationResponse
- type VCSSetStatusOfPRRequest
- type Versions
Constants ¶
const ( PluginTypeVCS = "vcs" PluginTypeScanner = "scanner" )
Variables ¶
var HandshakeConfig = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "SCANIO",
MagicCookieValue: "a65de33ff91e68ab6f5cd1fd5abb1235294816f5",
}
var PluginMap = map[string]plugin.Plugin{ PluginTypeVCS: &VCSPlugin{}, PluginTypeScanner: &ScannerPlugin{}, }
PluginMap defines the available plugins.
Functions ¶
func ContainsSubstring ¶
func ForEveryStringWithBoundedGoroutines ¶
func ForEveryStringWithBoundedGoroutines(limit int, values []interface{}, f func(i int, value interface{}))
ForEveryStringWithBoundedGoroutines limits the number of concurrent goroutines and executes the provided function.
func GetPluginVersions ¶ added in v0.2.0
func GetPluginVersions(pluginsDir, pluginType string) map[string]PluginMeta
GetPluginVersions iterates through the plugin directories and reads their version files.
func StructToMap ¶ added in v0.2.0
StructToMap converts a struct to a map[string]string using reflection.
func WithPlugin ¶
func WithPlugin(cfg *config.Config, loggerName, pluginType, pluginName string, f func(interface{}) error) error
WithPlugin initializes the plugin client, sets up the plugin, and executes the provided function.
func WriteGenericResult ¶ added in v0.2.0
func WriteGenericResult(cfg *config.Config, logger hclog.Logger, result GenericLaunchesResult, commandName string) error
WriteGenericResult writes the provided result to a JSON file.
Types ¶
type GenericLaunchesResult ¶
type GenericLaunchesResult struct {
Launches []GenericResult `json:"launches"`
}
GenericLaunchesResult represents a list of launches.
type GenericResult ¶
type GenericResult struct { Args interface{} `json:"args"` Result interface{} `json:"result"` Status string `json:"status"` Message string `json:"message"` }
GenericResult represents the result of a generic operation.
type ListFuncResult ¶
type ListFuncResult struct { Args VCSListRepositoriesRequest `json:"args"` Result []RepositoryParams `json:"result"` Status string `json:"status"` Message string `json:"message"` }
type PRParams ¶
type PRParams struct { Id int `json:"id"` Title string `json:"title"` Description string `json:"description"` State string `json:"state"` Author User `json:"author"` SelfLink string `json:"self_link"` Source Reference `json:"source"` Destination Reference `json:"destination"` CreatedDate int64 `json:"created_date"` UpdatedDate int64 `json:"updated_date"` }
type PluginMeta ¶ added in v0.2.0
PluginMeta holds version information for a plugin.
type ProjectParams ¶
type RepositoryParams ¶
type Scanner ¶
type Scanner interface { Setup(configData config.Config) (bool, error) Scan(args ScannerScanRequest) (ScannerScanResponse, error) }
Scanner defines the interface for scanner-related operations.
type ScannerPlugin ¶
type ScannerPlugin struct {
Impl Scanner
}
ScannerPlugin is the implementation of the plugin.Plugin interface for scanners.
func (*ScannerPlugin) Client ¶
func (p *ScannerPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
Client returns an RPC client for the Scanner plugin.
func (*ScannerPlugin) Server ¶
func (p *ScannerPlugin) Server(*plugin.MuxBroker) (interface{}, error)
Server returns an RPC server for the Scanner plugin.
type ScannerRPCClient ¶
type ScannerRPCClient struct {
// contains filtered or unexported fields
}
ScannerRPCClient implements the Scanner interface for RPC clients.
func (*ScannerRPCClient) Scan ¶
func (c *ScannerRPCClient) Scan(req ScannerScanRequest) (ScannerScanResponse, error)
Scan calls the Scan method on the RPC client.
type ScannerRPCServer ¶
type ScannerRPCServer struct {
Impl Scanner
}
ScannerRPCServer wraps a Scanner implementation to provide an RPC server.
func (*ScannerRPCServer) Scan ¶
func (s *ScannerRPCServer) Scan(args ScannerScanRequest, resp *ScannerScanResponse) error
Scan calls the Scan method on the Scanner implementation.
type ScannerScanRequest ¶
type ScannerScanRequest struct { TargetPath string // Path to the target to scan ResultsPath string // Path to save the results of the scan ConfigPath string // Path to the configuration file for the scanner ReportFormat string // Format of the report to generate (e.g., JSON, Sarif) AdditionalArgs []string // Additional arguments for the scanner }
ScannerScanRequest represents a single scan request.
type ScannerScanResponse ¶
type ScannerScanResponse struct {
ResultsPath string // Path to the saved results of the scan
}
ScannerScanResponse represents the response from a scan plugin.
type VCS ¶
type VCS interface { Setup(configData config.Config) (bool, error) Fetch(req VCSFetchRequest) (VCSFetchResponse, error) ListRepositories(args VCSListRepositoriesRequest) ([]RepositoryParams, error) RetrievePRInformation(req VCSRetrievePRInformationRequest) (PRParams, error) AddRoleToPR(req VCSAddRoleToPRRequest) (bool, error) SetStatusOfPR(req VCSSetStatusOfPRRequest) (bool, error) AddCommentToPR(req VCSAddCommentToPRRequest) (bool, error) }
type VCSAddCommentToPRRequest ¶
type VCSAddCommentToPRRequest struct { VCSRequestBase Comment string FilePaths []string }
type VCSAddRoleToPRRequest ¶
type VCSAddRoleToPRRequest struct { VCSRequestBase Login string Role string }
type VCSFetchRequest ¶
type VCSFetchResponse ¶
type VCSFetchResponse struct {
Path string
}
type VCSListRepositoriesRequest ¶ added in v0.2.0
type VCSListRepositoriesResponse ¶ added in v0.2.0
type VCSListRepositoriesResponse struct {
Repositories []RepositoryParams
}
type VCSRPCClient ¶
type VCSRPCClient struct {
// contains filtered or unexported fields
}
func (*VCSRPCClient) AddCommentToPR ¶ added in v0.2.0
func (g *VCSRPCClient) AddCommentToPR(req VCSAddCommentToPRRequest) (bool, error)
func (*VCSRPCClient) AddRoleToPR ¶
func (g *VCSRPCClient) AddRoleToPR(req VCSAddRoleToPRRequest) (bool, error)
func (*VCSRPCClient) Fetch ¶
func (g *VCSRPCClient) Fetch(req VCSFetchRequest) (VCSFetchResponse, error)
func (*VCSRPCClient) ListRepositories ¶ added in v0.2.0
func (g *VCSRPCClient) ListRepositories(req VCSListRepositoriesRequest) ([]RepositoryParams, error)
func (*VCSRPCClient) RetrievePRInformation ¶ added in v0.2.0
func (g *VCSRPCClient) RetrievePRInformation(req VCSRetrievePRInformationRequest) (PRParams, error)
func (*VCSRPCClient) SetStatusOfPR ¶
func (g *VCSRPCClient) SetStatusOfPR(req VCSSetStatusOfPRRequest) (bool, error)
type VCSRPCServer ¶
type VCSRPCServer struct {
Impl VCS
}
func (*VCSRPCServer) AddCommentToPR ¶ added in v0.2.0
func (s *VCSRPCServer) AddCommentToPR(args VCSAddCommentToPRRequest, resp *VCSRetrievePRInformationResponse) error
func (*VCSRPCServer) AddRoleToPR ¶
func (s *VCSRPCServer) AddRoleToPR(args VCSAddRoleToPRRequest, resp *VCSRetrievePRInformationResponse) error
func (*VCSRPCServer) Fetch ¶
func (s *VCSRPCServer) Fetch(args VCSFetchRequest, resp *VCSFetchResponse) error
func (*VCSRPCServer) ListRepositories ¶ added in v0.2.0
func (s *VCSRPCServer) ListRepositories(args VCSListRepositoriesRequest, resp *VCSListRepositoriesResponse) error
func (*VCSRPCServer) RetrievePRInformation ¶ added in v0.2.0
func (s *VCSRPCServer) RetrievePRInformation(args VCSRetrievePRInformationRequest, resp *VCSRetrievePRInformationResponse) error
func (*VCSRPCServer) SetStatusOfPR ¶
func (s *VCSRPCServer) SetStatusOfPR(args VCSSetStatusOfPRRequest, resp *VCSRetrievePRInformationResponse) error
type VCSRequestBase ¶
type VCSRetrievePRInformationRequest ¶ added in v0.2.0
type VCSRetrievePRInformationRequest struct {
VCSRequestBase
}
type VCSRetrievePRInformationResponse ¶ added in v0.2.0
type VCSRetrievePRInformationResponse struct {
PR PRParams
}
type VCSSetStatusOfPRRequest ¶
type VCSSetStatusOfPRRequest struct { VCSRequestBase Login string Status string }