Skip to content

Commit

Permalink
Merge pull request #239 from zscaler/zia-#239-vpncredential-getbyip
Browse files Browse the repository at this point in the history
Fix: Added GetByIP Function to vpncredentials model
  • Loading branch information
willguibr authored Mar 27, 2024
2 parents 983af18 + cdc4e8e commit aee549a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

# 2.4.32 (March 27, 2024)

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

### Fixes

- [PR #239](https://github.com/zscaler/zscaler-sdk-go/pull/239) - Added function `GetByIP` in the ZIA `vpncredentials` package

# 2.4.31 (March 16, 2024)

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

---

``Last updated: v2.4.31``
``Last updated: v2.4.32``

---

# 2.4.32 (March 27, 2024)

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

### Fixes

- [PR #239](https://github.com/zscaler/zscaler-sdk-go/pull/239) - Added function `GetByIP` in the ZIA `vpncredentials` package

# 2.4.31 (March 16, 2024)

## Notes
Expand Down
8 changes: 4 additions & 4 deletions docs/guides/support.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ page_title: "Support Guide"

# General Support Statement

The ZIA Terraform provider is supported and maintained by the Zscaler Technology Alliances team, and we welcome questions on how to use the provider.
The Zscaler SDK GO is supported and maintained by the Zscaler Technology Alliances team, and we welcome questions on how to use this SDK.
Please, refer to our [troubleshooting guide](troubleshooting.md) for guidance on typical problems.

## Support Ticket Severity

Support tickets related to the Terraform providers can be opened with [Zscaler Support](https://help.zscaler.com/login-tickets), however since the provider is just a client of the underlying product API, we will **NOT** be able to treat provider related support requests as a Severity-1 (Immediate time frame).
Support tickets related to the GO SDK can be opened with [Zscaler Support](https://help.zscaler.com/login-tickets), however since the SDK is just a client of the underlying product API, we will **NOT** be able to treat SDK related support requests as a Severity-1 (Immediate time frame).

When reporting bugs, please provide the Terraform script that demonstrates the bug and the command output. Stack traces will also be helpful.

Expand All @@ -19,5 +19,5 @@ Urgent, production related Terraform issues can be resolved via direct interacti

## Contact

For questions or requests that cannot be submitted via GitHub Issues, please contact zscaler-partner-labs@z-bd.com with zia-terraform-provider" in the subject line.
We also provide a [private Slack channel](https://docs.google.com/forms/d/e/1FAIpQLSfkd3EMkLQdIWMNQ7QCr8TrH_xVSwSYcQshfBPDEZFOaF28qA/viewform?usp=sf_link) where you can submit your questions to the provider maintainers. Notice that this form will be reviewed and approved by Zscaler Technology Alliances team.
For questions or requests that cannot be submitted via GitHub Issues, please contact devrel@zscaler.com with "Zscaler-SDK-GO" in the subject line.
We also provide a [private Slack channel](https://docs.google.com/forms/d/e/1FAIpQLSfkd3EMkLQdIWMNQ7QCr8TrH_xVSwSYcQshfBPDEZFOaF28qA/viewform?usp=sf_link) where you can submit your questions to the SDK maintainers. Notice that this form will be reviewed and approved by Zscaler Technology Alliances team.
15 changes: 15 additions & 0 deletions zia/services/trafficforwarding/vpncredentials/vpncredentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ func (service *Service) GetByFQDN(vpnCredentialName string) (*VPNCredentials, er
return nil, fmt.Errorf("no vpn credentials found with fqdn: %s", vpnCredentialName)
}

func (service *Service) GetByIP(vpnCredentialIP string) (*VPNCredentials, error) {
var vpnCredentials []VPNCredentials

err := common.ReadAllPages(service.Client, vpnCredentialsEndpoint, &vpnCredentials)
if err != nil {
return nil, err
}
for _, vpnCredential := range vpnCredentials {
if strings.EqualFold(vpnCredential.IPAddress, vpnCredentialIP) {
return &vpnCredential, nil
}
}
return nil, fmt.Errorf("no vpn credentials found with ip: %s", vpnCredentialIP)
}

func (service *Service) Create(vpnCredentials *VPNCredentials) (*VPNCredentials, *http.Response, error) {
resp, err := service.Client.Create(vpnCredentialsEndpoint, *vpnCredentials)
if err != nil {
Expand Down

0 comments on commit aee549a

Please sign in to comment.