asset

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapTenantToAssetScoringConfig

func MapTenantToAssetScoringConfig(s *tenantdom.RiskScoringSettings) *assetdom.RiskScoringConfig

MapTenantToAssetScoringConfig maps tenantdom.RiskScoringSettings to assetdom.RiskScoringConfig.

Types

type AssetGroupService

type AssetGroupService struct {
	// contains filtered or unexported fields
}

AssetGroupService handles asset group business logic.

func NewAssetGroupService

func NewAssetGroupService(repo assetgroupdom.Repository, log *logger.Logger) *AssetGroupService

NewAssetGroupService creates a new asset group service.

func (*AssetGroupService) AddAssetsToGroup

func (s *AssetGroupService) AddAssetsToGroup(ctx context.Context, groupID shared.ID, assetIDs []string) error

AddAssetsToGroup adds assets to a group.

func (*AssetGroupService) BulkDeleteAssetGroups

func (s *AssetGroupService) BulkDeleteAssetGroups(ctx context.Context, groupIDs []string) (int, error)

BulkDeleteAssetGroups deletes multiple asset groups.

func (*AssetGroupService) BulkUpdateAssetGroups

func (s *AssetGroupService) BulkUpdateAssetGroups(ctx context.Context, tenantID string, input BulkUpdateInput) (int, error)

BulkUpdateAssetGroups updates multiple asset groups.

func (*AssetGroupService) CreateAssetGroup

CreateAssetGroup creates a new asset group.

func (*AssetGroupService) DeleteAssetGroup

func (s *AssetGroupService) DeleteAssetGroup(ctx context.Context, id shared.ID) error

DeleteAssetGroup deletes an asset group.

func (*AssetGroupService) GetAssetGroup

func (s *AssetGroupService) GetAssetGroup(ctx context.Context, tenantIDStr string, id shared.ID) (*assetgroupdom.AssetGroup, error)

GetAssetGroup retrieves an asset group by tenant and ID.

func (*AssetGroupService) GetAssetGroupStats

func (s *AssetGroupService) GetAssetGroupStats(ctx context.Context, tenantID string) (*assetgroupdom.Stats, error)

GetAssetGroupStats retrieves aggregated statistics.

func (*AssetGroupService) GetGroupAssets

func (s *AssetGroupService) GetGroupAssets(ctx context.Context, groupID shared.ID, pageNum, perPage int) (pagination.Result[*assetgroupdom.GroupAsset], error)

GetGroupAssets retrieves assets in a group.

func (*AssetGroupService) GetGroupFindings

func (s *AssetGroupService) GetGroupFindings(ctx context.Context, groupID shared.ID, pageNum, perPage int) (pagination.Result[*assetgroupdom.GroupFinding], error)

GetGroupFindings retrieves findings for assets in a group.

func (*AssetGroupService) ListAssetGroups

ListAssetGroups lists asset groups with filtering and pagination.

func (*AssetGroupService) RemoveAssetsFromGroup

func (s *AssetGroupService) RemoveAssetsFromGroup(ctx context.Context, groupID shared.ID, assetIDs []string) error

RemoveAssetsFromGroup removes assets from a group.

func (*AssetGroupService) SetScopeRuleReconciler

func (s *AssetGroupService) SetScopeRuleReconciler(fn scope.RuleGroupReconcilerFunc)

SetScopeRuleReconciler sets the scope rule reconciler callback. Called when asset group membership changes to re-evaluate scope rules.

func (*AssetGroupService) UpdateAssetGroup

func (s *AssetGroupService) UpdateAssetGroup(ctx context.Context, tenantIDStr string, id shared.ID, input UpdateAssetGroupInput) (*assetgroupdom.AssetGroup, error)

UpdateAssetGroup updates an existing asset group.

type AssetImportResult

type AssetImportResult struct {
	AssetsCreated int      `json:"assets_created"`
	AssetsUpdated int      `json:"assets_updated"`
	AssetsSkipped int      `json:"assets_skipped"`
	Errors        []string `json:"errors,omitempty"`
}

AssetImportResult contains the result of an import operation.

type AssetImportService

type AssetImportService struct {
	// contains filtered or unexported fields
}

AssetImportService handles bulk asset import from various formats.

func NewAssetImportService

func NewAssetImportService(assetRepo assetdom.Repository, log *logger.Logger) *AssetImportService

NewAssetImportService creates a new AssetImportService.

func (*AssetImportService) ImportCSVAssets

func (s *AssetImportService) ImportCSVAssets(ctx context.Context, tenantID string, reader io.Reader) (*AssetImportResult, error)

ImportCSVAssets imports assets from CSV data. Expected columns: name, type, sub_type, description, tags, properties (JSON)

func (*AssetImportService) ImportKubernetes

func (s *AssetImportService) ImportKubernetes(ctx context.Context, tenantID string, input K8sDiscoveryInput) (*AssetImportResult, error)

ImportKubernetes imports assets from a Kubernetes cluster discovery report.

func (*AssetImportService) ImportNessus

func (s *AssetImportService) ImportNessus(ctx context.Context, tenantID string, reader io.Reader) (*AssetImportResult, error)

ImportNessus imports hosts from Nessus XML export.

type AssetRelationshipService

type AssetRelationshipService struct {
	// contains filtered or unexported fields
}

AssetRelationshipService handles relationship business logic.

func NewAssetRelationshipService

func NewAssetRelationshipService(
	relRepo assetdom.RelationshipRepository,
	assetRepo assetdom.Repository,
	log *logger.Logger,
) *AssetRelationshipService

NewAssetRelationshipService creates a new AssetRelationshipService.

func (*AssetRelationshipService) CreateRelationship

CreateRelationship creates a new relationship between two assets.

func (*AssetRelationshipService) CreateRelationshipBatch

func (s *AssetRelationshipService) CreateRelationshipBatch(
	ctx context.Context,
	tenantID, sourceAssetID string,
	items []BatchCreateRelationshipInput,
) (*BatchCreateRelationshipResult, error)

CreateRelationshipBatch creates many relationships from one source asset in a single call. The source asset and tenant are validated ONCE for the whole batch (instead of per-item like the singleton CreateRelationship), and each item's outcome is reported separately so the caller can produce a per-target success/failure UI.

Semantics intentionally match Promise.allSettled on the frontend: a per-item failure does NOT abort the rest of the batch. The whole thing returns 200 with a results array even if every item failed — the caller decides what to do based on the per-item statuses.

This is what the frontend Add Relationship dialog calls when the user multi-selects targets. It replaces the previous N parallel POSTs at the cost of one slightly bigger response.

