github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/pkg/control/controlexecute/direct_children_mod_decorator.go (about)

     1  package controlexecute
     2  
     3  import (
     4  	"github.com/turbot/steampipe/pkg/steampipeconfig/modconfig"
     5  )
     6  
     7  // DirectChildrenModDecorator is a struct used to wrap a Mod but modify the results of GetChildren to only return
     8  // immediate mod children (as opposed to all resources in dependency mods as well)
     9  // This is needed when running 'check all' for a mod which has dependency mopds'
    10  type DirectChildrenModDecorator struct {
    11  	*modconfig.Mod
    12  }
    13  
    14  // GetChildren is overridden
    15  func (r DirectChildrenModDecorator) GetChildren() []modconfig.ModTreeItem {
    16  	var res []modconfig.ModTreeItem
    17  	for _, child := range r.Mod.GetChildren() {
    18  		if child.GetMod().ShortName == r.Mod.ShortName {
    19  			res = append(res, child)
    20  		}
    21  	}
    22  	return res
    23  }
    24  
    25  // GetDocumentation implements DashboardLeafNode
    26  func (r DirectChildrenModDecorator) GetDocumentation() string {
    27  	return r.Mod.GetDocumentation()
    28  }
    29  
    30  // GetDisplay implements DashboardLeafNode
    31  func (r DirectChildrenModDecorator) GetDisplay() string {
    32  	return ""
    33  }
    34  
    35  // GetType implements DashboardLeafNode
    36  func (r DirectChildrenModDecorator) GetType() string {
    37  	return ""
    38  }
    39  
    40  // GetWidth implements DashboardLeafNode
    41  func (r DirectChildrenModDecorator) GetWidth() int {
    42  	return 0
    43  }