mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-15 09:00:59 -08:00
Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io> Co-authored-by: Simar <simar@linux.com> Co-authored-by: simar7 <1254783+simar7@users.noreply.github.com>
31 lines
711 B
Go
31 lines
711 B
Go
package parser
|
|
|
|
// Module represents a logical module in a playbook or task.
|
|
// It wraps a Node and provides module-specific utility methods.
|
|
//
|
|
// All the data and metadata for the module is stored in the embedded Node.
|
|
type Module struct {
|
|
*Node
|
|
|
|
Name string
|
|
}
|
|
|
|
// IsFreeForm returns true if the module is a free-form Ansible module.
|
|
// In Ansible, a free-form module is called using a single scalar value
|
|
// instead of a key-value mapping.
|
|
//
|
|
// Example:
|
|
//
|
|
// # Free-form
|
|
// - command: echo "Hello"
|
|
// # IsFreeForm() -> true
|
|
//
|
|
// # Structured
|
|
// - ansible.builtin.yum:
|
|
// name: vim
|
|
// state: present
|
|
// # IsFreeForm() -> false
|
|
func (m *Module) IsFreeForm() bool {
|
|
return m.Node.IsString()
|
|
}
|