func (*AssetRelationshipService) DeleteRelationship

func (s *AssetRelationshipService) DeleteRelationship(ctx context.Context, tenantID, relationshipID string) error

DeleteRelationship removes a relationship.

func (*AssetRelationshipService) GetRelationship

func (s *AssetRelationshipService) GetRelationship(ctx context.Context, tenantID, relationshipID string) (*assetdom.RelationshipWithAssets, error)

GetRelationship retrieves a relationship by ID.

func (*AssetRelationshipService) GetRelationshipTypeUsage

func (s *AssetRelationshipService) GetRelationshipTypeUsage(
	ctx context.Context,
	tenantID string,
) ([]RelationshipTypeUsage, error)

GetRelationshipTypeUsage returns counts per relationship type for a tenant joined with the metadata from the generated registry. The result includes EVERY registered type (zero-count entries are preserved) so admins can see which types are unused and prune the registry based on real data instead of guessing.

func (*AssetRelationshipService) ListAssetRelationships

func (s *AssetRelationshipService) ListAssetRelationships(
	ctx context.Context,
	tenantID, assetID string,
	filter assetdom.RelationshipFilter,
) ([]*assetdom.RelationshipWithAssets, int64, error)

ListAssetRelationships lists all relationships for an asset.

func (*AssetRelationshipService) UpdateRelationship

func (s *AssetRelationshipService) UpdateRelationship(ctx context.Context, tenantID, relationshipID string, input UpdateRelationshipInput) (*assetdom.RelationshipWithAssets, error)

UpdateRelationship updates a relationship's mutable fields.

type AssetService

type AssetService struct {
	// contains filtered or unexported fields
}

AssetService handles asset-related business operations.

func NewAssetService

func NewAssetService(repo assetdom.Repository, log *logger.Logger) *AssetService

NewAssetService creates a new AssetService.

func (*AssetService) ActivateAsset

func (s *AssetService) ActivateAsset(ctx context.Context, tenantID, assetID string) (*assetdom.Asset, error)

ActivateAsset activates an asset. Security: Requires tenantID to prevent cross-tenant activation.

func (*AssetService) ArchiveAsset

func (s *AssetService) ArchiveAsset(ctx context.Context, tenantID, assetID string) (*assetdom.Asset, error)

ArchiveAsset archives an asset. Security: Requires tenantID to prevent cross-tenant archival.

func (*AssetService) ArchiveStaleAssets

func (s *AssetService) ArchiveStaleAssets(ctx context.Context, tenantID string, staleDays int, dryRun bool) (int64, error)

ArchiveStaleAssets finds and archives assets that haven't been seen for staleDays. Returns the count of archived assets. If dryRun is true, only counts without archiving.

func (*AssetService) BulkUpdateAssetStatus

func (s *AssetService) BulkUpdateAssetStatus(ctx context.Context, tenantID string, input BulkUpdateAssetStatusInput) (*BulkAssetStatusResult, error)

BulkUpdateAssetStatus atomically updates the status of multiple assets. Security: Requires tenantID to prevent cross-tenant status changes. Uses a single SQL UPDATE with IN clause for atomicity.

func (*AssetService) CreateAsset

func (s *AssetService) CreateAsset(ctx context.Context, input CreateAssetInput) (*assetdom.Asset, error)

CreateAsset creates a new asset.

func (*AssetService) CreateRepositoryAsset

CreateRepositoryAsset creates a new repository asset with its extension. If an existing asset matches (by name or fullName), it will be updated with SCM data.

func (*AssetService) DeactivateAsset

func (s *AssetService) DeactivateAsset(ctx context.Context, tenantID, assetID string) (*assetdom.Asset, error)

DeactivateAsset deactivates an asset. Security: Requires tenantID to prevent cross-tenant deactivation.

func (*AssetService) DeleteAsset

func (s *AssetService) DeleteAsset(ctx context.Context, assetID string, tenantID string) error

DeleteAsset deletes an asset by ID. Security: Requires tenantID to prevent cross-tenant deletion.

func (*AssetService) DisableRepositoryScan

func (s *AssetService) DisableRepositoryScan(ctx context.Context, assetID string) error

DisableRepositoryScan disables scanning for a repository asset.

func (*AssetService) EnableRepositoryScan

func (s *AssetService) EnableRepositoryScan(ctx context.Context, assetID string, schedule string) error

EnableRepositoryScan enables scanning for a repository asset.

func (*AssetService) GetAsset

func (s *AssetService) GetAsset(ctx context.Context, tenantID, assetID string) (*assetdom.Asset, error)

GetAsset retrieves an asset by ID within a tenant. Security: Requires tenantID to prevent cross-tenant data access.

func (*AssetService) GetAssetByExternalID

func (s *AssetService) GetAssetByExternalID(ctx context.Context, tenantID, provider, externalID string) (*assetdom.Asset, error)

GetAssetByExternalID retrieves an asset by provider and external ID.

func (*AssetService) GetAssetStats

func (s *AssetService) GetAssetStats(ctx context.Context, tenantID string, types []string, tags []string, subType string, countByFields ...string) (*assetdom.AggregateStats, error)

ListTags returns distinct tags across all assets for a tenant. Supports prefix filtering for autocomplete. GetAssetStats returns aggregated asset statistics using SQL aggregation. Filters: types (asset_type ANY), tags (overlap, matches List semantics).

func (*AssetService) GetAssetWithRepository

func (s *AssetService) GetAssetWithRepository(ctx context.Context, tenantID, assetID string) (*assetdom.Asset, *assetdom.RepositoryExtension, error)

GetAssetWithRepository retrieves an asset with its repository extension. Security: Requires tenantID to prevent cross-tenant data access.

func (*AssetService) GetAssetWithScope

func (s *AssetService) GetAssetWithScope(ctx context.Context, tenantID, assetID, actingUserID string, isAdmin bool) (*assetdom.Asset, error)

GetAssetWithScope retrieves an asset with optional data scope enforcement. Non-admin users with group assignments can only access assets in their groups. Security: fail-closed — any error during scope check denies access. Returns ErrNotFound (not ErrForbidden) to prevent information disclosure.

func (*AssetService) GetPropertyFacets

func (s *AssetService) GetPropertyFacets(ctx context.Context, tenantID string, types []string, subType string) ([]assetdom.PropertyFacet, error)

GetPropertyFacets returns distinct property keys and values for faceted filtering.

func (*AssetService) GetRepositoryExtension

func (s *AssetService) GetRepositoryExtension(ctx context.Context, tenantID, assetID string) (*assetdom.RepositoryExtension, error)

