Skip to content

Commit c53fba1

Browse files
Properly unmarshal trustedIdentity response (#116)
1 parent 451475d commit c53fba1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

sysdig/internal/client/secure/cloud_account.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package secure
22

33
import (
44
"context"
5+
"encoding/json"
56
"fmt"
67
"io/ioutil"
78
"net/http"
@@ -89,7 +90,7 @@ func (client *sysdigSecureClient) UpdateCloudAccount(ctx context.Context, accoun
8990
return CloudAccountFromJSON(bodyBytes), nil
9091
}
9192

92-
func (client *sysdigSecureClient) GetTrustedCloudIdentity(ctx context.Context, provider string) (string, error) {
93+
func (client *sysdigSecureClient) GetTrustedCloudIdentity(ctx context.Context, provider string) (identity string, err error) {
9394
response, err := client.doSysdigSecureRequest(ctx, http.MethodGet, client.trustedCloudIdentityURL(provider), nil)
9495
if err != nil {
9596
return "", err
@@ -105,5 +106,9 @@ func (client *sysdigSecureClient) GetTrustedCloudIdentity(ctx context.Context, p
105106
return "", err
106107
}
107108

108-
return string(bodyBytes), nil
109+
if err := json.Unmarshal(bodyBytes, &identity); err != nil {
110+
return "", err
111+
}
112+
113+
return identity, nil
109114
}

0 commit comments

Comments
 (0)