graph

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2017 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EgressOnlyInternetGatewayTarget routeTargetType = iota
	GatewayTarget
	InstanceTarget
	NatTarget
	NetworkInterfaceTarget
	VpcPeeringConnectionTarget
)

Variables

View Source
var (
	DefaultDiffer = &hierarchicDiffer{rdf.ParentOf}
	MetaPredicate = "meta"
)

Functions

func Subtract added in v0.0.23

func Subtract(one, other map[string]interface{}) map[string]interface{}

func VisitorCollectFunc

func VisitorCollectFunc(collect *[]*Resource) visitEachFunc

Types

type And

type And struct {
	Resolvers []Resolver
}

func (*And) Resolve

func (r *And) Resolve(snap tstore.RDFGraph) (result []*Resource, err error)

type ById

type ById struct {
	Id string
}

func (*ById) Resolve

func (r *ById) Resolve(snap tstore.RDFGraph) ([]*Resource, error)

type ByProperty

type ByProperty struct {
	Key   string
	Value interface{}
}

func (*ByProperty) Resolve

func (r *ByProperty) Resolve(snap tstore.RDFGraph) ([]*Resource, error)

type ByType

type ByType struct {
	Typ string
}

func (*ByType) Resolve

func (r *ByType) Resolve(snap tstore.RDFGraph) ([]*Resource, error)

type ByTypeAndProperty added in v0.1.2

type ByTypeAndProperty struct {
	Type  string
	Key   string
	Value interface{}
}

func (*ByTypeAndProperty) Resolve added in v0.1.2

func (r *ByTypeAndProperty) Resolve(snap tstore.RDFGraph) ([]*Resource, error)

type ByTypes added in v0.0.20

type ByTypes struct {
	Typs []string
}

func (*ByTypes) Resolve added in v0.0.20

func (r *ByTypes) Resolve(snap tstore.RDFGraph) ([]*Resource, error)

type ChildrenVisitor

type ChildrenVisitor struct {
	From        *Resource
	Each        visitEachFunc
	IncludeFrom bool
}

func (*ChildrenVisitor) Visit

func (v *ChildrenVisitor) Visit(g *Graph) error

type Diff

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

func NewDiff

func NewDiff(fromG, toG *Graph) *Diff

func (*Diff) FromGraph

func (d *Diff) FromGraph() *Graph

func (*Diff) HasDiff added in v0.0.22

func (d *Diff) HasDiff() bool

func (*Diff) MergedGraph

func (d *Diff) MergedGraph() *Graph

func (*Diff) ToGraph

func (d *Diff) ToGraph() *Graph

type Differ

type Differ interface {
	Run(string, *Graph, *Graph) (*Diff, error)
}

type DistributionOrigin added in v0.0.25

type DistributionOrigin struct {
	ID         string `predicate:"cloud:id"`
	PublicDNS  string `predicate:"cloud:publicDNS"`
	PathPrefix string `predicate:"cloud:pathPrefix"`
	OriginType string `predicate:"cloud:type"`
	Config     string `predicate:"cloud:config"`
}

func (*DistributionOrigin) String added in v0.0.25

func (o *DistributionOrigin) String() string

type FilterFn

type FilterFn func(*Resource) bool

func BuildPropertyFilterFunc

func BuildPropertyFilterFunc(key, val string) FilterFn

func BuildTagFilterFunc added in v0.0.24

func BuildTagFilterFunc(key, val string) FilterFn

func BuildTagKeyFilterFunc added in v0.0.24

func BuildTagKeyFilterFunc(key string) FilterFn

func BuildTagValueFilterFunc added in v0.0.24

func BuildTagValueFilterFunc(value string) FilterFn

type FirewallRule

type FirewallRule struct {
	PortRange PortRange    `predicate:"net:portRange"`
	Protocol  string       `predicate:"net:protocol"`
	IPRanges  []*net.IPNet `predicate:"net:cidr"` // IPv4 or IPv6 range
	Sources   []string     `predicate:"cloud:source"`
}

func (*FirewallRule) Contains added in v0.0.22