GetRepositoryExtension retrieves the repository extension for an asset. Security: Requires tenantID to prevent cross-tenant data access.

func (*AssetService) GetRepositoryExtensionsByAssetIDs

func (s *AssetService) GetRepositoryExtensionsByAssetIDs(ctx context.Context, assetIDs []shared.ID) (map[shared.ID]*assetdom.RepositoryExtension, error)

GetRepositoryExtensionsByAssetIDs retrieves repository extensions for multiple assets in a single query. Security: Caller must ensure all assetIDs belong to the specified tenant.

func (*AssetService) HasRepositoryExtensionRepository

func (s *AssetService) HasRepositoryExtensionRepository() bool

HasRepositoryExtensionRepository returns true if the repository extension repository is configured.

func (*AssetService) InvalidateScoringConfigCache

func (s *AssetService) InvalidateScoringConfigCache(tenantID shared.ID)

InvalidateScoringConfigCache removes the cached scoring config for a tenant. Call this when scoring settings are updated.

func (*AssetService) ListAssets

ListAssets retrieves assets with filtering, sorting, and pagination.

func (*AssetService) ListTags

func (s *AssetService) ListTags(ctx context.Context, tenantID string, prefix string, types []string, limit int) ([]string, error)

func (*AssetService) MarkAssetSyncFailed

func (s *AssetService) MarkAssetSyncFailed(ctx context.Context, tenantID, assetID string, syncError string) (*assetdom.Asset, error)

MarkAssetSyncFailed marks an asset sync as failed with an error message. Security: Requires tenantID to prevent cross-tenant status modification.

func (*AssetService) MarkAssetSynced

func (s *AssetService) MarkAssetSynced(ctx context.Context, tenantID, assetID string) (*assetdom.Asset, error)

MarkAssetSynced marks an asset as successfully synced. Security: Requires tenantID to prevent cross-tenant status modification.

func (*AssetService) MarkAssetSyncing

func (s *AssetService) MarkAssetSyncing(ctx context.Context, tenantID, assetID string) (*assetdom.Asset, error)

MarkAssetSyncing marks an asset as currently syncing. Security: Requires tenantID to prevent cross-tenant status modification.

func (*AssetService) PreviewRiskScoreChanges

func (s *AssetService) PreviewRiskScoreChanges(ctx context.Context, tenantID shared.ID, newConfig *assetdom.RiskScoringConfig) ([]RiskScorePreviewItem, int64, error)

PreviewRiskScoreChanges previews how a scoring config change would affect assets. Uses stratified sampling: top 20 + bottom 20 + random 60 assets. Returns preview items and total asset count for context.

func (*AssetService) RecalculateAllRiskScores

func (s *AssetService) RecalculateAllRiskScores(ctx context.Context, tenantID shared.ID) (int, error)

RecalculateAllRiskScores recalculates risk scores for all assets in a tenant using the current scoring configuration. Processes assets in batches.

func (*AssetService) RecordRepositoryScan

func (s *AssetService) RecordRepositoryScan(ctx context.Context, assetID string) error

RecordRepositoryScan records a scan completion for a repository.

func (*AssetService) SaveAsset

func (s *AssetService) SaveAsset(ctx context.Context, a *assetdom.Asset) error

SaveAsset persists changes to an asset entity directly. Used by handlers that modify the entity and need to persist without going through UpdateAssetInput.

func (*AssetService) SetAccessControlRepository

func (s *AssetService) SetAccessControlRepository(repo accesscontrol.Repository)

SetAccessControlRepository sets the access control repository for Layer 2 data scope checks.

func (*AssetService) SetAssetGroupRepository

func (s *AssetService) SetAssetGroupRepository(repo assetgroupdom.Repository)

SetAssetGroupRepository sets the asset group repository for recalculating stats.

func (*AssetService) SetRedisClient

func (s *AssetService) SetRedisClient(client *redis.Client)

SetRedisClient sets the Redis client for distributed locking.

func (*AssetService) SetRepositoryExtensionRepository

func (s *AssetService) SetRepositoryExtensionRepository(repo assetdom.RepositoryExtensionRepository)

SetRepositoryExtensionRepository sets the repository extension repository.

func (*AssetService) SetScopeRuleEvaluator

func (s *AssetService) SetScopeRuleEvaluator(fn scope.RuleEvaluatorFunc)

SetScopeRuleEvaluator sets the scope rule evaluator callback. When set, asset create/update will trigger async scope rule evaluation.

func (*AssetService) SetScoringConfigProvider

func (s *AssetService) SetScoringConfigProvider(provider assetdom.ScoringConfigProvider)

SetScoringConfigProvider sets the scoring config provider for configurable risk scoring.

func (*AssetService) SetUserMatcher

func (s *AssetService) SetUserMatcher(m UserMatcher)

SetUserMatcher sets the user matcher for owner auto-resolution.

func (*AssetService) UpdateAsset

func (s *AssetService) UpdateAsset(ctx context.Context, assetID string, tenantID string, input UpdateAssetInput) (*assetdom.Asset, error)

UpdateAsset updates an existing asset. Security: Requires tenantID to prevent cross-tenant data modification.

func (*AssetService) UpdateFindingCount

func (s *AssetService) UpdateFindingCount(ctx context.Context, tenantID, assetID string, count int) error

UpdateFindingCount updates the finding count for an asset. Security: Requires tenantID to prevent cross-tenant data modification.

func (*AssetService) UpdateRepositoryExtension

func (s *AssetService) UpdateRepositoryExtension(ctx context.Context, tenantID, assetID string, input UpdateRepositoryExtensionInput) (*assetdom.RepositoryExtension, error)

UpdateRepositoryExtension updates the repository extension for an asset. Security: Requires tenantID to prevent cross-tenant data modification.

func (*AssetService) UpdateRepositoryFindingCount

func (s *AssetService) UpdateRepositoryFindingCount(ctx context.Context, assetID string, count int) error

UpdateRepositoryFindingCount updates the finding count for a repository extension.

type AssetTypeService

type AssetTypeService struct {
	// contains filtered or unexported fields
}

AssetTypeService handles asset type-related business operations. Asset types are read-only system configuration created via DB seed or by system admin.

func NewAssetTypeService

func NewAssetTypeService(repo assettypedom.Repository, categoryRepo assettypedom.CategoryRepository, log *logger.Logger) *AssetTypeService

NewAssetTypeService creates a new AssetTypeService.

func (*AssetTypeService) GetAssetType

func (s *AssetTypeService) GetAssetType(ctx context.Context, assetTypeID string) (*assettypedom.AssetType, error)

