github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/pkg/steampipeconfig/parse/limiter.go (about)

     1  package parse
     2  
     3  import (
     4  	"github.com/hashicorp/hcl/v2"
     5  	"github.com/hashicorp/hcl/v2/gohcl"
     6  	"github.com/turbot/steampipe/pkg/steampipeconfig/modconfig"
     7  )
     8  
     9  func DecodeLimiter(block *hcl.Block) (*modconfig.RateLimiter, hcl.Diagnostics) {
    10  	var limiter = &modconfig.RateLimiter{
    11  		// populate name from label
    12  		Name: block.Labels[0],
    13  	}
    14  	diags := gohcl.DecodeBody(block.Body, nil, limiter)
    15  	if !diags.HasErrors() {
    16  		limiter.OnDecoded(block)
    17  	}
    18  
    19  	return limiter, diags
    20  }