func (r *FirewallRule) Contains(ip string) bool

func (*FirewallRule) String

func (r *FirewallRule) String() string

type FirewallRules added in v0.0.22

type FirewallRules []*FirewallRule

func (FirewallRules) Sort added in v0.0.22

func (rules FirewallRules) Sort()

type Grant

type Grant struct {
	Permission string  `predicate:"cloud:permission"`
	Grantee    Grantee `predicate:"cloud:grantee" subject:"rand"`
}

func (*Grant) String

func (g *Grant) String() string

type Grantee added in v0.0.22

type Grantee struct {
	GranteeID          string `predicate:"cloud:id"`
	GranteeDisplayName string `predicate:"cloud:name"`
	GranteeType        string `predicate:"cloud:granteeType"`
}

type Grants added in v0.0.22

type Grants []*Grant

func (Grants) Sort added in v0.0.22

func (grants Grants) Sort()

type Graph

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

func NewGraph

func NewGraph() *Graph

func NewGraphFromFile

func NewGraphFromFile(filepath string) (*Graph, error)

func (*Graph) Accept

func (g *Graph) Accept(v Visitor) error

func (*Graph) AddAppliesOnRelation

func (g *Graph) AddAppliesOnRelation(parent, child *Resource) error

func (*Graph) AddGraph

func (g *Graph) AddGraph(other *Graph)

func (*Graph) AddParentRelation

func (g *Graph) AddParentRelation(parent, child *Resource) error

func (*Graph) AddResource

func (g *Graph) AddResource(resources ...*Resource) error

func (*Graph) AsRDFGraphSnaphot added in v0.1.2

func (g *Graph) AsRDFGraphSnaphot() tstore.RDFGraph

func (*Graph) Filter

func (g *Graph) Filter(entity string, filters ...FilterFn) (*Graph, error)

func (*Graph) FindAncestor added in v0.1.3

func (g *Graph) FindAncestor(res *Resource, resourceType string) *Resource

func (*Graph) FindResource

func (g *Graph) FindResource(id string) (*Resource, error)

func (*Graph) FindResourcesByProperty

func (g *Graph) FindResourcesByProperty(key string, value interface{}) ([]*Resource, error)

func (*Graph) GetAllResources

func (g *Graph) GetAllResources(typs ...string) ([]*Resource, error)

func (*Graph) GetResource

func (g *Graph) GetResource(t string, id string) (*Resource, error)

func (*Graph) ListResourcesAppliedOn

func (g *Graph) ListResourcesAppliedOn(start *Resource) ([]*Resource, error)

func (*Graph) ListResourcesDependingOn

func (g *Graph) ListResourcesDependingOn(start *Resource) ([]*Resource, error)

func (*Graph) MarshalTo added in v0.1.2

func (g *Graph) MarshalTo(w io.Writer) error

func (*Graph) MustMarshal

func (g *Graph) MustMarshal() string

func (*Graph) OrFilter added in v0.0.24

func (g *Graph) OrFilter(entity string, filters ...FilterFn) (*Graph, error)

func (*Graph) ResolveResources

func (g *Graph) ResolveResources(resolvers ...Resolver) ([]*Resource, error)

func (*Graph) Unmarshal

func (g *Graph) Unmarshal(data []byte) error

func (*Graph) UnmarshalFromReaders added in v0.1.4

func (g *Graph) UnmarshalFromReaders(readers ...io.Reader) error

type KeyValue added in v0.0.23

type KeyValue struct {
	KeyName string `predicate:"cloud:keyName"`
	Value   string `predicate:"cloud:value"`
}

func (*KeyValue) String added in v0.0.24

func (kv *KeyValue) String() string

type Or added in v0.1.6

type Or struct {
	Resolvers []Resolver
}

func (*Or) Resolve added in v0.1.6

func (r *Or) Resolve(snap tstore.RDFGraph) (result []*Resource, err error)

type ParentsVisitor

type ParentsVisitor struct {
	From        *Resource
	Each        visitEachFunc
	IncludeFrom bool
}

