Skip to content

Commit

Permalink
feat: Added ZIA SSL Inspection Rules Endpoint (#295)
Browse files Browse the repository at this point in the history
* feat: Added ZIA SSL Inspection Rules Endpoint
  • Loading branch information
willguibr authored Jan 21, 2025
1 parent 9eaf44e commit bb212b2
Show file tree
Hide file tree
Showing 11 changed files with 831 additions and 184 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/zia-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: ZIA Test
on:
pull_request:
types: [opened, synchronize]
merge_group:
types: [checks_requested]
push:
branches:
- master

# For systems with an upstream API that could drift unexpectedly (like most SaaS systems, etc.),
# we recommend testing at a regular interval not necessarily tied to code changes. This will
# ensure you are alerted to something breaking due to an API change, even if the code did not
# change.

schedule:
- cron: '0 11 * * 1-5' # UTC
workflow_dispatch:

jobs:
zia-zsbeta-tests:
environment: ZIA_ZSBETA
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
goVersion: ["1.22"]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.goVersion }}

- name: Clean existing Go modules
run: go clean -modcache

- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set Go env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Install dependencies
run: go mod download

- name: Run tests with retry on Ubuntu
uses: nick-fields/retry@v2
with:
max_attempts: 3
timeout_minutes: 20 # Adjust as needed
command: |
make sweep:zia
make test:integration:zia
env:
ZSCALER_CLIENT_ID: ${{ secrets.ZSCALER_CLIENT_ID }}
ZSCALER_CLIENT_SECRET: ${{ secrets.ZSCALER_CLIENT_SECRET }}
ZSCALER_VANITY_DOMAIN: ${{ secrets.ZSCALER_VANITY_DOMAIN }}
ZSCALER_CLOUD: ${{ secrets.ZSCALER_CLOUD }}
# ZSCALER_SDK_LOG: ${{ secrets.ZSCALER_SDK_LOG }}
# ZSCALER_SDK_VERBOSE: ${{ secrets.ZSCALER_SDK_VERBOSE }}
ZIA_SDK_TEST_SWEEP: ${{ secrets.ZIA_SDK_TEST_SWEEP }}
ZSCALER_SANDBOX_TOKEN: ${{ secrets.ZSCALER_SANDBOX_TOKEN }}
ZSCALER_SANDBOX_CLOUD: ${{ secrets.ZSCALER_SANDBOX_CLOUD }}

- name: Publish test coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.out
fail_ci_if_error: true
84 changes: 84 additions & 0 deletions .github/workflows/zpa-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: ZPA Test
on:
pull_request:
types: [opened, synchronize]
merge_group:
types: [checks_requested]
push:
branches:
- master
schedule:
- cron: '0 11 * * 1-5' # UTC
workflow_dispatch:

jobs:
zpa-beta-tenants:
# needs: [zpa-beta-tenants]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
goVersion: ["1.22"]
environment:
- ZPA_BETA_TENANT01
environment: ${{ matrix.environment }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.goVersion }}

- name: Clean existing Go modules
run: go clean -modcache

- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Set Go env
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Install dependencies
run: go mod download

- name: Run tests with retry
uses: nick-fields/retry@v2
with:
max_attempts: 3
timeout_minutes: 20
command: |
make sweep:zpa
make test:integration:zpa
make sweep:zpa
env:
ZSCALER_CLIENT_ID: ${{ secrets.ZSCALER_CLIENT_ID }}
ZSCALER_CLIENT_SECRET: ${{ secrets.ZSCALER_CLIENT_SECRET }}
ZSCALER_VANITY_DOMAIN: ${{ secrets.ZSCALER_VANITY_DOMAIN }}
ZSCALER_CLOUD: ${{ secrets.ZSCALER_CLOUD }}
ZPA_CUSTOMER_ID: ${{ secrets.ZPA_CUSTOMER_ID }}
# ZSCALER_SDK_LOG: ${{ secrets.ZSCALER_SDK_LOG }}
# ZSCALER_SDK_VERBOSE: ${{ secrets.ZSCALER_SDK_VERBOSE }}
ZPA_SDK_TEST_SWEEP: ${{ secrets.ZPA_SDK_TEST_SWEEP }}
OKTA_CLIENT_ORGURL: ${{ secrets.OKTA_CLIENT_ORGURL }}
OKTA_CLIENT_TOKEN: ${{ secrets.OKTA_CLIENT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish test coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.out
fail_ci_if_error: true
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

# 3.1.0 (January 20, 2025)

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

### ZIA SSL Inspection Rules
[PR #295](https://github.com/zscaler/zscaler-sdk-go/pull/295) - Added the following new ZIA API Endpoints:
- Added `GET /sslInspectionRules` Retrieves all SSL inspection rules.
- Added `GET /sslInspectionRules/{ruleId}` Retrieves the SSL inspection rule based on the specified ID
- Added `POST /sslInspectionRules` Creates a new SSL inspection rule
- Added `PUT /sslInspectionRules/{ruleId}` Updates the SSL inspection rule based on the specified ID
- Added `DELETE /sslInspectionRules/{ruleId}` Deletes an existing SSL inspection rule based on the specified ID

# 3.0.0 (January 20, 2025) - BREAKING CHANGES

## 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,12 +13,24 @@ Track all Zscaler SDK GO releases. New resources, features, and bug fixes will b

---

``Last updated: v3.0.0``
``Last updated: v3.1.0``

---

# Changelog


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

### ZIA SSL Inspection Rules
[PR #295](https://github.com/zscaler/zscaler-sdk-go/pull/295) - Added the following new ZIA API Endpoints:
- Added `GET /sslInspectionRules` Retrieves all SSL inspection rules.
- Added `GET /sslInspectionRules/{ruleId}` Retrieves the SSL inspection rule based on the specified ID
- Added `POST /sslInspectionRules` Creates a new SSL inspection rule
- Added `PUT /sslInspectionRules/{ruleId}` Updates the SSL inspection rule based on the specified ID
- Added `DELETE /sslInspectionRules/{ruleId}` Deletes an existing SSL inspection rule based on the specified ID

# 3.0.0 (January 20, 2025) - BREAKING CHANGES

## Notes
Expand Down
4 changes: 2 additions & 2 deletions zscaler/zia/activation_cli/ziaActivator.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func main() {
zscaler.WithClientSecret(clientSecret),
zscaler.WithVanityDomain(vanityDomain),
zscaler.WithZscalerCloud(zscalerCloud), // Optional, can be an empty string if not set
zscaler.WithUserAgentExtra("zscaler-sdk-go"),
zscaler.WithUserAgentExtra(""),
)
if err != nil {
log.Fatalf("[ERROR] Failed creating ZIA configuration: %v\n", err)
Expand All @@ -46,7 +46,7 @@ func main() {

// Call the activation API using the instantiated client
resp, err := activation.CreateActivation(context.Background(), cli, activation.Activation{
Status: "active",
Status: "ACTIVE",
})
if err != nil {
log.Printf("[ERROR] Activation Failed: %v\n", err)
Expand Down
Loading

0 comments on commit bb212b2

Please sign in to comment.