From 1f6846d785a659cc9a0d6029d4cecb90c66c3bbe Mon Sep 17 00:00:00 2001 From: William Guilherme Date: Fri, 5 Jul 2024 17:14:30 -0700 Subject: [PATCH] fix: Fixed Cloud Browser Isolation Search Mechanism --- CHANGELOG.md | 12 ++++++++++++ docs/guides/release-notes.md | 14 +++++++++++++- .../cbicertificatecontroller.go | 16 +++++++++++++--- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 250cc648..adba6d2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/docs/guides/release-notes.md b/docs/guides/release-notes.md index 021c1de0..d11fb49e 100644 --- a/docs/guides/release-notes.md +++ b/docs/guides/release-notes.md @@ -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 diff --git a/zpa/services/cloudbrowserisolation/cbicertificatecontroller/cbicertificatecontroller.go b/zpa/services/cloudbrowserisolation/cbicertificatecontroller/cbicertificatecontroller.go index e895d61b..e542bb6f 100644 --- a/zpa/services/cloudbrowserisolation/cbicertificatecontroller/cbicertificatecontroller.go +++ b/zpa/services/cloudbrowserisolation/cbicertificatecontroller/cbicertificatecontroller.go @@ -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) }