Documentation ¶
Index ¶
- func FindResourcesPerFile(dir string) (files map[string][]Resource, err error)
- func ScanFileForModules(fileName string) (filesToResourcesMap map[string][]Resource, err error)
- type Attribute
- type Resource
- func (r Resource) GetAttributesKeys() (keys []string)
- func (r Resource) GetRuleset(rulebook rules_api.Rulebook, appearances map[string][]string) (rulesetObj rules_api.RuleSet, err error)
- func (r *Resource) Init(block *hclwrite.Block, metadata *tfconfig.Resource)
- func (r Resource) IsDataSource() bool
- func (r Resource) IsResource() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindResourcesPerFile ¶
FindResourcesPerFile
@brief:
FindResourcesPerFile parses all the .tf files under a given folder tree recursively in order to get all the Resources and Data Sources in it
@params:
dir string - the folder to parse
@returns:
resources - map[string][]Resource - map of all resources found in the given folder and its attributes' error - if exists, else nil
func ScanFileForModules ¶
ScanFileForModules
@brief:
ScanFileForModules parses a tf file in order to get the modules defined in it
@params:
filename string - the file to parse
@returns:
resources - map[string][]Resource - all the resources found in the given module error - if exists, else nil
Types ¶
type Resource ¶
type Resource struct { Type string Name string Alias string FullNameSequence string Provider tfconfig.ProviderRef Pos tfconfig.SourcePos Attributes []Attribute }
Resource holds all the data scraped from user files for a specific resource
func ScanFileForResources ¶
ScanFileForResources
@brief:
ScanFileForResources parses a tf file in order to get the resources and data source defined in it
@params:
filename string - the file to parse
@returns:
resources - []Resource - all the resource found in the given file error - if exists, else nil
func ScanFolder ¶
ScanFolder
@brief:
ScanFolder parses a folder which contains tf files in order to get the resources and data source defined in it
@params:
dir string - the folder to parse
@returns:
resources - []*Resource - map of all resources found in the given folder and its attributes' error - if exists, else nil
func ScanFolderRecursively ¶
ScanFolderRecursively
@brief:
ScanFolderRecursively parses all the .tf files under a given folder tree recursively in order to get all the Resources and Data Sources in it
@params:
dir string - the folder to parse
@returns:
resources - []*Resource - map of all resources found in the given folder and its attributes' error - if exists, else nil
func (Resource) GetAttributesKeys ¶
GetAttributesKeys
@brief:
GetAttributesKeys returns all attributes keys in the Resource in context
@returns:
keys - []string - the keys found
func (Resource) GetRuleset ¶
func (r Resource) GetRuleset(rulebook rules_api.Rulebook, appearances map[string][]string) (rulesetObj rules_api.RuleSet, err error)
GetRuleset
@brief:
GetRuleset checks if the resource in context is inside the given rulebook and returns it if it does. If no RuleSet is found, will return an empty object and no error.
@params:
rulebook rules_api.Rulebook - the rulebook to search for the ruleset in
@returns:
*gabs.Container - the ruleset to execute error - if exists
func (*Resource) Init ¶
Init
@brief:
Init initializes the Resource object in context
@params:
block - *hclwrite.Block - the resource to initialize with metadata - *tfconfig.Resource - the resource metadata
func (Resource) IsDataSource ¶
IsDataSource
@brief:
IsDataSource checks if the resource in context is of type data
@returns:
bool
func (Resource) IsResource ¶
IsResource
@brief:
IsResource checks if the resource in context is of type resource
@returns:
bool
Click to show internal directories.
Click to hide internal directories.