Documentation
¶
Index ¶
- type Client
- func (c *Client) CommitDriftFiles(ctx context.Context, project, branchName, generatedDir, repoPath string) (bool, error)
- func (c *Client) CreateDriftMR(ctx context.Context, project, branchName, defaultBranch string) (*gl.MergeRequest, error)
- func (c *Client) EnsureBranch(ctx context.Context, project, branchName, defaultBranch string) error
- func (c *Client) FetchAll(ctx context.Context, skipSet skip.Set, cfg FilterConfig) (*Resources, error)
- func (c *Client) FindExistingDriftMR(ctx context.Context, project string) (*gl.BasicMergeRequest, error)
- func (c *Client) GetDefaultBranch(ctx context.Context, project string) (string, error)
- func (c *Client) ListGroupHooks(ctx context.Context, groups []*gl.Group) (GroupHooks, error)
- func (c *Client) ListGroupLabels(ctx context.Context, groups []*gl.Group) (GroupLabels, error)
- func (c *Client) ListGroupMembers(ctx context.Context, groups []*gl.Group) (GroupMembers, error)
- func (c *Client) ListGroupVariables(ctx context.Context, groups []*gl.Group) (GroupVariables, error)
- func (c *Client) ListGroups(ctx context.Context, cfg FilterConfig) ([]*gl.Group, error)
- func (c *Client) ListJobTokenScopes(ctx context.Context, projects []*gl.Project) (JobTokenScopes, error)
- func (c *Client) ListPipelineSchedules(ctx context.Context, projects []*gl.Project) (PipelineSchedules, error)
- func (c *Client) ListProjectHooks(ctx context.Context, projects []*gl.Project) (ProjectHooks, error)
- func (c *Client) ListProjectLabels(ctx context.Context, projects []*gl.Project) (ProjectLabels, error)
- func (c *Client) ListProjectVariables(ctx context.Context, projects []*gl.Project) (ProjectVariables, error)
- func (c *Client) ListProjects(ctx context.Context, cfg FilterConfig) ([]*gl.Project, error)
- func (c *Client) ListProtectedBranches(ctx context.Context, projects []*gl.Project) (ProtectedBranches, error)
- func (c *Client) ListProtectedTags(ctx context.Context, projects []*gl.Project) (ProtectedTags, error)
- type ClientConfig
- type DriftMRResult
- type FilterConfig
- type GroupHooks
- type GroupLabels
- type GroupMembers
- type GroupVariables
- type JobTokenScope
- type JobTokenScopes
- type PipelineSchedules
- type ProjectHooks
- type ProjectLabels
- type ProjectVariables
- type ProtectedBranches
- type ProtectedTags
- type Resources
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CommitDriftFiles ¶ added in v1.4.0
func (c *Client) CommitDriftFiles(ctx context.Context, project, branchName, generatedDir, repoPath string) (bool, error)
CommitDriftFiles commits generated .tf files to the given branch. Returns true if a commit was created, false if all files are identical.
func (*Client) CreateDriftMR ¶ added in v1.4.0
func (c *Client) CreateDriftMR(ctx context.Context, project, branchName, defaultBranch string) (*gl.MergeRequest, error)
CreateDriftMR creates a new merge request for the drift branch.
func (*Client) EnsureBranch ¶ added in v1.4.0
EnsureBranch creates the branch if it does not already exist.
func (*Client) FindExistingDriftMR ¶ added in v1.4.0
func (c *Client) FindExistingDriftMR(ctx context.Context, project string) (*gl.BasicMergeRequest, error)
FindExistingDriftMR searches for an open MR with a "drift/" source branch prefix. Returns nil, nil if no matching MR is found.
func (*Client) GetDefaultBranch ¶ added in v1.4.0
GetDefaultBranch returns the default branch for the given project. Falls back to "main" if the project has no default branch configured.
func (*Client) ListGroupHooks ¶ added in v1.7.0
func (*Client) ListGroupLabels ¶ added in v1.5.0
func (*Client) ListGroupMembers ¶ added in v1.1.0
func (*Client) ListGroupVariables ¶ added in v1.8.0
func (*Client) ListGroups ¶
func (*Client) ListJobTokenScopes ¶ added in v1.11.0
func (*Client) ListPipelineSchedules ¶ added in v1.6.0
func (c *Client) ListPipelineSchedules(ctx context.Context, projects []*gl.Project) (PipelineSchedules, error)
ListPipelineSchedules is the heaviest fetcher: the list endpoint omits variables, so each schedule needs an extra detail call. fetchPerProject runs the projects concurrently so it doesn't become the scan's long pole; the client's rate limiter still bounds the overall request rate.
func (*Client) ListProjectHooks ¶ added in v1.7.0
func (*Client) ListProjectLabels ¶ added in v1.5.0
func (*Client) ListProjectVariables ¶ added in v1.8.0
func (*Client) ListProjects ¶
func (*Client) ListProtectedBranches ¶ added in v1.9.0
func (*Client) ListProtectedTags ¶ added in v1.13.0
type ClientConfig ¶ added in v1.15.0
type ClientConfig struct {
// RateLimit caps API requests per second via the client's proactive
// limiter. 0 disables the cap.
RateLimit float64
// Concurrency bounds how many resource fetchers run at once. <= 0 uses
// defaultConcurrency.
Concurrency int
}
ClientConfig tunes how the client talks to the GitLab API.
type DriftMRResult ¶ added in v1.4.0
type DriftMRResult struct {
WebURL string
Created bool // true = new MR, false = existing MR updated
}
DriftMRResult holds the outcome of the MR creation/update workflow.
type FilterConfig ¶ added in v1.14.0
type FilterConfig struct {
// ShowPendingDeletion includes groups and projects that are in the deletion
// grace period (MarkedForDeletionOn). They are hidden by default.
ShowPendingDeletion bool
// HideArchived excludes archived projects. They are shown by default.
// (Groups have no archived state in the GitLab API.)
HideArchived bool
}
FilterConfig controls which groups and projects a scan includes, based on their lifecycle state. It is populated from CLI flags today; keeping it as a single struct means a future config file can populate the same fields without touching the call sites.
type GroupHooks ¶ added in v1.7.0
GroupHooks maps group IDs to their hooks.
type GroupLabels ¶ added in v1.5.0
type GroupLabels = map[int64][]*gl.GroupLabel
GroupLabels maps group IDs to their labels.
type GroupMembers ¶ added in v1.1.0
type GroupMembers = map[int64][]*gl.GroupMember
GroupMembers maps group IDs to their direct members.
type GroupVariables ¶ added in v1.8.0
type GroupVariables = map[int64][]*gl.GroupVariable
GroupVariables maps group IDs to their CI/CD variables.
type JobTokenScope ¶ added in v1.11.0
type JobTokenScopes ¶ added in v1.11.0
type JobTokenScopes = map[int64]*JobTokenScope
type PipelineSchedules ¶ added in v1.6.0
type PipelineSchedules = map[int64][]*gl.PipelineSchedule
type ProjectHooks ¶ added in v1.7.0
type ProjectHooks = map[int64][]*gl.ProjectHook
ProjectHooks maps project IDs to their hooks.
type ProjectLabels ¶ added in v1.5.0
ProjectLabels maps project IDs to their labels.
type ProjectVariables ¶ added in v1.8.0
type ProjectVariables = map[int64][]*gl.ProjectVariable
ProjectVariables maps project IDs to their CI/CD variables.
type ProtectedBranches ¶ added in v1.9.0
type ProtectedBranches = map[int64][]*gl.ProtectedBranch
ProtectedBranches maps project IDs to their protected branches.
type ProtectedTags ¶ added in v1.13.0
type ProtectedTags = map[int64][]*gl.ProtectedTag
ProtectedTags maps project IDs to their protected tags.
type Resources ¶
type Resources struct {
Groups []*gl.Group
Projects []*gl.Project
GroupMembers GroupMembers
GroupLabels GroupLabels
ProjectLabels ProjectLabels
PipelineSchedules PipelineSchedules
ProjectHooks ProjectHooks
GroupHooks GroupHooks
ProjectVariables ProjectVariables
GroupVariables GroupVariables
ProtectedBranches ProtectedBranches
ProtectedTags ProtectedTags
JobTokenScopes JobTokenScopes
}