export

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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)

Types

type Collector

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

Collector collects data from Port API concurrently.

func NewCollector

func NewCollector(client *api.Client) *Collector

NewCollector creates a new collector.

func (*Collector) Collect

func (c *Collector) Collect(ctx context.Context, opts Options) (*Data, error)

Collect collects all data from Port API concurrently.

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
}

Data represents collected export data.

func (*Data) WriteJSON added in v0.1.7

func (d *Data) WriteJSON(w io.Writer) error

WriteJSON encodes the Data as indented JSON into w.

type Module

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

Module handles exporting data from Port.

func NewModule

func NewModule(token *auth.Token, orgConfig *config.OrganizationConfig) *Module

NewModule creates a new export module.

func (*Module) Close

func (m *Module) Close() error

Close closes the API client.

func (*Module) Execute

func (m *Module) Execute(ctx context.Context, opts Options) (*Result, error)

Execute performs the export operation.

type Options

type Options struct {
	OutputPath             string
	Blueprints             []string
	Format                 string
	SkipEntities           bool
	SkipSystemBlueprints   bool // skip _* blueprint schemas and their entities
	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
}

Options represents export options.

func (*Options) Validate

func (o *Options) Validate() error

Validate validates 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
	TimeoutErrors     []string // Blueprints that timed out during export
	Error             error
}

Result represents the result of an export operation.

Jump to

Keyboard shortcuts

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