diff options
author | Julien Dessaux | 2023-07-31 00:31:43 +0200 |
---|---|---|
committer | Julien Dessaux | 2023-07-31 00:31:43 +0200 |
commit | 6642a66a1df5db5f2f9780905e83ba2c412128f6 (patch) | |
tree | 35d04ade200db806152bc80cd6cf33ed6bf23052 /external/evcli/client.go | |
parent | Upgrade notes (diff) | |
download | terraform-provider-eventline-0.0.5.tar.gz terraform-provider-eventline-0.0.5.tar.bz2 terraform-provider-eventline-0.0.5.zip |
Implemented identities datasourcev0.0.5
Diffstat (limited to 'external/evcli/client.go')
-rw-r--r-- | external/evcli/client.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/external/evcli/client.go b/external/evcli/client.go index b9d5032..ce3d4a0 100644 --- a/external/evcli/client.go +++ b/external/evcli/client.go @@ -181,6 +181,34 @@ func (c *Client) UpdateProject(project *eventline.Project) error { return c.SendRequest("PUT", uri, project, nil) } +func (c *Client) FetchIdentities() (Identities, error) { + var identities Identities + + cursor := eventline.Cursor{Size: 20} + + for { + var page IdentityPage + + uri := NewURL("identities") + uri.RawQuery = cursor.Query().Encode() + + err := c.SendRequest("GET", uri, nil, &page) + if err != nil { + return nil, err + } + + identities = append(identities, page.Elements...) + + if page.Next == nil { + break + } + + cursor = *page.Next + } + + return identities, nil +} + func (c *Client) ReplayEvent(id string) (*eventline.Event, error) { var event eventline.Event |