Documentation
¶
Index ¶
- Variables
- type Action
- type ActionOp
- type EntitlementGraph
- func (d *EntitlementGraph) AddEdge(srcEntitlementID string, dstEntitlementID string, shallow bool, ...) error
- func (d *EntitlementGraph) AddEntitlement(entitlement *v2.Entitlement)
- func (d *EntitlementGraph) GetAncestors(entitlementID string) []string
- func (d *EntitlementGraph) GetCycles() ([][]string, bool)
- func (d *EntitlementGraph) GetDescendants(entitlementID string) map[string]*edgeInfo
- func (d *EntitlementGraph) HasEntitlement(entitlementID string) bool
- func (d *EntitlementGraph) HasUnexpandedAncestors(entitlementID string) bool
- func (d *EntitlementGraph) IsEntitlementExpanded(entitlementID string) bool
- func (d *EntitlementGraph) IsExpanded() bool
- func (d *EntitlementGraph) MarkEdgeExpanded(sourceEntitlementID string, descendantEntitlementID string)
- type EntitlementGraphAction
- type Progress
- type State
- type SyncOpt
- type Syncer
Constants ¶
This section is empty.
Variables ¶
var (
ErrNoEntitlement = errors.New("no entitlement found")
)
var (
ErrSyncNotComplete = fmt.Errorf("sync exited without finishing")
)
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Op ActionOp `json:"operation,omitempty"`
PageToken string `json:"page_token,omitempty"`
ResourceTypeID string `json:"resource_type_id,omitempty"`
ResourceID string `json:"resource_id,omitempty"`
ParentResourceTypeID string `json:"parent_resource_type_id,omitempty"`
ParentResourceID string `json:"parent_resource_id,omitempty"`
}
Action stores the current operation, page token, and optional fields for which resource is being worked with.
type ActionOp ¶
type ActionOp uint8
ActionOp represents a sync operation.
func (*ActionOp) MarshalJSON ¶
MarshalJSON marshals the ActionOp insto a json string.
func (ActionOp) String ¶
String() returns the string representation for an ActionOp. This is used for marshalling the op.
func (*ActionOp) UnmarshalJSON ¶
UnmarshalJSON unmarshal's the input byte slice and updates this action op.
type EntitlementGraph ¶ added in v0.1.6
type EntitlementGraph struct {
Entitlements map[string]bool `json:"entitlements"`
Edges map[string]map[string]*edgeInfo `json:"edges"`
Loaded bool `json:"loaded"`
Depth int `json:"depth"`
Actions []EntitlementGraphAction `json:"actions"`
}
func NewEntitlementGraph ¶ added in v0.1.6
func NewEntitlementGraph(ctx context.Context) *EntitlementGraph
func (*EntitlementGraph) AddEntitlement ¶ added in v0.1.6
func (d *EntitlementGraph) AddEntitlement(entitlement *v2.Entitlement)
func (*EntitlementGraph) GetAncestors ¶ added in v0.1.6
func (d *EntitlementGraph) GetAncestors(entitlementID string) []string
Find the direct ancestors of the given entitlement. The 'all' flag returns all ancestors regardless of 'done' state.
func (*EntitlementGraph) GetCycles ¶ added in v0.1.6
func (d *EntitlementGraph) GetCycles() ([][]string, bool)
Find the direct ancestors of the given entitlement. The 'all' flag returns all ancestors regardless of 'done' state.
func (*EntitlementGraph) GetDescendants ¶ added in v0.1.6
func (d *EntitlementGraph) GetDescendants(entitlementID string) map[string]*edgeInfo
func (*EntitlementGraph) HasEntitlement ¶ added in v0.1.6
func (d *EntitlementGraph) HasEntitlement(entitlementID string) bool
func (*EntitlementGraph) HasUnexpandedAncestors ¶ added in v0.1.6
func (d *EntitlementGraph) HasUnexpandedAncestors(entitlementID string) bool
HasUnexpandedAncestors returns true if the given entitlement has ancestors that have not been expanded yet.
func (*EntitlementGraph) IsEntitlementExpanded ¶ added in v0.1.6
func (d *EntitlementGraph) IsEntitlementExpanded(entitlementID string) bool
IsEntitlementExpanded returns true if all the outgoing edges for the given entitlement have been expanded.
func (*EntitlementGraph) IsExpanded ¶ added in v0.1.6
func (d *EntitlementGraph) IsExpanded() bool
IsExpanded returns true if all entitlements in the graph have been expanded.
func (*EntitlementGraph) MarkEdgeExpanded ¶ added in v0.1.6
func (d *EntitlementGraph) MarkEdgeExpanded(sourceEntitlementID string, descendantEntitlementID string)
type EntitlementGraphAction ¶ added in v0.1.6
type Progress ¶ added in v0.0.25
type Progress struct {
Action string
ResourceTypeID string
ResourceID string
ParentResourceTypeID string
ParentResourceID string
Count uint32
}
func NewProgress ¶ added in v0.0.25
type State ¶
type State interface {
PushAction(ctx context.Context, action Action)
FinishAction(ctx context.Context)
NextPage(ctx context.Context, pageToken string) error
ResourceTypeID(ctx context.Context) string
ResourceID(ctx context.Context) string
EntitlementGraph(ctx context.Context) *EntitlementGraph
ParentResourceID(ctx context.Context) string
ParentResourceTypeID(ctx context.Context) string
PageToken(ctx context.Context) string
Current() *Action
Marshal() (string, error)
Unmarshal(input string) error
NeedsExpansion() bool
SetNeedsExpansion()
}
type SyncOpt ¶
type SyncOpt func(s *syncer)
func WithC1ZPath ¶ added in v0.1.0
func WithConnectorStore ¶ added in v0.1.0
func WithConnectorStore(store connectorstore.Writer) SyncOpt
func WithProgressHandler ¶ added in v0.0.25
WithProgress sets a `progressHandler` for `NewSyncer` Options.
func WithRunDuration ¶
WithRunDuration sets a `time.Duration` for `NewSyncer` Options. `d` represents a duration. The elapsed time between two instants as an int64 nanosecond count.
func WithTmpDir ¶ added in v0.1.8
func WithTransitionHandler ¶
WithTransitionHandler sets a `transitionHandler` for `NewSyncer` Options.