Documentation
¶
Index ¶
- func ApplyBlueprintExclusions(all []api.Blueprint, excludeDeep, excludeSchema []string) (iterList, dataList []api.Blueprint)
- func FilterBlueprintsToReferenced(blueprints []api.Blueprint, referenced map[string]bool) []api.Blueprint
- func FilterByField[T ~map[string]interface{}](items []T, ids []string, field string) []T
- func FilterFoldersToAncestors(folders []api.Folder, pages []api.Page) []api.Folder
- func SelectActionsForResources(allActions []api.Action, includeActions, includeAutomations bool, ...) []api.Action
- type ArchiveWriter
- type Collector
- type Data
- type EntitySink
- type Module
- type Options
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyBlueprintExclusions ¶ added in v0.1.8
func ApplyBlueprintExclusions(all []api.Blueprint, excludeDeep, excludeSchema []string) (iterList, dataList []api.Blueprint)
ApplyBlueprintExclusions returns two filtered slices from all:
- iterList: used to iterate for fetching entities/scorecards/actions (deep-excluded removed, schema-only kept)
- dataList: written to data.Blueprints for export output (both deep and schema-only excluded)
func FilterBlueprintsToReferenced ¶ added in v0.3.4
func FilterBlueprintsToReferenced(blueprints []api.Blueprint, referenced map[string]bool) []api.Blueprint
FilterBlueprintsToReferenced narrows blueprints to only those whose identifier is present in referenced. Used by AutoScopeBlueprints callers once they've finished gathering every signal of "this blueprint is referenced" (see Data.ReferencedBlueprintIDs).
func FilterByField ¶ added in v0.3.1
FilterByField filters a slice of map-typed resources, keeping only items whose field value appears in the ids set. Returns all items when ids is empty.
func FilterFoldersToAncestors ¶ added in v0.3.1
FilterFoldersToAncestors returns only the folders that are ancestors of the given pages. It walks up the parent chain from each page's parent folder.
func SelectActionsForResources ¶ added in v0.3.7
func SelectActionsForResources(allActions []api.Action, includeActions, includeAutomations bool, actionIDs []string) []api.Action
SelectActionsForResources filters the org-wide /actions response to the resource types requested by the caller. Non-automation actions are treated as actions; trigger.type=automation records are treated as automations.
Types ¶
type ArchiveWriter ¶ added in v0.3.2
type ArchiveWriter interface {
WriteResource(name string, value interface{}) error
WriteEntities(func(EntitySink) error) error
Close() error
}
ArchiveWriter writes export resources section by section.
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector collects data from Port API concurrently.
func NewCollector ¶
NewCollector creates a new collector.
type Data ¶
type Data struct {
Blueprints []api.Blueprint
Entities []api.Entity
Scorecards []api.Scorecard
Actions []api.Action
// BlueprintPermissions maps blueprint identifier -> permissions object.
BlueprintPermissions map[string]api.Permissions
// ActionPermissions maps action identifier -> permissions object.
ActionPermissions map[string]api.Permissions
// PagePermissions maps page identifier -> permissions object.
PagePermissions map[string]api.Permissions
Teams []api.Team
Users []api.User
Folders []api.Folder
Pages []api.Page
Integrations []api.Integration
TimeoutErrors []string // Blueprints that timed out during export
Warnings []string // Non-fatal issues encountered during collection
// ReferencedBlueprintIDs is populated when Options.AutoScopeBlueprints is
// true: the set of blueprint identifiers that produced at least one
// matching entity/scorecard/action during Collect. Always non-nil.
ReferencedBlueprintIDs map[string]bool
}
Data represents collected export data.
type EntitySink ¶ added in v0.3.2
EntitySink accepts entities one at a time while an export archive is being written.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module handles exporting data from Port.
type Options ¶
type Options struct {
OutputPath string
Blueprints []string
Format string
SkipEntities bool
SkipSystemBlueprints bool // skip _* blueprint schemas and their entities
SkipSystemBlueprintProperties bool
IncludeRuleResults bool // include the _rule_result system blueprint and its entities (excluded by default)
IncludeResources []string
ExcludeBlueprints []string // deep: exclude blueprint schema + all its resources
ExcludeBlueprintSchema []string // shallow: exclude only the blueprint schema, keep resources
// AutoScopeBlueprints, when true, causes Collect to record which blueprints
// produced at least one matching entity/scorecard/action into
// Data.ReferencedBlueprintIDs. It does NOT narrow Data.Blueprints itself —
// callers that want the narrowed set call FilterBlueprintsToReferenced
// after combining this signal with any other source of "referenced" (e.g.
// export.go's separate entity-streaming pass, which never runs inside
// Collect when SkipEntities is forced true).
AutoScopeBlueprints bool
// Per-resource ID filters (client-side, applied after bulk fetch)
Entities []string
Scorecards []string
Actions []string
Pages []string
Integrations []string
Teams []string
Users []string
}
Options represents export options.
type Result ¶
type Result struct {
Success bool
Message string
OutputPath string
BlueprintsCount int
EntitiesCount int
ActionsCount int
PagesCount int
IntegrationsCount int
UsersCount int
TeamsCount int
FoldersCount int
Format string
TimeoutErrors []string // Blueprints that timed out during export
Error error
}
Result represents the result of an export operation.