Documentation
¶
Overview ¶
Package provider has the abstraction of a Provider which holds the specific logic of that Provider when trying to generate a Graph. The logic to hide/show specific elements and how they should be represented
Index ¶
- Constants
- func TypeStrings() []string
- type NopProvider
- func (n NopProvider) DataSource(rsc string) (*resource.Resource, error)
- func (n NopProvider) IsEdge(rsc string) bool
- func (n NopProvider) IsNode(rsc string) bool
- func (n NopProvider) PreProcess(cfg map[string]map[string]interface{}) [][]string
- func (n NopProvider) Resource(rsc string) (*resource.Resource, error)
- func (n NopProvider) ResourceInOutNodes(id, rs string, cfg map[string]map[string]interface{}) (in, out, nodes []string)
- func (n NopProvider) Type() Type
- func (n NopProvider) UsedAttributes() []string
- type Provider
- type RawProvider
- type Type
Constants ¶
const HCLCanonicalKey = "_im_canonical"
HCLCanonicalKey is used to define a specific key to the config, in this case the HCL config, as it does not have an 'id' we'll add this key with the Canonical of the Resource (ex: _im_canonical => aws_lb.front)
Variables ¶
This section is empty.
Functions ¶
func TypeStrings ¶
func TypeStrings() []string
TypeStrings returns a slice of all String values of the enum
Types ¶
type NopProvider ¶
type NopProvider struct{}
NopProvider holds the default methods for the provider.Interface so if one Provider does not implement one method we do not have to write the method
func (NopProvider) DataSource ¶
func (n NopProvider) DataSource(rsc string) (*resource.Resource, error)
DataSource returns the resource information
func (NopProvider) IsEdge ¶
func (n NopProvider) IsEdge(rsc string) bool
IsEdge checks if the resource should be considered an Edge or not
func (NopProvider) IsNode ¶
func (n NopProvider) IsNode(rsc string) bool
IsNode checks if the resource should be considered a Node or not
func (NopProvider) PreProcess ¶ added in v0.2.0
func (n NopProvider) PreProcess(cfg map[string]map[string]interface{}) [][]string
PreProcess defines new edges from the config. each element is an edge and for each edge we have the source and the target. [_][0] is the source of the edge [_][1] is the target of the edge
func (NopProvider) Resource ¶
func (n NopProvider) Resource(rsc string) (*resource.Resource, error)
Resource returns the resource information
func (NopProvider) ResourceInOutNodes ¶ added in v0.4.0
func (n NopProvider) ResourceInOutNodes(id, rs string, cfg map[string]map[string]interface{}) (in, out, nodes []string)
ResourceInOutNodes returns the resource In Out and Nodes from a state config. As an example in AWS this would be an "aws_security_group" "ingress" and "egress" In are the incoming connections, Out are the exiting connections and Nodes are fictional Nodes that need to be added, it's basically to represent the internet access
func (NopProvider) UsedAttributes ¶
func (n NopProvider) UsedAttributes() []string
UsedAttributes returns all the attributes that are required/used/needed on the providers, so when we have to prune we know what to keep
type Provider ¶
type Provider interface { // Type returns the name of the Provider Type() Type // IsNode checks if the resource should be considered // a Node or not IsNode(rsc string) bool // IsEdge checks if the resource should be considered // an Edge or not IsEdge(rsc string) bool // Resource returns the resource information Resource(rsc string) (*resource.Resource, error) // DataSource returns the resource information DataSource(rsc string) (*resource.Resource, error) // ResourceInOutNodes returns the resource In Out and Nodes from a // state config. As an example in AWS this would be // an "aws_security_group" "ingress" and "egress" // In are the incoming connections, Out are the exiting connections // and Nodes are fictional Nodes that need to be added, it's basically // to represent the internet access ResourceInOutNodes(id, rs string, cfg map[string]map[string]interface{}) (in, out, nodes []string) // UsedAttributes returns all the attributes that are // required/used/needed on the providers, so when we have to // prune we know what to keep UsedAttributes() []string // PreProcess defines new edges from the config. // each element is an edge and for each edge we have the source // and the target. // [_][0] is the source of the edge // [_][1] is the target of the edge PreProcess(cfg map[string]map[string]interface{}) [][]string }
Provider is an interface to abstract common functions on all the providers
type RawProvider ¶
type RawProvider struct {
NopProvider
}
RawProvider is the provider that would be used when we do not have an specific implementation a Provider
func (RawProvider) IsNode ¶
func (n RawProvider) IsNode(rsc string) bool
IsNode checks if the resource should be considered a Node or not For the default one we consider all of the Nodes
type Type ¶
type Type int
Type defines the type of the Provider
List of all the Providers supported
func TypeString ¶
TypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.