Skip to content

Commit

Permalink
Bump Terraform provider to 0.11.0 (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonehusin authored Aug 20, 2024
1 parent 76713fd commit 0335b41
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/charmbracelet/huh v0.4.2
github.com/charmbracelet/huh/spinner v0.0.0-20240328185852-590ecabc34b9
github.com/fatih/color v1.17.0
github.com/firehydrant/terraform-provider-firehydrant v0.10.0
github.com/firehydrant/terraform-provider-firehydrant v0.11.0
github.com/gosimple/slug v1.14.0
github.com/hashicorp/hcl/v2 v2.21.0
github.com/opsgenie/opsgenie-go-sdk-v2 v1.2.23
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/firehydrant/terraform-provider-firehydrant v0.10.0 h1:KI/lzh2LfRsPyT8nl0BcUez1LCd66QVN8b+dIaYQTw8=
github.com/firehydrant/terraform-provider-firehydrant v0.10.0/go.mod h1:BpmqKPjJVHD/D9p8fepwrSozsRqTPZs3D4d6pugyOBw=
github.com/firehydrant/terraform-provider-firehydrant v0.11.0 h1:4CokezAEaVjTOM0qCIM2GmoZ0a2EN4l1ifBaZAY6vck=
github.com/firehydrant/terraform-provider-firehydrant v0.11.0/go.mod h1:BpmqKPjJVHD/D9p8fepwrSozsRqTPZs3D4d6pugyOBw=
github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
Expand Down
29 changes: 11 additions & 18 deletions internal/firehydrant/firehydrant.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,21 @@ func (c *Client) ListTeams(ctx context.Context) ([]store.FhTeam, error) {

teams := []store.FhTeam{}
opts := &firehydrant.TeamQuery{}
for {
resp, err := c.client.Teams().List(ctx, opts)
if err != nil {
return nil, fmt.Errorf("fetching teams from FireHydrant: %w", err)
}
for _, t := range resp.Teams {
teams = append(teams, store.FhTeam{
ID: t.ID,
Name: t.Name,
Slug: t.Slug,
})
}
if resp.Pagination.Next == 0 || resp.Pagination.Page >= resp.Pagination.Last {
break
}
opts.Page = resp.Pagination.Next
resp, err := c.client.Teams().List(ctx, opts)
if err != nil {
return nil, fmt.Errorf("fetching teams from FireHydrant: %w", err)
}
for _, t := range resp.Teams {
team := store.FhTeam{
ID: t.ID,
Name: t.Name,
Slug: t.Slug,
}

for _, t := range teams {
if err := q.InsertFhTeam(ctx, store.InsertFhTeamParams(t)); err != nil {
if err := q.InsertFhTeam(ctx, store.InsertFhTeamParams(team)); err != nil {
return nil, fmt.Errorf("storing teams to database: %w", err)
}
teams = append(teams, team)
}
return teams, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
}
],
"pagination": {
"count": 11,
"items": 11,
"count": 1,
"items": 1,
"last": 1,
"next": null,
"page": 1,
Expand Down

0 comments on commit 0335b41

Please sign in to comment.