graph

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2017 License: Apache-2.0 Imports: 14 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(g *Graph) (result []*Resource, err error)

type ById

type ById struct {
	Id string
}

func (*ById) Resolve

func (r *ById) Resolve(g *Graph) ([]*Resource, error)

type ByProperty

type ByProperty struct {
	Key   string
	Value interface{}
}

func (*ByProperty) Resolve

func (r *ByProperty) Resolve(g *Graph) ([]*Resource, error)

type ByType

type ByType struct {
	Typ string
}

func (*ByType) Resolve

func (r *ByType) Resolve(g *Graph) ([]*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(g *Graph) ([]*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
}

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) Filter

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

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) Marshal

func (g *Graph) Marshal() ([]byte, 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) UnmarshalMultiple added in v0.0.22

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

type KeyValue added in v0.0.23

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

func (*KeyValue) String added in v0.0.24

func (kv *KeyValue) String() string

type ParentsVisitor

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

func (*ParentsVisitor) Visit

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

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(g *Graph) ([]*Resource, error)
}

type Resource

type Resource struct {
	Properties map[string]interface{}
	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 (*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 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