GetAssetType retrieves an asset type by ID.

func (*AssetTypeService) GetAssetTypeByCode

func (s *AssetTypeService) GetAssetTypeByCode(ctx context.Context, code string) (*assettypedom.AssetType, error)

GetAssetTypeByCode retrieves an asset type by code.

func (*AssetTypeService) GetCategory

func (s *AssetTypeService) GetCategory(ctx context.Context, categoryID string) (*assettypedom.Category, error)

GetCategory retrieves a category by ID.

func (*AssetTypeService) GetCategoryByCode

func (s *AssetTypeService) GetCategoryByCode(ctx context.Context, code string) (*assettypedom.Category, error)

GetCategoryByCode retrieves a category by code.

func (*AssetTypeService) ListActiveAssetTypes

func (s *AssetTypeService) ListActiveAssetTypes(ctx context.Context) ([]*assettypedom.AssetType, error)

ListActiveAssetTypes lists all active asset types.

func (*AssetTypeService) ListActiveAssetTypesByCategory

func (s *AssetTypeService) ListActiveAssetTypesByCategory(ctx context.Context, categoryID string) ([]*assettypedom.AssetType, error)

ListActiveAssetTypesByCategory lists active asset types by category.

func (*AssetTypeService) ListActiveCategories

func (s *AssetTypeService) ListActiveCategories(ctx context.Context) ([]*assettypedom.Category, error)

ListActiveCategories lists all active categories.

func (*AssetTypeService) ListAssetTypes

ListAssetTypes lists asset types with filtering and pagination.

func (*AssetTypeService) ListAssetTypesWithCategory

ListAssetTypesWithCategory lists asset types with their categories.

func (*AssetTypeService) ListCategories

ListCategories lists categories with pagination.

type BatchCreateRelationshipInput

type BatchCreateRelationshipInput struct {
	TargetAssetID   string   `validate:"required,uuid"`
	Type            string   `validate:"required"`
	Description     string   `validate:"max=1000"`
	Confidence      string   `validate:"omitempty"`
	DiscoveryMethod string   `validate:"omitempty"`
	ImpactWeight    *int     `validate:"omitempty,min=1,max=10"`
	Tags            []string `validate:"omitempty,max=20,dive,max=50"`
}

BatchCreateRelationshipInput is the per-item payload for the batch create endpoint. The TenantID and SourceAssetID are NOT here — the service takes them once for the whole batch and reuses for every item, which is the entire point of the batch endpoint.

type BatchCreateRelationshipResult

type BatchCreateRelationshipResult struct {
	Results    []BatchCreateRelationshipResultItem `json:"results"`
	CreatedN   int                                 `json:"created"`
	DuplicateN int                                 `json:"duplicates"`
	ErrorN     int                                 `json:"errors"`
	TotalN     int                                 `json:"total"`
}

BatchCreateRelationshipResult is the aggregate response.

type BatchCreateRelationshipResultItem

type BatchCreateRelationshipResultItem struct {
	Index          int                                 `json:"index"`
	Status         BatchCreateRelationshipResultStatus `json:"status"`
	TargetAssetID  string                              `json:"target_asset_id"`
	RelationshipID string                              `json:"relationship_id,omitempty"`
	Error          string                              `json:"error,omitempty"`
}

BatchCreateRelationshipResultItem is one slot in the batch response. `Index` matches the position of the corresponding input in the request, so the frontend can map results back to target names without re-fetching anything.

type BatchCreateRelationshipResultStatus

type BatchCreateRelationshipResultStatus string

BatchCreateRelationshipResultStatus enumerates the possible outcomes for one item in a batch create call.

const (
	BatchCreateStatusCreated   BatchCreateRelationshipResultStatus = "created"
	BatchCreateStatusDuplicate BatchCreateRelationshipResultStatus = "duplicate"
	BatchCreateStatusError     BatchCreateRelationshipResultStatus = "error"
)

type BranchService

type BranchService struct {
	// contains filtered or unexported fields
}

BranchService handles branch-related business operations.

func NewBranchService

func NewBranchService(repo branchdom.Repository, log *logger.Logger) *BranchService

NewBranchService creates a new BranchService.

func (*BranchService) CompareBranches

func (s *BranchService) CompareBranches(ctx context.Context, repositoryID, baseBranch, compareBranch string) (*branchdom.BranchComparison, error)

CountRepositoryBranches counts branches for a repository. CompareBranches compares findings between two branches.

func (*BranchService) CountRepositoryBranches

func (s *BranchService) CountRepositoryBranches(ctx context.Context, repositoryID string) (int64, error)

func (*BranchService) CreateBranch

func (s *BranchService) CreateBranch(ctx context.Context, input CreateBranchInput) (*branchdom.Branch, error)

CreateBranch creates a new branch.

func (*BranchService) DeleteBranch

func (s *BranchService) DeleteBranch(ctx context.Context, branchID, repositoryID string) error

DeleteBranch deletes a branch by ID.

func (*BranchService) GetBranch

func (s *BranchService) GetBranch(ctx context.Context, branchID string) (*branchdom.Branch, error)

GetBranch retrieves a branch by ID.

func (*BranchService) GetBranchByName

func (s *BranchService) GetBranchByName(ctx context.Context, repositoryID, name string) (*branchdom.Branch, error)

GetBranchByName retrieves a branch by repository ID and name.

func (*BranchService) GetDefaultBranch

func (s *BranchService) GetDefaultBranch(ctx context.Context, repositoryID string) (*branchdom.Branch, error)

GetDefaultBranch retrieves the default branch for a repository.

func (*BranchService) ListBranches

ListBranches retrieves branches with filtering and pagination.

func (*BranchService) ListRepositoryBranches

func (s *BranchService) ListRepositoryBranches(ctx context.Context, repositoryID string) ([]*branchdom.Branch, error)

ListRepositoryBranches retrieves all branches for a repository.

func (*BranchService) SetDefaultBranch

func (s *BranchService) SetDefaultBranch(ctx context.Context, branchID, repositoryID string) (*branchdom.Branch, error)

SetDefaultBranch sets a branch as the default for a repository.

func (*BranchService) UpdateBranch

func (s *BranchService) UpdateBranch(ctx context.Context, branchID, repositoryID string, input UpdateBranchInput) (*branchdom.Branch, error)

UpdateBranch updates an existing branch.

func (*BranchService) UpdateBranchScanStatus

func (s *BranchService) UpdateBranchScanStatus(ctx context.Context, branchID, repositoryID string, input UpdateBranchScanStatusInput) (*branchdom.Branch, error)

