mirror of
https://github.com/turbot/steampipe.git
synced 2026-02-25 05:01:06 -05:00
21 lines
468 B
Go
21 lines
468 B
Go
package parse
|
|
|
|
import (
|
|
"github.com/hashicorp/hcl/v2"
|
|
"github.com/hashicorp/hcl/v2/gohcl"
|
|
"github.com/turbot/steampipe/pkg/steampipeconfig/modconfig"
|
|
)
|
|
|
|
func DecodeLimiter(block *hcl.Block) (*modconfig.RateLimiter, hcl.Diagnostics) {
|
|
var limiter = &modconfig.RateLimiter{
|
|
// populate name from label
|
|
Name: block.Labels[0],
|
|
}
|
|
diags := gohcl.DecodeBody(block.Body, nil, limiter)
|
|
if !diags.HasErrors() {
|
|
limiter.OnDecoded(block)
|
|
}
|
|
|
|
return limiter, diags
|
|
}
|