func (*ParentsVisitor) Visit

func (v *ParentsVisitor) Visit(g *Graph) error

type Policy added in v0.1.4

type Policy struct {
	Version    string             `json:",omitempty"`
	ID         string             `json:"Id,omitempty"`
	Statements compositeStatement `json:"Statement,omitempty"`
}

type PolicyStatement added in v0.1.4

type PolicyStatement struct {
	ID           string              `json:"Sid,omitempty"`
	Principal    *StatementPrincipal `json:",omitempty"`
	NotPrincipal *StatementPrincipal `json:",omitempty"`
	Effect       string              `json:",omitempty"`
	Actions      compositeString     `json:"Action,omitempty"`
	NotActions   compositeString     `json:"NotAction,omitempty"`
	Resources    compositeString     `json:"Resource,omitempty"`
	NotResources compositeString     `json:"NotResource,omitempty"`
	Condition    interface{}         `json:",omitempty"`
}

type PortRange

type PortRange struct {
	FromPort, ToPort int64
	Any              bool
}

func ParsePortRange added in v0.0.22

func ParsePortRange(s string) (PortRange, error)

func (PortRange) Contains added in v0.0.22

func (p PortRange) Contains(port int64) bool

func (PortRange) String added in v0.0.22

func (p PortRange) String() string

type Resolver

type Resolver interface {
	Resolve(snap tstore.RDFGraph) ([]*Resource, error)
}

type Resource

type Resource struct {
	Properties map[string]interface{}
	Relations  map[string][]*Resource
	Meta       map[string]interface{}
	// contains filtered or unexported fields
}

func InitResource

func InitResource(kind, id string) *Resource

func NotFoundResource added in v0.0.22

func NotFoundResource(id string) *Resource

func ResolveResourcesWithProp added in v0.1.2

func ResolveResourcesWithProp(snap tstore.RDFGraph, resType, propName, propVal string) ([]*Resource, error)

func (*Resource) Format added in v0.1.2

func (res *Resource) Format(layout string) (out string)

func (*Resource) Id

func (res *Resource) Id() string

func (*Resource) Same

func (res *Resource) Same(other *Resource) bool

Compare only the id and type of the resources (no properties nor meta)

func (*Resource) String

func (res *Resource) String() string

func (*Resource) Type

func (res *Resource) Type() string

type Resources

type Resources []*Resource

func (Resources) Map

func (res Resources) Map(f func(*Resource) string) (out []string)

type Route

type Route struct {
	Destination             *net.IPNet     `predicate:"net:cidr"`
	DestinationIPv6         *net.IPNet     `predicate:"net:cidrv6"`
	DestinationPrefixListId string         `predicate:"net:routeDestinationPrefixList"`
	Targets                 []*RouteTarget `predicate:"net:routeTargets"`
}

func (*Route) String

func (r *Route) String() string

type RouteTarget

type RouteTarget struct {
	Type  routeTargetType
	Ref   string
	Owner string
}

func ParseRouteTarget added in v0.0.22

func ParseRouteTarget(s string) (*RouteTarget, error)

func (*RouteTarget) String

func (t *RouteTarget) String() string

type Routes added in v0.0.22

type Routes []*Route

func (Routes) Sort added in v0.0.22

func (routes Routes) Sort()

type SiblingsVisitor

type SiblingsVisitor struct {
	From        *Resource
	Each        visitEachFunc
	IncludeFrom bool
}

func (*SiblingsVisitor) Visit

func (v *SiblingsVisitor) Visit(g *Graph) error

type StatementPrincipal added in v0.1.4

type StatementPrincipal struct {
	AWS       compositeString `json:",omitempty"`
	Service   compositeString `json:",omitempty"`
	Federated compositeString `json:",omitempty"`
}

func (*StatementPrincipal) UnmarshalJSON added in v0.1.4

func (c *StatementPrincipal) UnmarshalJSON(data []byte) (err error)

To support AWS JSON for Policy in which a principal can be either a JSON object, either "*"

type Visitor

type Visitor interface {
	Visit(*Graph) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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