mirror of
https://github.com/hashicorp/packer.git
synced 2026-05-28 04:35:38 -04:00
add kvfilter type that regroups very frequently used filters
This commit is contained in:
parent
9e6d5da277
commit
af38430eb8
1 changed files with 16 additions and 0 deletions
|
|
@ -6,3 +6,19 @@ type KeyValue struct {
|
|||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
type KVFilter struct {
|
||||
Filters map[string]string
|
||||
Filter []KeyValue
|
||||
}
|
||||
|
||||
func (kvf *KVFilter) Prepare() error {
|
||||
for _, filter := range kvf.Filter {
|
||||
kvf.Filters[filter.Key] = filter.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (kvf *KVFilter) Empty() bool {
|
||||
return len(kvf.Filters) == 0
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue