Skip to content

Commit

Permalink
Properly unmarshal trustedIdentity response
Browse files Browse the repository at this point in the history
  • Loading branch information
nkraemer-sysdig committed Aug 18, 2021
1 parent d464ef6 commit 8c199a6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sysdig/internal/client/secure/cloud_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package secure

import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -89,7 +90,7 @@ func (client *sysdigSecureClient) UpdateCloudAccount(ctx context.Context, accoun
return CloudAccountFromJSON(bodyBytes), nil
}

func (client *sysdigSecureClient) GetTrustedCloudIdentity(ctx context.Context, provider string) (string, error) {
func (client *sysdigSecureClient) GetTrustedCloudIdentity(ctx context.Context, provider string) (identity string, err error) {
response, err := client.doSysdigSecureRequest(ctx, http.MethodGet, client.trustedCloudIdentityURL(provider), nil)
if err != nil {
return "", err
Expand All @@ -105,5 +106,9 @@ func (client *sysdigSecureClient) GetTrustedCloudIdentity(ctx context.Context, p
return "", err
}

return string(bodyBytes), nil
if err := json.Unmarshal(bodyBytes, &identity); err != nil {
return "", err
}

return identity, nil
}

0 comments on commit 8c199a6

Please sign in to comment.