UpdateBranchScanStatus updates scan-related fields for a branch.

type BulkAssetStatusResult

type BulkAssetStatusResult struct {
	Updated int      `json:"updated"`
	Failed  int      `json:"failed"`
	Errors  []string `json:"errors,omitempty"`
}

BulkAssetStatusResult represents the result of a bulk asset status operation.

type BulkUpdateAssetStatusInput

type BulkUpdateAssetStatusInput struct {
	AssetIDs []string
	Status   string // "active", "inactive", "archived"
}

BulkUpdateAssetStatusInput represents input for bulk asset status update.

type BulkUpdateInput

type BulkUpdateInput struct {
	GroupIDs    []string
	Environment *string `validate:"omitempty,asset_group_environment"`
	Criticality *string `validate:"omitempty,asset_group_criticality"`
}

BulkUpdateInput represents input for bulk updating asset groups.

type BusinessUnitService

type BusinessUnitService struct {
	// contains filtered or unexported fields
}

BusinessUnitService manages business units.

func NewBusinessUnitService

func NewBusinessUnitService(repo businessunitdom.Repository, log *logger.Logger) *BusinessUnitService

NewBusinessUnitService creates a new service.

func (*BusinessUnitService) AddAsset

func (s *BusinessUnitService) AddAsset(ctx context.Context, tenantID, buID, assetID string) error

AddAsset links an asset to a BU.

func (*BusinessUnitService) Create

Create creates a new business unit.

func (*BusinessUnitService) Delete

func (s *BusinessUnitService) Delete(ctx context.Context, tenantID, buID string) error

Delete deletes a BU.

func (*BusinessUnitService) Get

Get retrieves a BU.

func (*BusinessUnitService) List

List lists BUs.

func (*BusinessUnitService) RemoveAsset

func (s *BusinessUnitService) RemoveAsset(ctx context.Context, tenantID, buID, assetID string) error

RemoveAsset unlinks an asset from a BU.

func (*BusinessUnitService) Update

Update updates an existing business unit.

type ComponentService

type ComponentService struct {
	// contains filtered or unexported fields
}

ComponentService handles component-related business operations.

func NewComponentService

func NewComponentService(repo componentdom.Repository, log *logger.Logger) *ComponentService

NewComponentService creates a new ComponentService.

func (*ComponentService) CreateComponent

CreateComponent creates a new component (Global) and links it to an asset.

func (*ComponentService) DeleteAssetComponents

func (s *ComponentService) DeleteAssetComponents(ctx context.Context, assetID string) error

DeleteAssetComponents deletes all components for an asset.

func (*ComponentService) DeleteComponent

func (s *ComponentService) DeleteComponent(ctx context.Context, dependencyID string, tenantID string) error

DeleteComponent deletes a component dependency linkage.

func (*ComponentService) GetComponent

func (s *ComponentService) GetComponent(ctx context.Context, componentID string) (*componentdom.Component, error)

GetComponent retrieves a component by ID.

func (*ComponentService) GetComponentByPURL

func (s *ComponentService) GetComponentByPURL(ctx context.Context, tenantID, purl string) (*componentdom.Component, error)

GetComponentByPURL retrieves a component by Package URL.

func (*ComponentService) GetComponentStats

func (s *ComponentService) GetComponentStats(ctx context.Context, tenantID string) (*componentdom.ComponentStats, error)

GetComponentStats retrieves aggregated component statistics for a tenant.

func (*ComponentService) GetEcosystemStats

func (s *ComponentService) GetEcosystemStats(ctx context.Context, tenantID string) ([]componentdom.EcosystemStats, error)

GetEcosystemStats retrieves per-ecosystem statistics for a tenant.

func (*ComponentService) GetLicenseStats

func (s *ComponentService) GetLicenseStats(ctx context.Context, tenantID string) ([]componentdom.LicenseStats, error)

GetLicenseStats retrieves license statistics for a tenant.

func (*ComponentService) GetVulnerableComponents

GetVulnerableComponents retrieves paginated vulnerable components for a tenant.

func (*ComponentService) ListAssetComponents

func (s *ComponentService) ListAssetComponents(ctx context.Context, assetID string, page, perPage int) (pagination.Result[*componentdom.AssetDependency], error)

ListAssetComponents retrieves components for a specific asset (Dependencies).

func (*ComponentService) ListComponents

ListComponents retrieves components with filtering and pagination.

func (*ComponentService) UpdateComponent

func (s *ComponentService) UpdateComponent(ctx context.Context, dependencyID string, tenantID string, input UpdateComponentInput) (*componentdom.AssetDependency, error)

UpdateComponent updates a component (specifically an Asset Dependency link). NOTE: For now, we assume edits are focused on the context (path, type). Updating global properties (Version, License) would theoretically require creating a NEW component and re-linking, which is complex. For version bumps, we recommend re-ingestion or Delete+Create. If input.Version is provided, we will return an error or handle it as "not supported via this endpoint" for now, or we implement the re-link logic. DECISION: We will assume `componentID` passed here is the `AssetDependency.ID`.

type CreateAssetGroupInput

type CreateAssetGroupInput struct {
	TenantID     string
	Name         string   `validate:"required,min=1,max=255"`
	Description  string   `validate:"max=1000"`
	Environment  string   `validate:"required,asset_group_environment"`
	Criticality  string   `validate:"required,asset_group_criticality"`
	BusinessUnit string   `validate:"max=255"`
	Owner        string   `validate:"max=255"`
	OwnerEmail   string   `validate:"omitempty,email,max=255"`
	Tags         []string `validate:"max=20,dive,max=50"`
	AssetIDs     []string `validate:"dive,uuid"`
}

CreateAssetGroupInput represents input for creating an asset group.

type CreateAssetInput

type CreateAssetInput struct {
	TenantID    string         `validate:"omitempty,uuid"`
	Name        string         `validate:"required,min=1,max=255"`
	Type        string         `validate:"required,asset_type"`
	Criticality string         `validate:"required,criticality"`
	Scope       string         `validate:"omitempty,scope"`
	Exposure    string         `validate:"omitempty,exposure"`
	Description string         `validate:"max=1000"`
	Tags        []string       `validate:"max=20,dive,max=50"`
	OwnerRef    string         `validate:"max=500"` // Raw owner from external source
	Properties  map[string]any // JSONB properties (known fields auto-promoted to columns)
}

CreateAssetInput represents the input for creating an asset.

func PromoteKnownProperties

func PromoteKnownProperties(input CreateAssetInput) CreateAssetInput

