Skip to content

Commit 58b3b4b

Browse files
committed
fix(api): Store lookup by ID when empty ID param is provided.
1 parent 7725ea3 commit 58b3b4b

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

api/store.go

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,25 @@ func (c *Client) ListCertificateStores(params *map[string]interface{}) (*[]GetCe
169169
if params != nil {
170170
sId, ok := (*params)["Id"]
171171
if ok {
172-
var resp, err = c.GetCertificateStoreByID(fmt.Sprintf("%s", sId.([]string)[0]))
173-
if err != nil {
174-
return nil, err
172+
switch sId.(type) {
173+
case string:
174+
var resp, err = c.GetCertificateStoreByID(fmt.Sprintf("%s", sId.(string)))
175+
if err != nil {
176+
return nil, err
177+
}
178+
return &[]GetCertificateStoreResponse{*resp}, nil
179+
case []string:
180+
// Only single ID lookup is supported
181+
lookup := sId.([]string)
182+
if len(lookup) > 0 {
183+
var resp, err = c.GetCertificateStoreByID(fmt.Sprintf("%s", lookup[0]))
184+
if err != nil {
185+
return nil, err
186+
}
187+
return &[]GetCertificateStoreResponse{*resp}, nil
188+
}
175189
}
176-
return &[]GetCertificateStoreResponse{*resp}, nil
177190
}
178-
179191
query, _ = buildQuery(*params, "certificateStoreQuery.queryString")
180192
}
181193

0 commit comments

Comments
 (0)