Skip to content

Commit

Permalink
fixing the rate
Browse files Browse the repository at this point in the history
  • Loading branch information
dianibar committed Jan 5, 2024
1 parent 77895dd commit 35ee031
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions examples/.terraform.tfstate.lock.info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ID":"47a5427e-12a1-50df-e42d-a4f8e3f3be9c","Operation":"OperationTypeApply","Info":"","Who":"[email protected]","Version":"1.3.5","Created":"2024-01-05T03:59:14.038262Z","Path":"terraform.tfstate"}
2 changes: 1 addition & 1 deletion examples/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource "doit_report" "my-report" {
value = "cost"
}
advanced_analysis = {
trending_up = false
trending_up = true
trending_down = false
not_trending = false
forecast = false
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"log"
"os"
"strconv"
"time"

"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/path"
Expand Down Expand Up @@ -209,7 +208,8 @@ func (p *doitProvider) Configure(ctx context.Context, req provider.ConfigureRequ
if resp.Diagnostics.HasError() {
return
}
rl := rate.NewLimiter(rate.Every(60*time.Second), requestsMinute) // default 100 requests per minute

rl := rate.NewLimiter(4, 4) // default 250 requests per minute
// Create a new DoiT client using the configuration values
client, err := NewClientTest(&host, &doiTAPIToken, &customerContext, rl)
if err != nil {
Expand Down
6 changes: 2 additions & 4 deletions internal/provider/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,16 @@ func (c *ClientTest) GetReport(orderID string) (*Report, error) {
if err != nil {
return nil, err
}

report := Report{}
body, err := c.doRequest(req)
if err != nil {
return nil, err
}
log.Println("Body----------------")
log.Println(string(body))
report := Report{}

err = json.Unmarshal(body, &report)
if err != nil {
return nil, err
}

return &report, nil
}

0 comments on commit 35ee031

Please sign in to comment.