promoteKnownProperties extracts well-known fields from Properties JSONB into their proper columns on CreateAssetInput. This allows collectors to send everything in properties (e.g., {"sub_type": "firewall", "vendor": "Cisco"}) and the system auto-promotes recognized fields while keeping the rest as JSONB metadata.

Promoted fields (removed from Properties after extraction):

  • sub_type → used to set entity.SubType
  • type → resolved via TypeAliases (e.g., "firewall" → type=network, sub_type=firewall)
  • scope, exposure, criticality → override top-level input fields if empty
  • description → override if empty
  • tags → merged with input.Tags

type CreateBranchInput

type CreateBranchInput struct {
	RepositoryID  string `validate:"required,uuid"`
	Name          string `validate:"required,min=1,max=255"`
	BranchType    string `validate:"required,branch_type"`
	IsDefault     bool
	IsProtected   bool
	LastCommitSHA string `validate:"max=40"`
}

CreateBranchInput represents the input for creating a branch.

type CreateBusinessUnitInput

type CreateBusinessUnitInput struct {
	TenantID    string
	Name        string
	Description string
	OwnerName   string
	OwnerEmail  string
	Tags        []string
}

CreateBusinessUnitInput holds input for creating a BU.

type CreateComponentInput

type CreateComponentInput struct {
	TenantID       string `validate:"required,uuid"`
	AssetID        string `validate:"required,uuid"`
	Name           string `validate:"required,min=1,max=255"`
	Version        string `validate:"required,max=100"`
	Ecosystem      string `validate:"required,ecosystem"`
	PackageManager string `validate:"max=50"`
	Namespace      string `validate:"max=255"`
	ManifestFile   string `validate:"max=255"`
	ManifestPath   string `validate:"max=500"`
	DependencyType string `validate:"omitempty,dependency_type"`
	License        string `validate:"max=100"`
}

CreateComponentInput represents the input for creating a component.

type CreateRelationshipInput

type CreateRelationshipInput struct {
	TenantID        string   `validate:"required,uuid"`
	SourceAssetID   string   `validate:"required,uuid"`
	TargetAssetID   string   `validate:"required,uuid"`
	Type            string   `validate:"required"`
	Description     string   `validate:"max=1000"`
	Confidence      string   `validate:"omitempty"`
	DiscoveryMethod string   `validate:"omitempty"`
	ImpactWeight    *int     `validate:"omitempty,min=1,max=10"`
	Tags            []string `validate:"omitempty,max=20,dive,max=50"`
}

CreateRelationshipInput represents the input for creating a relationship.

type CreateRepositoryAssetInput

type CreateRepositoryAssetInput struct {
	// Basic info
	TenantID       string   `validate:"omitempty,uuid"`
	Name           string   `validate:"required,min=1,max=255"`
	Description    string   `validate:"max=1000"`
	Criticality    string   `validate:"required,criticality"`
	Scope          string   `validate:"omitempty,scope"`
	Exposure       string   `validate:"omitempty,exposure"`
	Tags           []string `validate:"max=20,dive,max=50"`
	Provider       string   `validate:"omitempty"`
	ExternalID     string   `validate:"omitempty,max=255"`
	Classification string   `validate:"omitempty"`
	// Repository extension fields
	RepoID          string           `validate:"omitempty,max=255"`
	FullName        string           `validate:"required,max=500"`
	SCMOrganization string           `validate:"omitempty,max=255"`
	CloneURL        string           `validate:"omitempty,url"`
	WebURL          string           `validate:"omitempty,url"`
	SSHURL          string           `validate:"omitempty,max=500"`
	DefaultBranch   string           `validate:"omitempty,max=100"`
	Visibility      string           `validate:"omitempty"`
	Language        string           `validate:"omitempty,max=50"`
	Languages       map[string]int64 `validate:"omitempty"`
	Topics          []string         `validate:"max=50,dive,max=100"`
	// Stats
	Stars      int `validate:"min=0"`
	Forks      int `validate:"min=0"`
	Watchers   int `validate:"min=0"`
	OpenIssues int `validate:"min=0"`
	SizeKB     int `validate:"min=0"`
	// Scan settings
	ScanEnabled  bool   `validate:"omitempty"`
	ScanSchedule string `validate:"omitempty,max=100"`
	// Timestamps from SCM (ISO 8601 format)
	RepoCreatedAt string `validate:"omitempty"`
	RepoUpdatedAt string `validate:"omitempty"`
	RepoPushedAt  string `validate:"omitempty"`
}

CreateRepositoryAssetInput represents the input for creating a repository asset.

type K8sDiscoveryInput

type K8sDiscoveryInput struct {
	ClusterName string         `json:"cluster_name"`
	Namespaces  []K8sNamespace `json:"namespaces"`
}

K8sDiscoveryInput holds Kubernetes cluster info for asset import.

type K8sNamespace

type K8sNamespace struct {
	Name      string        `json:"name"`
	Workloads []K8sWorkload `json:"workloads"`
}

K8sNamespace holds namespace + workloads.

type K8sWorkload

type K8sWorkload struct {
	Kind     string            `json:"kind"`
	Name     string            `json:"name"`
	Replicas int               `json:"replicas"`
	Images   []string          `json:"images"`
	Labels   map[string]string `json:"labels,omitempty"`
}

K8sWorkload represents a Kubernetes workload.

type ListAssetGroupsInput

type ListAssetGroupsInput struct {
	TenantID      string
	Search        string
	Environments  []string
	Criticalities []string
	BusinessUnit  string
	Owner         string
	Tags          []string
	HasFindings   *bool
	MinRiskScore  *int
	MaxRiskScore  *int
	Sort          string
	Page          int `validate:"min=1"`
	PerPage       int `validate:"min=1,max=100"`
}

ListAssetGroupsInput represents input for listing asset groups.

type ListAssetGroupsOutput

type ListAssetGroupsOutput struct {
	Groups []*assetgroupdom.AssetGroup
	Total  int64
	Page   int
	Pages  int
}

ListAssetGroupsOutput represents output from listing asset groups.

type ListAssetsInput

