Skip to content

Commit

Permalink
fix: Fixed Cloud Browser Isolation Search Mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
willguibr committed Jul 6, 2024
1 parent 751004b commit 1f6846d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

# 2.61.10 (July 5, 2024)

## Notes
- Golang: **v1.21**

### Bug Fixes

- [PR #268](https://github.com/zscaler/zscaler-sdk-go/pull/268) - Fixed ZPA Cloud Browser Isolation resources to allow search by name and ID.
- `cbibannercontroller`
- `cbicertificatecontroller`
- `cbiprofilecontroller`

# 2.61.9 (July 5, 2024)

## Notes
Expand Down
14 changes: 13 additions & 1 deletion docs/guides/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,22 @@ Track all Zscaler SDK GO releases. New resources, features, and bug fixes will b

---

``Last updated: v2.61.9``
``Last updated: v2.61.10``

---

# 2.61.10 (July 5, 2024)

## Notes
- Golang: **v1.21**

### Bug Fixes

- [PR #268](https://github.com/zscaler/zscaler-sdk-go/pull/268) - Fixed ZPA Cloud Browser Isolation resources to allow search by name and ID.
- `cbibannercontroller`
- `cbicertificatecontroller`
- `cbiprofilecontroller`

# 2.61.9 (July 5, 2024)

## Notes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,37 @@ func Get(service *services.Service, certificateID string) (*CBICertificate, *htt
return v, resp, nil
}

func GetByName(service *services.Service, certificateName string) (*CBICertificate, *http.Response, error) {
list, resp, err := GetAll(service)
if err != nil {
return nil, nil, err
}
for _, cert := range list {
if strings.EqualFold(cert.Name, certificateName) {
return &cert, resp, nil
}
}
return nil, resp, fmt.Errorf("no certificate named '%s' was found", certificateName)
}

func GetByNameOrID(service *services.Service, identifier string) (*CBICertificate, *http.Response, error) {
// Retrieve all banners
list, resp, err := GetAll(service)
if err != nil {
return nil, nil, err
}

// Try to find by ID
for _, certificate := range list {
if certificate.ID == identifier {
return Get(service, certificate.ID)
}
}

// Try to find by name
for _, certificate := range list {
if strings.EqualFold(certificate.Name, identifier) {
return Get(service, certificate.ID)
}
}

return nil, resp, fmt.Errorf("no isolation certificate named or with ID '%s' was found", identifier)
}

Expand Down

0 comments on commit 1f6846d

Please sign in to comment.