Simplify Zendesk driver and share time parsing
Drop the zendeskRole helper and use the raw API role, matching the other drivers. Factor the duplicated RFC3339 timestamp parsing (parseZendeskTime and parseDatadogTime were identical) into a shared parseRFC3339Ptr in driver.go. Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.probo.inc/probo/pkg/coredata"
|
||||
)
|
||||
@@ -148,7 +147,7 @@ func (d *DatadogDriver) ListAccounts(ctx context.Context) ([]AccountRecord, erro
|
||||
AuthMethod: coredata.AccessEntryAuthMethodUnknown,
|
||||
AccountType: accountType,
|
||||
ExternalID: u.ID,
|
||||
CreatedAt: parseDatadogTime(u.Attributes.CreatedAt),
|
||||
CreatedAt: parseRFC3339Ptr(u.Attributes.CreatedAt),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -197,16 +196,3 @@ func (d *DatadogDriver) queryUsers(ctx context.Context, page int) (*datadogUsers
|
||||
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func parseDatadogTime(s string) *time.Time {
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
t, err := time.Parse(time.RFC3339, s)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &t
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user