graph

package
v0.0.0-...-dc23247 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

Variables

View Source
var Differ = &differ{rdf.DefaultDiffer}

Functions

func VisitorCollectFunc

func VisitorCollectFunc(collect *[]*Resource) visitEachFunc

Types

type Alias

type Alias string

func (Alias) ResolveToId

func (a Alias) ResolveToId(g *Graph, resT ResourceType) (string, bool)

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 {
	*rdf.Diff
}

func NewDiff

func NewDiff(fromG, toG *Graph) *Diff

func (*Diff) FromGraph

func (d *Diff) FromGraph() *Graph

func (*Diff) MergedGraph

func (d *Diff) MergedGraph() *Graph

func (*Diff) ToGraph

func (d *Diff) ToGraph() *Graph

type FirewallRule

type FirewallRule struct {
	PortRange PortRange
	Protocol  string
	IPRanges  []*net.IPNet // IPv4 or IPv6 range
}

func (*FirewallRule) String

func (r *FirewallRule) String() string

type Grant

type Grant struct {
	Permission,
	GranteeID,
	GranteeDisplayName,
	GranteeType string
}

func (*Grant) String

func (g *Grant) String() string

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(graph *Graph)

func (*Graph) AddParentRelation

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

func (*Graph) AddResource

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

func (*Graph) CountChildrenForNode

func (g *Graph) CountChildrenForNode(res *Resource) (int, error)

func (*Graph) CountChildrenOfTypeForNode

func (g *Graph) CountChildrenOfTypeForNode(res *Resource, childType ResourceType) (int, 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(t ResourceType) ([]*Resource, error)

func (*Graph) GetResource

func (g *Graph) GetResource(t ResourceType, 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) Unmarshal

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

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
}

type Properties

type Properties map[string]interface{}

func (Properties) Substract

func (props Properties) Substract(other Properties) Properties

type Property

type Property struct {
	Key   string
	Value interface{}
}

type Resource

type Resource struct {
	Properties Properties
	Meta       Properties
	// contains filtered or unexported fields
}

func InitResource

func InitResource(id string, kind ResourceType) *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() ResourceType

type ResourceById

type ResourceById []*Resource

func (ResourceById) Len

func (r ResourceById) Len() int

func (ResourceById) Less

func (r ResourceById) Less(i, j int) bool

func (ResourceById) Swap

func (r ResourceById) Swap(i, j int)

type ResourceType

type ResourceType string
const (
	Region ResourceType = "region"
	//infra
	Vpc             ResourceType = "vpc"
	Subnet          ResourceType = "subnet"
	Image           ResourceType = "image"
	SecurityGroup   ResourceType = "securitygroup"
	Keypair         ResourceType = "keypair"
	Volume          ResourceType = "volume"
	Instance        ResourceType = "instance"
	InternetGateway ResourceType = "internetgateway"
	RouteTable      ResourceType = "routetable"

	//access
	User   ResourceType = "user"
	Role   ResourceType = "role"
	Group  ResourceType = "group"
	Policy ResourceType = "policy"

	//s3
	Bucket ResourceType = "bucket"
	Object ResourceType = "storageobject"
	Acl    ResourceType = "storageacl"
)

func (ResourceType) String

func (r ResourceType) String() string

func (ResourceType) ToRDFString

func (r ResourceType) ToRDFString() 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
	TargetType  routeTargetType
	Target      string
}

func (*Route) String

func (r *Route) String() string

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
internal
rdf

Jump to

Keyboard shortcuts

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