Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ZPA API Client Restructure #258

Merged
merged 16 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
122 changes: 61 additions & 61 deletions .github/workflows/zdx-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,74 +18,74 @@ on:
workflow_dispatch:

jobs:
zdx-zsbeta-tests:
environment: ZDX_BETA
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
goVersion: ["1.21"]
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 test:integration:zdx
env:
ZDX_API_KEY_ID: ${{ secrets.ZDX_API_KEY_ID }}
ZDX_API_SECRET: ${{ secrets.ZDX_API_SECRET }}

- name: Publish test coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.out
fail_ci_if_error: true
# zdx-zsbeta-tests:
# environment: ZDX_BETA
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# goVersion: ["1.21"]
# 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 test:integration:zdx
# env:
# ZDX_API_KEY_ID: ${{ secrets.ZDX_API_KEY_ID }}
# ZDX_API_SECRET: ${{ secrets.ZDX_API_SECRET }}

# - name: Publish test coverage
# uses: codecov/codecov-action@v4
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# file: ./coverage.out
# fail_ci_if_error: true

zdx-test-tenants:
runs-on: ubuntu-latest
needs: [zdx-zsbeta-tests]
# needs: [zdx-zsbeta-tests]
strategy:
fail-fast: false
matrix:
goVersion: ["1.21"]
environment:
- ZDX_ZS1
- ZDX_ZSCLOUD
- ZDX_ZS2
# - ZDX_ZS1
# - ZDX_ZSCLOUD
# - ZDX_ZS2
- ZDX_ZS3
environment: ${{ matrix.environment }}
steps:
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
uses: nick-fields/retry@v2
with:
max_attempts: 3
timeout_minutes: 20 # Adjust as needed
timeout_minutes: 30 # Adjust as needed
command: |
make test:integration:zdx
env:
Expand Down
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
# Changelog

# 2.61.0 (June 14, 2024)

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

### Enhancements

- [PR #258](https://github.com/zscaler/zscaler-sdk-go/pull/258) - Added new ZDX API methods and Endpoints
- `GET` - `/alerts/ongoing`
- `GET` - `/alerts/historical`
- `GET` - `/alerts/{alert_id}`
- `GET` - `/alerts/{alert_id}/affected_devices`
- `GET` - `/inventory/software`
- `GET` - `/alerts/software/{software_key}`
- `GET` - `/active_geo`
- `GET` - `/devices/{deviceid}/deeptraces`
- `POST` - `/devices/{deviceid}/deeptraces`
- `GET` - `/devices/{deviceid}/deeptraces/{trace_id}`
- `DELETE` - `/devices/{deviceid}/deeptraces/{trace_id}`
- `GET` - `/devices/{deviceid}/deeptraces/{trace_id}/web_probe-metrics`
- `GET` - `/devices/{deviceid}/deeptraces/{trace_id}/cloudpath-metrics`
- `GET` - `/devices/{deviceid}/deeptraces/{trace_id}/cloudpath`
- `GET` - `/devices/{deviceid}/deeptraces/{trace_id}/health-metrics`
- `GET` - `/devices/{deviceid}/deeptraces/{trace_id}/events`
- `GET` - `/devices/{deviceid}/deeptraces/{trace_id}/top-processes`
- `POST` - `/analysis`
- `GET` - `/analysis/{analysis}`
- `DELETE` - `/analysis/{analysis}`

For details on the functionality of each of the above endpoints, please see [ZDX API Guide](https://help.zscaler.com/zdx/getting-started-zdx-api)

### Internal Changes

- [PR #258](https://github.com/zscaler/zscaler-sdk-go/pull/258) - Refactored ZPA package to centralize the `service.go` client instantiation.
- [PR #258](https://github.com/zscaler/zscaler-sdk-go/pull/258) - Refactored ZIA package to centralize the `service.go` client instantiation.
- [PR #258](https://github.com/zscaler/zscaler-sdk-go/pull/258) - Refactored ZDX package to centralize the `service.go` client instantiation.
- [PR #258](https://github.com/zscaler/zscaler-sdk-go/pull/258) - Refactored ZCC package to centralize the `service.go` client instantiation.
- [PR #258](https://github.com/zscaler/zscaler-sdk-go/pull/258) - Refactored ZCON package to centralize the `service.go` client instantiation.
- [PR #258](https://github.com/zscaler/zscaler-sdk-go/pull/258) - Enhanced test coverage statements across several functions in all API packages.

### Deprecations
- [PR #258](https://github.com/zscaler/zscaler-sdk-go/pull/258) - Deprecated ZIA `urlcategories` function ``GetCustomURLCategories``. The `customOnly` parameter is now combined within the function `GetIncludeOnlyUrlKeyWordCounts` and can be optionally set to `true`.

- [PR #258](https://github.com/zscaler/zscaler-sdk-go/pull/258) - Deprecated ZPA `ConvertV1ResponseToV2Request` from package ``policysetcontrollerv2`` package. The function now lives directly in the ZPA Terraform Provider to convert ``policysetcontroller`` v1 responses into ``policysetcontrollerv2`` format.

### Documentation
- [PR #258](https://github.com/zscaler/zscaler-sdk-go/pull/258) - Expanded README with more details regarding client instantiation and options. The README also include details regarding rate limites, retries and caching parameters.

# 2.6.0 (June 6, 2024)

## Notes
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ test\:integration\:zcon:
test\:integration\:zdx:
@echo "$(COLOR_ZSCALER)Running zcon integration tests...$(COLOR_NONE)"
go test -v -race -cover -coverprofile=zdxcoverage.out -covermode=atomic ./zdx/... -parallel 4 -timeout 60m
go tool cover -html=zdxcoverage.out -o zdxcoverage.html
@go tool cover -html=zdxcoverage.out -o zdxcoverage.html
@go tool cover -func zdxcoverage.out | grep total:

test\:integration\:zpa:
@echo "$(COLOR_ZSCALER)Running zpa integration tests...$(COLOR_NONE)"
Expand Down
Loading
Loading