type ListAssetsInput struct {
	TenantID         string              `validate:"omitempty,uuid"`
	Name             string              `validate:"max=255"`
	Types            []string            `validate:"max=20,dive,asset_type"`
	Criticalities    []string            `validate:"max=5,dive,criticality"`
	Statuses         []string            `validate:"max=3,dive,status"`
	Scopes           []string            `validate:"max=6,dive,scope"`
	Exposures        []string            `validate:"max=5,dive,exposure"`
	Tags             []string            `validate:"max=20,dive,max=50"`
	Search           string              `validate:"max=255"` // Full-text search across name and description
	MinRiskScore     *int                `validate:"omitempty,min=0,max=100"`
	MaxRiskScore     *int                `validate:"omitempty,min=0,max=100"`
	HasFindings      *bool               // Filter by whether asset has findings
	IsCrownJewel     *bool               // Filter crown jewel assets
	SubType          *string             // Filter by sub_type
	PropertiesFilter map[string][]string // Filter by JSONB properties (AND across keys, OR within values)
	Sort             string              `validate:"max=100"` // Sort field (e.g., "-created_at", "name")
	Page             int                 `validate:"min=0"`
	PerPage          int                 `validate:"min=0,max=100"`

	// Layer 2: Data Scope
	ActingUserID string // From JWT context
	IsAdmin      bool   // True for owner/admin (bypasses data scope)
}

ListAssetsInput represents the input for listing assets.

type ListBranchesInput

type ListBranchesInput struct {
	RepositoryID string   `validate:"required,uuid"`
	Name         string   `validate:"max=255"`
	BranchTypes  []string `validate:"max=10,dive,branch_type"`
	IsDefault    *bool
	ScanStatus   string `validate:"omitempty,scan_status"`
	Sort         string `validate:"max=100"`
	Page         int    `validate:"min=0"`
	PerPage      int    `validate:"min=0,max=100"`
}

ListBranchesInput represents the input for listing branches.

type ListComponentsInput

type ListComponentsInput struct {
	TenantID           string   `validate:"required,uuid"`
	AssetID            string   `validate:"omitempty,uuid"`
	Name               string   `validate:"max=255"`
	Ecosystems         []string `validate:"max=10,dive,ecosystem"`
	Statuses           []string `validate:"max=5,dive,component_status"`
	DependencyTypes    []string `validate:"max=5,dive,dependency_type"`
	HasVulnerabilities *bool
	Licenses           []string `validate:"max=20,dive,max=100"`
	Page               int      `validate:"min=0"`
	PerPage            int      `validate:"min=0,max=100"`
}

ListComponentsInput represents the input for listing components.

type RelationshipSuggestionService

type RelationshipSuggestionService struct {
	// contains filtered or unexported fields
}

RelationshipSuggestionService handles relationship suggestion business logic.

func NewRelationshipSuggestionService

func NewRelationshipSuggestionService(
	suggestionRepo relationshipdom.SuggestionRepository,
	assetRepo assetdom.Repository,
	relRepo assetdom.RelationshipRepository,
	log *logger.Logger,
) *RelationshipSuggestionService

NewRelationshipSuggestionService creates a new RelationshipSuggestionService.

func (*RelationshipSuggestionService) Approve

func (s *RelationshipSuggestionService) Approve(ctx context.Context, tenantID, suggestionID, reviewerID string) error

Approve approves a suggestion and creates the real relationship.

func (*RelationshipSuggestionService) ApproveAll

func (s *RelationshipSuggestionService) ApproveAll(ctx context.Context, tenantID, reviewerID string) (int, error)

ApproveAll approves all pending suggestions and creates relationships for each.

func (*RelationshipSuggestionService) ApproveBatch

func (s *RelationshipSuggestionService) ApproveBatch(ctx context.Context, tenantID string, ids []string, reviewerID string) (int, error)

ApproveBatch approves multiple suggestions by IDs. Returns (approved count, error). Returns error only if ALL items failed.

func (*RelationshipSuggestionService) CountPending

func (s *RelationshipSuggestionService) CountPending(ctx context.Context, tenantID string) (int64, error)

CountPending returns the number of pending suggestions for a tenant.

func (*RelationshipSuggestionService) Dismiss

func (s *RelationshipSuggestionService) Dismiss(ctx context.Context, tenantID, suggestionID, reviewerID string) error

Dismiss marks a suggestion as dismissed.

func (*RelationshipSuggestionService) GenerateSuggestions

func (s *RelationshipSuggestionService) GenerateSuggestions(ctx context.Context, tenantID string) (int, error)

GenerateSuggestions analyzes assets and generates relationship suggestions. It creates suggestions for:

  • Domain contains subdomain: contains relationship (parent → child)
  • Domain/subdomain with resolved_ip -> IP address asset: resolves_to relationship

func (*RelationshipSuggestionService) ListPending

ListPending returns pending suggestions for a tenant, optionally filtered by search.

func (*RelationshipSuggestionService) UpdateRelationshipType

func (s *RelationshipSuggestionService) UpdateRelationshipType(ctx context.Context, tenantID, suggestionID, relType string) error

UpdateRelationshipType changes the relationship type of a pending suggestion.

type RelationshipTypeUsage

type RelationshipTypeUsage struct {
	ID          string `json:"id"`
	Direct      string `json:"direct"`
	Inverse     string `json:"inverse"`
	Description string `json:"description"`
	Category    string `json:"category"`
	// Count is the number of relationships of this type that exist
	// for the tenant. 0 means the type is registered but unused —
	// a candidate for removal from the registry.
	Count int64 `json:"count"`
}

RelationshipTypeUsage holds usage stats for a single relationship type.

type RiskScorePreviewItem

type RiskScorePreviewItem struct {
	AssetID      string `json:"asset_id"`
	AssetName    string `json:"asset_name"`
	AssetType    string `json:"asset_type"`
	CurrentScore int    `json:"current_score"`
	NewScore     int    `json:"new_score"`
	Delta        int    `json:"delta"`
}

RiskScorePreviewItem represents how an asset's risk score would change.

type SBOMImportResult

type SBOMImportResult struct {
	Format             string   `json:"format"` // cyclonedx or spdx
	SpecVersion        string   `json:"spec_version"`
	ComponentsTotal    int      `json:"components_total"`    // total in file
	ComponentsImported int      `json:"components_imported"` // successfully imported
	ComponentsSkipped  int      `json:"components_skipped"`
	LicensesFound      int      `json:"licenses_found"`
	Errors             []string `json:"errors,omitempty"`
}

SBOMImportResult contains the result of an SBOM import.

type SBOMImportService

type SBOMImportService struct {
	// contains filtered or unexported fields
}

SBOMImportService handles importing SBOM files (CycloneDX, SPDX).

func NewSBOMImportService

func NewSBOMImportService(repo componentdom.Repository, log *logger.Logger) *SBOMImportService

NewSBOMImportService creates a new SBOMImportService.

func (*SBOMImportService) ImportSBOM

func (s *SBOMImportService) ImportSBOM(ctx context.Context, tenantID, assetID string, reader io.Reader) (*SBOMImportResult, error)

ImportSBOM detects format and imports components from a SBOM file.

type TenantScoringConfigProvider

type TenantScoringConfigProvider struct {
	// contains filtered or unexported fields
}

TenantScoringConfigProvider implements assetdom.ScoringConfigProvider by reading scoring settings from the tenant repository.

func NewTenantScoringConfigProvider

func NewTenantScoringConfigProvider(tenantRepo tenantdom.Repository) *TenantScoringConfigProvider

NewTenantScoringConfigProvider creates a new scoring config provider.

func (*TenantScoringConfigProvider) GetScoringConfig

func (p *TenantScoringConfigProvider) GetScoringConfig(ctx context.Context, tenantID shared.ID) (*assetdom.RiskScoringConfig, error)

GetScoringConfig returns the risk scoring config for a tenant.

type UpdateAssetGroupInput

type UpdateAssetGroupInput struct {
	Name         *string  `validate:"omitempty,min=1,max=255"`
	Description  *string  `validate:"omitempty,max=1000"`
	Environment  *string  `validate:"omitempty,asset_group_environment"`
	Criticality  *string  `validate:"omitempty,asset_group_criticality"`
	BusinessUnit *string  `validate:"omitempty,max=255"`
	Owner        *string  `validate:"omitempty,max=255"`
	OwnerEmail   *string  `validate:"omitempty,email,max=255"`
	Tags         []string `validate:"omitempty,max=20,dive,max=50"`
}

UpdateAssetGroupInput represents input for updating an asset group.

type UpdateAssetInput

type UpdateAssetInput struct {
	Name        *string  `validate:"omitempty,min=1,max=255"`
	Criticality *string  `validate:"omitempty,criticality"`
	Scope       *string  `validate:"omitempty,scope"`
	Exposure    *string  `validate:"omitempty,exposure"`
	Description *string  `validate:"omitempty,max=1000"`
	OwnerRef    *string  `validate:"omitempty,max=500"` // Free-text owner reference
	Tags        []string `validate:"omitempty,max=20,dive,max=50"`
}

UpdateAssetInput represents the input for updating an asset.

type UpdateBranchInput

type UpdateBranchInput struct {
	IsProtected            *bool
	LastCommitSHA          *string `validate:"omitempty,max=40"`
	LastCommitMessage      *string `validate:"omitempty,max=1000"`
	LastCommitAuthor       *string `validate:"omitempty,max=100"`
	LastCommitAuthorAvatar *string `validate:"omitempty,max=500"`
	ScanOnPush             *bool
	ScanOnPR               *bool
	KeepWhenInactive       *bool
	RetentionDays          *int `validate:"omitempty,min=0,max=365"`
}

UpdateBranchInput represents the input for updating a branch.

type UpdateBranchScanStatusInput

type UpdateBranchScanStatusInput struct {
	ScanID           string `validate:"required,uuid"`
	ScanStatus       string `validate:"required,scan_status"`
	QualityGate      string `validate:"omitempty,quality_gate_status"`
	TotalFindings    *int   `validate:"omitempty,min=0"`
	CriticalFindings *int   `validate:"omitempty,min=0"`
	HighFindings     *int   `validate:"omitempty,min=0"`
	MediumFindings   *int   `validate:"omitempty,min=0"`
	LowFindings      *int   `validate:"omitempty,min=0"`
}

UpdateBranchScanStatusInput represents the input for updating scan status.

type UpdateBusinessUnitInput

type UpdateBusinessUnitInput struct {
	TenantID    string
	ID          string
	Name        string
	Description string
	OwnerName   string
	OwnerEmail  string
	Tags        []string
}

UpdateBusinessUnitInput holds input for updating a BU.

type UpdateComponentInput

type UpdateComponentInput struct {
	Version            *string `validate:"omitempty,max=100"`
	PackageManager     *string `validate:"omitempty,max=50"`
	Namespace          *string `validate:"omitempty,max=255"`
	ManifestFile       *string `validate:"omitempty,max=255"`
	ManifestPath       *string `validate:"omitempty,max=500"`
	DependencyType     *string `validate:"omitempty,dependency_type"`
	License            *string `validate:"omitempty,max=100"`
	Status             *string `validate:"omitempty,component_status"`
	VulnerabilityCount *int    `validate:"omitempty,min=0"`
}

UpdateComponentInput represents the input for updating a component.

type UpdateRelationshipInput

type UpdateRelationshipInput struct {
	Description  *string  `json:"description" validate:"omitempty,max=1000"`
	Confidence   *string  `json:"confidence" validate:"omitempty"`
	ImpactWeight *int     `json:"impact_weight" validate:"omitempty,min=1,max=10"`
	Tags         []string `json:"tags" validate:"omitempty,max=20,dive,max=50"`
	MarkVerified bool     `json:"mark_verified"`
}

UpdateRelationshipInput represents the input for updating a relationship.

type UpdateRepositoryExtensionInput

type UpdateRepositoryExtensionInput struct {
	RepoID               *string          `validate:"omitempty,max=255"`
	FullName             *string          `validate:"omitempty,max=500"`
	SCMOrganization      *string          `validate:"omitempty,max=255"`
	CloneURL             *string          `validate:"omitempty,url"`
	WebURL               *string          `validate:"omitempty,url"`
	SSHURL               *string          `validate:"omitempty,max=500"`
	DefaultBranch        *string          `validate:"omitempty,max=100"`
	Visibility           *string          `validate:"omitempty"`
	Language             *string          `validate:"omitempty,max=50"`
	Languages            map[string]int64 `validate:"omitempty"`
	Topics               []string         `validate:"omitempty,max=50,dive,max=100"`
	Stars                *int             `validate:"omitempty,min=0"`
	Forks                *int             `validate:"omitempty,min=0"`
	Watchers             *int             `validate:"omitempty,min=0"`
	OpenIssues           *int             `validate:"omitempty,min=0"`
	ContributorsCount    *int             `validate:"omitempty,min=0"`
	SizeKB               *int             `validate:"omitempty,min=0"`
	BranchCount          *int             `validate:"omitempty,min=0"`
	ProtectedBranchCount *int             `validate:"omitempty,min=0"`
	ComponentCount       *int             `validate:"omitempty,min=0"`
}

UpdateRepositoryExtensionInput represents the input for updating a repository extension.

type UserMatcher

type UserMatcher interface {
	FindUserIDByEmail(ctx context.Context, tenantID shared.ID, email string) (*shared.ID, error)
}

UserMatcher resolves external references (email, username) to user IDs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL